MMG2D adaptation with higher-order Gmsh mesh file


I am currently using mmg2d to generate anisotropic meshes based on a Gmsh file only, with the metrics given as NodeData, the final goal being to then generate P2 (curved) triangle meshes. I’d like to work with a straight P2 mesh from the start (6-node straight triangles), but I understand MMG only deals with Gmsh elements with type 2, 4 or 15 (tri, tet, node). Is there a way to launch mmg2d with a Gmsh .msh file made of type 8 and 9 (2nd order lines and tri)? I would provide metrics at high-order vertices, even though I expect only metrics at P1 vertices to be considered for adaptation.

Thank you for your time!

Hello Arthur,
Since high degree elements are not supported, Mmg neither reads additional internal points on an input mesh, neither reconstruct them on the output mesh (which is always linear).

So I think your only ways out would be:

  • either to write a small code of your own to preprocess the mesh in order to pass to Mmg only linear entities (this will need to loop on elements and mark nodes that are actually vertices, so that they can be renumbered by excluding internal points), and to increase the degree of the linear mesh you get as Mmg output (this will need to “hash” internal faces/edges to avoid adding internal points twice),
  • either to modify the functions in the src/common/inout.c to “linearize” your input mesh, and to increase the degree of the output mesh (this will need basically the same techniques as in the previous point).

Hope this helps,