How to add all particles to a new pack.SpherePack()

Asked by Leonard on 2020-03-07

Hi,
I want to plot the PSD curve in a triaxial test, the PSD curve is the curve of all particles after scale up (not original psd in makeCloud). And the yade psd.py[1] is really a good example to plot the psd curve, but it aims at the original size of the particles(see MWE below).
#####
import matplotlib; matplotlib.rc('axes',grid=True)
from yade import pack
import pylab
sp=pack.SpherePack();
sp.makeCloud((0,0,0),(1,1,1),rMean=0.03,rRelFuzz=2/3.,distributeMass=False);
pylab.figure()
pylab.plot(*(sp.psd(mass=True)+('g',)))
pylab.legend(['Mass PSD of size-uniform distribution'])
#############

I tried in this way:
##
sp=pack.SpherePack();
sp.makeCloud((0,0,0),(1,1,1),rMean=0.03,rRelFuzz=2/3.,distributeMass=False);
Here: particles scale-up code which is from yade triaxial script
sp2=pack.SpherePack()
Here: how to add all scale-up particles to the new defined sp2
Then :
pylab.figure()
pylab.plot(*(sp2.psd(mass=True)+('g',)))
pylab.legend(['Mass PSD of size-uniform distribution'])
###

I'd like to ask that how to add all particles to a new pack.SpherePack().
Or is there other ways that can directly plot the scale-up psd curve?

Thanks,
Leonard
[1]https://github.com/yade/trunk/blob/master/examples/test/psd.py

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
2020-03-09
Last query:
2020-03-09
Last reply:
2020-03-09

> I'd like to ask that how to add all particles to a new pack.SpherePack().

Read the documentation of pack.SpherePack? [1]
https://yade-dem.org/doc/yade.pack.html?highlight=spherepack#yade._packSpheres.SpherePack.fromSimulation
Bruno

Jérôme Duriez (jduriez) said : #3

Note that referring to deprecated github is not ideal.. We moved to https://gitlab.com/yade-dev/trunk (see 4th § of https://yade-dem.org/doc/)

Leonard (z2521899293) said : #4

Thanks Robert, Bruno and Jérôme for your kind instructions.

Cheers,
Leonard

Leonard (z2521899293) said : #5

Thanks Bruno Chareyre, that solved my question.