Trouble in generating sphere packing

Asked by Huan

Hello,

I'm trying to create a random sphere packing that consists of roughly 21,182 particles for Marshall hot mix design simulation.
I am trying to generate:
28 particles of aggregates size (0.0125<=x<0.019)
86 particles of aggregates size (0.0095<=x<0.0125)
2,071 particles of aggregates size (0.000475<=x<0.0095)
18,997 particles of aggregates size (0.00236<=x<0.00475)
I want to create it randomly to the following code, but I was only able to generate it in layer per layer by using makeCloud.

import random
import math
from yade import geom, pack, utils, plot, ymport

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
diameter = 0.102
height = 0.064

# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = geom.facetCylinder(center=center, radius=diameter/2, height=height, segmentsNumber=80, wallMask=6)

# assign material to each body in the cylinder
for body in cylinder:
    body.bodyMat = material

# add cylinder to simulation
O.bodies.append(cylinder)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.2
dOutput = 0.102
hBunker = 0
hOutput = 0.08
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

# assign material to each body in the funnel
for body in funnel:
    body.bodyMat = material

# add funnel to simulation
O.bodies.append(funnel)

Thank you,
Huan

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Karol Brzezinski
Solved:
Last query:
Last reply:

This question was reopened

  • by Huan
Revision history for this message
Karol Brzezinski (kbrzezinski) said (last edit ):
#1

Hi Huan,

The good news is that you can call makeCloud() multiple times with different radii and new spheres are added to the SpherePack.

Cheers,
Karol

import random
import math
from yade import geom, pack, utils, plot, ymport

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
diameter = 0.102
height = 0.064

# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = geom.facetCylinder(center=center, radius=diameter/2, height=height, segmentsNumber=80, wallMask=6)

# assign material to each body in the cylinder
for body in cylinder:
    body.bodyMat = material

# add cylinder to simulation
O.bodies.append(cylinder)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.2
dOutput = 0.102
hBunker = 0
hOutput = 0.08
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

# assign material to each body in the funnel
for body in funnel:
    body.bodyMat = material

# add funnel to simulation
O.bodies.append(funnel)

###### new part
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 28

# (other sizes) ....

rMean4 = (0.00475+0.00236)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 18997

sp = pack.SpherePack()
## just call makeCloud() multiple times before sending to simulation
sp.makeCloud((-dBunker/3,-dBunker/3,2*height),(dBunker/3,dBunker/3,10*height), rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
#(...)
sp.makeCloud((-dBunker/3,-dBunker/3,2*height),(dBunker/3,dBunker/3,10*height), rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)
sp.toSimulation()

Revision history for this message
Huan (huan-liu) said :
#2
Revision history for this message
Huan (huan-liu) said :
#3
Revision history for this message
Huan (huan-liu) said :
#4

Thanks Karol Brzezinski, that solved my question.

Revision history for this message
Huan (huan-liu) said :
#5

Thanks Karol, that solve my problem.

# set color for sphere
for body in O.bodies:
   if not isinstance(body.shape, Sphere):
       continue
   if body.shape.radius == rMean1: #SP1
       body.shape.color = (0,0,1) #blue
   if body.shape.radius == rMean2: #SP1
       body.shape.color = (1,0,0) #red
   if body.shape.radius == rMean3: #SP2
       body.shape.color = (0,1,0) #green
   if body.shape.radius == rMean4: #SP3
       body.shape.color = (1,1,1) #white
I try this to create color for the spheres, but it doesn't seems to work. Any idea?

Also, I would like to use oedometric test on the simulation. My question is how would I know the load that I should use?

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

Hello,

> Also, I would like to use oedometric test on the simulation. My question is how would I know the load that I should use?

plese open a new question for a new question ([1], point 5)

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
Best Karol Brzezinski (kbrzezinski) said :
#7

Hi Huan,

For each radius, I prescribed some 'spread', so the radii of particles fall between given sieve sizes (rRelFuzz1 = (0.019-0.0125)/4/rMean1).

If you want to have all the particles in a given size to have equal radius, set rRelFuzz = 0 everywhere. In such a case, your colouring method should work.

As Jan said, please open a new topic for the new question.

Cheers,
Karol

Revision history for this message
Huan (huan-liu) said :
#8

Thanks Karol Brzezinski, that solved my question.