# Dolfin can't successfully read the xdmf file consisted with tetra and wedge mesh

**URL:** <https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120>\
**Category:** mesh\
**Created:** [April 4, 2024, 1:41am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120 "2024-04-04T01:41:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xirancao](https://avatars.discourse-cdn.com/v4/letter/x/0ea827/32.png) [@xirancao](https://fenicsproject.discourse.group/u/xirancao)\
**Post date:** [April 4, 2024, 1:41am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120/1 "2024-04-04T01:41:29Z")

</div>

Continuing the discussion from [Gmshio can't successfully read the msh file created by Gmsh](https://fenicsproject.discourse.group/t/gmshio-cant-successfully-read-the-msh-file-created-by-gmsh/14112):

When I exported the mesh as .xdmf using meshio, and used dolfin to read the file, it dosen’t work either when the xdmf could be opened with paraview. I tried to export only tetrahedra or wedge, and only the file contained tetraIs could be read. fenics couldn’t read the msh file that contains two and more kinds of mesh?

```python
import meshio
import matplotlib.pyplot as pt
msh = meshio.read("msh_generate.msh")
#mesh
meshio.write("mesh.xdmf", meshio.Mesh(points=msh.points, cells={"tetra": msh.cells["tetra"],"wedge": msh.cells["wedge"]}))
#boundary face
meshio.write("mf.xdmf", meshio.Mesh(points=msh.points, cells={"triangle": msh.cells["triangle"],"quad": msh.cells["quad"]},cell_data={"triangle": {"name_to_read": msh.cell_data["triangle"]["gmsh:physical"]},"quad": {"name_to_read": msh.cell_data["quad"]["gmsh:physical"]}}))
#boundary cell
meshio.write("cf.xdmf", meshio.Mesh(points=msh.points, cells={"tetra": msh.cells["tetra"],"wedge": msh.cells["wedge"]},cell_data={"tetra": {"name_to_read":msh.cell_data["tetra"]["gmsh:physical"]},"wedge": {"name_to_read":msh.cell_data["wedge"]["gmsh:physical"]}}))

from dolfin import * 
mesh = Mesh()
with XDMFFile("mesh.xdmf") as infile:
    infile.read(mesh)
mvc = MeshValueCollection("size_t", mesh, 2) 
with XDMFFile("mf.xdmf") as infile:
    infile.read(mvc, "name_to_read")
mf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
boundary_markers=MeshFunction("size_t",mesh,mvc)
#print(boundaries.value())
mvc = MeshValueCollection("size_t", mesh, 3)
with XDMFFile("cf.xdmf") as infile:
    infile.read(mvc, "name_to_read")
cf = cpp.mesh.MeshFunctionSizet(mesh, mvc)

```

The error is as follows:

```python
Traceback (most recent call last):
  File "meshfile.py", line 15, in <module>
    infile.read(mesh)
RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to recognise cell type.
*** Reason: Unknown value "mixed".
*** Where: This error was encountered inside XDMFFile.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset: 2e001bd1aae8e14d758264f77382245e6eed04b0
*** --------------------------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [April 4, 2024, 5:24am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120/2 "2024-04-04T05:24:44Z")

</div>

Dolfin does not support wedge meshes or Mixed meshes.

---

<div class="post-metadata">

**Author:** ![xirancao1](https://avatars.discourse-cdn.com/v4/letter/x/839c29/32.png) [@xirancao1](https://fenicsproject.discourse.group/u/xirancao1)\
**Post date:** [April 4, 2024, 5:33am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120/3 "2024-04-04T05:33:10Z")

</div>

Can other methods be used to implement the boundary layer grid over there? Neither dolfin nor dolfinx can calculate the simulation model with boundary layers?

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [April 4, 2024, 5:43am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120/4 "2024-04-04T05:43:36Z")

</div>

You would have make a mesh consisting of either only tetrahedra or hexahedral elements.

There has been done some work on supporting meshes with mixed cell types, but the work is not complete

---

<div class="post-metadata">

**Author:** ![xirancao1](https://avatars.discourse-cdn.com/v4/letter/x/839c29/32.png) [@xirancao1](https://fenicsproject.discourse.group/u/xirancao1)\
**Post date:** [April 4, 2024, 8:11am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120/5 "2024-04-04T08:11:58Z")

</div>

Can’t both dolfin and dolfinx recognize wedge or mixed cell types? If that’s the case, I’m really looking forward to the new version.

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [April 4, 2024, 8:42am UTC](https://fenicsproject.discourse.group/t/dolfin-cant-successfully-read-the-xdmf-file-consisted-with-tetra-and-wedge-mesh/14120/6 "2024-04-04T08:42:33Z")

</div>

As @dokken said, neither of them currently supports that. There is no ETA on when this feature will land in the new version.
