Intrinsic operations

## Intrinsic operations

There are numerous of intrinsic operations in the software which are useful when defining functions. A complete list of the available intrinsic operations are presented here. These operations are divided into six different sections. Direct links to each one of them can be accessed from the quick links below.

### Operations

##### Math operations

Math operations are used to do simple operations between two variables. If one wants to add the variable x with y, the result would be: x + y.

Operation
Description
+
-
Substraction
*
Multiplication
/
Division
^
Exponentiation
##### Logical operations

Logical operations are used in condition controls and control flow operation. For example, 2 $\lt$ 10 would result in logical True.

Operation
Description
&&
And
||
Or
==
Equality
!=
Inequality
<
Strictly less than
<=
Less than or equal
>
Strictly greater than
>=
Greater than or equal

### Objects and values

There are some built-in objects and values that can be used to get data from the simulation, such as time step size or current time.

Operation
Description
pi
3.141592653589793...
dt
Time step
t
Current simulation time
term
Termination time
R
theta
Angle
X
x-coordinate (initial)
Y
y-coordinate (initial)
Z
z-coordinate (initial)
x
x-coordinate (current)
y
y-coordinate (current)
z
z-coordinate (current)
vx
Local velocity in x-direction
vy
Local velocity in y-direction
vz
Local velocity in z-direction
xnorm
x-component of local surface normal direction
ynorm
y-component of local surface normal direction
znorm
z-component of local surface normal direction
vnorm
Local velocity in the normal direction to the surface of the structure
epsp
Equivalent plastic strain
sigy0
Initial yield stress
dmg
Damage
amax
Max acceleration
eint
Specific internal energy
pres
Contact pressure or hydrostatic pressure in material (LOAD_PRESSURE)
vtang
Relative tangential sliding velocity (for use with CONTACT)
dnorm
Spring elongation in CONNECTOR_SPRING
vnorm
Local velocity in the normal direction to the surface of the structure or rate of elongation in CONNECTOR_SPRING
wi
Returns the total internal energy in the model
we
Returns the total elastic energy in the model
wk
Returns the total kinetic energy in the model
rnd
Returns a random number between 0 and 1. The seed to the random number generator can be defined as deterministic (default) or random (see RANDOM_NUMBER_GENERATOR_SEED)
T
Temperature
vmax_cfd
Max velocity in cfd domain (see CFD_DOMAIN)
sph_jet
SPH jet tip coordinate

### Functions

sin(x)
 x = degrees
Trigonometric sine function (degrees)
cos(x)
 x = degrees
Trigonometric cosine function (degrees)
tan(x)
 x = degrees
Trigonometric tangent function (degrees)
asin(x)
 x = [-1, 1]
Trigonometric arcsine function (degrees)
acos(x)
 x = [-1, 1]
Trigonometric arccosine function (degrees)
atan(x)
 x = real number
Trigonometric arctangent function (degrees)
tanh(x)
 x = degrees
Hyperbolic tangent function (degrees)
sinr(x)
cosr(x)
tanr(x)
asinr(x)
 x = [-1, 1]
acosr(x)
 x = [-1, 1]
atanr(x)
 x = real number
exp(x)
 x = real number
Exponential function
ln(x)
 x = positive real number
Natural logarithm
log(x)
 x = positive real number
Natural logarithm, identical to ln(x)
log10(x)
 x = positive real number
Logarithm to base 10
sqrt(x)
 x = positive real number
Square root
min($x_1$, $x_2$, $x_n$)
 $x_1$ = real number $x_2$ = real number $x_n$ = real number (Optional)
Min value of arguments. This function can take up to 10 arguments, min($x_1$, $x_2$, ..., $x_n$)
max($x_1$, $x_2$, $x_n$)
 $x_1$ = real number $x_2$ = real number $x_n$ = real number (Optional)
Max value of arguments. This function can take up to 10 arguments, max($x_1$, $x_2$, ..., $x_n$)
mod($a$, $b$)
 $a$ = integer (dividend) $b$ = integer (divisor)
Modulo operation, returning the remainder of division $a/b$.
abs(x)
 x = value
Absolute value
sign(x)
 x = value
Sign function (sign(x $\lt$ 0) = -1; sign(x $\geq$ 0) = 1)
floor(x)
 x = value
Rounds to nearest integer below or equal to x
ceil(x)
 x = value
Rounds to nearest integer above or equal to x
round(x)
 x = value
