Importing XMDF file into workspace file

Hey y’all. I am working on an indentation model with penalty formulation. I have had a Python file which included both the generation of the mesh with Gmsh and solving the problem out, but as the project continues it was evident to separate the mesh formation from the solving into different files, so that when changes in the mesh occur I don’t have to solve the entire problem again. I used the code below to extract and save the mesh into .h5 and .xmdf files, and it works great.

msh_data = gmshio.model_to_mesh(gmsh.model, MPI.COMM_WORLD, 0, gdim=2)

gmsh.finalize()

domain = msh_data.mesh

cell_tags = msh_data.cell_tags

facet_tags = msh_data.facet_tags

gdim = domain.geometry.dim

cell_tags.name = "cell_tags"

facet_tags.name = "facet_tags"

with io.XDMFFile(domain.comm, "axisymmetric_mesh.xdmf", "w") as xdmf:

xdmf.write_mesh(domain)

# Saving Physical Groups

xdmf.write_meshtags(cell_tags, domain.geometry)

xdmf.write_meshtags(facet_tags, domain.geometry)

But an issue comes when I try to bring the mesh into my new file for solving. I have the code below:

from mpi4py import MPI

#DOLFINX Imports

from dolfinx import mesh, fem, plot, io

with io.XDMFFile(MPI.COMM_WORLD, "axisymmetric_mesh.xdmf", "r") as xdmf:

#Read the mesh topology and geometry

domain = xdmf.read_mesh(name="mesh")

#Pulling saved tags

cell_tags = xdmf.read_meshtags(domain, name="cell_tags")

facet_tags = xdmf.read_meshtags(domain, name="facet_tags")

gdim = domain.geometry.dim

Specifically, I get the following error below:

Traceback (most recent call last):
facet_tags = xdmf.read_meshtags(domain, name="facet_tags")
mt = super().read_meshtags(mesh.\_cpp_object, name, attribute_name, xpath)
RuntimeError: Missing IndexMap in Topology. Maybe you need to create_entities(1).

Has anyone come across a similar issue, if so, how did you fix the issue? For reference I am using version 0.10.0 if Dolfinx and version 4.15.1 of Gmsh. Additionally, the mesh is set up correctly, because in the file where both mesh generation and solving occur together, there are no issues.