Error in loading xdmf file: unable to recognise cell type


I am trying to load a mesh from an xdmf file generating from the following code.

import pygmsh

with pygmsh.occ.Geometry() as geom:
    geom.characteristic_length_min = 0.1
    geom.characteristic_length_max = 0.1
    rectangle1 = geom.add_rectangle([0.0, 0.0, 0.0], 1.0, 0.5)
    rectangle2 = geom.add_rectangle([0.0, 0.5, 0.0], 1.0, 0.5)
    geom.boolean_fragments(rectangle1, rectangle2)
    mesh = geom.generate_mesh()


Then I use “infile” to read the mesh into fenics by below code.

from fenics import *

mesh = Mesh()

with XDMFFile("out.xdmf") as infile:

But I encounter an error below:

Error: Unable to recognise cell type.
Reason: Unknown value “mixed”.
Where: This error was encountered inside XDMFFILE.cpp.
Process: 0

May I enquire that how can I resolve this error? Thank you.

This has been covered in several other topics: Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio
Line mesh in a 2D space - #2 by dokken

1 Like