Is it possible to calculate the area of the cell faces that are marked in a subdomain?
Below is some test code using a basic hex mesh cube domain. I want to extend this to a complex tetrahedral mesh, so if possible I’d like to avoid iterating through the marked faces and calculating their areas manually.
from dolfin import * from dolfin_adjoint import * n = 10 Nx, Ny, Nz = n,n,n mesh = BoxMesh.create(MPI.comm_world, [Point(0,0,0), Point(1,1,1)], [Nx, Ny, Nz], CellType.Type.hexahedron) DG_FS = FunctionSpace(mesh, "DG", 0) CG_FS = FunctionSpace(mesh, "CG", 1) CG_VFS = VectorFunctionSpace(mesh, "CG", 1) class top(SubDomain): def inside(self, x, on_boundary): return on_boundary and near(x, 1.) class bottom(SubDomain): def inside(self, x, on_boundary): return on_boundary and near(x, 0) top = top() bottom = bottom() materials = MeshFunction('size_t', mesh, 2) materials.set_all(0) top.mark(materials, 1) bottom.mark(materials, 2) ds = Measure("ds")(subdomain_data=materials) # Total area of top top_area = .... # Exact value is 1 in this case bottom_area = .... # Exact value is 1 in this case