← Back to team overview

yade-users team mailing list archive

Re: [Question #685862]: About transverse strain

 

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

AnnaMaria posted a new comment:
Hi Jan,
I think I am getting close
2) I Changed the script as follows:
After creating the packing:
I added the following:
#sp.toSimulation()
def lateral():
   global elat
   global d
   global dnew
   for p in O.bodies:
    x=p.state.refPos[0]
    z=p.state.refPos[2]
    d=sqrt(pow(x,2)+pow(z,2))
    if d>r1 and d<r2:
     p.shape.color=(1,1,1)
     xnew=p.state.pos[0]
     znew=p.state.pos[2]
     dnew=sqrt(pow(xnew,2)+pow(znew,2))
     elat=(d-dnew)/d
     return elat

and then:
def recorder():
 lateral()
yade.plot.addData({'i':O.iter,'eps':abs(strainer.strain),'elat':(elat),'sigma':abs(strainer.avgStress)})
 
as you said.
The thing is that the function above does not seem to work correct. The spheres have the same color, while before they were white (color=(1,1,1)). Maybe the distance measurement is not working as well.
Also what do you mean:
3) furthermore, d and dnew are just values form the last single body.
You want probably some average (maybe wighted?) of the values.
Like this: elat=(avg(d)-avg(dnew))/avg(d)

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