Main Help → All Commands → Language Reference → User-Defined Functions
When a user-defined function option is allowed in any command, you can enter any valid function of the following variables when doing MPM simulations:
x
- x position in length unitsy
- y position in length unitsz
- z position in length unitst
- current time in alt time unitsdt
- the time step in alt time unitsq
- particle rotation in radians about the z (or θ if axisymmetric) axisFor FEA calculations, the following variables are allowed and may refer to position of element centroid or node depending on the command:
x
- x position in length unitsy
- y position in length unitsr
- radial position of axisymmetric calculations in length units (synonym for x
)z
- axial position of axisymmetric calculations in length units (synonym for y
)When a function is used, it will be calculated using these variables and should return a result in the units expected by the command.
Note that commands that allow functions may only allow a subset of these variables (due to command context). You can refer to each command for the allowed variables. For example, some MPM options require the function to depend only on time. Particle-based MPM boundary conditions let the function depend on clockwise particle rotational angle q about the z
axis (in radians), which allows rotation of the boundary conditions with the particle. Note that q is particle rotation since the start of the simulation and will differ from material angle if the particle started with a non-zero orientation angle (i.e., the current material angle is the sum of q
and its initial angle).
When setting up MPM simulations or FEA calculations, a few more variables are sometimes allowed:
R
- radial position in length units for axisymmetric calculation; R
is a synonym for x
, which also worksZ
- axial position in length units for axisymmetric calculation; Z
is a synonym for y
, which also worksD
- distance from origin in length unitsT
- counter-clockwise angle (in radians) from the positive x axis (i.e., θ in polar coordinates)Here (R,Z)
are axisymmetric coordinates and (D,T)
are polar coordinates, where D
is distance from the origin to the (x,y)
(or (R,Z)
if axisymmetric) point and T
is counter-clockwise angle from the positive x
(or R
if axisymmetric) axis to the point. These extra variables are only allowed in:
Some details on entering functions are:
x^2+y^2
") to prevent it from being evaluated as a command expression prior to being used in the analysis.
x
, y
, etc., and not with the preceding "#
" used for command expression variables.
pi
(or Pi
or PI
) for the number π.
e
" or "E
" for powers of ten such as 1.4e3
for 1400
.