How to create spheres with radius varying with gaussian distrubtion

Asked by Yaswanth Kalepu

Hi,
I want to create spheres, with radius-es having gaussian distribution and with given mean and variance. How to do that?

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

See eg the psdSizes and psdCumm attributes of makeCloud() [*]

[*] https://yade-dem.org/doc/yade.pack.html?highlight=makecloud#yade._packSpheres.SpherePack.makeCloud

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

A MWE:
###
import scipy.stats
mean = 1
variance = .01

def gauss(x,mean,variance): # or using directly the formula if scipy.stats is not an option
   stddev = sqrt(variance)
   return scipy.stats.norm.cdf(x,mean,stddev)

sp = yade.pack.SpherePack()
psdSizes = numpy.linspace(0,4*mean,100)
psdCumm = [gauss(size,mean,variance) for size in psdSizes]
psdCumm[0] = 0
psdCumm[-1] = 1
sp.makeCloud((0,0,0),(10,10,10),num=1000,psdSizes=psdSizes,psdCumm=psdCumm)
sp.toSimulation()
br,bp,bc = yade.utils.psd(bins=50)
for r,p in zip(br,bp):
   print(r,p,gauss(2*r,mean,variance))
###

Can you help with this problem?

Provide an answer of your own, or ask Yaswanth Kalepu for more information if necessary.

To post a message you must log in.