### Vertex Identification on the boundary

102
views
1
6 months ago by
Hi guys,

Solving a FSI problem, I want to know which vertices lie on the FSI boundary so I can apply values on them. From what I have seen in the post this can be done with different ways(i.e. SubsetIterator with a corresponding FacetFunction or CellFunction would be best for me). This is a MWE:

from fenics import *
from mshr import *

fluid = UnitSquareMesh(100, 100)
V = VectorFunctionSpace(fluid, 'P', 1)

ff = Function(V)

class left(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 0.0)

left = left()

fluidboundaries = FacetFunction("size_t", fluid)
fluidboundaries.set_all(0)
cell_domains = CellFunction("size_t", fluid)
cell_domains.set_all(0)

left.mark(fluidboundaries, 20)

plot(fluidboundaries, interactive=True)

for cell in cells(fluid):
for facet in facets(cell):
if facet.exterior() and fluidboundaries[facet]==20:
cell_domains[cell] = 1

cfg = SubsetIterator(cell_domains, 1)

for cell in cfg:
print(cell.index())
ff.vector()[cell.index()] = 1

File('FF/ff.pvd') << ff
​

This is a wrong code created on purpose just to give you a working space that you can alter.

and I get this as a result for ff.

I want to properly find the vertices on the left boundary and their indices and then give values to some function living on the same vertices.

Any ideas??
Community: FEniCS Project