yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #28021
[Question #702411]: Calculation of a time averaging of a physical quantity
New question #702411 on Yade:
https://answers.launchpad.net/yade/+question/702411
Hello everyone,
I would like to calculate a time averaging of a physical quantity in yade (the average of the velocity of a group of particles made over a period of rotation of the drum).
Below is a part of my code that allows me to calculate the average velocity of several groups of particles, but this average is at a given time. What I would like is the average made over one revolution. Any suggestion will be appreciated.
Part of my code:
for i in range(0,19):
teta0=i*dteta
global listcase
listcase=[]
#global listcase
for b in O.bodies:
if isinstance(b.shape,Sphere):
rayon=sqrt((b.state.pos[0])**2 +(b.state.pos[1])**2)
dr=d
teta=atan(b.state.pos[1]/b.state.pos[0])
if (b.state.pos[1]>0 and b.state.pos[0]<0) or (b.state.pos[1]<0 and b.state.pos[0]<0):
teta=pi-teta
if (b.state.pos[1]<0 and b.state.pos[0]>0):
teta=2*pi+teta
if (rayon<rcylint+dr and rayon>rcylint) and (teta>teta0 and teta<teta0+dteta):
c=b.id
listcase.append(c)
veltot=0
for im in listcase:
b = O.bodies[im]
veltot = veltot + O.bodies[im].state.vel.norm()
if len(listcase)!=0:
velmoy = veltot/len(listcase)
else:
velmoy = 0
print('len(listcase)=',len(listcase))
print('teta0=',teta0)
print('velmoy=',velmoy)
Thanks.
pegbehe
--
You received this question notification because your team yade-users is
an answer contact for Yade.