Using different InsertGenerator3D for the same volume in gengeo
Hi all,
I'm using gengeo to create a cubic AVolume3D with particles and I want to introduce the particles using different InsertGenerator3D, so that I can better control the total particles volumes by assigning different radius ranges for each InsertGenerator3D in the same cubic AVolume3D. I can also assign one GroupID for each generated packer and therefore create bonds only between one GroupID and depending on the distance within this groupID.
The problem using two or more InsertGenerator3D with the same Volume3D is that after creating the first generatePacking, lets say with coarse or big particles, I want to introduce the second generatePacking with much smaller particles and fill the same Volume3D "minus" the volume of particles created by the first generatePacking. I'm using a "for...loop" to make a DifferenceVol between the original Volume3D and each created particle by the first generatePacking, but I get an error in the loop, I cannot subtract the volume of the first particle, and then re-use the result to subtract the volume of the second particle and so on, within the same loop. I get a"pure virtual method called" and I don't know if it is my bad programming or because the class AVolume3D cannot be instantiated from python. If you understand my problem and have an idea how to deal with it I would be very thankful!
Here is my code:
from gengeo import *
def makeSample(
#create a volume of general particles:
box = BoxWithPlanes3D (
minPoint = Vector3(
maxPoint = Vector3(
)
#Create a neighbour table to contain the particles:
table = MNTable3D (
minPoint = Vector3(
maxPoint = Vector3(
gridSize = 1.2*3.5,
numGroups = 2
)
#Create a particle packer for inserting particles into the volume:
#general particles:
packer1 = InsertGenerator3D (
minRadius = 2.5,
maxRadius = 3.5,
insertFails = 100,
maxIterations = 50,
tolerance = -1.0e-4,
seed = True
)
#Generate the particles packing for the sample:
#general particles:
packer1.
volume = box,
ntable = table,
groupID = 0,
tag = 0
)
#calculate particles volume and print
partVol = table.getSumVol
print "partVol:", partVol
#create a difference volume from general particles and box:
sphereList = table.getSphere
rest = box
print "rest:", rest
for i in range (0, len(sphereList)):
sphere1 = sphereList[i]
S = SphereVol(
rest = DifferenceVol(rest, S)
#
#
#here is the problem when I want to use the residual volume "rest" again and again during the loop to subtract all particle #volumes from "box", and then use "rest" as the volume for the second generatePacking
#
#
#small particles:
packer2 = InsertGenerator3D (
minRadius = 0.3,
maxRadius = 0.5,
insertFails = 100,
maxIterations = 50,
tolerance = -1.0e-4,
seed = True
)
#small particles packer generation:
packer2.
volume = rest,
ntable = table,
groupID = 1,
tag = 1
)
#calculate rest volume and print
partVol2 = table.getSumVol
print "partVol2:", partVol2
#create bonds between neighbouring small particles:
table.
groupID = 1,
tolerance = 0.05,
bondID = 1
)
# write a VTK file
table.write(
fileName = "box.vtu",
outputStyle = 2
)
if __name_
makeSample()
Thanks!
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Dion Weatherley
- Solved:
- Last query:
- Last reply: