Simple anisotropic metric prescription : how to constrain mesh sizes?

Hello mmg community,

I think I have trouble understanding how to use the anisotropic metric prescription.

Let’s take a 10x10x10 cube, aligned with the x, y z axis. The original mesh is this one :

My goal is to have a mesh size of ~1 in the x and y direction, and a mesh size of ~0.1 in the z direction.

My first try was to prescribe this anisotropic metric tensor:
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 0.1

But the result was not the one I expected :

There is two things I don’t understand

  1. Why the tetra are stretched in the z direction ? If I use the tensor
    0.1 0.0 0.0
    0.0 0.1 0.0
    0.0 0.0 1.0
    It is closer to what I expect but…

  2. How can I control the mesh size ? I don’t see any edges which are close to 0.1 in the anisotropic direction ?

There must be something I don’t understand about the anisotropic metric prescription, sorry if my question is dumb ^^. I have attached my input gmsh file

untitled.msh (54.0 KB)

Hi Antoine,

If I note :

  • (λ1 , λ2 , λ3) the eigenvalues of your metric tensor;
  • (r1, r2, r3) the associated eigenvectors;

Your tensor prescribes the sizes :

  • s1 = 1 / sqrt (λ1) in the direction r1;
  • s2 = 1 / sqrt (λ2) in the direction r2;
  • s3 = 1 / sqrt (λ3) in the direction r3;

In your case, if you want to prescribe a size of s3 = 0.1 along the z-direction, you must have λ3 = 1 / (s3 * s3) = 100.

Thus, must use the following tensor
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 100

Few additional remarks :

  • We are still working on improving the anisotropic mode of Mmg (we have poor qualities in presence of corners and sharp angles in the mesh) : on your test case for example (with the suitable metric :wink: ), we have some interpolation issues.

  • Regarding the Gmsh file format :

    • In the current release of Mmg (5.4), it is better to not add your string tag “my_metric” between quotes. (It is an error of our Gmsh parser that will be corrected in the future bug fix)
    • In the 5.5 version of Mmg, a NodeData field will be detected as a metric only if its string tag ends with the “:metric” pattern. In your case “my_metric:metric” (no space allowed). The idea is to allow the user to store other data that Mmg will ignore.

I hope that it will helps,

Regards,
Algiane

Hi Algiane,

Thanks ! That was very helpful !

I totally understand now.

To add a little bit of context, I work with geological model meshes of this kind :


With a lot of sharp angles, internal surfaces, and a conforming tetrahedral mesh to those surfaces. And my goal was to first, generate an “optimized” mesh : the original mesh come from a geomodeler and it is far from being perfect, and then to generate an anisotropic mesh that follow the geological anisotropy (which is vertical). My plan is to try mmg to do that.

Regards,

Antoine

Hi,

It is a very interessant (and challenging) project!
If you want to follow the surface anisotropy, you can use mmg with the -A option (experimental) and without metric, it builds automatically an anisotropic size map from the surface model and the Hausdorff parameter.

A good way to fit the Mmg parameters for the surface adaptation is to begin to adapt the surface only with Mmgs (volume will be removed so the process will be faster and slightly more robust) and when you have the wanted surface, you can use the same parameters with Mmg3d.

Do not hesitate to contact me if you have other questions,
Regards,

Algiane