Card 9 - EXPRESSION Symbolic Expression Definition

This optional card defines symbolic expressions for various parameters in the model.

Parameters: KODE, N1, T1

KODE

KODE is the code EXPRESSION (or 100)

N1

N1 is the expression number.

An expression cannot have the same number as a table or array in the model. An expression number can be referenced the same way as a table number in most of the places where a table number is accepted. Expressions are mainly supported for the cards and definitions (including emissivity and heat transfer coefficients) where the actual evaluation of the expression or table is done in (or postponed until) the Analyzer module execution. Those normally include, but may not be limited to, INTERP, SINK, PSINK, QNODE, and RELTEMP cards, material properties, thermal couplings, as well as various fields in VOID_NONGEOM, VOID_REGION, TSTREAM, and ZONE_CONVECTION cards.

Expression numbers can also be referenced as dependent variable values in TABDATA cards for tables whose dependent and independent variable types (in TABTYPE card) are TABLE and OPERATION, respectively. This is supported provided that such a TABLE-OPERATION table is not referenced from another expression. For places where a table with number n can be referenced using Tn or -n convention, you can also use the En notation, which is an equivalent intended for cases when n is an expression number.

T1

T1 is the code for the dependent variable type, which has the same meaning and can accept the same values as the dependent variable type in TABTYPE cards

For a list of supported types and for their descriptions, see Card 9 - TABDATA Analyzer Table Data.

T2

