How can I check if a point belongs to a subdomain or not?

3 months ago by
So I have the following code:
from dolfin import *

#Meshing done by GMSH

mesh =Mesh('3layered_annulus.xml')  
mesh_coordinates = mesh.coordinates()

V = VectorFunctionSpace(mesh, 'P', 1)
N = V.dim()
d = mesh.geometry().dim() 

Volume = MeshFunction('size_t' , mesh , '3layered_annulus_physical_region.xml' )  
bnd_mesh = MeshFunction('size_t', mesh , '3layered_annulus_facet_region.xml')  

ds = Measure('ds', subdomain_data=bnd_mesh)
dx = Measure('dx', subdomain_data=Volume)

I have done the meshing and marking in GMSH. My region is a three layered annular cylinder with the inner layer marked by '1' the middle by '2' and the outer by '3'. I am sure about my marking because when I plot "Volume" I can clearly see it. Now suppose I have a mesh node p=(1,1,1), how can I check which layer it belongs to?

Thank you in advance
Community: FEniCS Project

1 Answer

3 months ago by
You must first determine the index of the cell your point belongs to, see e.g. , then you can query the MeshFunction. If your point is on the boundary of multiple layers this is of course not well-defined.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »