Hi,
I’m trying to import a 3D mesh from gmsh and I’m having the following Error:
RuntimeError Traceback (most recent cal l last) Cell In[89], line 11 9 mvc_2d = MeshValueCollection(“size_t”, mesh, 2) 10 with XDMFFile(path + filename + “_triangle.xdmf”) as infile: —> 11 infile.read(mvc_2d, “name_to_read”) 13 mf_2d = cpp.mesh.MeshFunctionSizet(mesh, mvc_2d) 15 n = FacetNormal(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 possi ble, *** include a minimal running example to reproduce the error. ***
*** -------------------------------------------------------------------- ----- ***
Error: Unable to recognise cell type. *** Reason: Unknown value “”. *** Where: This error was encountered inside XDMFFile.cpp. *** Process: 0 *** *** DOLFIN version: 2019.1.0 ***
The code I’m using to import the mesh is the following:
from dolfin import *
path=" "
filename="Design"
mesh = Mesh()
with XDMFFile(path + filename + "_tetra.xdmf") as infile:
infile.read(mesh)
mvc_3d = MeshValueCollection("size_t", mesh, 3)
with XDMFFile("path + filename + "_tetra.xdmf") as infile:
infile.read(mvc_3d, "name_to_read")
mf_3d = cpp.mesh.MeshFunctionSizet(mesh, mvc_3d)
mvc_2d = MeshValueCollection("size_t", mesh, 2)
with XDMFFile("path + filename + "_triangle.xdmf") as infile:
infile.read(mvc_2d, "name_to_read")
mf_2d = cpp.mesh.MeshFunctionSizet(mesh, mvc_2d)
n=FacetNormal(mesh)
mesh.num_cells()
I have tried to solve it by running the following line but it is not working:
pip install meshio lxml h5py
Secondly, you would have to either supply the xdmf-file and the binary h5 file, a pure ascii xdmf file, or the original mesh file, and the functions that have been used to convert it to xdmf.
I have tried the same mesh and code in other computer and it works. Could the error be related to the program version?
The code I’ve used to convert the mesh is the following: