Hello, FEniCS community,
I am encountering an issue when trying to read a MeshFunction
from an XDMF file in FEniCS 2019.1.0. The error message indicates a “Mismatched number of entities” inside XDMFFile.cpp.
Here’s a brief overview of my setup:
- I created the mesh and physical groups using GMSH and exported them to XDMF files.
- I’m trying to tag facets for boundary conditions on a 3D domain.
After loading my domain mesh and facets into FEniCS, I attempt to read my facets with:
*** -------------------------------------------------------------------------
from fenics import *
mesh = Mesh()
with XDMFFile(“domain_mesh.xdmf”) as infile:
infile.read(mesh)
facet_mesh = MeshFunction(“size_t”, mesh, mesh.topology().dim() - 1)
with XDMFFile(“facet_mesh.xdmf”) as infile:
infile.read(facet_mesh)
V = FunctionSpace(mesh, ‘P’, 1)
*** -------------------------------------------------------------------------
This is where I encounter the error. Below the error message can be seen:
*** -------------------------------------------------------------------------
*** Error: Unable to read MeshFunction.
*** Reason: Mismatched number of entities.
*** Where: This error was encountered inside XDMFFile.cpp.
*** Process: 0
*** DOLFIN version: 2019.1.0
*** Git changeset: ba376b6aebd7a9bc089be46b50bdd9f5c548fb91
*** -------------------------------------------------------------------------
I’ve verified that the mesh and facet files are consistent, but the issue persists. Could this be related to the way physical groups are defined in GMSH, or is there a step I might have missed?
Below is the github link for you to examine the mesh files:
Any insights or suggestions on how to resolve this mismatch would be greatly appreciated. Thank you!