# yade-users team mailing list archive

## [Question #670078]: Dense packing with given distribution of radii

```New question #670078 on Yade:

Hi all,

I want to create a spherical dense packing of spheres, where the radii of the spheres are given by a Gaussian distribution. Since I want to assign the radii myself, I have seen on some questions (https://answers.launchpad.net/yade/+question/406741) that filterSpherePack should be the way to go. But I am unsure how I can make my spherePack dense after filling the predicate? In the question linked above it seems as I could do it using an isotropic compression, but when I try that all my spheres "explode". And since my body of spheres is also spherical, it seems to me that a compression from 6 different planes will only distort my sphere.

that it is suggested to change the source code for spherePack, how can this be done?

I am new with Yade so I greatly appreciate any help!

Cheers, Olav

Below is my script for creating the spherical loose-packed body using filterSpherePack:

import numpy as np
## Creating a body of spheres of varying radii

# Using numpy to generate a Gaussian distribution of sphere diameters
mu, sigma=20,2  #mean and standard deviation
numParticles=1000
d=np.random.normal(mu,sigma,numParticles) #diameter array

#Sorting the diameters
psdSizes=sorted(d)
#psdCumm=np.arange(1/numParticles,1+1/numParticles,1/numParticles)
#Creating a vector of accumulated factors of the particles
#Here we have one particle assigned to each radius
psdCumm=np.arange(0.001,1+0.001,0.001)

## making cloud of spheres to insert into predicate
sp=pack.SpherePack()
#giving the spheres a radius assigned by Normal distribution
sp.makeCloud((0,0,0),(200,200,200),psdSizes=psdSizes,psdCumm=psdCumm
,num=numParticles,porosity=0.2)

## constructing predicate

## packing predicate with loosely packed spheres
spheres=pack.filterSpherePack(pred,sp)