Skip to content

Winslow untangler for linear meshes

Maxence Reberol requested to merge winslow_untangler into master

This PR implements the untangler/smoother described in the recent paper Foldover-free maps in 50 lines of code. In short, it optimizes triangles and tetrahedra to match ideal shapes by minimizing (with LBFGS) the Winslow functional, with a special regularization for tangled elements.

In my experience, this smoother is extremely robust and efficient. Results are similar to Mesquite but untangling and smoothing is done at the same time, and is orders of magnitude faster. I am using it in the new version of quadqs, and in the all-hex boundary layer (future PR).

More info in the README. For the moment, the surface smoother works only with planar geometry (or close-to with mean plane projection). It would be very nice to adapt it for curved surfaces by smoothing the geometry in uv coordinates while considering the CAD parametrization, but it requires some non-trivial additional work.

In terms of UI, I have added a button "Mesh > Experimental > Untangle geometry", which applies the smoothing to all the planar surfaces, then to the regions. I can interface it differently if you have other suggestions.

Example of results on the default tri/tet mesh of a simple CAD model (MAMBO M1):

Info    : Optimizing mesh (UntangleMeshGeometry)...
Info    : - Face 3: Winslow untangling, SICN min: 0.780 -> 0.814, avg: 0.982 -> 0.986 (1335 vertices, 0.070 seconds)
Info    : - Face 4: Winslow untangling, SICN min: 0.803 -> 0.809, avg: 0.976 -> 0.981 (943 vertices, 0.028 seconds)
Info    : - Face 8: Winslow untangling, SICN min: 0.847 -> 0.865, avg: 0.978 -> 0.983 (388 vertices, 0.009 seconds)
Info    : - Face 9: Winslow untangling, SICN min: 0.799 -> 0.816, avg: 0.975 -> 0.978 (69 vertices, 0.001 seconds)
Info    : - Face 11: Winslow untangling, SICN min: 0.779 -> 0.813, avg: 0.975 -> 0.978 (68 vertices, 0.001 seconds)
Info    : - Face 12: Winslow untangling, SICN min: 0.913 -> 0.922, avg: 0.963 -> 0.967 (32 vertices, 0.000 seconds)
Info    : - Face 13: Winslow untangling, SICN min: 0.913 -> 0.922, avg: 0.963 -> 0.967 (32 vertices, 0.000 seconds)
Info    : - Face 14: Winslow untangling, SICN min: 0.777 -> 0.813, avg: 0.975 -> 0.978 (68 vertices, 0.001 seconds)
Info    : - Face 19: Winslow untangling, SICN min: 0.799 -> 0.816, avg: 0.976 -> 0.978 (69 vertices, 0.002 seconds)
Info    : - Face 20: Winslow untangling, SICN min: 0.913 -> 0.922, avg: 0.963 -> 0.967 (32 vertices, 0.000 seconds)
Info    : - Face 21: Winslow untangling, SICN min: 0.913 -> 0.922, avg: 0.963 -> 0.967 (32 vertices, 0.001 seconds)
Info    : - Face 42: Winslow untangling, SICN min: 0.872 -> 0.868, avg: 0.942 -> 0.945 (80 vertices, 0.001 seconds)
Info    : - Region 1: Winslow untangling, SICN min: 0.167 -> 0.233, avg: 0.803 -> 0.819 (8062 vertices, 0.531 seconds)
Info    : Done optimizing mesh (Wall 0.646925s, CPU 0.645947s)
Edited by Maxence Reberol

Merge request reports