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.

CSG question

More
3 years 11 months ago #2595 by mary
CSG question was created by mary
Dear all,

I want to solve the heat equation in a cube - I managed to set a dirichlet boundary condition on the top and bottom of the cube, by defining the individual planes

left = Plane (Pnt(0,0,0), Vec(-1,0,0) )
right = Plane (Pnt(1,1,1), Vec( 1,0,0) )
front = Plane (Pnt(0,0,0), Vec(0,-1,0) )
back = Plane (Pnt(1,1,1), Vec(0, 1,0) )
bot = Plane (Pnt(0,0,0), Vec(0,0,-1) ).bc('bot')
top = Plane (Pnt(1,1,1), Vec(0,0, 1) ).bc('top')
cube = left * right * front * back * bot * top

However, what I really want is that the Dirichlet bc are only set on parts of the bottom and top plane - for example on two circles with center (0.5, 0.5) and radius 0.1 which lie in the bot and top plane. How can I do that ?

A related question is - if I want to solve the heat equation in a sphere and set two Dirichlet boundary conditions - again on two circles lying on the surface of the sphere. How do I do that ?

Thanks a lot
Marie-Therese
More
3 years 11 months ago #2596 by schruste
Replied by schruste on topic CSG question
Hi Marie-Therese,

You can explicitly define and add Surface. Here is a small example of a cuboid with two rectangles on one of the sides:
Code:
geo = CSGeometry() left = Plane (Pnt(0,0,0), Vec(-1,0,0)).bc("wall") insurf = Plane (Pnt(0,0,0), Vec(-1,0,0)).bc("in").maxh(0.05) outsurf = Plane (Pnt(0,0,0), Vec(-1,0,0)).bc("out").maxh(0.05) brick = left * OrthoBrick (Pnt(0,0,0),Pnt(0.84,0.50,0.60)).bc("wall") inbrick = insurf * OrthoBrick (Pnt(-0.01, 0.413,0.222), Pnt(0.01, 0.455,0.378)) outbrick = outsurf * OrthoBrick (Pnt(-0.01, 0.300,0.27), Pnt(0.01, 0.340,0.33)) geo.Add(brick) geo.AddSurface(insurf, inbrick) geo.AddSurface(outsurf, outbrick)

Best,
Christoph
Time to create page: 0.141 seconds