Supported Mesh Formats

MFEM supports a number of mesh formats, including:

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:

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:

  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.