Particles fall out the container
import random
import math
from yade import geom, pack, utils, ymport
from yade import export
import numpy as np
# Define cylinder parameters
center = (0, 0, 0)
radius = 0.102
height = 0.064
# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = yade.geom.
# define material properties
mat = PolyhedraMat()
mat.density = 2600 # kg/m^3
mat.young = 1E6 # Pa
mat.poisson = 20000 / 1E6
mat.frictionAngle = 0.6 # rad
# assign material to each body in the cylinder
for body in cylinder:
body.bodyMat = mat
# add cylinder to simulation
O.bodies.
# Generate sphere pack
O.materials.
sp = pack.SpherePack()
sp.makeCloud(
sp2_1 = pack.SpherePack()
sp2_1.makeCloud
sp2_2 = pack.SpherePack()
sp2_2.makeCloud
sp2_3 = pack.SpherePack()
sp2_3.makeCloud
sp3_1 = pack.SpherePack()
sp3_1.makeCloud
sp3_2 = pack.SpherePack()
sp3_2.makeCloud
sp3_3 = pack.SpherePack()
sp3_3.makeCloud
sp4_1 = pack.SpherePack()
sp4_1.makeCloud
sp4_2 = pack.SpherePack()
sp4_2.makeCloud
sp4_3 = pack.SpherePack()
sp4_3.makeCloud
sp5_1 = pack.SpherePack()
sp5_1.makeCloud
sp5_2 = pack.SpherePack()
sp5_2.makeCloud
sp5_3 = pack.SpherePack()
sp5_3.makeCloud
sp6_1 = pack.SpherePack()
sp6_1.makeCloud
sp6_2 = pack.SpherePack()
sp6_2.makeCloud
sp6_3 = pack.SpherePack()
sp6_3.makeCloud
sp7_1 = pack.SpherePack()
sp7_1.makeCloud
sp7_2 = pack.SpherePack()
sp7_2.makeCloud
sp7_3 = pack.SpherePack()
sp7_3.makeCloud
sp8_1 = pack.SpherePack()
sp8_1.makeCloud
sp8_2 = pack.SpherePack()
sp8_2.makeCloud
sp8_3 = pack.SpherePack()
sp8_3.makeCloud
sp9 = pack.SpherePack()
sp9.makeCloud(
sp10 = pack.SpherePack()
sp10.makeCloud(
# add the sphere pack to the simulation
sp.toSimulation
sp2_1.toSimulat
sp2_2.toSimulat
sp2_3.toSimulat
sp3_1.toSimulat
sp3_2.toSimulat
sp3_3.toSimulat
sp4_1.toSimulat
sp4_2.toSimulat
sp4_3.toSimulat
sp5_1.toSimulat
sp5_2.toSimulat
sp5_3.toSimulat
sp6_1.toSimulat
sp6_2.toSimulat
sp6_3.toSimulat
sp7_1.toSimulat
sp7_2.toSimulat
sp7_3.toSimulat
sp8_1.toSimulat
sp8_2.toSimulat
sp8_3.toSimulat
sp9.toSimulatio
sp10.toSimulati
# Define gravity engine
O.engines = [ ForceResetter(), InsertionSortCo
InteractionLoop(
),
GlobalStiffn
NewtonIntegr
]
# Define simulation duration and time step
O.dt = 0.5e-6
O.run(10, wait=True)
for body in O.bodies:
if not isinstance(
continue
if body.shape.radius == 0.01575: #SP
if body.shape.radius == 0.01175 :
if body.shape.radius == 0.011 :
if body.shape.radius == 0.01025 :
if body.shape.radius == 0.00831250 : #SP3
if body.shape.radius == 0.007125 :
if body.shape.radius == 0.0059375 :
if body.shape.radius == 0.0041525: #SP4
if body.shape.radius == 0.003555 :
if body.shape.radius == 0.0029575 :
if body.shape.radius == 0.002065: #SP5
if body.shape.radius == 0.00177 :
if body.shape.radius == 0.001475 :
if body.shape.radius == 0.001035: #SP6
if body.shape.radius == 0.00089 :
if body.shape.radius == 0.000745 :
if body.shape.radius == 0.000525: #SP7
if body.shape.radius == 0.00045 :
if body.shape.radius == 0.000375 :
if body.shape.radius == 0.0002625: #SP8
if body.shape.radius == 0.000225 :
if body.shape.radius == 0.0001875 :
if body.shape.radius == 0.000075: #SP9
if body.shape.radius == 0.00005: #SP10
def checkUnbalanced():
if unbalancedForce() < .05:
O.pause()
plot.
# plot.saveGnuplo
# Count the number of spheres in the cylinder
num_spheres_
for body in O.bodies:
if body.id == 0: # skip the cylinder
continue
sphere_center = body.state.pos
dist_to_axis = math.sqrt(
if dist_to_axis <= radius and sphere_center[2] >= center[2] and sphere_center[2] <= center[2] + height:
# Calculate volume of spheres in cylinder
volume_
for body in O.bodies:
sphere_center = body.state.pos
dist_to_axis = math.sqrt(
if dist_to_axis <= radius and sphere_center[2] >= center[2] and sphere_center[2] <= center[2] + height:
if isinstance(
# Calculate volume of cylinder
volume_of_cylinder = (math.pi * radius**2) * height
# Calculate porosity
porosity = (volume_of_cylinder - volume_
porosity_percent = porosity * 100
# Print results
print("Number of spheres in cylinder:", num_spheres_
print("Volume of spheres in cylinder:", volume_
print("Volume of cylinder:", volume_of_cylinder)
print("Porosity:", porosity)
print("Porosity:", porosity_percent, "%")
When I try to simulate I don't understand why the particles fall under the container?
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Lassakorn Eawsakul for more information if necessary.