T2 is the symbolic expression string, which could be either enclosed in double quotes (") or left unquoted. The expression string consists of:

  • Constants
  • Operators
  • Backed variables
  • Built-in functions
  • Table references (fields) registered functions
  • Punctuation (parentheses and if/then/else statements)

For example:

EXPRESSION9TEMPcos(0.3E2∗time)∗VT(1)∗fd("FieldName(1)")∗thickness/67.89

where:

  • time and thickness are examples of backed variables.
  • cos is a built-in function.
  • VT is a registered function.
  • fd is a reference to a table for a field named "FieldName(1)"
  • 0.3E2, 67.89, 1, and "FieldName(1)" are constants.

The expression strings in the INPF should not contain any unit specifications, such as "[mm/sec]". All unit conversions should be done before the expression string is written to the INPF file. In that expression string all quantities are assumed to be in the same units as in other INPF cards.

Expression constants can be of type:

  • integer, for example 257
  • real, for example 0.1, 1E6, 2.3d4
  • boolean, for example true or false or various capitalized versions of those
  • string enclosed in quotes, for example "string 1(a)#$%^&"

Those are also the types used in arguments or return values of expression functions.

Expression operators include standard mathematical operators (+, -, *, /, and ^ for power), comparison operators (==, !=, <, >, <=, >=), and boolean operators (!, &&, ||). The meaning of those operators (except using ^ for power) is the same as in C or C++ programming languages.

The built-in function symbols include:

  • abs
  • acosine
  • asine
  • atangent
  • atangent2 (two arguments, x and y)
  • ceiling (returns integer for a real argument)
  • cos
  • floor (returns integer for a real argument)
  • hypcos
  • hypsin
  • hyptan
  • log
  • log10
  • max
  • minimum
  • mod
  • pi (pi constant, 3.14159.., no arguments)
  • round (returns integer for a real argument)
  • sin
  • sqrt
  • tan

Note that in the INPF file expression strings, all angular quantities in arguments or return values of those built-in functions should be in degrees, not radians (for example cos(90.0) is the cosine of a 90 degree angle).

Expression backed variables is an Analyzer-supported set of variable names to access various quantities in the expression evaluation context, which is for a given element or conductance number to which the expression is applied at a given moment in the solve integration time, that can be used as independent variables. Many of those names have a corresponding equivalent with the same definition in the list of possible independent variable types for TABTYPE cards, which are listed in the following table. For more information on the types, see Card 9 - TABDATA Analyzer Table Data.

Variable name TABTYPE equivalent Meaning
contact_pressure THMCPRES Contact pressure
fluid_temperature Fluid temperature at associated fluid element
gap_distance THMCDISP Gap distance
heat_flow_rate QNODE Heat flow rate
mass_flow_rate MASSFL Mass flow rate at associated fluid element
nx x component of the unit normal vector for the associated surface element
ny y component of the unit normal vector for the associated surface element
nz z component of the unit normal vector for the associated surface element
pressure PTOTAL Total fluid pressure at associated fluid element
radius Radius value at element CG
rotational_speed Rotational speed at element CG
swirl_velocity Swirl velocity at element CG
temperature TEMP Temperature
temperature_difference TDIFF Temperature difference
thermal_capacitance CAP Thermal capacitance
thickness Shell element thickness
time TIME Simulation time
velocity VELOC Flow velocity
volume_flow_rate VOLUME Volume flow rate
x x coordinate at element CG
y y coordinate at element CG
z z coordinate at element CG
Expression fields (table references) have the form fd(...), which is a symbolic function call with a string argument (double-quoted) containing the name of the corresponding table. That name should be defined using an EXPTAB card, which associates the name to a table number. For simple table names (without spaces or special characters), you can put those names (without quotes) directly in expressions as variable names, such as backed variables without wrapping them in fd(...) calls.

EXPRESSION 14 QNODE 2.0*(fd("Field Name (1)"") + Table2)
EXPTAB  15 "Field Name (1)"
EXPTAB  16 Table2
TABTYPE 15 VALUE EID
TABDATA 15 ...
TABTYPE 16 VALUE TIME
TABDATA 16 ...

Parentheses, with any number of matching “(” and “)”, could be used to structure an expression. The if-then-else construct can be used according to the following syntax:

if <expr1> then <expr2> else <expr3>

For example:

EXPRESSION46COND if (gap_distance>0) then fd("Table8") else fd("Table9")

Note that spaces are required before and after each of the “if”, “then”, and “else” keywords.

Other functions, besides the built-in functions and fd(...) fields, should be registered in the expression evaluation system by loading plugins (dynamic library files loaded at run time by the solver) that contain definitions (names, numbers and types of mandatory and optional arguments, type of the return value) and implementations of those functions. A generally available standard set of registered functions is supported through solver built-in plugins that are distributed with the thermal solver executable. Those ones include general function, solution-dependent function, and fluid properties function plugins. Other functions that are not part of that pre-supplied set can be registered by loading additional user-provided plugins specified by EXPPLUGIN cards.

Registered functions can have required and optional arguments (parameters) or no arguments. In the latter case, the parentheses “()” should still follow the function name. When optional arguments for a given function are not provided, then their function-specific defaults are used. For example, possible uses of required and optional arguments of the function ABS2REL could be:

ABS2REL(300.0)
ABS2REL(300.0,0.99*radius)
ABS2REL(300.0,radius,0.5*rotational_speed)
ABS2REL(300.0,radius,rotational_speed,0,0.5*
swirl_velocity)

To set a desired optional argument (for example, the third one) one should also provide all of the preceding ones (for example, the first two).

Note that when there are expressions with significant sensitivity to temperature through backed variables or registered functions and/or there are expressions with critical inter dependencies (an expression result on one boundary condition depends on the quantities on another boundary condition which is governed by another expression), then use of the fully implicit integration method setting for GRADNT field on Card 2b is recommended for increased accuracy and consistency of the results.

The following table lists registered functions from the general category.

Function name Required parameters Output
KU Temperature value to be converted to Kelvin units Converts a temperature value from the solve units to degrees Kelvin and returns it as a unitless quantity.
R Name of a named point Returns the radius from the current rotation axis to a named point.
THICK Name of a named point Returns the local shell thickness at a named point.
X Name of a named point Returns the X coordinate of a named point.
Y Name of a named point Returns the Y coordinate of a named point.
Z Name of a named point Returns the Z coordinate of a named point.

The following table lists registered functions from the solution dependent category.

Function name Required parameters Optional parameters Output
CHRS TSTREAM card ID Returns the convective heat flux for stream ID.
CHRV VOID_REGION card ID Returns the convective heat flux for void ID.
CHRZ ZONE_CONVECTION card ID Returns the convective heat flux for zone ID.
DR Name of a named point Returns the change in radius of a named point from the current rotation axis due to structural displacement.
DX Name of a named point Returns the change in coordinate X of a named point due to structural displacement.
DY Name of a named point Returns the change in coordinate Y of a named point due to structural displacement.
DZ Name of a named point Returns the change in coordinate Z of a named point due to structural displacement.
GAPD Name of a named point Returns the local gap distance at a named point.
MF Name of a named point Returns the local mass flow at a named point.
ONEOF Double precision values Returns the first value that is defined from two or more arguments.
PR Three double-precision values Returns the first argument that is defined from one required and two optional arguments. During evaluation, it generates a printout of the arguments.
PWR TSTREAM card ID Returns the power input from feeding the specified stream into a void.
PWRV

Mass flow from the void to another void,

THERMAL_VOID card ID

Returns the power input from feeding the specified void into another void.
RLD Name of the CURVE defined by the Card 9 - CURVE Returns the closest distance to the curve.
RS Name of a named point Returns the local rotational speed at a named point.
SA TSTREAM card ID Returns the element selection area for stream ID.
SAC TSTREAM card ID Returns the corrected convecting area for stream ID.
SAC2 TSTREAM card ID Returns the corrected convecting area of one side of a two-sided stream ID.
SMO TSTREAM card ID Returns the outlet mass flow for stream ID.
SP TSTREAM card ID Returns the pressure for stream ID.
SSV TSTREAM card ID Returns the swirl velocity for stream ID.
STI TSTREAM card ID Returns the total absolute or relative inlet temperature for stream ID.
STMO TSTREAM card ID Returns the outlet metal temperature for stream ID.
STO TSTREAM card ID Returns the total absolute or relative outlet temperature for stream ID.
TEMP Name of a named point Returns the local solid temperature at a named point.
TEMPF Name of a named point Returns the local fluid temperature at a named point.
THRS TSTREAM card ID Returns the total convective heat flux plus the heat pickup for stream ID.
THRV VOID_REGION card ID Returns the total convective heat flux plus the heat pickup for void ID.
THRZ ZONE_CONVECTION card ID Returns the specific heat ratio of a fluid at the given temperature for zone ID.
VA VOID_NONGEOM card ID VOID_REGION card ID Returns the element selection area for void ID or one of its regions.
VAC VOID_REGION card ID Returns the corrected convecting area for void ID.
VP VOID_NONGEOM card ID VOID_REGION card ID Returns the pressure for void ID or one of its regions.
VSV VOID_NONGEOM card ID VOID_REGION card ID Returns the swirl velocity for void ID or one of its regions.
VT VOID_NONGEOM card ID VOID_REGION card ID Returns the total absolute or relative temperature for void ID or one of its regions.
ZA ZONE_CONVECTION card ID Returns the element selection area for convecting zone ID.
ZAC ZONE_CONVECTION card ID Returns the corrected convecting area for zone ID.
ZP ZONE_CONVECTION card ID Returns the pressure for convecting zone ID.
ZSV ZONE_CONVECTION card ID Returns the swirl velocity for convecting zone ID.
ZT ZONE_CONVECTION card ID Returns the total absolute or relative temperature for convecting zone ID.

Note that for the functions that return pressure, swirl, or temperature for convecting zone, void, or stream BCs (ZT, ZP, etc), when there are spatial variations of that quantity along the BC, then the output result is the maximum value over those spatial variations. In the functions where temperature is returned, the temperature is either total absolute or total relative temperature, depending on the type of rotational effects specified in the ROT_FXS option of the ROT_FX card, referenced in the given BC.

The following table lists registered functions from the additional solution dependent category.

Function name Required parameters Optional parameters Output
ABS2REL Total absolute temperature Radius,

rotational speed,

fluid swirl velocity,

fluid material index

Returns the total relative temperature of an input total absolute temperature.
ABS2REL_SR Total absolute temperature Radius,

rotational speed,

fluid swirl ratio,

fluid material index

Returns the total relative temperature of an input total absolute temperature.
HTCFORCE Hydraulic radius,

correlation type (PLATE, PLATE_ENV, DUCT, DUCT_FULL)

Characteristic length,

fluid velocity,

convection side

Returns the heat transfer coefficient for the specified forced convection correlation. Depending on the specified correlation type, different equations are used:
  • For PLATE correlation, the thermal solver uses equations for the NEARC4 option.
  • For PLATE_ENV correlation, the thermal solver uses equations for the FORCEDPASN option. You must also specify the convection side: 1, 2, or 3 respectively indicating that the top, bottom, or both plate sides convect. For two-layer shells and multi-layer shells, the thermal solver only computes and returns the top side heat transfer coefficient regardless of the specified convection side.
  • For DUCT correlation, the thermal solver uses equations for the NEARC12 option.
  • For DUCT_FULL correlation, the thermal solver uses equations for the NEARC1 option.

These options are described in Card 6e - Thermal Coupling Request Card - Optional and Forced Convection Conductances.

HTCFREE Correlation type (HORIZONTAL, INCLINED),

convection side (TOP, BOTTOM, BOTH)

Characteristic length,

perimeter

Returns the heat transfer for the specified free convection correlation. Depending on the specified correlation type, different equations are used:
  • For HORIZONTAL correlation, the thermal solver uses equations for the PLATEH and PLATEHASN options.
  • For INCLINED correlation, the thermal solver uses equations for the PLATE and PLATEASN options.

The convection side indicates which plate sides convect: top, bottom, of both sides. For two-layer shells and multi-layer shells, the thermal solver only computes and returns the top side heat transfer coefficient regardless of the specified convection side.

These options are described in Card 6e - Thermal Coupling Request Card - Optional and Free Convection Conductances.

MIX TSTREAM card ID,

TSTREAM card ID

Up to 8 more TSTREAM card IDs Returns the temperature that results from mixing the flows of two or more streams.
MMIX TSTREAM card ID,

TSTREAM card ID

Up to 8 more TSTREAM card IDs Returns the mass flow rate that results from mixing the flows of two or more streams.
REL2ABS Total relative temperature Radius,

rotational speed,

fluid swirl velocity,

fluid material index

Returns the total absolute temperature of an input total relative temperature.
REL2ABS_SR Total relative temperature Radius,

rotational speed,

fluid swirl ratio,

fluid material index

Returns the total absolute temperature of an input total relative temperature.
REL2REL Total relative temperature,

rotational speed at input,

fluid swirl velocity at input

Rotational speed at output,

fluid swirl velocity at output,

radius,

fluid material index

Converts the input total relative temperature at input rotational speed and swirl velocity to the equivalent output relative temperature at output (or current) rotational speed and swirl velocity. Both relative temperatures are evaluated at the same rotation radius.
REL2REL_SR Total relative temperature,

rotational speed at input,

fluid swirl ratio at input

Rotational speed at output,

fluid swirl ratio at output,

radius,

fluid material index

Converts the input total relative temperature at input rotational speed and swirl ratio to the equivalent output relative temperature at output (or current) rotational speed and swirl ratio. Both relative temperatures are evaluated at the same rotation radius.

The following table lists registered functions from the fluid properties category.

Fluid Function Required parameters Optional parameters Output
CONDFL Temperature Fluid material index Returns the thermal conductivity at a specified temperature for the fluid material.
DENSFL None Temperature,

pressure,

fluid material index

Returns the mass density at a specified temperature for the fluid material.
ENTHFL Temperature Fluid material index Returns the specific enthalpy at a specified temperature for the fluid material.
GAMMAFL Temperature Fluid material index Returns the ratio of specific heats at a specified temperature for the fluid material.
RE None Temperature,

radius,

rotational speed,

pressure,

fluid material index

Calculates the local rotational Reynolds number for the fluid material.
SPECFL Temperature Fluid material index Returns the specific heat at constant pressure of the fluid at a specified temperature for the fluid material.
VISCFL Temperature Fluid material index Returns the dynamic viscosity at a specified temperature for the fluid material.