Rounds to nearest integer
d(i, j)
 i = value j = value
Kronecker delta. The function returns 1 if the variables are equal, and 0 otherwise
H(x)
 x = value
Heaviside Step function (H(x $\lt$ 0) = 0; H(x $\geq$ 0) = 1)
erf(x)
 x = value
Gauss error function
smooth_d(dmax, t0, t1)
 dmax = displacement t0 = t0 t1 = t1
A displacement defined as smooth_d(%disp, %t_0, %t_1) is smoothly ramped up from 0 to %disp between time %t_0 and %t_1. The input does not have to be based on parameters; direct input works as well. Other quantities, such as pressure, temperature, force, e.t.c. can be used as input instead of displacement in smooth_d()
smooth_v(dmax, t0, t1)
 dmax = displacement t0 = t0 t1 = t1
Smooth velocity function that is obtained by differentiating smooth_d() with respect to time
smooth_a(dmax, t0, t1)
 dmax = displacement t0 = t0 t1 = t1
Smooth acceleration function that is obtained by differentiating smooth_v with respect to time
norminv($\mu$, $\sigma$, P, cap)
 $\mu$ = Median value $\sigma$ = Standard deviation P = Cumulative point cap = Limit the deviation (Optional)
Normal distribution quantile (inverse cumulative distribution function). The function returns a value in a normal distribution. Required input is the median value $\mu$, standard deviation $\sigma$ and a cumulative point in the distribution 0 $\lt$ P $\lt$ 10 (typically a random number). cap is optional and limits the deviation from $\mu$ (max number of standard deviations)
lognorminv($\mu$, $\sigma$, P, cap)
 $\mu$ = Median value $\sigma$ = Standard deviation P = Cumulative point cap = Limit the deviation (Optional)
Log-normal distribution quantile (inverse cumulative distribution function). The function returns a value in a log-normal distribution. exp($\mu$) is the median value in the distribution, $\sigma$ is the standard deviation of the variable's natural logarithm and 0 $\lt$ P $\lt$ 1 is a cumulative point in the distribution (typically a random number). cap is optional and limits the deviation from μ (max number of standard deviations)

### Feedback of data

##### Curve, function and table

Data from curves, functions and tables defined by:
CURVE, FUNCTION, TABLE

crv(cid, x)
 cid = Curve ID defined in CURVE x = Abscissa
Returns the ordinata of curve cid at abscissa x
fcn(fid, x)
 fid = Function ID defined in FUNCTION x = Abscissa (Optional)
Returns a curve or function value
dfcn(fid)
 fid = function ID
Time derivative of fcn(fid)
table(tid, rid, cid)
 tid = Table ID rid = Row cid = Column
Returns the value at row and column (rid, cid) of table tid
##### Node

Data from nodes (node id as input)

xn(nid)
 nid = Node ID
Returns the x-coordinate of nid
yn(nid)
 nid = Node ID
Returns the y-coordinate of nid
zn(nid)
 nid = Node ID
Returns the z-coordinate of nid
vxn(nid)
 nid = Node ID
Returns the x-velocity of nid
vyn(nid)
 nid = Node ID
Returns the y-velocity of nid
vzn(nid)
 nid = Node ID
Returns the z-velocity of nid
vn(nid)
 nid = Node ID
Returns the resultant velocity of nid
dist_surf(xn(nid), yn(nid), zn(nid))
 xn(nid) = x-coordinate yn(nid) = y-coordinate zn(nid) = z-coordinate
Distance to material surface
##### Part

Data from parts defined by: PART

dxp(pid)
 pid = Part ID
Returns the x-displacement of pid
dyp(pid)
 pid = Part ID
Returns the y-displacement of pid
dzp(pid)
 pid = Part ID
Returns the z-displacement of pid
vxp(pid)
 pid = Part ID
Returns the x-velocity of pid
vyp(pid)
 pid = Part ID
Returns the y-velocity of pid
vzp(pid)
 pid = Part ID
Returns the z-velocity of pid
rxp(pid)
 pid = Part ID
Returns the rotation around x-axis of pid
ryp(pid)
 pid = Part ID
Returns the rotation around y-axis of pid
rzp(pid)
 pid = Part ID
Returns the rotation around z-axis of pid
xmaxp(pid, xn, yn, zn)
 pid = Part ID xn = x-direction yn = y-direction zn = z-direction
Returns the maximum coordinate of part measure from (0, 0, 0) in direction (xn, yn, zn)
wip(pid)
 pid = Part ID
