How to extract SubMesh and corresponding MeshFunction from a mesh imported from Gmsh
10 weeks ago by
I am solving a 3D coupled fluid and structure problem. Now I have a full mesh and I want divide it into two submesh:
filer.read(*mesh,std::string("mesh"),false); filer.read(*cell_marker, std::string("subdomains_mark")); //MeshFunction for subdomains_mark with label=1 (fluid) and 2 (solid). filer.read(*bd_marker, std::string("facet_mark")); // MeshFunction for facet_mark with some labels representing different boundaries.
then I can get the SubMesh and MeshFuntion by:
fluid_mesh.reset( new SubMesh(*mesh, *cell_mark, 1)); //Here label=1 means taking fluid mesh. fluid_cell_marker.reset( new MeshFunction<std::size_t>(fluid_mesh, fluid_mesh->topology().dim())); fluid_bd_marker.reset( new MeshFunction<std::size_t>(fluid_mesh, fluid_mesh->topology().dim()-1));
But, fluid_cell_marker and fluid_bd_marker are not consistent with cell_marker and bd_marker, i.e., the same boundary has different boundary labels in mesh and submesh. How to solve this problem?
I found a similar post https://www.allanswered.com/post/nqzzq/#lozzv. In this post, the author was trying to impose a dirichlet boundary condition on a boundary. I think the difficulty is that this boundary is labeled as 3 in the full mesh, however we do not know what the label is in submesh.
Community: FEniCS Project
Please login to add an answer/comment or follow this question.