Problem with angular velocity

Asked by Jonathan Pergoli

Hi everybody!

I'm trying to set an initial value of the angular velocity for a body. I set the angular velocity:

body=utils.polyhedron((v1,v2,v3,v4,v5,v6,v7,v8),fixed=False,color=(.6,.45,0),material="mat",wire=False)
body.state.angVel=(0,0,0.1)
wx=body.state.angVel[0]
wy=body.state.angVel[1]
wz=body.state.angVel[2]

Then when I start yadedaily at the beginning of the simulation the angular velocity is correct but when I write O.run() I don't know why the angular velocity is set to (0,0,0). This happen when I use yadedaily for ubuntu server 14.04 LTS whereas when I run the simulation with ubuntu 14.04 on my laptop it works well and this problem is not present. Any solutions?

Thank you in advance,

Jonathan

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hi Jonathan,

please provide a working script, i.e. with definitions of v1-v8, MLI etc.
such that we can try what does not work.

do you use the same versions of yadedaily on both machines?

do you use the same script on both machines (not like polyhedron on one and
sphere on the other)?

meanwhile try to set angMom instead of angVel for non-spherical shapes.

cheers
Jan

2016-09-21 17:53 GMT+02:00 Jonathan Pergoli <
<email address hidden>>:

> New question #401682 on Yade:
> https://answers.launchpad.net/yade/+question/401682
>
> Hi everybody!
>
> I'm trying to set an initial value of the angular velocity for a body. I
> set the angular velocity:
> body.state.angVel=(0,0,0.1)
>
> Then when I start yadedaily at the beginning of the simulation the angular
> velocity is correct but when I write O.run() I don't know why the angular
> velocity is set to (0,0,0). This happen when I use yadedaily for ubuntu
> server 14.04 LTS whereas when I run the simulation with ubuntu 14.04 on my
> laptop it works well and this problem is not present. Any solutions?
>
> Thank you in advance,
>
> Jonathan
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Jonathan Pergoli (j812p89) said :
#2

Hi Jan,

sorry I will provide the working script:

E1=1e+8
E2=5e+7
mat=FrictMat(density=643,frictionAngle=0.1489,label="MLI",young=E2)
MLI=O.materials.append(mat)
a=.2754
b=.2822
c=.1963
aa=a/2
bb=b/2
cc=c/2
h=.65
dist=0
theta=0
thetav=0
v1=(aa,bb,c)
v2=(aa,-bb,c)
v3=(-aa,-bb,c)
v4=(-aa,bb,c)
v5=(aa,bb,0)
v6=(aa,-bb,0)
v7=(-aa,-bb,0)
v8=(-aa,bb,0)
V=[v1,v2,v3,v4,v5,v6,v7,v8]
vz=.19
R=[[m.cos(theta),0,m.sin(theta)],[0,1,0],[-m.sin(theta),0,m.cos(theta)]]
v1=(R[0][0]*V[0][0]+R[0][1]*V[0][1]+R[0][2]*V[0][2],R[1][0]*V[0][0]+R[1][1]*V[0][1]+R[1][2]*V[0][2],R[2][0]*V[0][0]+R[2][1]*V[0][1]+R[2][2]*V[0][2])
v2=(R[0][0]*V[1][0]+R[0][1]*V[1][1]+R[0][2]*V[1][2],R[1][0]*V[1][0]+R[1][1]*V[1][1]+R[1][2]*V[1][2],R[2][0]*V[1][0]+R[2][1]*V[1][1]+R[2][2]*V[1][2])
v3=(R[0][0]*V[2][0]+R[0][1]*V[2][1]+R[0][2]*V[2][2],R[1][0]*V[2][0]+R[1][1]*V[2][1]+R[1][2]*V[2][2],R[2][0]*V[2][0]+R[2][1]*V[2][1]+R[2][2]*V[2][2])
v4=(R[0][0]*V[3][0]+R[0][1]*V[3][1]+R[0][2]*V[3][2],R[1][0]*V[3][0]+R[1][1]*V[3][1]+R[1][2]*V[3][2],R[2][0]*V[3][0]+R[2][1]*V[3][1]+R[2][2]*V[3][2])
v5=(R[0][0]*V[4][0]+R[0][1]*V[4][1]+R[0][2]*V[4][2],R[1][0]*V[4][0]+R[1][1]*V[4][1]+R[1][2]*V[4][2],R[2][0]*V[4][0]+R[2][1]*V[4][1]+R[2][2]*V[4][2])
v6=(R[0][0]*V[5][0]+R[0][1]*V[5][1]+R[0][2]*V[5][2],R[1][0]*V[5][0]+R[1][1]*V[5][1]+R[1][2]*V[5][2],R[2][0]*V[5][0]+R[2][1]*V[5][1]+R[2][2]*V[5][2])
v7=(R[0][0]*V[6][0]+R[0][1]*V[6][1]+R[0][2]*V[6][2],R[1][0]*V[6][0]+R[1][1]*V[6][1]+R[1][2]*V[6][2],R[2][0]*V[6][0]+R[2][1]*V[6][1]+R[2][2]*V[6][2])
v8=(R[0][0]*V[7][0]+R[0][1]*V[7][1]+R[0][2]*V[7][2],R[1][0]*V[7][0]+R[1][1]*V[7][1]+R[1][2]*V[7][2],R[2][0]*V[7][0]+R[2][1]*V[7][1]+R[2][2]*V[7][2])
body=utils.polyhedron((v1,v2,v3,v4,v5,v6,v7,v8),fixed=False,color=(.6,.45,0),material="MLI",wire=False)
body.state.angVel=(0,0,0.1)
r=m.sqrt(aa**2+bb**2)
Rj=m.sqrt(r**2+cc**2)
Ri=0.05
Rr=Rj*Ri/(Rj+Ri)
mu_rM=0.05
mu_rG=1.08
KN=E1*2*Ri*E1*2*Ri/(E1*2*Ri+E1*2*Ri)
KR=3*Ri**2*mu_rG**2*KN/4

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Polyhedra_Aabb()]),
 InteractionLoop(
  [Ip2_FrictMat_FrictMat_MindlinPhys(en=.45,es=.45,krot=KR,frictAngle=.7853)],
  [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
 ),
 NewtonIntegrator(gravity=(0,0,-2.5e-4),damping=0),
]

