Sphere packing location
Hello,
I create two python script.
1. Sphere Packing Position Saving
2. Importing the sphere packing from 1. to do gravity deposition
>>The Problem I encounter is that I try to move the ( zi = minz + l * gridsize ) lower by dividing it by 8. However, after I import the postion in 2nd python script the sphere packing burst out which I am confuse on what is making them burst apart.
### SCRIPT 1 ###
import random
import math
from yade import geom, pack, utils, plot, ymport, export
import numpy as np
# Define cylinder with funnel parameters
center = (0, 0, 0)
diameter = 0.102
height = 0.18
# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = geom.facetCylin
# add cylinder to simulation
O.bodies.
# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0
# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunke
# add funnel to simulation
O.bodies.
def makeRandomBlock
bunkerLimit = diameter/2
#
# Make grid blocks inside a bunker
#
grid = np.arange(
inGrid = []
for yi in grid:
for xi in grid:
c = [[xi, yi], [xi+gridsize, yi], [xi+gridsize, yi+gridsize], [xi, yi+gridsize]]
#
# Check if the block corners are outside of the bunker or not
#
out = False
for p in c:
r = (p[0]**2 + p[1]**2)**0.5
if r > bunkerLimit:
#
# If the block is inside the bunker, keep it
#
if not out:
layer = math.ceil(numblocks / len(inGrid))
blocks = []
for l in range(layer):
for g in inGrid:
zi = minz + l*gridsize
p1 = g[0].copy()
p2 = g[2].copy()
random.
return blocks
minZ = 2.35
dbunker = 0.4
gridSize = dbunker/8
numblocks = 51
blockList = makeRandomBlock
for i in range(numblocks):
print("Making cloud block", i+1, "/", numblocks)
corner = blockList.pop()
sp = pack.SpherePack()
# 15.75 mm 13 particles
if (i < 13):
n1 = sp.makeCloud(
# 11 mm 51 particles
n2 = sp.makeCloud(
# 7.125 mm 51x11 = 561 particles
n3 = sp.makeCloud(
# 3.555 mm 51x100 = 5,100 particles
n4 = sp.makeCloud(
# 1.77 mm 51x360 = 18,360 particles
n5 = sp.makeCloud(
# 0.6 mm 51x19000 = 969,000 particles
n6 = sp.makeCloud(
# 0.3 mm 51x78510 = 4,004,010 particles
n7 = sp.makeCloud(
sp.
export.
#######
### Script 2 ###
import random
import math
from yade import geom, pack, utils, plot, ymport, export
import numpy as np
# Define cylinder with funnel parameters
center = (0, 0, 0)
diameter = 0.102
height = 0.18
# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = geom.facetCylin
# add cylinder to simulation
O.bodies.
# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0
# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunke
# add funnel to simulation
O.bodies.
# add sphere packing
O.bodies.
# materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 2700, label = 'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 1060, frictionAngle = radians(40), normalCohesion = 2e5, shearCohesion = 2e5, label = 'asphalt_binder')
# add properties
O.materials.
O.materials.
# give color and properties to shpere
for body in O.bodies:
if not isinstance(
continue
if body.shape.radius == 0.01575/2 :
if body.shape.radius == 0.011/2:
if body.shape.radius == 0.007125/2:
if body.shape.radius == 0.003555/2:
if body.shape.radius == 0.00177/2 :
if body.shape.radius == 0.0006/2 :
if body.shape.radius == 0.0003/2 :
O.engines = [
# handle sphere+sphere and facet+sphere collisions
),
# call the checkUnbalanced function (defined below) every 2 seconds
# call the addPlotData function every 200 steps
]
O.dt = .5 * PWaveTimeStep()
# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy[
O.trackEnergy = True
# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
if unbalancedForce() < .05:
O.pause()
plot.
# plot.saveGnuplo
# collect history of data which will be plotted
def addPlotData():
# each item is given a names, by which it can be the unsed in plot.plots
# the **O.energy converts dictionary-like O.energy to plot.addData arguments
plot.addData(
# define how to plot data: 'i' (step number) on the x-axis, unbalanced force
# on the left y-axis, all energies on the right y-axis
# (O.energy.keys is function which will be called to get all defined energies)
# None separates left and right y-axis
plot.plots = {'i': ('unbalanced', None, O.energy.keys)}
# show the plot on the screen, and update while the simulation runs
plot.plot()
O.saveTmp()
#######
Question information
- Language:
- English Edit question
- Status:
- Open
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
This question was reopened
- by Huan
Can you help with this problem?
Provide an answer of your own, or ask Huan for more information if necessary.