CaseyAMeakin / gmsh-exodus-converter

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gmsh-exodus-converter

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

Usage:

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

element_type is an integer (see Supported gmsh element types section)

Requirements

  • VTK Toolkit >= 5.8 (with python bindings)

Supported gmsh element types

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

2D

  • 2 = 3-node triangle
  • 3 = 4-node quadrangle

3D

  • 4 = 4-node tetrahedron

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
  • 1 = 2-node line
  • 2 = 3-node line
  • 3 = 4-node quadrangle
  • 4 = 4-node tetrahedron
  • 15 = 1-node point

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

About

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

License:GNU General Public License v2.0


Languages

Language:Python 96.8%Language:GLSL 3.2%