Periodic mesh with a level set function

Dear developers,

I’m facing a problem with periodic boundary conditions with mmg2d.
I am using mmg2d with a level set function.
Using the -nosurf option or RequiredEdges field, a periodic mesh is obtained when 0-level iso-surface is included in the geometry.
However, I couldn’t obtain the periodic mesh when the iso-surface is on boundaries where the periodic boundary conditions are imposed.
The following post seems to be relevant to this issue.

Does the current version of MMG solve this problem?

Best regards,

Dear Yuki,

For now the required entities aren’t taken into account in isosurface discretization mode.

In level-set discretization, if a required boundary is intersected by the level-set, we have 2 choices:

  1. Ignore the level-set definition and respect the required entity: it is hard to implement because we don’t have any info on how to modify the level-set, we can’t just “cut it” before the required boundary. Moreover, it may lead to tricky topology issues;
  2. Ignore the “required” attribute and respect the input level-set. It is safe and easy to do… but not yet implemented. In this case, normally, if a periodic required boundary is splitted by the level-set, the matching periodic edge is also splitted (along the opposite boundary) and, in 2D, the new boundary edges of both sides must match (at epsilon accuracy). Can you handle your periodic mesh as it?

If yes:
I am really overbusy (due to the confinement I can’t work at full time) so I can’t impement it before few month. But a way to simulate the same behaviour may be to run Mmg twice:

  1. you discretize your isovalue but forbid the overall boundary remeshing with -nosurf option:
    mmg2d_O3 your-mesh.mesh -ls -nosurf
    It is normal if the mesh quality is very poor.

  2. you set the “true” required edges: as the interface between the new domains created by the level-set splitting has the reference 10, you can set all edges that have a ref not equal to 10 as required. Then you can try to improve your mesh:
    mmg2d_O3 your-mesh.o.mesh

If you test this and if it works, I think that it worth to temporarly hack the libmmg3d.c file so you can do that in one command only (I can send you the patch).

I hope that it will helps,



Dear Algiane,

Thank you for your kind instructions.
Following the second choice you mentioned, I could obtain periodic meshes that conform to my “RequiredEdges.”

Since I executed the two commands from the FreeFEM++ script, running mmg2d_O3 twice was not a heavy task for me.

Thanks again for your help, I will continue to use the Mmg tool for my research.

Best regards,

Dear Yuki,

Thank you for your feedback,

Have a nice day,