- Thank you received: 0
Combining boundaries
4 years 1 week ago #3313
by rgs
Combining boundaries was created by rgs
Hello,
I am trying to group some surfaces together into a boundary condition, and currently, each surface gets the name I want, but they are not in the same boundary condition. I guess what happens is, each boundary index is assigned the corresponding boundary name, but they remain separate boundaries.
My code is as follows:
And this prints:
How can I combine or group together boundaries, so that in the above case, there is only one boundary called 'FSI'?
Thanks in advance!
I am trying to group some surfaces together into a boundary condition, and currently, each surface gets the name I want, but they are not in the same boundary condition. I guess what happens is, each boundary index is assigned the corresponding boundary name, but they remain separate boundaries.
My code is as follows:
Code:
from netgen.csg import *
cube = OrthoBrick ( Pnt(-0.5, -0.5, -0.3), Pnt(0.5, 0.5, 0.3) ) #Scaled up 1000 times
holeX = Cylinder ( Pnt(-0.5, 0, 0), Pnt(0.5, 0, 0), 0.2)
holeY1 = Cylinder ( Pnt(0, -5, 0.3), Pnt(0, 5, 0.3), 0.2)
holeY2 = Cylinder ( Pnt(0, -5, -0.3), Pnt(0, 5, -0.3), 0.2)
cut1 = cube - holeX
cut2 = cut1 - holeY1
cut3 = cut2 - holeY2
pX = Plane(Pnt(0.5,0,0),Vec(1,0,0))
nX = Plane(Pnt(-0.5,0,0),Vec(-1,0,0))
pY = Plane(Pnt(0,0.5,0),Vec(0,1,0))
nY = Plane(Pnt(0,-0.5,0),Vec(0,-1,0))
pZ = Plane(Pnt(0,0,0.3),Vec(0,0,1))
nZ = Plane(Pnt(0,0,-0.3),Vec(0,0,-1))
boundingBox = pX*nX*pY*nY*pZ*nZ
Budapest = cut3*boundingBox
Budapest.bc('FSI')
# Mesh for bounding box
bbgeo=CSGeometry()
bbgeo.Add(boundingBox)
bbngmesh = bbgeo.GenerateMesh(maxh=0.1)
bbmesh = Mesh(bbngmesh)
geo=CSGeometry()
geo.Add(Budapest.mat("domain"), bcmod=[(pX,"xplus"),(nX,"xminus"),(pY,"yplus"),(nY,"yminus"),(pZ,"zplus"),(nZ,"zminus")])
from ngsolve.comp import Mesh
netgenMesh=geo.GenerateMesh(maxh=0.025)
mesh = Mesh(netgenMesh)
# Marking periodic surfaces
geo.PeriodicSurfaces(pX,nX)
geo.PeriodicSurfaces(pY,nY)
geo.PeriodicSurfaces(pZ,nZ)
print(mesh.GetBoundaries())
And this prints:
('zminus', 'xminus', 'yplus', 'xplus', 'zplus', 'FSI', 'yminus', 'FSI', 'FSI')
How can I combine or group together boundaries, so that in the above case, there is only one boundary called 'FSI'?
Thanks in advance!
Time to create page: 0.093 seconds