Hello,

I have a 2D rectangular geometry. The boundaries are the inlet, the outlet and the wall. I want to impose a Dirichlet BC for an unknown using DG elements. By using the classical DirichletBC() function I can only impose a “pointwise” BC on the centroid of an element. To this end I would like to define a boundary that contains the centroids of the elements, lets say at the inlet, in order to use the DirichletBC() function for a boundary than for a point. Initially, I exported the centroids of the mesh and then I made a list with those that belong to the inlet boundary, the inletCentroids list. Finally, I do not get any error but the inflow sub_boundary does not contain any centroid. The centroids are calculated correctly, so I guess that the problem is inside class Inflow(). Here is the sample of my code

```
# Find centroids of the mesh
centroid = []
for cell_no in range(mesh.num_cells()):
coc = Cell(mesh, cell_no).midpoint()
coo = []
coo.append(coc.x())
coo.append(coc.y())
centroid.append(coo)
# Store the centroids of the inlet
inletCentroids = []
for i in range(len(centroid)):
if (abs(centroid[i][0]-0.0041)<1.e-4):
inletCentroids.append(i)
# Sub domain for inlet
class Inflow(SubDomain):
def inside(self, x, on_boundary):
tol = 1.e-4
for i in inletCentroids:
p = near( x[0], centroid[i][0] , tol) and near(x[1], centroid[i][1] , tol)
if ( p is True):
return (p)
sub_domains = MeshFunction("size_t", mesh,0)
sub_domains.set_all(0)
inflow = Inflow()
inflow.mark(sub_domains, 1)
inflowBC = DirichletBC(VP.sub(1), pIn , sub_boundaries , 1 )
```

Thank you