Dear Community,
I am trying to define boundaries from an xdmf file. I read a .med but I meet an issue with the function read_meshtags().
I read a previous discussion on dolfin where it advised to use write_checkpoint
and read_checkpoint
but how can I solve the " RuntimeError : Storage format “” is unknown" in using dolfinx ?
It seems that there is an issue where I use meshio.write() making datas that read_meshtags() can’t read.
This is the little script :
import matplotlib.pyplot as plt
import meshio
import dolfinx
from mpi4py import MPI
import numpy as np
def create_mesh(mesh, cell_type, prune_z=False):
cells = mesh.get_cells_type(cell_type)
points = mesh.points[:,:2] if prune_z else mesh.points
out_mesh = meshio.Mesh(points=points, cells={cell_type: cells})
return out_mesh
proc = MPI.COMM_WORLD.rank
if proc == 0:
# Read in mesh
msh = meshio.read("Mesh_quad_v4_1.med")
# Create and save one file for the mesh, and one file for the facets
quad_mesh = create_mesh(msh, "quad")
line_mesh = create_mesh(msh, "line")
meshio.write("mesh.xdmf", quad_mesh)
meshio.write("mt.xdmf", line_mesh)
with dolfinx.io.XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "r") as xdmf:
mesh = xdmf.read_mesh(name="Grid")
ct = xdmf.read_meshtags(mesh, name="Grid") # RunTimeError
Thank you for the help.
Kind regards,
Lamia