yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #19043
Re: [Question #678646]: tracking a particle
Question #678646 on Yade changed:
https://answers.launchpad.net/yade/+question/678646
Status: Open => Answered
Jan Stránský proposed the following answer:
Hello,
there are several options. E.g. storing the position by PyRunner.
You can store the values in separate variable or using plot module [1]
A MWE:
###
from yade import plot
O.bodies.append(sphere((0,0,0),1))
O.engines = [
ForceResetter(),
NewtonIntegrator(gravity=(0,0,-10)),
PyRunner(iterPeriod=10,command="trackParticle()"),
]
def trackParticle():
b = O.bodies[0]
pos = b.state.pos
plot.addData(i=O.iter,pos=pos)
O.dt = 1e-2
O.run(100,True)
print plot.data["pos_z"]
###
cheers
Jan
[1] https://yade-dev.gitlab.io/trunk/user.html#tracking-variables
--
You received this question notification because your team yade-users is
an answer contact for Yade.