gengeo question: BoundingBox Size in *.geo was different from what was set in MNTable3D

Asked by Jiadun Liu

Question BoundingBox Size in smooth_box.geo was different from what was set in MNTable3D
In smooth_box.geo: BoundingBox 0 0 0 10 10 10
the value in MNTable3D: maxPoint 8 8 8

# --- geometry setup script for monodisperse packing with particle at regular postion ---
from gengeo import *
from math import *
# - input parameters --

#'''
# radius
minRadius = 0.4
maxRadius = 2.0
# maximum number of particle in three directions
N_X = 10
N_Y = 10
N_Z = 10

# atuo_cal block dimensions
## adopt float!
xdim=N_X*2.0*minRadius
ydim=N_Y*2.0*minRadius
zdim=N_Z*2.0*minRadius

#

# ---------------------
# corner points
minPoint = Vector3(0.0,0.0,0.0)
maxPoint = Vector3(xdim,ydim,zdim)
# neighbour table
mntable = MNTable3D(minPoint,maxPoint,2.5*maxRadius,1)
# block volume
box = BoxWithPlanes3D(minPoint,maxPoint)

# boundary planes
bottomPlane=Plane(minPoint,Vector3(0.0,1.0,0.0))
leftPlane=Plane(minPoint,Vector3(1.0,0.0,0.0))
frontPlane=Plane(minPoint,Vector3(0.0,0.0,1.0))
topPlane=Plane(maxPoint,Vector3(0.0,-1.0,0.0))
rightPlane=Plane(maxPoint,Vector3(-1.0,0.0,0.0))
backPlane=Plane(maxPoint,Vector3(0.0,0.0,-1.0))
# add them to the box
box.addPlane(bottomPlane)
box.addPlane(leftPlane)
box.addPlane(frontPlane)
box.addPlane(topPlane)
box.addPlane(rightPlane)
box.addPlane(backPlane)

# -- setup packer --
# iteration parameters
insertFails = 10000
maxIter = 10000
tol = 1.0e-6

Particle_number_1 = 0

#generate particle at regular position

for i in range(N_X):
 for j in range(N_Y):
  for k in range(N_Z):

   mySphere = Sphere(centre=Vector3((i+0.5)*2*minRadius,(j+0.5)*2*minRadius,(k+0.5)*2*minRadius), radius=minRadius)
   mySphere.setTag (2)
   mntable.insert(mySphere,0)
   Particle_number_1 +=1

print "Particle_number_1: ",Particle_number_1
#'''
# generate interior particle
# packer
packer = InsertGenerator3D( minRadius,maxRadius,insertFails,maxIter,tol,False)
# pack particles into volume
packer.generatePacking(box,mntable,0,1)
#'''
#'''

#'''
# get ParticleList
particleList = mntable.getSphereListFromGroup(groupID=0)

# remove
mntable.removeParticlesInGroup(0)

Particle_Number = 0
# change the tag
for pp in particleList:
 Particle_Number += 1
 Pcentre = pp.Centre()
 Pradius = pp.Radius()
 X_Posn = Pcentre.X()
 Y_Posn = Pcentre.Y()
 Z_Posn = Pcentre.Z()
 ###
 if ((Y_Posn - 1.5*minRadius) <= 0):#bottom
  pp.setTag(2)
 elif (Y_Posn + 1.5*minRadius>=ydim):#top
  pp.setTag(3)
 elif ((X_Posn - 1.5*minRadius) <= 0):#left
  pp.setTag(4)
 elif ((X_Posn + 2.0*minRadius) >= xdim):#right
  pp.setTag(5)
 elif ((Z_Posn - 1.5*minRadius) <= 0):#back
  pp.setTag(6)
 elif ((Z_Posn + 1.5*minRadius) >= zdim):#front
  pp.setTag(7)
 else:
  pp.setTag(1)
 mntable.insert(pp)
 ###
# create bonds between neighbouring particles:
mntable.generateBonds(0,0.005,1)

print "Particle_Number: ", Particle_Number

#output xdim, ydim, zdim
print "xdim: ", xdim
print "ydim: ", ydim
print "zdim: ", zdim

#'''
# write a geometry file
mntable.write("smooth_box.geo", 1)
mntable.write("smooth_box.vtu", 2)

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
SteffenAbe
Solved:
Last query:
Last reply:
Revision history for this message
Best SteffenAbe (s-abe) said :
#1

Hi Jiadun,

the bounding box in the .geo file is the actual dimension of the MNTable, not the one requested by the parameters. The difference is do to the fact that the requested grid spacing (in your case 2.5*maxRadius, which is 5.0) is not always compatible with the requested dimensions of the MNTable (in your case 8.0 in all dimensions). In such cases the requested grid size is used and the dimensions of the MNTable are inflated to the next larger multiple of the grid spacing - which is 2x5.0 = 10.0 in your case. Therefore you get a dimension of 10 instead of 8 in the .geo file.

Steffen

Revision history for this message
Jiadun Liu (liujiadun) said :
#2

Thanks SteffenAbe, that solved my question.