Local mesh refinement

Hello! I use mmgs to solve strength problems. I need to refine the mesh in the high stress zone. Can I apply the size map to only some nodes? At the same time, let mmgs find the metric in other nodes according to -hgrad and -hausd parameters.


It is not possible to do that natively but using the library you can :

  • call the `MMG_doSol function to let Mmg compute the size map;
  • travel your vertices to overwrite the value setted by Mmg at wanted nodes (using the MMG<X>_Set_scalarSol API function).
  • call the MMG<X>_mmg<x>lib function to trigger the mesh adaptation process.

Best regards,

Thank you for the quick response! Is it possible to do the same thing by running mmgs_O3.exe with command line parameters?

No, it is not possible using command line, sorry.

What if do this:

  1. Fix the mesh vertices before rebuilding the mesh in mmgs
  2. Run mmgs and get sol file with fixed vertices
  3. Find old fixed vertices by coordinates in the sol file
  4. Change the metric for given vertices

Is it possible to fix vertices in a mesh file? Like “RequiredTriangles” for example.


You can use the RequiredVertices keyword to fix vertices.

Beside, I am not sure if it is needed to fix it : you can run mmgs without authorizing the remeshing operators (only analysis and size map computation is performed) with -noinsert -noswap -nomove command line arguments. So I think that your process can be changed by:

  1. Run mmgs in analysis mode : mmgs -noinsert -noswap -nomove ...
  2. Change the output metric in the saved .sol file for given vertices.

I hope that it will help,

Thank you! It really helped.