periodic motion of a boundary

Asked by Rioual on 2020-02-06

Hello,

I would like to code a periodic motion of translation for a boundary with TranslationEngine (Shaking).
Is there a simple way to do it ??

Thanks,

Vincent

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2020-02-06
Last query:
2020-02-06
Last reply:
2020-02-06
Jan Stránský (honzik) said : #1

Hi Vincent,
it is possible to change TranslationEngine attributes (translationAxis, velocity) [1], e.g. in a PyRunner as a function of O.time
Alternatively, it is possible to implement in C++ a derived class suitable for your needs.
cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.TranslationEngine

Rioual (francois-rioual-v) said : #2

Hi Jan,

OK, do you mean a conditional statement on O.time in a function called by Pyrunner at every time step ?

regards,

V.

Jan Stránský (honzik) said : #3

not necessarily conditional and not necessarily called at every time step :-) although both is possible
suitable form would strongly depend on actual meaning of "periodic motion" and "shaking"
cheers
Jan

Rioual (francois-rioual-v) said : #4

Dear Jan,

Let's say the simplest case of the periodic vertical motion up and down of a horizontal plate with velocities V_up (upwards) and V_down (downwards); what would be the most appropriate ?

Thanks,

V.

Best Jan Stránský (honzik) said : #5

> 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

Rioual (francois-rioual-v) said : #6

Thanks Jan Stránský, that solved my question.