with XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "r") as xdmf:
mesh = xdmf.read_mesh(name="Grid")
ct = xdmf.read_meshtags(mesh, name="Grid")
mesh.topology.create_connectivity(mesh.topology.dim, mesh.topology.dim-1)
with XDMFFile(MPI.COMM_WORLD, "mt.xdmf", "r") as xdmf:
ft = xdmf.read_meshtags(mesh, name="Grid")
But when I try to run this I get the traceback that there is a missing .h5 file.
with XDMFFile(MPI.COMM_WORLD, meshfile, "r") as xdmf:
RuntimeError: Unable to open HDF5 file. File mesh.h5 does not exist.
Default encoding is HDF5, should I be changing that to ASCII or am I on the wrong track?
MWE since I didn’t include it in my original post.
import numpy as np
from mpi4py import MPI
from petsc4py import PETSc
from dolfinx import geometry
from dolfinx.io import gmshio, XDMFFile
from dolfinx.fem import FunctionSpace, Function, Constant
from dolfinx.fem.petsc import LinearProblem
import ufl
from ufl import dx, grad, inner, ds, Measure
with XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "r") as xdmf:```
with dolfinx.io.XDMFFile(mesh.comm, "mesh.xdmf", "r", encoding=dolfinx.io.XDMFFile.Encoding.ASCII) as infile:
mesh = infile.read_mesh(name="base_mesh")