The arithmetic IF function allows you to conditionally define a function expression.
IF (expression 1: expression 2, expression 3, expression 4)
ADAMS/Solver (FORTRAN) evaluates expression 1.
If the value of expression 1 is less than zero, the arithmetic IF is evaluated using expression 2.
If the value of expression 1 is zero, the arithmetic IF is evaluated using expression 3.
If the value of expression 1 is greater than zero, the arithmetic IF is evaluated using expression 4.
The arithmetic IF function allows you to conditionally define a function expression.
Format
IF (test : lt, eq, gt)
Arguments
|
test |
Any valid function expression. ADAMS/Solver (FORTRAN) evaluated the test expression to determine which branch of the arithmetic IF, lt, eq, or gt is selected. |
|
lt |
Any valid function expression. If the value of the test expression is less than zero, ADAMS/Solver (FORTRAN) evaluates the lt expression and the IF function takes the value of lt. Otherwise, the lt expression is not evaluated. |
|
eq |
Any valid function expression. If the value of the test expression is equal to zero, ADAMS/Solver (FORTRAN) evaluates the eq expression and the IF function takes the value of eq. Otherwise, the eq expression is not evaluated. |
|
gt |
Any valid function expression. If the value of the test expression is equal to zero, ADAMS/Solver (FORTRAN) evaluates the gt expression and the IF function takes the value of gt. Otherwise, the gt expression is not evaluated. |
Cautions
When using an arithmetic IF function, ensure that the resulting function is continuous. If the function is discontinuous, ADAMS/Solver (FORTRAN) may fail to find a solution when it encounters the discontinuity. Even the greater reliability can be achieved if continuity of the first derivative can be ensured.
Much greater care is required when using an arithmetic IF function to define a MOTION element. In this case, a continuous second derivative is also required. The use of arithmetic IF functions to define MOTION is best avoided.
Examples
-6*IF(VR(10,31): 0, 0, VR(10,31)**3)
This function is interpreted as follows:
- If the radial velocity (see VR) between Markers 20 and 31 is less than or equal to zero, the value is zero.
- If the radial velocity between Markers 10 and 31 is greater than zero, the value is -6*VR(10,31)**3.