← Back to team overview

yade-users team mailing list archive

Re: [Question #218848]: momentum

 

Question #218848 on Yade changed:
https://answers.launchpad.net/yade/+question/218848

    Status: Answered => Open

Riccardo carta is still having a problem:
HI Christian, I tried something like this

def Momentum():
	qdmx=0
	qdmy=0
	qdmz=0
	for j in range(0,len(sp2)):
		qdmz=qdmz+(O.bodies[j].state.vel[2]*O.bodies[j].state.mass)
		qdmx=qdmx+(O.bodies[j].state.vel[0]*O.bodies[j].state.mass)
		qdmy=qdmy+(O.bodies[j].state.vel[1]*O.bodies[j].state.mass)
	plot.addData(tm=O.time, momentumz=qdmz, momentumx=qdmx, momentumy=qdmy)
	plot.saveDataTxt('momentum.txt',vars=('tm','momentumx','momentumy','momentumz'))

#then into O.engine

O.engines=[
	...
	PyRunner(iterPeriod=1680936,command='Momentum()')
]

#calling it only at half simulation because I think that the "for" cycle inside the defined function takes a lot of time to run
(however this try have gone bad..)

I hoped to avoid this using the .vtu files
What do you think?

Thanks

Riccardo

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.