dolfin-convert, a Python code which can convert a mesh file from Gmsh, MEDIT, METIS or SCOTCH format to an XML format suitable for use by DOLFIN or FENICS, by Anders Logg.

The conversions carried out by this function include:

Note that the examples of converting a 3D GMSH file to DOLFIN XML file have failed. This is because the GMSH 3D tetrahedral elements are listed as type 29, whereas DOLFIN-CONVERT is expecting an element type of 4. Thanks to Sean Breckling for reporting this issue, 13 May 2016.


The computer codes made available on this web page are distributed under the GNU LGPL license.


dolfin-convert is available in a Python version.

Related Data and Software:

dolfin_xml a data directory which contains examples of xml files that describe 3d finite element meshes as used by dolfin and fenics.

fenics, examples which illustrate the use of fenics, a collection of free software with an extensive list of features for automated, efficient solution of differential equations.

gmsh, examples which illustrate the use of the gmsh program, a 3d mesh generator for the finite element method (fem).

gmsh_to_fem, a fortran90 program which reads a mesh data file created by the gmsh program and writes a pair of node and element files that correspond to the fem format.

medit, examples which illustrate the use of medit, an interactive graphics program developed to visualize numerical simulation results on unstructured meshes in two and three dimensions. scalar, vector and tensor fields can be easily associated and displayed with meshes. the program is by pascal frey.

mitchell_fenics, examples which illustrate the implementation of the Mitchell elliptic test problems using FENICS.

msh, a data directory of examples of MSH files, the native 3D mesh format used by Gmsh.

xml, a data directory which contains examples of XML files, a standard, general datafile format.


Anders Logg


Source Code:

CYLINDER_2D is a 2D mesh for a cylinder.

CYLINDER_3D is a 3D mesh for a cylinder.

ELL_2D is a 2D mesh for the L-shaped region.

PINCH is a 2D channel formed by starting with a long rectangular channel and creating a narrow neck by removing elliptical portions from the top and bottom. The resulting mesh has 4,325 nodes and 8,656 elements.

STEP_2D is a 2D mesh for a step.

STEP_3D is a 3D mesh for a step.

TEST02 is the upside down L-shaped region, for the Mitchell test problem #2.

TEST03 is the square [-1,+1]x[-1,+1] with a slit from (0,0) to (1,0), for the Mitchell test problem #3.

Last revised on 21 January 2020.