GMSH NodeData reading

Dear MMG community,

I’m new to MMG_3D and I’m trying to re-mesh a part firstly meshed in GMSH. The idea is to mesh a parallelipiped split in two parts : one should be isotropic and the other anisotropic. I first create a isotropic mesh in GMSH and give each part a different reference number. Based on these reference numbers, a NodeData section with a tensor metric is added to the .msh file with help of a small python script.

When I give this file to MMG_3D, it seems that the .msh format specifications are respected (at least MMG_3D reads the file without complaining) but later I get the following error :
Error: _MMG5_scaleMesh: at least 1 wrong metric (point 1 -> eigenvalues : 0.000000e+00 0.000000e+00 0.000000e+00).
metric tensor: 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00.

Did I miss something in the tensor metric definition ? I tried to join the .msh file to this message in case it can help to solve the problem but as it is my first message, I’m not allowed to.

Thanks in advance,

Lionel Wilhelm

Hi Lionel,

Do you have 1 NodeData for your entire mesh or 1 NodeData for each mesh part?

Normally, Mmg read only 1 NodeData field and it must contain the same number of entities than the number of mesh vertices. Otherwise Mmg writes an error message:

** MISMATCHES DATA: THE NUMBER OF VERTICES IN THE MESH (1732) DIFFERS FROM THE NUMBER OF VERTICES IN THE SOLUTION (1731)

I don’t know what may happens in your case but maybe an example will help you: the cube_ani.msh (453.5 KB) mesh contains a mesh and the associated anisotropic metric (a constant metric of values 1000 0 0 0 1000 0 0 0 4).

I will look at the forum configuration to understand why you are not allowed to attach files to your post.

Regards,

Algiane

Hi,

I have changed the forum settings for “new users”. Now you are allowed to attach 2 files to your post (but I think that you are not a “new user” anymore because your answer will be your second message :slight_smile: )

Regards,

Algiane

Hi,
thank you very much for the quick response.

My mesh contain only one partition but some elements refer to one reference number (1) and other elements have another reference number (2).
The example you sent me it it does indeed not work because it is declared in the $NodeData header that the mesh contains 1731 points but it does contain 1732 points. After modifying the header, mmg3d runs fine :slight_smile:

I send you the file I wanted to send yesterday. I will still inverstigate a workaround and keep you upadated if I find something that might help others.

I suggest that you add a small note in the “tutorial” page (https://www.mmgtools.org/mmg-remesher-try-mmg/mmg-remesher-tutorials) in the paragraph that tells users can specify a metric in the $NodeData section of a gmsh file. Indeed, the metric format one should use is not as specified in “Anisotropic metric prescription” page (https://www.mmgtools.org/mmg-remesher-try-mmg/mmg-remesher-tutorials/anisotropic-metric-prescription). The user must specify the full matrix in a .msh file and only the lower triangular in a .sol file. It took me a bit of time to understand this :sweat_smile:

Kindly,

Lionel

Hello,

I finally found my mistake : the header of the $NodeData function was wrong. It should be

$NodeData
1
"test"
1
0.0
3
0
9
10371

and it was

$NodeData
1
"test"
1
0.0
8
0
9
10371

I am glad that you find the problem!

I will update the Mmg website as you suggest as soon as possible (I simply totally forget to update the documentation when I add the compatibility with the gmsh file format).

Regards,

Algiane

Hi,

The Mmg website is updated so I close this topic.

Best regards,

Algiane