← Back to team overview

yade-users team mailing list archive

Re: [Question #404417]: Generate a specific number of spheres in the empty spaces of a created loose pack

 

Question #404417 on Yade changed:
https://answers.launchpad.net/yade/+question/404417

amir gave more information on the question:
MY problem is that the loaded particles are not created right after the
deletion. I have prepared two simple scripts. If you run the second
script, you will see that new particles fall down freely without effect
of filter particles(seems there is no filter particles). I appreciate if
you could take a look at the scripts.

######################## script 1 - save simulation
from yade import pack, plot,ymport,export,geom,bodiesHandling
r1 = .003/2.0
nf=40
sp = pack.SpherePack()
sp.makeCloud((0,0,0),(0.01,0.01,0.1),rMean=r1,num=nf)
sp.toSimulation()

O.bodies.append(utils.geom.facetBox((0.005,0.005,0.05),(0.005,0.005,0.05),wallMask=31))

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
    InteractionLoop(
	[Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom(),Ig2_Wall_Sphere_L3Geom()],
	[Ip2_FrictMat_FrictMat_FrictPhys()],
	[Law2_L3Geom_FrictPhys_ElPerfPl()]
    ),
    GravityEngine(gravity=(0,0,-9.81)),
    NewtonIntegrator(damping=.3),
    PyRunner(command='func()',iterPeriod=100,label='checker'),
    PyRunner(command='addPlotData()',iterPeriod=100)
]
O.dt=1*utils.PWaveTimeStep()

def func():
    if O.iter>20000:
        O.pause()
    O.save("pip0.yade")

def addPlotData():
    if O.iter<20000: return
    plot.addData(i=O.iter,unbalanced=utils.unbalancedForce(),**O.energy)
########################

######################## script 2 - loads simulation
from yade import pack, plot,ymport,export,geom,bodiesHandling
O.load('pip0.yade')
r2 = .001/2.0

sp = pack.SpherePack([(b.state.pos,b.shape.radius) for b in O.bodies if isinstance (b.shape,Sphere)])
print len(O.bodies)

sp = pack.SpherePack()
sp.makeCloud((0,0,0.0),(0.01,0.01,0.01),rMean=r2,num=10)

for b in O.bodies:
    if isinstance (b.shape,Sphere): O.bodies.erase(b.id)
#O.bodies.clear()

sp.toSimulation()
print len(O.bodies)

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
    InteractionLoop(
	[Ig2_Sphere_Sphere_L3Geom(),Ig2_Facet_Sphere_L3Geom(),Ig2_Wall_Sphere_L3Geom()],
	[Ip2_FrictMat_FrictMat_FrictPhys()],
	[Law2_L3Geom_FrictPhys_ElPerfPl()]
    ),
    GravityEngine(gravity=(0,0,-9.81)),
    NewtonIntegrator(damping=.3),
    PyRunner(command='func()',iterPeriod=100,label='checker'),
    PyRunner(command='addPlotData()',iterPeriod=100)
]

def func():
    if O.iter>200000:
        O.pause()

def addPlotData():
    plot.addData(i=O.iter,unbalanced=utils.unbalancedForce(),**O.energy)

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.