View on GitHub

gmsh-exodus-converter

Converts a mesh written with gmsh to the exodus II format to use it with Peridigm

gmsh-exodus-converter

Converts a mesh written with gmsh to the exodus II format, which is used in common simulations tools, like Peridigm

Citing the code

Are you using this code for research purposes? Please take the time to cite it using this DOI:

DOI

Usage:

python convert.py -i input.msh -o output.g

Note that meshio supprts the same functionality with

meshio-convert input.msh output.e

Requirements

If you are using Ubuntu, you must use the python-vtk package (sudo apt-get install python-vtk). There is a bug with the python-vtk6 package which provokes a segmentation fault. (More information about it here: https://gitlab.kitware.com/vtk/vtk/issues/16009)

Supported gmsh element types

The input.msh file must be generated with Gmsh. Currently, only the following elements are supported:

2D

3D

gmsh format

Description of the gmsh format and how it works. An example can be found here. The [brackets] contain comments expanations about each line. More complex files can be found, refer to the gmsh documentation in that case.

Mesh format
$MeshFormat
2.2 0 8
$EndMeshFormat
Nodes

$Nodes [The start-tag $Nodes anounces that the nodes are going to be listed]

148 [Number of nodes]

1 2.5 9.5 49.6423745119 [Node number] [Element node point 1] [Elmnt node pt2] [Elmnt node #pt3]

2 2.5 6.5 28.5
3 -2.5 9.5 49.6423745119
4 -2.5 6.5 28.5
...

$EndNodes [The end-tag $EndNodes anounces that the node list is over]

Elements

For detailed information, check this section of gmsh documentation

$Elements [The start-tag $Elements anounces that the elements are going to be listed]

729 [Number of elements]

1 15 2 0 1 1 [Element number] [Elmnt type] [Elmnt physical entity tag] [Elmnt Geometry point] [Vertex tag]

2 15 2 0 2 2
3 15 2 0 3 3
4 15 2 0 4 4
5 15 2 0 5 5
...

$EndElements [The end-tag $EndElements anounces that the Elements list is over]

Element types

Example

2D

Mesh generated with gmesh Exodus geometry visualized with paraview
Mesh Exodus

3D

Mesh generated with gmesh Exodus geometry visualized with paraview
Mesh Exodus
Mesh Exodus