Returns the internal energy of pid
wkp(pid)
 pid = Part ID
Returns the kinetic energy of pid
mpp(pid)
 pid = Part ID
Returns the part mass (physical) of pid
mpa(pid)
 pid = Part ID
Returns the part mass (added) of pid
dmgp(pid)
 pid = Part ID
Returns max damage of pid
epsp_part(pid, option)
 pid = Part ID option = See description
Option = 0: Largest effective plastic strain
Option = 1: x-coordinate of integration point with largest effective plastic strain
Option = 2: y-coordinate of integration point with largest effective plastic strain
Option = 3: z-coordinate of integration point with largest effective plastic strain
pres_part(pid, option)
 pid = Part ID option = See description
Option = 0: Highest pressure
Option = 1: x-coordinate of integration point with highest pressure
Option = 2: y-coordinate of integration point with highest pressure
Option = 3: z-coordinate of integration point with highest pressure
vmax_p(pid)
 pid = Part ID
Returns max velocity of pid
##### Sensor

Data from sensor defined by: OUTPUT_SENSOR

xs_old(sid)
 sid = Sensor ID
Returns the x-coordinate (initial) of sid
ys_old(sid)
 sid = Sensor ID
Returns the y-coordinate (initial) of sid
zs_old(sid)
 sid = Sensor ID
Returns the z-coordinate (initial) of sid
xs(sid)
 sid = Sensor ID
Returns the x-coordinate (current) of sid
ys(sid)
 sid = Sensor ID
Returns the y-coordinate (current) of sid
zs(sid)
 sid = Sensor ID
Returns the z-coordinate (current) of sid
dxs(sid)
 sid = Sensor ID
Returns the x-displacement of sid
dys(sid)
 sid = Sensor ID
Returns the y-displacement of sid
dzs(sid)
 sid = Sensor ID
Returns the z-displacement of sid
vxs(sid)
 sid = Sensor ID
Returns the x-velocity of sid
vys(sid)
 sid = Sensor ID
Returns the y-velocity of sid
vzs(sid)
 sid = Sensor ID
Returns the z-velocity of sid
axs(sid)
 sid = Sensor ID
Returns the x-acceleration of sid
ays(sid)
 sid = Sensor ID
Returns the y-acceleration of sid
azs(sid)
 sid = Sensor ID
Returns the z-acceleration of sid
epsps(sid)
 sid = Sensor ID
Returns the effective plastic strain of sid
depsps(sid)
 sid = Sensor ID
Returns the effective plastic strain increment of sid
epsxxs(sid)
 sid = Sensor ID
Returns the X-strain of sid
epsyys(sid)
 sid = Sensor ID
Returns the Y-strain of sid
epszzs(sid)
 sid = Sensor ID
Returns the Z-strain of sid
dmgs(sid)
 sid = Sensor ID
Returns the damage of sid
Ts(sid)
 sid = Sensor ID
Returns the temperature of sid
ps(sid)
 sid = Sensor ID
Returns the pressure of sid
sps(sid)
 sid = Sensor ID
Returns the surface pressure of sid
sigxxs(sid)
 sid = Sensor ID
Returns the X-stress of sid
sigyys(sid)
 sid = Sensor ID
Returns the Y-stress of sid
sigzzs(sid)
 sid = Sensor ID
Returns the Z-stress of sid
sig1s(sid)
 sid = Sensor ID
Returns the first principal stress of sid
sgps(sid)
 sid = DP sensor ID
Returns the gas pressure of sid
##### Contact

Data from contacts defined by: CONTACT

fxc(cid)
 cid = Contact ID
Returns the total contact force in x-direction of cid
fyc(cid)
 cid = Contact ID
Returns the total contact force in y-direction of cid
fzc(cid)
 cid = Contact ID
Returns the total contact force in z-direction of cid
fc(cid)
 cid = Contact ID
Returns the resultant contact force of cid
##### Boundary condition

Data from boundary conditions defined by:
BC_MOTION, BC_SYMMETRY, BC_TELEPORT, BC_TEMPERATURE

fxr(bcid)
 bcid = Boundary condition ID
Returns the reaction force, x-direction of bcid
fyr(bcid)
 bcid = Boundary condition ID
Returns the reaction force, y-direction of bcid
fzr(bcid)
 bcid = Boundary condition ID
Returns the reaction force, z-direction of bcid
fr(bcid)
 bcid = Boundary condition ID
