I have a 3D mesh that consists of mesh.xdmf (volume, tetra) and mf.xdmf (surface, triangle) where mf.xdmf has boundary markers.
What I want to do is to extract the boundary which is marked in mf.xdmf and save as xdmf file for another simulation, but I’m a bit confused how to proceed.
The way I read the mesh is as follows and from there I would like to use
mf to save the marked boundary
from fenics import * mesh = Mesh() mvc = MeshValueCollection("size_t", mesh, mesh.topology().dim()) with XDMFFile(MPI.comm_world, "mesh.xdmf") as infile: infile.read(mesh) infile.read(mvc, “name_to_read") mvc = MeshValueCollection("size_t", mesh, mesh.topology().dim()-1) with XDMFFile(MPI.comm_world, "mf.xdmf") as infile: infile.read(mvc, “name_to_read") mf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
I attached the screen shot of how it looks when you load
mf.xdmf. The inlet boundary is marked as 1, the wall part is marked as 2, and the outlet part is marked as 3.
Mesh files can be accessed here mesh_coarse - Google Drive