Mmg2d: grid stretching at the boundaries


Dear all,

I am trying to use mmg2d to adat a mesh, adn I’d like the cell size variations to be small along the boundaries. For this purpose, I use a value of hgrad = 1.1, but I end up with significant variations of the cell size at the boundary. An exemple is available here:

The edge sizes along the profile are:

In this case I get a stretching of up to 20%; but in some cases it goes upto 50%.

Is it possible to force the stretching to be smaller at the boundaries than inside the domain?
Thank you very much for your help.
Best regards,



Dear Xavier,

I am not sure to understand what you mean by stretching: is it the ratio between two adjacent edges or the anisotropic ratio?

In Mmg, we doesn’t control the anisotropic ratio. The gradation (that control the ratio between two adjacent edges) is constant through the mesh (thus it can’t be different over the boundaries than inside the domain).

When you compute your edge lengths, do you compute the euclidean length or the length in the input metric?

I don’t know if you define your metric by yourself but if yes, I think that the easiest way to obtain the wanted behaviour is to include your streching bounds inside the input metric and to disable the Mmg gradation using the -hgrad -1 argument.

Best Regards,