Variables Available to User Functions

This section introduces the variables that are available to user functions.

User functions can access variables of two principal types:

  • Field Functions
  • Stored Variables

Accessing Field Functions in User Functions

Field functions can be accessed in user functions by requesting them with their names enclosed in double-quotes; the syntax depends on whether they are scalar or vector field functions. Temperature would be referred to as “$Temperature”, for example, and velocity as “$$Velocity”. Additionally:

  • Field function arguments are always arrays of cell or face values, even when the fundamental data that they represent is a single value.

    For example “$Iteration” is a cell or face array, each element of which is the iteration number.

  • Scalar field functions have CoordReal elemental type, even when the fundamental data that they represent has a different type.

    For example, whereas the iteration number is an integer, each element of “$Iteration” is the iteration number in CoordReal precision.

  • Similarly, vector field functions have Vector<3, CoordReal> type, even when the fundamental data that they represent has a different type.
  • The report can be accessed as a field function.

    For example, the Cell Count report spawns a CellCountReport field function, which can be requested in a user function as “$CellCountReport”.

Accessing Stored Variables in User Functions

Some quantities in Simcenter STAR-CCM+ are not available as field functions, and must be accessed directly. For example, FaceCellIndex is a stored variable of type Vector<2, unsigned int>.