dengwirda / mesh2d

MESH2D is a MATLAB-based Delaunay mesh generator for two-dimensional geometries.
Other
119 stars 48 forks source link

long meshing times with heavy duty constraints #14

Closed krober10nd closed 3 years ago

krober10nd commented 3 years ago

Hey Darren,

I have a meshing problem where I'd like to constrain the red lines in the blue polygon region below. There's a lot of constraints and what I find is that passing some configurations of constraints lead to non-convergence.

Are there any geometry pre-processing/clean up that I can do with the constraints that I can do to perhaps avoid this?

question1

question2

Thanks!

krober10nd commented 3 years ago

Here are some profiling results which maybe can give you some indication of what's going on.

Screen Shot 2021-04-17 at 5 18 07 PM
dengwirda commented 3 years ago

I'm happy to take a quick look at the geometry here @krober10nd, if you can save it to file. It looks fairly skinny in places, so may require many cells...

If there's non-convergence occurring this is definitely worth getting to the bottom of. If it's more of a performance issue though switching to jigsaw is possibly worth pursuing (the jigsaw-matlab and/or jigsaw-python bindings are available for script-based work).

I am keen to keep mesh2d working into the future, but it's mostly for historical reasons at this stage --- the jigsaw-based algorithms + workflows are the focus for any new dev.

krober10nd commented 3 years ago

Hey @dengwirda I ended up figuring it out myself. Some "bad" geometry. Worked just fine took a couple minutes.

dengwirda commented 3 years ago

Hi @krober10nd, just checking whether you're looking to use mesh2d in oceanmesh2d? I had a quick look, and there seem to be a few routines from mesh2d in the repo these days.

No problem to do this of course, but can you add a few references/links, etc if this is the case.

krober10nd commented 3 years ago

@dengwirda yep we've been using it recently combining the two approaches for some workflows (like the one I've shown above).

We did add references in the individual files to you and folders but please let me know if that is not sufficient.

For example

https://github.com/CHLNDDEV/OceanMesh2D/tree/Projection/utilities/GEOM_UTIL

https://github.com/CHLNDDEV/OceanMesh2D/blob/Projection/utilities/smooth2.m

https://github.com/CHLNDDEV/OceanMesh2D/blob/Projection/utilities/limgrad.m

https://github.com/CHLNDDEV/OceanMesh2D/blob/Projection/utilities/inpoly.m

etc.

Would you like further acknowledgement at the README level too? We can do that as well as I'm very grateful for your help over the years. @wpringle

WPringle commented 3 years ago

@dengwirda @krober10nd , How does this look?

dengwirda commented 3 years ago

Thanks @WPringle, @krober10nd --- looks good!

Also, just for reference: the historical mesh2d was initially based on a spring-based method a'la distmesh, but these days is more of a cut-down jigsaw (a brand of Delaunay-refinement). It is possible to call the full jigsaw from within MATLAB (Python, etc). Happy to discuss if this is of interest.