# yade-users team mailing list archive

## [Question #678425]: kenetic Energy of particles

 Thread Previous • Date Previous • Date Next • Thread Next

```New question #678425 on Yade:

hi everyone ,
i wrote code about falling spheres in cylinder and now i want to know  the average kinetic energy of all spheres .
this is what i obtain :

AttributeError                            Traceback (most recent call last)

41    for b in O.bodies:
42       if (type(b.shape)==Sphere):
---> 43          Ek = b. O.energy['kinetic']
45

AttributeError: 'Body' object has no attribute 'O'
In [1]: exit

my code is :
from yade import pack,plot

#material of cylinder
Mat1 = O.materials.append(ViscElMat(kn=10.0e4,ks=10.0e4,frictionAngle=0.455,density=2650.0))

# create the big sphere
big_sphr=O.bodies.append(utils.sphere((0,0,.3),1.,fixed=False,color=(1,0,0),highlight=True))

# create sphere packing
sp=pack.SpherePack()
sp.makeCloud((-7.2,-7.2,1.),(7.2,7.2,58.7),rMean=.5,rRelFuzz=0,num=6000)
sp.toSimulation(color=(0,1,0))

# create Cylinder

# interactions
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.3),
]

O.dt=utils.PWaveTimeStep()
O.saveTmp()

#energy kenetic
O.trackEnergy=True

for b in O.bodies:
if (type(b.shape)==Sphere):
Ek = b. O.energy['kinetic']

plot.plots={'time':('energy')}
plot.plot()

any suggestions ? thank's in advance.
cordially
Any suggestions ?

--