← Back to team overview

yade-users team mailing list archive

Re: [Question #705005]: problem of erasing particle

 

Question #705005 on Yade changed:
https://answers.launchpad.net/yade/+question/705005

Guo, Chang posted a new comment:
Yes. You are right.
Actually, this is a simplified code. Now I know the reason. If I use the periodic boundary, there is an error.

WidthX=0.7 # box width
HeightZ=0.7 # box height, not soil sample's
LengthY=0.25 # pipe length
################## set periodic cell ##################
# O.periodic = True
# O.cell.hSize=Matrix3(WidthX,0,0,0,LengthY,0,0,0,HeightZ)
def deletParticle():
    for bid in ParID:
        x=O.bodies[bid].state.pos[0]
        if  (0.2<x<0.3):
            O.bodies.erase(bid)
            ParID.remove(bid)
            print(f'Particle {bid} is deleted.')


sp=pack.SpherePack()
sp.makeCloud([0,0,0],[0.5,0.5,0.5],num=10000)
ParID=[]
for c,r in sp:
    ParID.append(O.bodies.append(sphere(c,r)))

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()]
    ),
    GlobalStiffnessTimeStepper(),
    NewtonIntegrator(),

    PyRunner(command='deletParticle()', firstIterRun=200),

]


O.run()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.