# Re: [Yade-users] [Question #401682]: Problem with angular velocity

```Question #401682 on Yade changed:
```
Jan Stránský proposed the following answer:
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

2016-09-22 12:57 GMT+02:00 Jonathan Pergoli <

> Question #401682 on Yade changed:
>
> 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
>
> --
>
> _______________________________________________
>

--