How to make complicated motion patterns without lots of repetitive fix commands?

Submitted by Ikeblue on Fri, 03/30/2018 - 05:18

Hi there, LIGGGHTS forum. I've been learning to use LIGGGHTS, and I'd like to run a simulation where moving parts stay still and move at specific intervals. Maybe somewhat like the 'pulsed' behavior that's possible by using the duration keyword with the insert_every keyword of the insert/stream fix.

I imagine I could accomplish this by using a repeating pattern of commands like:

run ... upto
fix all spinner move/mesh ...
run ... upto
unfix spinner

But I'm also wondering if I could define the motion pattern in one move/mesh fix by doing the right thing with rotate/variable or linear/variable keywords.

I haven't yet found any example infiles using rotate/variable or linear/variable with move/mesh fixes.
Does anyone here have any suggestions or recommendations?

richti83's picture

richti83 | Fri, 03/30/2018 - 10:56

Hi,
the "trick" for variable movement is to use v_VARID inside the move command:

variable a equal 0.5
variable accsteps equal 1/dt #steps to accelerate
variable vx equal 0
variable vy equal 0
variable vz equal $a*step*dt #accelerated movement
fix movecad1 all move/mesh mesh cad1 linear/variable v_vx v_vy v_vz
run ${accsteps}
variable vz equal 0.5 #constant velocity
run 100000
variable vz equal 0 #stop
run 100000

Same for rotate/variable (note here we need to use omega instead of period as the variable could become zero)

variable w equal sin(step*dt)
fix movecad2 all move/mesh mesh cad1 rotate origin 0. 0. 0. axis 0. 1. 0. omega v_w

With some math (sine, cosine, modulo) you can make a step (time) depending variable formula and do all the movement in one run.

Best,
Christian.

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact