# yade-users team mailing list archive

## [Question #689408]: Are there any way to stop particles poping out of the box?

```New question #689408 on Yade:

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)

--