# Set Dirichlet Boundary Condition by Coordinates

1 month 4 days ago #3687 by NV
Hello Everybody,

I am looking for a different method to specify Dirichlet boundary conditions. I would like to define them depending on the coordinates

Considering a square domain ((-1,-1),(1,1)) without any bc markers
geo = geom2d.SplineGeometry()
pnums = [ geo.AddPoint (x,y,maxh=0.01) for x,y in [(-1,-1), (-1,1), (1,1), (1,-1)] ]
for p1,p2,bc in [(0,1), (1,2), (2,3), (3,0)]:
geo.Append(["line", pnums[p1], pnums[p2]])
mesh = Mesh(geo.GenerateMesh())

It would be great if we could specify the dirichlet bc depending on the coordinates. E.g. considering the left edge as a dirichlet bc the input could be something like
fes = H1(mesh, order=2, dirichlet= y==-1 )

or likewise a redefinition of the bc marker would also work in style of
geo.SetBC(x=-1, y=0, bc='left_edge')
fes = H1(mesh, order=2, dirichlet='left_edge')

Is something related implemented in NGSolve? Unfortanetly I was not able to find anything in the documentation.