Hi all,
I'm trying to create a SubMesh of a BoundaryMesh. For instance, given a UnitSquareMesh, I would like to get only the vertices on the top boundary of the mesh. I've tried this code:
from dolfin import *
mesh = UnitSquareMesh(10, 10)
class OmegaTop(SubDomain):
def inside(self, x, on_boundary):
return x[1] == 1
omega_top = OmegaTop()
subdomains = CellFunction('size_t', mesh)
subdomains.set_all(0)
omega_top.mark(subdomains, 1)
submesh_omega_top = SubMesh(mesh, subdomains, 1)
However, the output is:
In [1]: print submesh_omega_top
Out [1]: <Mesh of topological dimension 2 (triangles) with 0 vertices and 0 cells, ordered>
The point is, that I don't understand, why the SubMesh has no vertices and no cells? I've expected an intervall with 11 vertices and 10 cells. How can I correct the code to get only the vertiecs on the top boundary of the UnitSquareMesh?
By the way, using the folling code leads to the same result:
submesh_omega_top = SubMesh( BoundaryMesh(mesh, "exterior") , subdomains, 1)
Thank you for your support in advance.