# Problems with psdSizes and psdCumm in makeCloud function

Dear all,

I used the makeCloud function to generate spheres according to psdSizes and psdCumm, and replaced some of the spheres with polyhedra.

The psd parameters I used are: psdSizes=[0.01,0.015,0.025],psdCumm=(0,0.5,1), according to my understanding, the distribution of the small balls is:
size ratio (%)
0-0.01 0
0.01-0.015 50
0.015-0.025 50

But I found that the size of all the generated balls is below 0.015. What is the reason?In addition, there are the following warnings when generating the sphere: The size distribution has been scaled down, how to solve this?

Below is my MWS.

Jie

################################
import numpy as np
import math
import random
#Material
m = FrictMat(young=7.2e7,poisson=.2,density=2.5e3)
n = PolyhedraMat(young=7.2e7,poisson=.2,density=2.5e3)
O.materials.append((m,n))
#Dimensions
meanSize = 0.05
wallThickness = 0.5*meanSize
distanceToCentre = 0.05
lengthOfBase =0.25
heightOfBase = 0.6
#-------------------------------------------
#Make Cloud
sp=pack.SpherePack()
mn,mx=Vector3(-0.5*(lengthOfBase-wallThickness),0.5*meanSize,-0.5*(lengthOfBase-wallThickness)),Vector3(0.5*(lengthOfBase-wallThickness),1*heightOfBase,0.5*(lengthOfBase-wallThickness))
sp.makeCloud(mn,mx,psdSizes=[0.01,0.015,0.025],psdCumm=(0,0.5,1),num=1000)
O.bodies.append(t)
t=polyhedra_utils.polyhedra(material=n,size=(0.01,0.01,0.01),seed=1)
t.state.pos = center # sets polyhedron position according to sphere position
O.bodies.append(t)

#count numbers
countSPs=0
for b in O.bodies:
if isinstance(b.shape,Sphere):
countSPs=countSPs+1
print("number of PotentialBlocks = ", countSPs)
countPol=0
for b in O.bodies:
if isinstance(b.shape,Polyhedra):
countPol=countPol+1
print("number of Polyhedra = ", countPol)

v=qt.View()
v.ortho=True # I activate orthotropic projection, to make visual comparisons easier
O.saveTmp()

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2020-06-24
2020-06-24
 Jérôme Duriez (jduriez) said on 2020-06-24: #1

Hi,

If YADE warns you the size have been scaled down, maybe it's not surprising that you do not get the sizes you asked for ;-)

Reason is that you assigned altogether
- size of the cloud: mn and max attributes
- the number of the spheres
- their volume

And it was impossible for makeCloud to randomly insert that many spheres with these sizes in that volume, without the spheres touching each other.

Solution is to change your use of the function, eg enlarging the mn,max attributes defining the cloud "box".