Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Set Dirichlet Boundary Condition by Coordinates

More
3 years 2 weeks 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
Code:
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
Code:
fes = H1(mesh, order=2, dirichlet= y==-1 )

or likewise a redefinition of the bc marker would also work in style of
Code:
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.
Time to create page: 0.106 seconds