The script is the same and also the version of yadedaily.

I'll try with angMom.

Thank you,

Jonathan

Revision history for this message
Jan Stránský (honzik) said :
#3

Hi Jonathan,
next time please try the script that it really works ;-) and please doulble
check if both scripts are exactly the same for the two versions (especially
O.bodies.append, see below)

To get some effect, you should use O.bodies.append(body) so that the
engines know about the particle. Do you use it in your scripts or not?

If you don't add body to O.bodies, than angVel does not change (but the
body does not move at the same time, because Yade engines do not know about
the particle)

With O.bodies.append(body), angVel is reset after O.step(), which is
expected (see e.g. [1] and links from there). Setting angMom is the
solution. The relation is angMom = inertiaTensor*angVel (similar to
momentum=mass*velocity). If this works for you, it should not be a problem
to correctly define inertiaTensor.

cheers
Jan

[1] https://answers.launchpad.net/yade/+question/274324

2016-09-22 12:57 GMT+02:00 Jonathan Pergoli <
<email address hidden>>:

> Question #401682 on Yade changed:
> https://answers.launchpad.net/yade/+question/401682
>
> Jonathan Pergoli posted a new comment:
> Hi Jan,
>
> sorry I will provide the working script:
>
> E1=1e+8
> E2=5e+7
> mat=FrictMat(density=643,frictionAngle=0.1489,label="MLI",young=E2)
> MLI=O.materials.append(mat)
> a=.2754
> b=.2822
> c=.1963
> aa=a/2
> bb=b/2
> cc=c/2
> h=.65
> dist=0
> theta=0
> thetav=0
> v1=(aa,bb,c)
> v2=(aa,-bb,c)
> v3=(-aa,-bb,c)
> v4=(-aa,bb,c)
> v5=(aa,bb,0)
> v6=(aa,-bb,0)
> v7=(-aa,-bb,0)
> v8=(-aa,bb,0)
> V=[v1,v2,v3,v4,v5,v6,v7,v8]
> vz=.19
> R=[[m.cos(theta),0,m.sin(theta)],[0,1,0],[-m.sin(theta),0,m.cos(theta)]]
> v1=(R[0][0]*V[0][0]+R[0][1]*V[0][1]+R[0][2]*V[0][2],R[1][0]*
> V[0][0]+R[1][1]*V[0][1]+R[1][2]*V[0][2],R[2][0]*V[0][0]+R[
> 2][1]*V[0][1]+R[2][2]*V[0][2])
> v2=(R[0][0]*V[1][0]+R[0][1]*V[1][1]+R[0][2]*V[1][2],R[1][0]*
> V[1][0]+R[1][1]*V[1][1]+R[1][2]*V[1][2],R[2][0]*V[1][0]+R[
> 2][1]*V[1][1]+R[2][2]*V[1][2])
> v3=(R[0][0]*V[2][0]+R[0][1]*V[2][1]+R[0][2]*V[2][2],R[1][0]*
> V[2][0]+R[1][1]*V[2][1]+R[1][2]*V[2][2],R[2][0]*V[2][0]+R[
> 2][1]*V[2][1]+R[2][2]*V[2][2])
> v4=(R[0][0]*V[3][0]+R[0][1]*V[3][1]+R[0][2]*V[3][2],R[1][0]*
> V[3][0]+R[1][1]*V[3][1]+R[1][2]*V[3][2],R[2][0]*V[3][0]+R[
> 2][1]*V[3][1]+R[2][2]*V[3][2])
> v5=(R[0][0]*V[4][0]+R[0][1]*V[4][1]+R[0][2]*V[4][2],R[1][0]*
> V[4][0]+R[1][1]*V[4][1]+R[1][2]*V[4][2],R[2][0]*V[4][0]+R[
> 2][1]*V[4][1]+R[2][2]*V[4][2])
> v6=(R[0][0]*V[5][0]+R[0][1]*V[5][1]+R[0][2]*V[5][2],R[1][0]*
> V[5][0]+R[1][1]*V[5][1]+R[1][2]*V[5][2],R[2][0]*V[5][0]+R[
> 2][1]*V[5][1]+R[2][2]*V[5][2])
> v7=(R[0][0]*V[6][0]+R[0][1]*V[6][1]+R[0][2]*V[6][2],R[1][0]*
> V[6][0]+R[1][1]*V[6][1]+R[1][2]*V[6][2],R[2][0]*V[6][0]+R[
> 2][1]*V[6][1]+R[2][2]*V[6][2])
> v8=(R[0][0]*V[7][0]+R[0][1]*V[7][1]+R[0][2]*V[7][2],R[1][0]*
> V[7][0]+R[1][1]*V[7][1]+R[1][2]*V[7][2],R[2][0]*V[7][0]+R[
> 2][1]*V[7][1]+R[2][2]*V[7][2])
> body=utils.polyhedron((v1,v2,v3,v4,v5,v6,v7,v8),fixed=
> False,color=(.6,.45,0),material="MLI",wire=False)
> body.state.angVel=(0,0,0.1)
> r=m.sqrt(aa**2+bb**2)
> Rj=m.sqrt(r**2+cc**2)
> Ri=0.05
> Rr=Rj*Ri/(Rj+Ri)
> mu_rM=0.05
> mu_rG=1.08
> KN=E1*2*Ri*E1*2*Ri/(E1*2*Ri+E1*2*Ri)
> KR=3*Ri**2*mu_rG**2*KN/4
>
> O.engines=[
> ForceResetter(),
> InsertionSortCollider([Bo1_Polyhedra_Aabb()]),
> InteractionLoop(
> [Ip2_FrictMat_FrictMat_MindlinPhys(en=.45,es=.45,
> krot=KR,frictAngle=.7853)],
> [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
> ),
> NewtonIntegrator(gravity=(0,0,-2.5e-4),damping=0),
> ]
>
> The script is the same and also the version of yadedaily.
>
> I'll try with angMom.
>
> Thank you,
>
> Jonathan
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Jonathan Pergoli (j812p89) said :
#4

Hi Jan,

sorry I have made a mess with the code :)

I have used O.bodies.append(body).

Anyway, I have solved the problem using angMom :)

Thank you,

Jonathan

Revision history for this message
Jonathan Pergoli (j812p89) said :
#5

Thanks Jan Stránský, that solved my question.