# Are there any way to stop particles poping out of the box?

I want to use top box to press down the scattered particles until the particles all be compressed to the bottom of the box. Then, the particles and top box should stop when they firmly fit right at the bottom of the box

And here are some difficulty I have faced;
The particles don’t stop when they all pack at the bottom but rather pop out or break throughout of the box, the top box itself also go out of the wall.

And here is my question;
Are there any function key to make top box stop when the particles is tightly packed at the bottom of the box, how?
Are there any way to stop particles poping out of the box, how?

this is video :

This is my script :

# create rectangular box from boxes (maybe there is some library function, but I did not find it quickly)
cx,cy,cz = .5,.5,.5 # center of the box
dx,dy,dz = .5,.5,.5 # half-dimensions of the box
t = 0.025 # half-thickness of walls
topx,topy = 0.2, 0.3 # top box half-dimensions
left = box((cx-dx-2*t,cy,1.5*cz),(2*t,dy,1.5*dz),fixed=True,wire=True)
right = box((cx+dx+2*t,cy,1.5*cz),(2*t,dy,1.5*dz),fixed=True,wire=True)
front = box((cx,cy-dy-t,1.5*cz),(dx,t,1.5*dz),fixed=True,wire=True)
back = box((cx,cy+dy+t,1.5*cz),(dx,t,1.5*dz),fixed=True,wire=True)
bottom = box((cx,cy,cz-dz-5*t),(dx,dy,5*t),fixed=True,wire=True) #t

top = box((cx,cy,1.5*cz+1.5*dz+t),(dx,dy,t),fixed=True)
O.bodies.append((left,right,back,front,bottom,top))

sp=pack.SpherePack()
# generate randomly spheres with uniform radius distribution
sp.makeCloud((0,0,0),(1,1,1.5),rMean=.03,rRelFuzz=.01,num=100000,seed=10000)
# add the sphere pack to the simulation
sp.toSimulation()

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),

]
O.dt=.5*PWaveTimeStep()
top.state.vel=(0,0,-.5)

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2020-03-27
2020-03-28
 Jan Stránský (honzik) said on 2020-03-20: #1

Hi,

> Are there any function key to make top box stop when the particles is tightly packed at the bottom of the box, how?

there are several approaches, depending on your specific definition of what "tightly packed" is, e.g.:
- you know desired packing fraction (the resulting box volume), so you can a priori tell when to stop the top box
- based on unbalancedForce, kinetic energy, whatever.. checking it periodically and stop when the desired state is reached

To make the box step, just assign it zero velocity:
top.state.vel = Vector3.Zero

> Are there any way to stop particles poping out of the box, how?

- increase stiffness of the box (use another material for them)
- or stop it before it pushes particles away (see above)

cheers
Jan

 veerawat (suesan) said on 2020-03-27: #2

Dear jan ,

Before the particles pop out of all the box, the particles reach its compression peak point then pop out. I want to stop top box before the particles pop out, Do you have any idea how to stop top box?

 veerawat (suesan) said on 2020-03-27: #3

Dear jan,

so suppose I want compaction of the particles at it’s most tightest stage which volume equal to 1.0*1.0*1.0. How to do it ?

 Jan Stránský (honzik) said on 2020-03-28: #4

> Do you have any idea how to stop top box?

>> To make the box step, just assign it zero velocity:
>> top.state.vel = Vector3.Zero

> I want compaction ... at ... stage which volume equal to 1.0*1.0*1.0. How to do it ?

use e.g. PyRunner:
###
O.engines = [
...
PyRunner(iterPeriod=1,command="stopBoxIfCompacted()")
]
def stopBoxIfCompacted():
area = ...
height = ...
volume = area * height
if volume < 1.0*1.0*1.0:
top.state.vel = Vector3.Zero
O.pause() # ?
###

cheers
Jan