← Back to team overview

yade-users team mailing list archive

[Question #690691]: setPermF broken?

 

New question #690691 on Yade:
https://answers.launchpad.net/yade/+question/690691

I have a user-defined force that I need to apply to a clump. The force changes with time, but rather slowly relative to the time step.  I noticed that the PyRunner to calculate and apply this force was taking 20 - 30% of the entire simulation time, so I thought to recalculate the force only every 100 iterations or so.  I was previously using this to apply the force

O.forces.addF(ClumpId, ( 0, externalForce , 0) )

I switched it to this:

O.forces.setPermF(ClumpId, ( 0, externalForce , 0) )

The result is that the clump in question does not move.  It's as if zero force was applied to it.  I checked O.forces.permF(ClumpId), and it gives me the expected force, but the body does not move.  I also tried addF with permanent=True, also adding the force directly to a single member of the clump instead of the clump directly.  None of these work.  Any suggestions?  Or anybody can point me a to working example of setPermF?

I am using recent daily build (20200511-3819~5bf8512~buster1).  

Here's the key part of the source:

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()], verletDist=verlet_dist ),
 InteractionLoop(
   [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
   [Ip2_FrictMat_FrictMat_FrictPhys()],
   [Law2_ScGeom_FrictPhys_CundallStrack()] ),
 timestepper,
 PyRunner(command='swing()',iterPeriod=100),
 newton,
   PyRunner(command='addPlotData()',iterPeriod=plotDataPeriod),

]


def swing():
        global theta
        
        theta = 2 * math.pi * ( f_sweep_start * O.time + f_sweep_rate * O.time**2) 
        extF = F_amp * math.sin(theta)

        kF   = -k * ( wall_state.pos[1]-x0 )
        cF   = -c * ( wall_state.vel[1] )

#     O.forces.addF( ClumpId, ( 0, extF + kF + cF , 0) )  # works
        O.forces.setPermF(ClumpId, ( 0, extF + kF +cF , 0) ) # does nothing?



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