I'm trying to create objects in 3D, specifically a cylinder, within a larger
mesh.  The object will be static and will be solid (for example it will not
permit diffusion, while the surrounding medium will).  Below I have created
an object in 3D inside of a rectangular mesh, where the position of the
object is defined by the value of pillar=1 (concept taken from one of the
level set examples).  Because the mesh is square, the edges will
"pixilated."  Is there a better way to define a cylinder or other smooth,
non-planar face within a larger mesh (perhaps create an irregular grid?).

 

mesh = Grid3D(nx=nx, ny = ny, nz = nz, dx=dx, dy=dy, dz=dz)

X = mesh.getCellCenters()[0:nx*ny*nz,0]

Y = mesh.getCellCenters()[0:nx*ny*nz,1]

Z = mesh.getCellCenters()[0:nx*ny*nz,2]

 

pillarCenter=[5,5]

centerX=pillarCenter[0]

centerY=pillarCenter[1]

radius = 3

height = 5

 

pillar = CellVariable(mesh, value = 0.0)

pillar.setValue(1.0,where=((((X-centerX)**2+(Y-centerY)**2) < radius**2) &
(Z < height)))

 

Chris Calebrese

Reply via email to