I am currently working on designing a mesh system and have been following Jorgen S. Dokken’s tutorial, which includes using Meshio to convert a .msh file to .xdmf. I successfully performed the conversion, and I am able to visually inspect the .xdmf file in ParaView without any issues. However, I’m encountering difficulties when attempting to load the .xdmf file into FEniCS.
Here is the code snippet I am using to load the mesh:
from fenics import *
# Load mesh from XDMF file
mesh = Mesh()
with XDMFFile("tetra_mesh.xdmf") as infile:
infile.read(mesh)
The error I am facing is as follows:
RuntimeError Traceback (most recent call last)
Input In [2], in <cell line: 5>()
4 mesh = Mesh()
5 with XDMFFile("tetra_mesh.xdmf") as infile:
----> 6 infile.read(mesh)
8 # Load mesh function from XDMF file
9 volumes = MeshValueCollection("size_t", mesh, mesh.topology().dim())
I am unsure whether the problem lies within the mesh file itself or if I might be missing some important details or steps required to read the mesh file correctly in FEniCS. Here are my system details:
FEniCS Version: Legacy Edition 2019.1.0
Installation: Docker
Platform: Linux
I would greatly appreciate any guidance or suggestions you could provide to help resolve this issue. To assist in diagnosing the problem, below in the github link you can see both the .xdmf and .msh files.
Without the corresponding tetra_mesh.h5 we cannot help you.
Also add the full error message of the RunTimeError, as it seems like you haven’t included it all
I have updated the github. Please see the link below.
Hence, the error message in full can be seen below:
RuntimeError Traceback (most recent call last)
Input In [2], in <cell line: 5>()
4 mesh = Mesh()
5 with XDMFFile(“tetra_mesh.xdmf”) as infile:
----> 6 infile.read(mesh)
8 # Load mesh function from XDMF file
9 volumes = MeshValueCollection(“size_t”, mesh, mesh.topology().dim())
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
*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error: Unable to open HDF5 file.
*** Reason: File “tetra_mesh.h5” does not exist.
*** Where: This error was encountered inside HDF5Interface.cpp.
*** Process: 0