It seems like you have not read the post I linked you to. You cannot use the meshio-convert
script out of the box for XDMF, and you have to use the meshio python interface. See the second section of: Mesh generation and conversion with GMSH and PYGMSH | Jørgen S. Dokken
where I read in a mesh:
import meshio
mesh_from_file = meshio.read("mesh.msh")
extract data for a given cell type
def create_mesh(mesh, cell_type, prune_z=False):
cells = numpy.vstack([cell.data for cell in mesh.cells if cell.type==cell_type])
cell_data = numpy.hstack([mesh.cell_data_dict["gmsh:physical"][key]
for key in mesh.cell_data_dict["gmsh:physical"].keys() if key==cell_type])
# Remove z-coordinates from mesh if we have a 2D cell and all points have the same third coordinate
points= mesh.points
if prune_z:
points = points[:,:2]
mesh_new = meshio.Mesh(points=points, cells={cell_type: cells}, cell_data={"name_to_read":[cell_data]})
return mesh_new
and write a separate mesh file for the cell and facet data
line_mesh = create_mesh(mesh_from_file, "line", prune_z=True)
meshio.write("facet_mesh.xdmf", line_mesh)
triangle_mesh = create_mesh(mesh_from_file, "triangle", prune_z=True)
meshio.write("mesh.xdmf", triangle_mesh)