Importing XMDF in fenics for mesh

Have XMDF file that contain mesh including tetrahedron, hexahedron, wedge and prism elements. I want to import meshes in fenics?
So far using meshio-convert to convert xmdf to xml gave error that dolfin-xml can only handle one cell type at a time. Converting xmdf to msh also gave this error.
Trying to read xdmf file via dolfin XDMFFile(filename).read() gave Error: Unable to recognise cell type. ** Reason: Unknown value “mixed”.
Can this be done in fenics to import multi element mesh?

Dolfin does not support multi element meshes. in dolfinx people are working on supporting prisms, as well as mixed elements. However, these changes are not in main yet.

1 Like

Thanks for the answer. Do I understand correctly that dolphinx does not currently support single (not multi element) meshes with prism (wedge) cell type?

There is currently only support for single cell type meshes, with some support for prisms meshes

Thanks a lot for the reply.

  1. Do I understand correctly that I can’t load prism mesh from XDMF file created with gmsh and converted with meshio? Correct me if I am wrong, but it seems so in dolfinx sources
  2. Can you please give me some hints (or an example if such exists) how to load gmsh mesh with prism cell type?
  3. Or maybe there is easier way to create and use prism meshes in dolfinx?

As prism is not part of: https://github.com/FEniCS/dolfinx/blob/main/cpp/dolfinx/io/xdmf_utils.cpp#L255-L268
I do not think it is supported. You could add it here and check if it works.
One of the few tests, regarding mesh creation, can be found here; https://github.com/FEniCS/dolfinx/blob/2be366d20632377e0688df585fcd7e201d5dc86c/python/test/unit/mesh/test_mesh.py#L280-L284

You could add prism to the dictionary in: https://github.com/FEniCS/dolfinx/blob/55d9d38ed6691224cb9bbbaa3050600980e85631/python/dolfinx/io/gmshio.py#L303-L312 (it is probably cell type 6 in GMSH, see the list in section: Gmsh 4.11.1

As I’ve said, prism meshes are very experimental as of now, and not all functionality is implemented for them