Lagrangian motion

It is possible to apply a motion to an object using mmg. To do so, there are some prerequisites:

  • build mmg with the lagrangian option enabled:

    • mmg propagates the movement of the boundary inside the mesh using the linear elasticity solver of the ISCD, that needs to be built and installed, Linear Elasticity.

    • mmg must detect the LinearElasticity library during CMake configuration step. If it is not detected automatically, it may be manually specified using the ELAS_DIR CMake variable:

      cmake -DELAS_DIR=$PATH_TO_ELAS
      
    • Once mmg is built, the -lag option should be available. To check it, call the mmg help:

      mmg2d_O3 -h
      
  • apply the motion to the input mesh:

    • mmg will move the boundaries of reference 10 only;

    • mmg will forbid movement of the boundaries of the bounding box. As a consequence:

      • if a surface of reference 10 intersect the bouding box, the surface will not move at the intersection.

      • an object cannot go out of the bouding box. mmg stops object movement when elements between the object and the box reach a quality that is too low.

    • The lagrangian motion in mmg works in the context of small deformations. Thus, the prescribed displacement must be small enough. If not, it is very probable that mmg stops before applying the entire movement. The proportion of the displacement realized is printed in the standard output and updated at each iteration (1 being the entire prescribed displacement):

      —> Realized displacement: 0.187272
      
    • mmg provides 3 different modes:
      • -lag 0: the object is moved inside the mesh using point relocation only (constant connectivity).

      • -lag 1: edge swapping is allowed but not point insertion and collapse.

      • -lag 2: all remeshing operators are allowed (point insertion/collapse, edge swapping, point relocation).

Lagrangian movement of a ball inside a tunnel

Consider a mesh containing a circle whose boundary has reference 10 (lag-mot2D.mesh file). mmg allows to provide a displacement at mesh nodes in a Medit solution file (one displacement vector per node should be specified).

For this example, a displacement of 20 on the circle surface and 0 at other nodes is provided in the lag-mot2D.sol file. Note that mmg automatically propagates the displacement in a given number of layers around the circle.

../_images/lagmotion1.png

Initial mesh and applied vector displacement. Tunnel length is 30 and displacement magnitude is 20.

To apply the displacement, run mmg2d with the -lag option and desired lagrangian mode. Since the solution file has the same name as the mesh, it is automatically detected.

Displacement at constant connectivity

To apply the displacement by keeping a constant connectivity throughout the process, run the command:

mmg2d_O3 -lag 0 -v 5 lag-mot2D.mesh

The following output mesh is obtained:

../_images/lagmotion2.png

Output mesh using point relocation only (-lag 0)

Since edge swaps and point insertions and collapses are forbidden, mmg cannot achieve the entire displacement as mesh quality becomes too low. Using increased verbosity (-v 5), mmg output shows that approximately 15.5% of the target displacement have been performed and that the worst element quality is equal to 0.000003:

** Cumulative time: 0.001s sec.
---> Realized displacement: 0.155372
-- PHASE 2 COMPLETED. 0.018s
-- MESH QUALITY 270
BEST 0.991985 AVRG. 0.528540 WRST. 0.000003 (157)
HISTOGRAMM: 93.33 % > 0.12

Displacement with constant number of nodes

To apply the displacement allowing point relocations and edge swaps, run the following command:

mmg2d_O3 -lag 1 lag-mot2D.mesh

The following output mesh is obtained:

../_images/lagmotion3.png

Output mesh using point relocation and edge swap (-lag 1)

With this option, the entire movement has been applied and the output mesh quality is better:

** Cumulative time: 0.003s sec.
---> Realized displacement: 1.000000
-- GRADATION : 1.300000 (2.300000)
-- PHASE 2 COMPLETED. 0.081s
-- MESH QUALITY 270
BEST 0.999292 AVRG. 0.807426 WRST. 0.184979 (141)
HISTOGRAMM: 100.00 % > 0.12

Displacement with point insertion, collapse, relocation and edge swap

Finally, all remeshing operators may be allowed by running the following command:

mmg2d_O3 -lag 2 lag-mot2D.mesh

The output mesh is displayed below.

../_images/lagmotion4.png

Output mesh obtaining using all remeshing operators (-lag 2)

The process is slower but the output quality is improved:

-- MESH QUALITY 301
   BEST 0.999723 AVRG. 0.921515 WRST. 0.654973 (284)

The applied displacement being very large, since mmg propagates the displacement in a given number of layers of elements around the object, the number of layers may constrain the movement. By default, mmg takes 20 layers of elements to propagate the displacement. It is enough for this example, however, in other cases, it can lead to a smaller displacement, if the initial mesh is very fine for example.