Slow start-up time for small particles

Asked by Emon Mitra

Hi,
I'm trying to simulate an uniaxial loading situation involving small particles. My problem is that when I reduce the particle size below .007 and launch yade, it says "running script xxx.py" and then stays on that while yade maxes out my CPU and nothing else happens. At particle size .007 though it launches the script in less than a minute. I was wondering if there is any way to make it load faster or should I be trying some other method?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Klaus Thoeni
Solved:
Last query:
Last reply:
Revision history for this message
Kneib François (francois-kneib) said :
#1

Hi,

Could you please give us more details ? Which sphere packing do you use ? The size of particles doesn't give any information without the box size, as this is a question of number of particles.
It would be useful to join your script.

Revision history for this message
Jan Stránský (honzik) said :
#2

Hi Emon,
to test if yade start, just put
print 'YADE STARTED'
as the first line of your script. Then you will be sure :-)

As suggested by Francois, the problem could be the number of particles, not
directly the size.
cheers
Jan

2014-04-16 8:26 GMT+02:00 Kneib François <
<email address hidden>>:

> Question #247061 on Yade changed:
> https://answers.launchpad.net/yade/+question/247061
>
> Status: Open => Needs information
>
> Kneib François requested more information:
> Hi,
>
> Could you please give us more details ? Which sphere packing do you use ?
> The size of particles doesn't give any information without the box size, as
> this is a question of number of particles.
> It would be useful to join your script.
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Emon Mitra (emon-mitra) said :
#3

Sorry for the late reply, I think you're right about the number of particles. I've attached the code below, is there any way to speed it up while maintaining the number of particles?

# gravity deposition, continuing with oedometric test after stabilization
# shows also how to run parametric studies with yade-batch

# The components of the batch are:
# 1. table with parameters, one set of parameters per line (ccc.table)
# 2. utils.readParamsFromTable which reads respective line from the parameter file
# 3. the simulation muse be run using yade-batch, not yade
#
# $ yade-batch --job-threads=1 03-oedometric-test.table 03-oedometric-test.py
#

# load parameters from file if run in batch
# default values are used if not run from batch
utils.readParamsFromTable(rMean=.002,rRelFuzz=.3,maxLoad=1e7,minLoad=1e4)
# make rMean, rRelFuzz, maxLoad accessible directly as variables later
from yade.params.table import *

# create box with free top, and ceate loose packing inside the box
from yade import pack, plot, qt
O.bodies.append(utils.geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=31))
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(1,1,1),rMean=rMean,rRelFuzz=rRelFuzz)
sp.toSimulation()

O.engines=[
   ForceResetter(),
   # sphere, facet, wall
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
   InteractionLoop(
      # the loading plate is a wall, we need to handle sphere+sphere, sphere+facet, sphere+wall
      [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=0.5),
   # save data for Paraview
   VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000),
   # save data from Yade's own 3d view
   qt.SnapshotEngine(fileBase='3d-',iterPeriod=200,label='snapshot'),

   # the label creates an automatic variable referring to this engine
   # we use it below to change its attributes from the functions called
   PyRunner(command='checkUnbalanced()',realPeriod=2,label='checker'),
]
O.dt=.5*utils.PWaveTimeStep()

# the following checkUnbalanced, unloadPlate and stopUnloading functions are all called by the 'checker'
# (the last engine) one after another; this sequence defines progression of different stages of the
# simulation, as each of the functions, when the condition is satisfied, updates 'checker' to call
# the next function when it is run from within the simulation next time

# we must open the view explicitly (limitation of the qt.SnapshotEngine)
qt.View()

# check whether the gravity deposition has already finished
# if so, add wall on the top of the packing and start the oedometric test
def checkUnbalanced():
   # at the very start, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable
   if O.iter<5000: return
   # the rest will be run only if unbalanced is < .1 (stabilized packing)
   if utils.unbalancedForce()>.1: return
   # add plate at the position on the top of the packing
   # the maximum finds the z-coordinate of the top of the topmost particle
   O.bodies.append(utils.wall(max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)]),axis=2,sense=-1))
   global plate # without this line, the plate variable would only exist inside this function
   plate=O.bodies[-1] # the last particles is the plate
   # Wall objects are "fixed" by default, i.e. not subject to forces
   # prescribing a velocity will therefore make it move at constant velocity (downwards)
   plate.state.vel=(0,0,-.1)
   # start plotting the data now, it was not interesting before
   O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=200)]
   # next time, do not call this function anymore, but the next one (unloadPlate) instead
   checker.command='unloadPlate()'
   utils.makeVideo(snapshot.snapshots,'3d.mpeg',fps=10,bps=10000)

def unloadPlate():
   # if the force on plate exceeds maximum load, start unloading
   if abs(O.forces.f(plate.id)[2])>maxLoad:
      plate.state.vel*=-1
      # next time, do not call this function anymore, but the next one (stopUnloading) instead
      checker.command='stopUnloading()'

def stopUnloading():
   if abs(O.forces.f(plate.id)[2])<minLoad:
      # O.tags can be used to retrieve unique identifiers of the simulation
      # if running in batch, subsequent simulation would overwrite each other's output files otherwise
      # d (or description) is simulation description (composed of parameter values)
      # while the id is composed of time and process number
      plot.saveDataTxt(O.tags['d.id']+'.txt')
      O.pause()

def addPlotData():
   if not isinstance(O.bodies[-1].shape,Wall):
      plot.addData(); return
   Fz=O.forces.f(plate.id)[2]
   plot.addData(Fz=Fz,w=plate.state.pos[2]-plate.state.refPos[2],unbalanced=utils.unbalancedForce(),i=O.iter)

# besides unbalanced force evolution, also plot the displacement-force diagram
plot.plots={'i':('unbalanced',),'w':('Fz',)}
plot.plot()

O.run()
# when running with yade-batch, the script must not finish until the simulation is done fully
# this command will wait for that (has no influence in the non-batch mode)
utils.waitIfBatch()

Revision history for this message
Kneib François (francois-kneib) said :
#4

Well, you try to generate particles of diameters 0.004 in a box of 1x1x1.
So, it's around 20 millions of particles.
Not sure that your computer can deal with this in DEM :-/
If you still want to generate this kind of huge packing, you should probably generate a "little" sphere pack and then duplicate it ...

Revision history for this message
Emon Mitra (emon-mitra) said :
#5

That's true, it is a rather large number of particles. I'm not sure how to duplicate a sphere pack though, is there a tutorial or any examples of that?

Revision history for this message
Best Klaus Thoeni (klaus.thoeni) said :
#6

Hi,

here is one way of doing it by using the export/import functions, i.e.

1. create your packing and export it with with something like [1]:
    export.text('packing.txt')

2. crate a second script where you import the packing with something like [2]:
    packing=[]
    for dx in [0,1,2]:
      packing+=ymport.text('packing.txt',scale=1.0,shift=Vector3(dx,0,0))
    O.bodies.append(packing)

HTH
Klaus

[1] https://yade-dem.org/doc/yade.export.html#yade.export.text
[2] https://yade-dem.org/doc/yade.ymport.html#yade.ymport.text

Revision history for this message
Emon Mitra (emon-mitra) said :
#7

Thanks Klaus Thoeni, that solved my question.