Returns the reaction force, resultant of bcid
txr(bcid)
 bcid = Boundary condition ID
Returns the torque around x-axis of bcid
tyr(bcid)
 bcid = Boundary condition ID
Returns the torque around y-axis of bcid
tzr(bcid)
 bcid = Boundary condition ID
Returns the torque around z-axis of bcid
tr(bcid)
 bcid = Boundary condition ID
Returns the resultant torque of bcid
##### Geometry

Data from geometries defined by:
GEOMETRY_BOX, GEOMETRY_COMPOSITE, GEOMETRY_EFP, GEOMETRY_PART, GEOMETRY_PIPE, GEOMETRY_SEED_COORDINATE, GEOMETRY_SEED_NODE, GEOMETRY_SPHERE

vol_geo(gid, tol, dir)
 gid = Geometry ID tol = Tolerance dir = Direction (Optional)
Volume enclosed by the element faces in geometry gid. tol is an optional dimensionless tolerance. Gaps in the surface will result in errors. If the estimated (relative) error is larger than tol then the function will return 0 (zero). The optional parameter dir is used to avoid the volume calculation in specific global directions (divergence theorem). This is necessary if the control volume is located on symmetry planes. The global x-direction is avoided if dir = 1, 4 or 6, the global y-direction is avoided if dir = 2, 4 or 5 and the global z-direction is avoided if dir = 3, 5 or 6
vol_geo0(gid, tol, dir)
 gid = Geometry ID tol = Tolerance dir = Direction
Initial volume enclosed by the element faces in geometry gid. The function arguments are the same as for function vol_geo()
##### Element set

Data from element sets defined by: SET_ELEMENT

dmg_es(setid)
 setid = Set ID
Returns max damage of elements in set setid
##### Face set

Data from face sets defined by: SET_FACE

volfs(setid)
 setid = Set ID
Returns the volume enclosed by face set setid
##### Joint

Data from joints defined by: RIGID_BODY_JOINT

fxj(jid)
 jid = Joint ID
Returns the force in x-direction of jid
fyj(jid)
 jid = Joint ID
Returns the force in y-direction of jid
fzj(jid)
 jid = Joint ID
Returns the force in z-direction of jid
txj(jid)
 jid = Joint ID
Returns the torque around x-axis of jid
tyj(jid)
 jid = Joint ID
Returns the torque around y-axis of jid
tzj(jid)
 jid = Joint ID
Returns the torque around z-axis of jid
rxj(jid)
 jid = Joint ID
Returns the rotation around x-axis of jid
ryj(jid)
 jid = Joint ID
Returns the rotation around y-axis of jid
rzj(jid)
 jid = Joint ID
Returns the rotation around z-axis of jid
sxj(jid)
 jid = Joint ID
Returns the spin around x-axis of jid
syj(jid)
 jid = Joint ID
Returns the spin around y-axis of jid
szj(jid)
 jid = Joint ID
Returns the spin around z-axis of jid
##### Discrete particles

Data from discrete particles defined by:
PARTICLE_HE, PARTICLE_AIR, PARTICLE_SOIL.

vmax_dp(sid, option)
 sid = Subdomain ID option = See description
Option = 0: Max velocity
Option = 1: Max velocity in x-direction
Option = 2: Max velocity in y-direction
Option = 3: Max velocity in z-direction

### Control flow

##### Conditional controls

Conditional statements are used to perform different actions based on different conditions. ~if and ~end_if are always required and can be complemented with ~else_if and/or ~end_if

~if condition
~if is used to specify a block of commands to execute if a condition is true. This operation requires a logical condition defined after the input. Multiple ~if statements can be nested.
~else_if condition
~else_if is used to specify a new condition if the previous condition is false. This operation requires a logical condition defined after the input.
~else
~else is used to specify a block of commands to execute if all previous conditions are false.
~end_if
~end_if is used to specify the end of a conditional block. If multiple ~if statements are defined, each one of them needs to be closed with ~end_if.
##### Iterative controls

Commands with iterative input can be defined in a repeat loop instead of being explicitly defined several times. An iterator is assigned for each ~repeat operation. This iterator is defined as a built-in variable named r1. If multiple ~repeat operations are nested, the second dimensioned iterator will be named r2, third r3, etc. Every iterator starts with the value 1 and increments until it reaches the number of specified iterations.

~repeat iterations
~repeat is used to specify a block of commands to execute X number of times. This operation requires a constant after the input defining the number of iterations.