← Back to team overview

yade-dev team mailing list archive

[Bug 1832235] [NEW] The NewtonIntegrator does not apply angular motion for aspherical bodies

 

Public bug reported:

I've tried several ways to impose an initial angular velocity on a free polyhedron but they do not work well as commented in the script and below. Please help me with this. Thanks!
Here are things I've observed: [In the code below, I simulate 2 polyhedrons, poly1 is free and has an initial velocity while poly2 is fixed.]
If I directly use state.angVel or utils.setBodyAngularVelocity to impost an angular velocity on both polyhedrons, nothing happens to poly1, I could observe no rotation but just transnational move. However, I could observe rotation on poly2, which is fixed.

A work around is to use angMom.

## using: "b.state.angMom" 
Mom=b1.state.ori*b1.state.inertia # This results to angVel=Vector3(1,1,1).
# Modify accordingly, to modify a specific angular velocity. e.g., to get an initial angVel=Vector3(5,6,7)
Mom[0]=Mom[0]*5.
Mom[1]=Mom[1]*6.
Mom[2]=Mom[2]*7.

O.bodies[0].state.angMom=Mom


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# ENGINES  
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Polyhedra_Aabb()],verletDist=0.01),
	InteractionLoop(
		[Ig2_Polyhedra_Polyhedra_PolyhedraGeom()],
		[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
		[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
	),
	NewtonIntegrator(damping=0.0,exactAsphericalRot=True,gravity=[0,0,0]),
]


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# POLYHEDRAL PARTICLES
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

from yade import polyhedra_utils
m = PolyhedraMat()
m.density = 2000 #kg/m^3 
m.young = 150e6 #Pa
m.poisson = .4
m.frictionAngle = 3.0 #rad

edge=0.025
vertices=[(-edge, -edge, -edge),
          (-edge,  edge, -edge),
	  ( edge, -edge, -edge),
	  ( edge,  edge, -edge),
	  (-edge, -edge,  edge),
          (-edge,  edge,  edge),
	  ( edge, -edge,  edge),
	  ( edge,  edge,  edge)]

# Free
b1 = polyhedra_utils.polyhedra(m,v=vertices)
b1.state.pos = (0,0,0)
O.bodies.append(b1)

# Fixed
b2 = polyhedra_utils.polyhedra(m,v=vertices,fixed=True)
b2.state.pos = (4.*edge,0,0)
O.bodies.append(b2)


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# INITIAL VELOCITY
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

# Initial translational velocity
O.bodies[0].state.vel=Vector3(1,0,0) 

# Initial angular velocity 
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
##Directly assigning the angular velocity- Not imposing initial angular velocity- No rotation for the free one but the fixed one will rotate
#O.bodies[0].state.angVel=Vector3(1,1,0)
#O.bodies[1].state.angVel=Vector3(1,1,0)


## using: "utils.setBodyAngularVelocity" - Not working for non-fixed bodies(poly1) but working for poly2
utils.setBodyAngularVelocity(0,5*Vector3(1,1,1))
utils.setBodyAngularVelocity(1,5*Vector3(1,1,1))
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

from yade import qt
v=qt.View()


O.dt=1.0e-8


O.saveTmp()

** Affects: yade
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yade
developers, which is subscribed to Yade.
https://bugs.launchpad.net/bugs/1832235

Title:
  The NewtonIntegrator does not apply angular motion for aspherical
  bodies

Status in Yade:
  New

Bug description:
  I've tried several ways to impose an initial angular velocity on a free polyhedron but they do not work well as commented in the script and below. Please help me with this. Thanks!
  Here are things I've observed: [In the code below, I simulate 2 polyhedrons, poly1 is free and has an initial velocity while poly2 is fixed.]
  If I directly use state.angVel or utils.setBodyAngularVelocity to impost an angular velocity on both polyhedrons, nothing happens to poly1, I could observe no rotation but just transnational move. However, I could observe rotation on poly2, which is fixed.

  A work around is to use angMom.

  ## using: "b.state.angMom" 
  Mom=b1.state.ori*b1.state.inertia # This results to angVel=Vector3(1,1,1).
  # Modify accordingly, to modify a specific angular velocity. e.g., to get an initial angVel=Vector3(5,6,7)
  Mom[0]=Mom[0]*5.
  Mom[1]=Mom[1]*6.
  Mom[2]=Mom[2]*7.

  O.bodies[0].state.angMom=Mom

  
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
  # ENGINES  
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

  O.engines=[
  	ForceResetter(),
  	InsertionSortCollider([Bo1_Polyhedra_Aabb()],verletDist=0.01),
  	InteractionLoop(
  		[Ig2_Polyhedra_Polyhedra_PolyhedraGeom()],
  		[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()],
  		[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()]
  	),
  	NewtonIntegrator(damping=0.0,exactAsphericalRot=True,gravity=[0,0,0]),
  ]

  
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
  # POLYHEDRAL PARTICLES
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

  from yade import polyhedra_utils
  m = PolyhedraMat()
  m.density = 2000 #kg/m^3 
  m.young = 150e6 #Pa
  m.poisson = .4
  m.frictionAngle = 3.0 #rad

  edge=0.025
  vertices=[(-edge, -edge, -edge),
            (-edge,  edge, -edge),
  	  ( edge, -edge, -edge),
  	  ( edge,  edge, -edge),
  	  (-edge, -edge,  edge),
            (-edge,  edge,  edge),
  	  ( edge, -edge,  edge),
  	  ( edge,  edge,  edge)]

  # Free
  b1 = polyhedra_utils.polyhedra(m,v=vertices)
  b1.state.pos = (0,0,0)
  O.bodies.append(b1)

  # Fixed
  b2 = polyhedra_utils.polyhedra(m,v=vertices,fixed=True)
  b2.state.pos = (4.*edge,0,0)
  O.bodies.append(b2)

  
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
  # INITIAL VELOCITY
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

  # Initial translational velocity
  O.bodies[0].state.vel=Vector3(1,0,0) 

  # Initial angular velocity 
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
  ##Directly assigning the angular velocity- Not imposing initial angular velocity- No rotation for the free one but the fixed one will rotate
  #O.bodies[0].state.angVel=Vector3(1,1,0)
  #O.bodies[1].state.angVel=Vector3(1,1,0)

  
  ## using: "utils.setBodyAngularVelocity" - Not working for non-fixed bodies(poly1) but working for poly2
  utils.setBodyAngularVelocity(0,5*Vector3(1,1,1))
  utils.setBodyAngularVelocity(1,5*Vector3(1,1,1))
  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

  from yade import qt
  v=qt.View()

  
  O.dt=1.0e-8

  
  O.saveTmp()

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/1832235/+subscriptions


Follow ups