← 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

Jan Stránský requested more information:
> This method doesn't work. The simulation will stop .

please be more specific [1]

Just in case, a complete MWE below. When I run it, I have no problem.
After 200 steps, I got bunch of "Particle XXXX is deleted." messages is printed in terminal.
In 3D view I see most of particles from middle plane deleted.

###
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()
###

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

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