# Parameter Operators and Functions

Parameter types of integer, real, and array may be any valid arithmetic expression. Valid expressions consist of the operators +, -, *, /, ^ (for power), parentheses, a set of built-in functions and a set of built-in or user-assigned variables, specified by the ASSIGN command.

The built-in functions are:
Abs(x)
Absolute value of x
Acos(x)
Principal value of arc cosine of x
Asin(x)
Principal value of arc sine of x
Atan(x)
Principal value of arc tangent of x
Atan2(x,y)
Principal value of arc tangent of y/x
Ceil(x)
Smallest integer greater than or equal to x
Cos(x)
Cosine of x
Cosh(x)
Hyperbolic cosine of x
Env("s")
Import environment variables
Exp(x)
Exponential of x
Floor(x)
Largest integer not greater than x
Log(x)
Natural log of x
Log10(x)
Base-ten log of x
Max(x,y)
Maximum of x and y
Min(x,y)
Minimum of x and y
Mod(x,y)
Remainder of x/y
Pow(x,y)
Value of x raised to the power of y (equivalent to x^y)
Sin(x)
Sine of x
Sinh(x)
Hyperbolic sine of x
Sqrt(x)
Square root of x
Tan(x)
Tangent of x
Tanh(x)
Hyperbolic tangent of x
The built-in variables are:
E
2.7182818284590452
PI
3.1415926535897931
EPS
Machine precision, typically 2.2204460492503131E-16
The expressions are evaluated at the time they are encountered in the input file; they are then replaced by their values. The expressions are not transferred to restart files; only their values are. For integer parameters, the final value is converted to an integer. For example,
ASSIGN {
variable                   = SHIFT
value                      = Sin (PI/8 + Asin(.3) )
}
MULTIPLIER_FUNCTION( "shifted half sin" ) {
type                       = cubic_spline
curve_fit_variable         = time
curve_fit_values           = {  0.0, SHIFT + Sin(0.0*PI) ;
0.1, SHIFT + Sin(0.1*PI) ;
...
1.0, SHIFT + Sin(1.0*PI) ; }
}
The special function Env is used to import the value of an environment variable and assign it to a parameter, of any type. Environment variables are typically set at the shell prompt prior to executing a command. The syntax of setting an environment variable depends on the shell and operating system. For example, in a Unix cshell an environment variable is set using the setenv command:
cshell-prompt> setenv INLET_VELOCITY 20
The input file may then contain
SIMPLE_BOUNDARY_CONDITION( "inlet" ) {
...
x_velocity = Env( "INLET_VELOCITY" )

This feature may be combined with any valid arithmetic expression as described above.

The Env function is particularly useful for performing parametric studies. For example, an investigation of the effect of inlet velocity may be automated with the following cshell loop:
foreach vel ( 5 10 15 20 )
echo "Processing velocity " $vel " ..." setenv INLET_VELOCITY$vel
acuRun
acuTrans -out -to stats > STATS.\$vel
end
The operator "." may be used to concatenate strings. This is particularly useful in connection with an Env function. For example, you can define the PROBLEM environment variable with the following command in a bash shell under Linux:
bash-prompt> PROBLEM="channel"
and then use it in the input file as
COORDINATE {
coordinates = Read( Env("PROBLEM") . ".crd" )
}
This is equivalent to
COORDINATE {
}
bash-prompt> EXT="crd"
}