Lagrangian movement: detection of the boundary to move

Hi all,

I am new to MMG and I am trying to use mmg3d v5.4.0 to perform a lagrangian movement.
So far I am only running the tests that I have found:

  • in the example folder @ libexamples/mmg3d/LagrangianMotion_example0 (tinyBoxt.mesh and tinyBoxt.sol)
  • in the user guide page 13 (testoption9.mesh and depoption9.sol)

The test with testoption9.mesh ran fine.
However, I add some trouble when running the example with tinyBoxt.mesh.

What happens it that it returns the error message below because there is no point to move.

## Error: MMG5_packLS: no triangle with reference 10 in the mesh.
              Nothing to move.

I think it happens because there is no boundary Id 10 in tinyBoxt.mesh.
For the testoption9.mesh test it works fine because there is a boundary Id 10.

From what I understand, we check that the faces are on the boundary and that it is the boundary Id we want to move.
This is happening several times in src/mmg3d/velextls_3d.c in function MMG5_packLS:

/* Step 1: pile all the tetras containing a triangle with ref DISPREF */
if ( (pxt->ftag[i] & MG_BDY) && (pxt->ref[i] == MMG5_DISPREF) ) {

And the boundary Id is set to 10 in src/common/

#define MMG5_DISPREF 10

If I remove the boundary Id check, this is every (pxt->ref[i] == MMG5_DISPREF) check in the MMG5_packLS function, then it works fine for both tests.
Therefore I would like to know if it is safe to remove the boundary Id check and set the gradient to {0,0,0} for the vertices of the boundaries we do not want to move?
Also is there another document that I can read to better understand the lagragian deformation process?

Thanks for your help,


Thank you for trying Mmg!

  • You’re right, the libexamples/mmg3d/LagrangianMotion_example0/tinyBoxt.mesh example was broken. I have modified the reference of the boundary of the ball and it works (now it has the reference 10 instead of 0). The modification is pushed in the master branch of the project.
    The error in this test case was due to the fact that initially we were moving the boundaries of reference 0 but during the tests for the last release, we realized that it was not very convenient because 0 can be chosen as “default” reference by users.

  • I have updated the Mmg web page to add an example of use of the lagrangian option (in 2D): (the documentation that you have founded is outdated and related to the Mmg3d-4 release. The option has been totally rewritten in Mmg-5).
    To know exactly how works the option, you can look at the algorithm :

  • For now, the number of layers of the submesh, the maximal number of iterations and the moved reference are hard coded but, if useful, it can be added as command line options (the hard coded options works well for small displacements but if you need to apply a large one (notably in 3D), your object will be stuck very fast);

  • To answer to your initial question : due to the construction of the submesh that is given to the linear elasticity solver, you can not simply comment the test of the boundary reference and apply the wanted displacement.

Do not hesitate if you need more help (this option is pretty new so we don’t have lot of feedbacks for now).


Thanks for your prompt answer Algiane.
It helps a lot!

Kind regards,