CSG question

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

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:

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