Incrementation of the value of variable

Submitted by Haith on Thu, 06/07/2018 - 15:02

Dear all,

I would like to check whether the value of the variable can be incremented or not? Here is a simplified example:

variable A equal 5
....
run 10000
Variable A equal "A*2"

Many thanks, Haithem

paul | Thu, 06/07/2018 - 20:01

Have you tried doing it?

There is a commando called print that can be used to output, among other things, the output of variables. Read the documentation.

richti83's picture

richti83 | Fri, 06/08/2018 - 08:20

should be

variable A equal 5
run 10000
variable A equal $A*5

The syntax ist:
$A for parser
v_A for runtime variable


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