← Back to team overview

yade-users team mailing list archive

[Question #694988]: Use of the yade.utils.psd

 

New question #694988 on Yade:
https://answers.launchpad.net/yade/+question/694988

Dear all,

I am trying to create a packing with log-normal particle size distribution.
I use yade.utils.psd [1] and [2] to check if the size distribution of the packing is consistent with the values I give.
It turns out that method [2] says yes, but method [1] says no. I am quite sure that the method [2] is the right way to calculate the particle size distribution. So I was wondering what exact parameter that yade.utils.psd [1] returns, especially the one called "binsProc" [1] which is named "bp" in the MWE.
Thanks!

[1] https://yade-dem.org/doc/yade.utils.html?highlight=yade%20utils%20psd#yade.utils.psd
[2] https://answers.launchpad.net/yade/+question/675926

###

from yade import plot
import numpy as np
import pylab
import matplotlib.pyplot as plt

mean = 2.2
stddev = 1.2

sp = yade.pack.SpherePack()
psdSizes = np.linspace(62.5, 500, 50)
pdf=[(1/x)*math.exp(-((np.log(x-mean))**2/(stddev*2)**2)) for x in psdSizes]
cdf=np.cumsum(pdf,axis=0)
psdCumm = cdf/max(cdf)
psdCumm[0] = 0
psdCumm[-1] = 1
sp.makeCloud((0,0,0),(5000,5000,5000),psdSizes=psdSizes,psdCumm=psdCumm, seed=1)
sp.toSimulation()
br,bp,bc = yade.utils.psd(bins=49)

def getDiameterArray():
    diameter=[]
    for b in O.bodies:
        if isinstance(b.shape,Sphere):
            diameter.append(b.shape.radius*2)
    return diameter

diameter = getDiameterArray()
values, base = np.histogram(diameter, bins=50)
cumulative = np.array(np.cumsum(values),dtype=float)
perc = cumulative/max(cumulative)

pylab.plot(psdSizes,psdCumm,color="b")
pylab.plot(base[:-1],perc,color="r")
pylab.plot(br,bp,color="g")
pylab.xlabel("particle size")
pylab.ylabel("Cumulative particle density")
pylab.show()

###

Cheers,
Chien-Cheng



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