This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

how to mark facets depending on their location on a plane / how to get facets position

0 votes

Basically, from this

boundary_mesh = BoundaryMesh(mesh, "exterior")
boundaries_Vol = FacetFunction('size_t', mesh)
for b in boundary_mesh.entity_map(space_dimension-1):
    boundaries_Vol[b] = id_

or from this:

class Bndry_(SubDomain):
    def inside(self, x, on_boundary):
        return abs(x[1]-x0) < tolerance_boundary_location   
Bndry_().mark(boundaries_Vol,id_)

I would like to add another spatial condition. I want that the value id_ are attributed only for facets located on a plane x[0]=x0 and between x[1]=x1min and x[1]=x1max and between x[2]=x2min and x[2]=x2max, knowing that i have a very large number of x1min, x1max, x2min, x2max values to check.

Then, what is the good way to to this?

asked Oct 28, 2016 by fussegli FEniCS Novice (700 points)

1 Answer

+1 vote

You can use the midpoint() method of Facet or just get the point() at each Vertex

answered Oct 29, 2016 by chris_richardson FEniCS Expert (31,740 points)
...