← Back to team overview

yade-users team mailing list archive

Re: [Question #691702]: About periodic simple shear example in the yade documentation

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> 1...

yes

> 2.... Why in line 87 (b.state.angVel=(0,0,0)) still set the angle
velocity to be 0? Isn't it blocking X,Y,Z rotations of spheres
equivalent to the angle velocity being 0?

setting state.blockedDOFs does NOT modify state.vel or state.angVel.
It blocks the degree of freedom from being influenced by interactions and the value of state.vel or state.angVel are actually preserved (with current value).

> 3.What's the meaning of "if stress[2,2]!=0 else 0" in line 112?

this is "python inline if-else" [1]
tanPhi = (stress[0,2]/stress[2,2]) if stress[2,2] != 0 else 0
could be rewritten as
###
if stress[2,2] != 0:
   tanPhi=(stress[0,2]/stress[2,2])
else:
  tanPhi = 0
###
Why it used here:
- it is shorter
- the longer way could not be used in plot.addData function

> 4....

see point 2

cheers
Jan

[1] https://docs.python.org/3/faq/programming.html?highlight=ternary#is-
there-an-equivalent-of-c-s-ternary-operator

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