krober10nd / SeismicMesh

2D/3D serial and parallel triangular mesh generation tool for finite element methods.
https://seismicmesh.readthedocs.io/
GNU General Public License v3.0
127 stars 33 forks source link

adding optimization benchmarks #87

Closed krober10nd closed 4 years ago

krober10nd commented 4 years ago
krober10nd commented 4 years ago
Screen Shot 2020-10-13 at 11 23 38 AM
jorgensd commented 4 years ago

Happy that the mesh optimization helps improving the mesh. Does the gmsh one improve when running optimization on it? (I thought gmsh used optimization in 3D by default). I would like to note that even if the average mesh quality goes up, the minimum mesh quality seems to decrease when you increase number of iterations (from 13.173 to 12.174). I'm not trying to say that this is disastrous, but I am then unsure if it is worth having more iterations (as the runtime increases with 60 percent). I guess your algorithm will always keep the dihedral algorithm over the minimum bound (default 10).

To try to draw some conclusions out of this:

krober10nd commented 4 years ago

Does the gmsh one improve when running optimization on it? (I thought gmsh used optimization in 3D by default).

All the above call the same optimization at the end.

jorgensd commented 4 years ago

Does the gmsh one improve when running optimization on it? (I thought gmsh used optimization in 3D by default).

All the above call the same optimization at the end.

I got that, but does this last optimization call actually improve the GMSH mesh?

krober10nd commented 4 years ago

I would like to note that even if the average mesh quality goes up, the minimum mesh quality seems to decrease when you increase number of iterations (from 13.173 to 12.174). I'm not trying to say that this is disastrous, but I am then unsure if it is worth having more iterations (as the runtime increases with 60 percent). I guess your algorithm will always keep the dihedral algorithm over the minimum bound (default 10).

Yes, 10 degree as a bound seems to work quite well. I believe you can also achieve higher dihedral bounds by repeatedly calling this method with progressively higher bounds.

This algorithm works by perturbing a vertex of the tetrahedral a fraction of the minimum edge length in the domain in the direction that increases circumsphere radii of the sliver the fastest. I could make the sliver_removal algorithm parallel but actually it already accelerates as there are fewer slivers since I use CGAL's incremental point moves capability (and avoid a full retriangulation at all costs).

krober10nd commented 4 years ago

I got that, but does this last optimization call actually improve the GMSH mesh?

No, so probably you're right. It's probably called by default when generating a 3d mesh.

krober10nd commented 4 years ago

Ah, the par3d to master switch today didn't carry over some critical thing on master...

krober10nd commented 4 years ago

The sliver_removal should actually be pretty quick and converge in < 10 iterations if the mesh is already high quality (~25 meshing iterations).

krober10nd commented 4 years ago

I can get a dihedral bound of 20 degrees in about a second with the following.

 import gmsh
 import SeismicMesh
 import meshio

 cube = SeismicMesh.Cube((0.0, 1.0, 0.0, 1.0, 0.0, 1.0))
 points, cells = SeismicMesh.generate_mesh(domain=cube, edge_length=0.05)
 points, cells = SeismicMesh.sliver_removal(points=points, domain=cube, edge_length=0.05)
 points, cells = SeismicMesh.sliver_removal(
     points=points, domain=cube, edge_length=0.05, min_dh_angle_bound=15
 )
 points, cells = SeismicMesh.sliver_removal(
     points=points, domain=cube, edge_length=0.05, min_dh_angle_bound=20
 )
krober10nd commented 4 years ago

This optimization benchmark came on in a different PR by accident so I'm going to close this.