## Error: MMG5_minQualCheck: too bad quality for the worst element:


I have an extremely simple 3d tetrahedral mesh of a cube created by triangulating an octree. However, mmg is unable to perform any kind of optimization or adaptation to a size field as it says.

Error: MMG5_minQualCheck: too bad quality for the worst element: (elt 78 -> 0.000000e+00)

Attached is the medit file

Is there a way to check for these existential problems? I checked that element and it appears fine in terms of quality, shape, and size. foo.mesh (97.3 KB)



Some of the tetrahedra of the mesh are valid but some others are not, I think that there is an issue in the vertex numbering (maybe in the first/last row/column of the octree grid). In the case of the tetra 78, it has 4 co-planar vertices so its area is zero (see the attached picture where the tetra 78 is in cyan and the indices and coordinates of its vertices are given in the terminal):

Regarding your second question: checking the mesh validity is an hard task. When Mmg fails on one of your mesh, a first step may be to try to visualize the mesh using the Medit software (that uses the same native format than Mmg, the .mesh files).

In your case, we see directly that the printed mesh is not what you wanted. Moreover, as Mmg gives you the index of a failing entity, you can focus on it:

  • # with Medit in first plan;
  • Your terminal prints ENTITY NUMBER: You can give it the wanted index (78);
  • Then you need to “cut” the medit view (F1) and to move the cutting plane (F2) until seeing the highlighted element (be careful, all entities of the given index are highlighted (so point, triangle and tetra));
  • you can click the element and read the wanted info (vertices, coordinates, references) inside the terminal window;

Another way to check things is to build Mmg in debug mode and to use a debugger to print mesh infos (but it can be hard because you will need some knowledge of the Mmg data structures).

I hope that it will helps,


Thanks a lot! So I’ll delete tetrahedral with nearly co-planar vertices and try again.

The problem was that the node numbering starts at zero and I had started it at 1. :] The medit software is super useful, thanks for pointing that out. I plan to use the API to do mesh adaptation for seismic inversion modeling with FEM.


Thank you for the feeback!