Mesh adaptation with a forced line



I have a simple 2d domain subdivided into 2 subdomains and a metric field defined on the whole domain.
I want to use mmg2d in order to adapt the mesh and its boundary according to the metric file but I also want that the adapted mesh takes into account the line delimiting the two subdomains.
I cannot adapt the two subdomains separately because I want the global mesh is conform between the two subdomains.

I thought to define an implicit edge by using a level-set method but I cannot adapt the mesh at the same time with mmg2d.

How can I do this operation (adapt the mesh while respecting an imposed line) ?
Is that possible with mmg2d ?

Thank you.



Hello Seb,

I am not sure to understand your problem: You have only 1 reference (= one color) for the two domains?

  • If yes, Mmg delete the line that delimite the domains because it considers that you have only one domain. In this case, you can simply change the reference of one of your domain and Mmg will adapt your mesh while preserving the two subdomains and their interface.

  • If no, can you post some images of your mesh and domains so I can better figure out your issue?

Thank you by advance,



Hello Algiane,

Thank you for your answer. You have well understood my “problem”.
So if I put a different reference on each subdomain, mmg will understand by itself that the two subdomains must be adapted separately while preserving the interface? That’s great then.
You helped me a lot.



Hi Seb,

Yes, with different references, it should work!