MeshFunction and SubMesh
Given a marked mesh (region and facets), I'd like to create submesh with the corresponding marked elements.
Example (quite self-explanatory):
mesh = Mesh("vessel.
dfun = MeshFunctionSiz
bfun = MeshFunctionSiz
mesh_fluid = SubMesh(mesh, dfun, 1)
mesh_struct = SubMesh(mesh, dfun, 2)
bfun_fluid = give_me_
bfun_struct = give_me_
The former problem was to apply assemble a problem on the submesh keeping the correct marked elements.
Of course I cannot use directly bfun, because facets ids are different.
Is there an equivalent to "give_me_a_name" in Dolfin?
Here my work around (not really efficient):
def give_me_
# creates the submesh bfun
bfun_submesh = MeshFunctionSiz
# submesh to mesh mappings
cfun = submesh.
pfun = submesh.
# iterate over the cells
for cell in cells(submesh) :
# extracts the facets and the corresponding one of the full mesh
facets_sub = cell.entities(2)
facets = Cell(mesh, cfun.array(
for facet_sub in facets_sub :
# mapped vertices
vert_mapped = pfun.array(
# find the corresponding facet on the full mesh
for facet in facets :
# vertices
vert = Facet(mesh, facet).entities(0)
# intersection
common = set(vert)
if len(common) == 3 :
break
return bfun_submesh
Sub-question: is there a way to know the type ("size_t", "uint", ...) of a MeshFunction?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Johan Hake
- Solved:
- Last query:
- Last reply: