# Errors when reading xdmf files converted from msh mesh containing both wedge and hexahedron cells

**URL:** <https://fenicsproject.discourse.group/t/errors-when-reading-xdmf-files-converted-from-msh-mesh-containing-both-wedge-and-hexahedron-cells/2282>\
**Category:** I/O\
**Created:** [January 23, 2020, 5:13pm UTC](https://fenicsproject.discourse.group/t/errors-when-reading-xdmf-files-converted-from-msh-mesh-containing-both-wedge-and-hexahedron-cells/2282 "2020-01-23T17:13:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DuyDucNGUYEN](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/duyducnguyen/32/941_2.png) [@DuyDucNGUYEN](https://fenicsproject.discourse.group/u/DuyDucNGUYEN)\
**Post date:** [January 23, 2020, 5:13pm UTC](https://fenicsproject.discourse.group/t/errors-when-reading-xdmf-files-converted-from-msh-mesh-containing-both-wedge-and-hexahedron-cells/2282/1 "2020-01-23T17:13:57Z")

</div>

Hi everyone

I am using XDMFFile to read a complex mesh file. My MSH mesh contains ‘hexahedron’, ‘wedge’ 3D cells in the body and ‘quad’ 2D cells on the surfaces.

Since Fenics can not read “mixed” mesh file. I have to seperate the original MSH mesh into “mesh\_wedge.xdmf” and ‘mesh\_hexahedron.xdmf’.

My questions rise from here.

1. How to read the xdmf files and recombine them with Fenics mesh? i.e.

mesh1 = Mesh()  
with XDMFFile(“mesh\_wedge.xdmf”) as infile:  
infile.read(mesh1)

mesh2 = Mesh()  
with XDMFFile(“mesh\_hexahedron.xdmf”) as infile:  
infile.read(mesh2)

How to define mesh1 + mesh2 ?

1. I have errors when read the ‘mesh\_wedge.xdmf’ and ‘mesh\_hexahedron.xdmf’ files.

* * *

\*\*\* Error: Unable to recognise cell type.  
\*\*\* Reason: Unknown value “wedge”.  
\*\*\* Where: This error was encountered inside XDMFFile.cpp.

and

* * *

\*\*\* Error: Unable to order hexahedron cell.  
\*\*\* Reason: Cell is not orderable.  
\*\*\* Where: This error was encountered inside HexahedronCell.cpp.  
\*\*\* Process: 0

1. Is there away to convert wedge and hexahedron into tetrahedron?

Thank you very much  
Best regards

 ![hexa](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/1X/f691ac24e83e2883f00ccde5ecb268d41c602793.png) ![wedge](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/1X/5c9a049ab85648e5bdd9d07dfc487efd7d7ec605.png)

---

<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:** [January 23, 2020, 9:18pm UTC](https://fenicsproject.discourse.group/t/errors-when-reading-xdmf-files-converted-from-msh-mesh-containing-both-wedge-and-hexahedron-cells/2282/2 "2020-01-23T21:18:11Z")

</div>

There is no support in FEniCS for Mixed meshes (element wise). Also, for hexahedron meshes, i strongly advice you to move to [dolfinx](https://github.com/FEniCS/dolfinx), as there has been done several significant improvements in handling non-simplistic meshes there.

---

<div class="post-metadata">

**Author:** ![DuyDucNGUYEN](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/duyducnguyen/32/941_2.png) [@DuyDucNGUYEN](https://fenicsproject.discourse.group/u/DuyDucNGUYEN)\
**Post date:** [January 24, 2020, 8:18am UTC](https://fenicsproject.discourse.group/t/errors-when-reading-xdmf-files-converted-from-msh-mesh-containing-both-wedge-and-hexahedron-cells/2282/3 "2020-01-24T08:18:03Z")

</div>

Thank Dokken

I will think about dolfinx latter.

Do you know how to convert hexahedron meshes, wedge meshes into tetrahedron meshes?

---

<div class="post-metadata">

**Author:** ![DuyDucNGUYEN](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/duyducnguyen/32/941_2.png) [@DuyDucNGUYEN](https://fenicsproject.discourse.group/u/DuyDucNGUYEN)\
**Post date:** [January 27, 2020, 8:18am UTC](https://fenicsproject.discourse.group/t/errors-when-reading-xdmf-files-converted-from-msh-mesh-containing-both-wedge-and-hexahedron-cells/2282/4 "2020-01-27T08:18:00Z")

</div>

I found a solution for converting all mesh types to tetra.

[https://gmsh.geuz.narkive.com/o68c1K1C/from-hexahedrons-to-tetrahedrons](https://gmsh.geuz.narkive.com/o68c1K1C/from-hexahedrons-to-tetrahedrons)
