Remeshing in msh format

Hi,square_input.mesh (501 Bytes)
square1.sol (109 Bytes)

I’m a new user of mmg and I’m trying a simple test case of refining a square 2D surface according to a scalar solution (./mmg2d_O3 square_input.mesh -sol square1.sol). I succeed to perform that with .mesh files format but I fail to do the same with .msh files (./mmg2d_O3 square.msh ? no sol file ?). Could you please advise me?

You will find attached herewith the Medit .mesh input and output files and the .msh file in which I added a Nodedata scalar field.

In the documentation you suggest to gmsh users to save their meshings into the Medit format (Save As -> Mesh - INRIA Medit (*.mesh)). I would like to point out that when I do that, the dimension in the medit file is 3 even for 2D surface. Also, it seems that mmg2d_O3 do not appreciate the 4th field in the vertices definition (see square2.mesh: output of gmsh in Medit format)

Thank you in advance for your help.



…and the other files.

Regardssquare.msh (338 Bytes)
square.geo (407 Bytes)

Hi Kokoch,

Sorry for the delay (I was on holiday) and thank you for the bug report.

  • I have broken the reading of the Gmsh data field during the last release. I think that it is fixed (master branch, commit bafe6119): due to some modifications in Mmg, now, to allow Mmg to understand that the NodeData field is a metric field, you will need to add the :metric suffix to the name of the field (the string tag that is provided). I attach the square.msh file with this modification. Please, say me if it works for you so I will release a new version of Mmg that will include this patch.

  • You are right, in 2D, Mmg asks for a “true” 2D mesh, while the .mesh output of Gmsh is a 3D mesh. You can run mmg2d on such files using the -msh 2 option of Mmg.

    mmg2d_O3 -msh 2 square2.mesh
    The output will be a mesh of the same format than the input (3D .mesh)
    The -msh option is an old option which dates from when the .msh files where not supported and I totally forgot to document it: I will do it this week.

I hope that it will helps,


Thank you very much, it works well!