15.2. Expression Syntax

The following sections of this chapter are:

FENSAP-ICE, solnEdit, convertgrid and other Ansys tools share the same syntax for expression evaluation.

An expression is a string defining an algebraic equation to compute a value. Typically, this equation is evaluated at a node or for a specific {X,Y,Z} coordinate.

Example 15.1: Basic Examples

"123" or "100+23" corresponds to the constant value 123.

"X>100" corresponds to 1 if X is greater than 100.


15.2.1. Operators

Arithmetic:

  • is the modulo operator (division remainder). is

  • is for exponent. is

Logical:

  • is "and", is "or".

  • The result of an operation is either 0 or 1.

  • ! is used to reverse a logical value (any nonzero value will be permuted to 0, 0 permuted to 1).

15.2.2. Functions

Table 15.1: Functions

sqrt(), cos(), sin(), tan(), acos(), asin(), atan(), atan2(,), exp()

Mathematical Functions

min(val1,val2), max(val1,val2)

Value Operations - Returns the minimum/maximum of two values

round(), floor(), ceil()

Rounding Functions

fabs()

Absolute Value


Table 15.2: Range Operations

inRange(value,min,max)

Returns 1 if the value within [min,max].

inRangeExcl(value,min,max)

Returns 1 if the value outside [min,max].

valueRange(val,min,max,valIN,valOUT)

Returns valIN if the value is within [min,max], returns valOUT otherwise.

valueRangeExcl(val,min,max,valIN,valOUT)

Same as valueRange, but when the value is outside [min,max].

ifValue(condition,valueTrue,valueFalse)

Returns valueTrue if the condition is true (nonzero), otherwise returns valueFalse.


Table 15.3: File Data

fileData1D(value,"filename")

Reads the filename from the current directory (must be a 1D dataset of N points). The data will be interpolated linearly. Values out of range are clamped to the minimum/maximum data point.

npoints

variable value

variable value

variable value

...

fileData1D File Format


Example 15.2: Linearly Interpolated Data

5

0.5 291.75

0.6 293.4

0.73 295.9935

0.88 299.616

1.2 309.6