Supported Mesh Formats
MFEM supports a number of mesh formats, including:
- MFEM's built-in formats, including arbitrary high-order curvilinear meshes and non-conforming (AMR) meshes.
- VTK format (XML VTU format and legacy ASCII format).
- The CUBIT meshes through the Genesis (NetCDF) binary format.
- The NETGEN triangular and tetrahedral mesh formats.
- The TrueGrid hexahedral mesh format.
See below for more details and information on the specific formats that are supported. All of these mesh formats are also supported by MFEM's native visualization tool, GLVis.
MFEM Mesh Formats
Detailed description of these formats can be found on MFEM's mesh formats page.
MFEM supports:
- MFEM's mesh v1.0 format for straight meshes.
- MFEM's mesh v1.x format for arbitrary high-order curvilinear and more general meshes.
- MFEM's mesh v1.2 format, which adds support for parallel meshes.
- MFEM's mesh v1.3 format, which adds support for named attribute sets.
- MFEM's NC mesh v1.0 format, supporting non-conforming (AMR) meshes.
- MFEM's format for NURBS meshes.
VTK Mesh Formats
MFEM supports reading VTK (ASCII) and VTU (XML) unstructured meshes. For more details on these formats, see the VTK User's Guide and the VTK Wiki.
Specifically, MFEM supports:
- Meshes with high-order Lagrange elements.
- Mixed meshes with all element types.
XML
format with inline or appended binary data, includingzlib
compression.
If the VTK or VTU file has a cell data array named "material" or "attribute", this cell data will be used for MFEM's element attribute numbers. If both data arrays are present, the one named "material" will take precedence.
Gmsh Mesh Formats
MFEM supports reading version 2.2 of the Gmsh ASCII and binary formats for 2D and 3D meshes. High-order elements (up to order 9) are supported, as are periodic meshes.
Note that newer versions of Gmsh output files in version 4.1 of the Gmsh format,
which is not compatible with MFEM. Users should either specify
Mesh.MshFileVersion = 2.2;
in their geometry file or run Gmsh with -format
msh22
from the command line.
Elements' physical tags in Gmsh correspond to their attribute numbers in MFEM. MFEM only supports strictly positive (≥ 1) attributes, so users should be sure to define all physical groups with strictly positive tag numbers. The one exception to this is in cases where all elements have physical tag zero (which happens by default in Gmsh when no physical groups are defined). In this case, MFEM will reassign all the elements to have attribute number 1 instead of failing to read the mesh.