translate energy

Asked by hafsa

hello,
i wont to plot only translate kinetic energy of particles that why i used :

NewtonIntegrator(damping=0.2,gravity=(0,0,-1), label='newtonIntegr',kinSplit=True),

#energy kenetic
def plotAddData():
    plot.addData(i=O.iter,e=kineticEnergy()/n,**O.energy)
plot.plots={'i':['e']+O.energy.keys()}
plot.plot()

but i obtain kinetic energy translate+rotation
so what i must change to have only translate energy?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
hafsa
Solved:
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

Did you try asking for O.energy['kinTrans'] ?

Revision history for this message
hafsa (sebbah.hafsa) said :
#2

hi Jérôme
 do you mean i replace kineticEnergy() by O.energy['kinTrans'] ?

Revision history for this message
hafsa (sebbah.hafsa) said :
#3

i found it in this link [1] (line 57)but it still not clear how to use this command .

[1] https://github.com/yade/trunk/blob/master/pkg/dem/NewtonIntegrator.cpp

Revision history for this message
Jérôme Duriez (jduriez) said :
#4

> do you mean i replace kineticEnergy() by O.energy['kinTrans'] ?

Kinetic energy doc [*] does not make it clear this function does not suit your needs ? ;-)
I think O.energy['kinTrans'] (just another valid YADE command) will. Did you try ?

PS : github code repository is obsolete. If you're curious into current YADE, it's at https://gitlab.com/yade-dev/trunk. See e.g. https://yade-dem.org/doc/

[*] https://yade-dem.org/doc/yade.utils.html#yade._utils.kineticEnergy

Revision history for this message
hafsa (sebbah.hafsa) said :
#5

thank you Jérôme, i used definition of translate kinetic energy to solve this problem. the solution:

# translate energy kenetic
def plotAddData():
    TE=0
    for b in O.bodies:
        if isinstance(b.shape,Sphere):
            m=b.state.mass
            v=b.state.vel.norm()
            TE+=0.5*pow(v,2)
    plot.addData(i=O.iter,e=TE/n)
plot.plots={'i':['e']}
plot.plot(