applying forces with a time/iteration condition

Asked by behzad

Hi guys,

I was looking at applied force statements to verify a contact model.

we've got;
1.
O.forces.addF(id_ball, (Fx_, Fy_, Fz_))

2.
def addForceEver():
 id_ball= 1
 Fx_= 0.0
 Fy_=0.0
 Fz_= 0.0
 O.forces.addF(id_ball, (Fx_, Fy_, Fz_),permanent=True)

the fist one applies a force for only one step but the second one when it comes with the PyRunner command of PyRunner(command='addForceEver()',iterPeriod=1) applies the force permanently.

I was wondering how can we apply a force for a certain duration of time or number of iterations?

Thanks for helping

Behzad

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
behzad
Solved:
Last query:
Last reply:
Revision history for this message
Ricardo Pieralisi (ricpieralisi) said :
#1
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

> PyRunner(command='addForceEver()',iterPeriod=1)

The above makes no sense. If the force is applied forever, why would we reapply at each iteration? It is only when using addF(...,False) that a PyRunner may help.

Does this solve your question?:

O.forces.addF(id_ball, F1,1)
O.run(100,1)
O.forces.addF(id_ball, F2,1)
O.run(100,1)

It applies F1 for 100 iterations, then F2. More automatic switches can of course be implemented.

@Ricardo
I think ForceEngine would make this more painful. It does not offer any help for changing force values dynamicaly over time, and applying forces independently on 1000 bodies would need 1000 independent ForceEngines...

Revision history for this message
behzad (behzad-majidi) said :
#3

Hey guys,

Actually the following code did what I wanted to do:

ForceEngine(force=(0,0,-2e4),ids=[1],label='fEngine'),
PyRunner(command="fEngine.force=(0,0,0)", iterPeriod=5000000)

However, I understand it can be difficult to manage if there're a lot of bodies to apply forces.

Thank you Rocardo & Bruno

Revision history for this message
Chareyre (bruno-chareyre-9) said :
#4

Good if you are happy with it but I still miss the point. Why a force
engine?
Why not just this:

O.engines=[...
PyRunner(command="O.forces.addF(1,(0,0,0),1)", iterPeriod=5000000)
... ]

O.forces.addF(1,(0,0,-2e4) ,1)

Bruno