Coupling LIGGGHTS-code_aster

DanielBR's picture
Submitted by DanielBR on Tue, 08/29/2017 - 04:18

Hi all,

I am working in a code to coupling code_aster ( and LIGGGHTS.
Do to this, I compiled LIGGGHTS with the libraries that make possible LIGGGHTS work with meshes in med (Modélisation et Echange de Données - format.
I share all the work here in hope that can be useful to someone.

The main objective are to keep track of the ID's of the elements in the LIGGGHTS study, dump the information in CSV and MED files and use this mesh MED (where the ID's were controlled) and the CSV ( Relating the ID's with the results field) to run a code_aster study.

This compressed file has all code I have developed until now:!R51kARAY!Qfkt22UOViUVLVOwx4maU0vtWOpZngt3ogmuwwpTaDE

To install the code you should extract the file inside LIGGGHTS source and type # make yes_med. This will compile the HDF5 and MED libraries, copy the files dump_mesh_med.cpp, dump_mesh_med.h, input_mesh_tri.cpp and input_mesh_tri.h to src folder and put flags in Makefile.package to make tool be able to find these libraries during compilation process.

To import meshes in the MED format you just need to import mesh using mesh/surface command. For example:
fix cad0 all mesh/surface/stress file type 2 heal auto_remove_duplicates scale 1e-3 move 0.0 0.0 0.0 reference_point 0.0 0.0 0.0 stress on wear finnie

To dump the mesh you need to use a command like this:
dump dump0 all mesh/med 1000 post/ stresscomponents stress id .wear vel owner area cad0
This will generate the mesh file in the post folder and 2 files of CSV format where are stored the forces (I modified the dump process to export forces instead tension) average in one and components in another. The MED format is monolithic, i.e. all the information will generate in a single file.

To read file you should download SALOME ( and use PARAVIS (a paraview modified version). To read the CSV files you can use LIBREOFICCE, for example.

The coupling process work well, but I faced a problem. When using the move/mesh command the ID's become mixed. I don't know exactly why this happen but I suspect that the move/mesh read all mesh in each iteration. This behavior is very problematic because the mesh in the MED format is store only on the first dump and, because of this, the elements ID's cannot change during the run. After the first dump, only the results are stored. I need to solve. Any help would be appreciate.

The coupling process could be done using the fields store in the MED file (without using the CSV files). code_aster has some commands to perform this, but I do not developed this for now.

Developed in Debian 8. Kernel 3.16.0-4-amd64. LIGGGHTS-PUBLIC 3.7. code_aster 13.4. MED library 3.2.0. HDF library

This is it.
I thank all the LIGGGHTS community. and specially to richti83 that pointed the direction to develop this work.

MiRa | Tue, 08/29/2017 - 15:18

Hi DanielBR,

this sounds like great work. I am highly interested in DEM/FEM coupling.
Does your code work both ways, i.e., does is it able to write the deformed mesh back to liggghts, or is it one-way coupling?

Best regards,

DanielBR's picture

DanielBR | Tue, 08/29/2017 - 16:41

Currently this code work in an one way form.
I am developing a two way coupling. The basic idea is to modify the scale function to support the deform function. Create a library exposing this deform function. Run aster (or some other FEM solver) and extract the mesh information (like node coordinates and connectivity matrix) on each timestep. Run liggghts using library (python or cpp) and use the deform function in that library to rewrite the mesh inside LIGGGHTS.
That is in very beginning phase, but it is possible to do.

hoehnp | Fri, 02/08/2019 - 17:17

Hi DanielBR,

I am facing a similiar problem to import the deformation from outside of LIGGGHTS. As quite some time has passed since your post, I wonder if you completed the code and wouldn't mind to share the deform part?

Thanks a lot and best Regards,