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

access to information whether a vertex is on the boundary or not

+2 votes

Dear All

For my work with multiple domains and fitting of different symmetries/ coordinates
I need to access the physical coordinates of all vertices on all boundaries.
I can of course find those by looking at the vertex coordinate, but
for order larger one some of the boundary vertices will not exactly lie on
the spherical surface but a bit inside. For interior boundaries
that is OK, however for exterior spherical boundaries the vertices lie a bit inside and
one needs to examine the mesh to find out where the cutoff is!

When defining a boundary condition using the normal FEniCS way
i.e.
def boundary(x,on_boundary):
if fun(x) <1.1 and on_boundary

this information is obviously known to FEniCS
How can I get access to this information to identify the boundary indices with less effort
as described above!

regards

Moritz

asked Apr 29, 2015 by moritzbraun FEniCS User (1,390 points)

1 Answer

+2 votes

d.get_boundary_values().keys()

Where d is a DirichletBC instance you get the dofs which belong to vertices of the dirichlet boundary. After that you can probably use a dof to vertex map to get the vertices.

answered Apr 30, 2015 by maxb90 FEniCS Novice (770 points)

Dear maxb90

Thanks a lot!

This is indeed the way to do it!

regards

Moritz

...