Updating LIGGGHTS input script variable in a coupled problem

Submitted by rashutsa on Mon, 04/20/2020 - 23:25

Hello,

I have a pure DEM simulation that employs a sinusoidal mesh motion using variables in the liggghts script. The motion equation variables are updated with time using the "run N every" command. Now I want to run the simulation as a coupled problem.
If I understand correctly, in CFDEM, the coupling code has the control over the liggghts run command, and thus the "every" part is getting ignored. Is there an easy way to include that part? I tried with the liggghtsCommandModel_execute command. But my commands have special characters like (, *,/ etc. I am not sure how to handle them in the CFD/constant/liggghtsCommands file.
Thanks in advance.

EDIT: tried to find a workaround by strategic uses of swiggle and cwiggle functions. The simulation runs but the timestep for each coupling run session is reset, so I'm getting only part of the motion over and over. Again, tried to use the execute command to run something like "run N start I stop J", but it gives me an error. (may be because N, I, and J are recorded as floats instead of integers? I don't know)

richti83's picture

richti83 | Tue, 04/21/2020 - 14:37

Maybe you can avoid the run N every by using a time variable.

#step and and dt are predefinded, internal variables
variable now equal step*dt #holds the time this variable has been used firsttime
variable time equal step*dt #used later for current time(step)

and for your movement use

variabele vx equal $A*sin(v_time-${now}) #v_time is evalueted everytime vx is evaluated, ${now} is replaced by a constant by the script-parser
variable vz equal $A*cos(v_time-${now}) #same

^^ this demonstrated the concept of ${}-variables and v_VARNAME-Variables
best,
Christian.

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

rashutsa | Wed, 04/22/2020 - 07:42

Thanks for the suggestion! So, tell me if I got it right, ${var} is a one-time assignment, while v_var is a dynamic assignment? If that's the case, then it makes sense, I was using ${var} before.

richti83's picture

richti83 | Wed, 04/22/2020 - 08:28

correct. With one exception: fix print will force a re-evaluation of ${var}-Variables

Immediate Evaluation of Variables:
#
There is a difference between referencing a variable with a leading $ sign (e.g. $x or ${abc}) versus with a leading “v_” (e.g. v_x or v_abc). The former can be used in any input script command, including a variable command. The input script parser evaluates the reference variable immediately and substitutes its value into the command. As explained in Section commands 3.2 for “Parsing rules”, you can also use un-named “immediate” variables for this purpose. An variable reference such as $((xlo+xhi)/2+sqrt(v_area)) evaluates the string between the parenthesis as an equal-style variable.
....

https://www.cfdem.com/media/DEM/docu/variable.html

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