Question #688548 on Yade changed:
https://answers.launchpad.net/yade/+question/688548
Status: Open => Answered
Jan Stránský proposed the following answer:
> what would be the most appropriate ?
again, it very depends on many factors..
is the time up and down same? different?
is O.dt constant, or changing?
...
The simplest case is that O.dt is not changing, then you know how many time
steps you need between the switch and can simply do
### without PyRunner
period_up, period_down = 1e-3, 2e-3
for iCycle in range(nCycles):
for period,vel in zip((period_up,period_down),(vel_up,vel_down)):
nIters = int(period/O.dt)
transEngine.velocity = vel
O.run(nIters,True)
###
or
### with PyRunner
O.engines = [
...
PyRunner(virtPeriod=1e-3,command="shake()")
]
def shake():
t = O.time % period # t i in interval [0,period]
if t < t_switch: vel = vel_up
else: vel = vel_down
transEngine.velocity = vel
###
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.
_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help : https://help.launchpad.net/ListHelp