Add Force every iterPeriod

Asked by Gastbye Liu

Hi everyone:

I want to apply force on the polyhedron and the force grows as the time grows.
Question1: This is my code. Is that correct?
Question2: Also I don't know how to print my added force in every iterPeriod.

Could you give me some advice?

############################################
from yade import *
from yade import polyhedra_utils

matF = PolyhedraMat()
matF.density = 10e15
matF.young = 2e11
matF.poisson = 0.1
matF.Ks = 1e14
matF.Kn = 1e15
matF.frictionAngle = 0.2
yade.O.materials.append(matF)

# basic YADE engines fo tetrahedra contact
O.bodies.append(polyhedra_utils.polyhedra(matF,v=[[-0.025,-0.025,-0.005],[-0.025,0.025,-0.005],[0.025,-0.025,-0.005],[0.025,0.025,-0.005],[-0.025,-0.025,0],[-0.025,0.025,0],[0.025,-0.025,0],[0.025,0.025,0]]))

O.bodies.append(polyhedra_utils.polyhedra(matF,v=[[-0.025,-0.025,0.1],[-0.025,0.025,0.1],[0.025,-0.025,0.1],[0.025,0.025,0.1],[-0.025,-0.025,0.105],[-0.025,0.025,0.105],[0.025,-0.025,0.105],[0.025,0.025,0.105]]))

O.engines = [
 ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb()],verletDist=0.1),
    InteractionLoop(
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()],
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()] # contact law -- apply forces
   ),
   #GravityEngi
 NewtonIntegrator(damping=0.2),
 PyRunner(command='addForce()',iterPeriod=1)
]
print "utils.PWaveTimeStep= "+str(utils.PWaveTimeStep())

def addForce():
 O.forces.addF(0,Vector3(0,0,5*O.iterPeriod))
 O.forces.addF(1,Vector3(0,0,-5*O.iterPeriod))

###################################################

Many Thanks!

Liu

Question information

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

Hello,

1) yes, the approach is correct

2)
def addForce():
  O.forces.addF(0,Vector3(0,0,5*O.iterPeriod))
  O.forces.addF(1,Vector3(0,0,-5*O.iterPeriod))
  print ...

cheers
Jan

Revision history for this message
Gastbye Liu (gastbye) said :
#2

Dear Jan:
      Many Thanks! That's solved my question.

Liu