← Back to team overview

yade-users team mailing list archive

Re: [Question #249243]: Tracking variables

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hi Luis

> I used:  PyRunner(command="AddData",iterPeriod=5)
>                      from yade import plot
>                      def myAddData():
>                      b=O.bodies[1]
>                      plot.addData(z1=b.state.pos[2],
v1=b.state.vel.norm(), i=O.iter, t=O.time) #OK, this worked!
>
> But I don`t know if I must use a different kind of command for each
variable and how to use correctly the def.
> I`m trying to print or plot normalForce,  cohesion... in each interaction
to get some output data, but the error of: name 'command' is not difined,
always appears.
>

You defined a function "myAddData", so you should call it in the
PyRunner:

def myAddData():
  # your definition

O.engines = [
  ...
  PyRunner(iterPeriod=5, command="myAddData()"),
  ...
]

HTH
Jan

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