yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #22494
Re: [Question #689234]: How to export relative velocity of spheres to Paraview
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234
Status: Open => Answered
Jan Stránský proposed the following answer:
> Can I get the formula for relative velocity [1] somewhere in Yade? Or
I have to define one by myself?
AFAIK you have to write it yourself..
you can write a function to it and call the function in exportInteractions / exportContactPoints, but as the commands are evaluated only locally, you have to "make the function global", e.g. using __builtin__ module (be very careful with this workaround not to overwrite some python basics, e.g. list etc.):
###
def relativeVelocity(interaction):
i1,i2 = interaction.id1, interaction.id2
b1,b2 = [O.bodies[i] for i in (i1,i2)]
r1,r2 = [b.shape.radius for b in (b1,b2)]
v1,v2 = [b.state.vel for b in (b1,b2)]
... # actual code comes here
return relativeVelocity
import __builtin__ # or buitlins (2ithout underscores) in Python3
__builtin__.relativeVelocity = relativeVelocity
vtk.exportInteractions(what=..."relativeVelocity(i)"...) # now you can use relativeVelocity inside exportInteractions
###
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.