← Back to team overview

yade-users team mailing list archive

Re: [Question #691285]: Extract Normals and Shears/tangentials forces on a ballMill

 

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

    Status: Solved => Open

NGANDU KALALA Gauthier is still having a problem:
Dear All,

With this piece of code, I can calculate for each interaction the normal impact force between a ball and the cylinder at each time step. The result is such that, by recording the time vector with time = O.time, the code registers the time of interaction. This is a good thing. However if I have ten interactions at the instant 0.0502s for instance, O.time, gives me a vector with 0.0502s repeated 10 times. This makes it difficult for me to calculate the spectrum of my signal with such a time vector.
What I would like to improve in my code is :
Rather than recording for each interaction the normal force and the time of interaction, I would rather record for each time step, the number of interactions, as well as the total normal force due to all its interactions in a time t.
 That way, I would have an easier signal to interpret.

Someone could help me to improve my code?

#######
O.engines=[
  ForceResetter(),
  InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),

  InteractionLoop(
    [Ig2_Sphere_Sphere_ScGeom(),
     Ig2_Facet_Sphere_ScGeom(),
     Ig2_Wall_Sphere_ScGeom()],
    [Ip2_FrictMat_FrictMat_MindlinPhys()],
    [Law2_ScGeom_MindlinPhys_Mindlin()]
  ),

  NewtonIntegrator(damping=0,gravity=[0,0,-9.81]),

  RotationEngine(ids=liner,rotationAxis=[0,-1,0],rotateAroundZero=True,
                 angularVelocity=omega),
  PyRunner(command='saveForces()',iterPeriod=1)
]

def saveForces():

  for i in O.interactions:
    
    if isinstance(O.bodies[i.id1].shape,Facet) or isinstance(O.bodies[i.id2].shape,Facet):
      fn = tuple((i.phys.normalForce))
      time  = O.time

    # Save Total force 
      out=open(os.getcwd()+'/output/normalForce','a')
      out.write('%s\n'%str(fn))
      out.close()

O.dt = .95*PWaveTimeStep()
O.run(int(math.ceil(tEnd/O.dt))+1)

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