← Back to team overview

yade-users team mailing list archive

Re: [Question #690104]: torque

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
> friction_force_cal = sum(O.forces.f(b) for b in cylinderIDS)
> torque_cal = sum(O.forces.t(b) for b in cylinderIDS)

python sum takes an initial value (default is 0, but does not work with vectors), so you can do:
###
friction_force_cal = sum((O.forces.f(b) for b in cylinderIDS), Vector3.Zero)
torque_cal = sum((O.forces.t(b) for b in cylinderIDS), Vector3.Zero)
###

if you sum torques "manually", do not forget to take into account forces
on bodies, otherwise it is different computation than utils.sumTorques
[1]

cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/-/blob/master/py/_utils.cpp#L207

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.