← Back to team overview

yade-users team mailing list archive

[Question #683160]: problem of pyRunner()

 

New question #683160 on Yade:
https://answers.launchpad.net/yade/+question/683160

hello
     i have defined a function named energysb() to culculate the linear kinetic energy of polyhedra and sphere seperately when the number of iterations is k*3000 , where k=1,2,3,...,  but it turn out to be that the calculation occured when the iter number more than 10000,i do not know where is wrong, can you give me some advice? 
below is part of my code:
   O.load('10-1.xml.bz2')
   O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Sphere_Aabb(),Bo1_Wall_Aabb()]),
    InteractionLoop(
        [Ig2_Polyhedra_Polyhedra_PolyhedraGeom(),Ig2_Sphere_Polyhedra_ScGeom(),Ig2_Wall_Polyhedra_PolyhedraGeom(),Ig2_Wall_Sphere_ScGeom(),Ig2_Sphere_Sphere_ScGeom()],
        [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(),Ip2_FrictMat_PolyhedraMat_FrictPhys(),Ip2_FrictMat_FrictMat_FrictPhys()],  
        [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]  
    ),
    # GravityEngine(gravity=(0,0,-9.81)),
    NewtonIntegrator(damping=0.5, gravity=(0, 0, -9.81)),
    
    PyRunner(command='changecolor()', realPeriod=15),
    PyRunner(command='checkUnbalanced()', realPeriod=15),
    qt.SnapshotEngine(fileBase='3d-',iterPeriod=10000,label='snapshot'),
    PyRunner(command='energysb()', realPeriod=3000),
]

def energysb():
    plke=0
    slke=0
    for b in O.bodies:
        if b.id>18:
            if isinstance(b.shape,Polyhedra):
                plke=plke+0.5*b.state.mass*b.state.vel.norm()*b.state.vel.norm()
            else:
                slke=slke+0.5*b.state.mass*b.state.vel.norm()*b.state.vel.norm()
    with open('spEnergyChange.txt','a') as text:
        text.write('%s\t'%serailsnumble)
        text.write('%s\t'%plke)
        text.write('%s\n'%slke)
by the way,there exist about 70000 sphere particles and 300 polyhedra particles in my simulation.

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