Referencing Field Functions, Coordinate Systems, and Reference Frames

The syntax for referencing field functions, coordinate systems, and reference frames is presented below.

Referencing Field Functions

When you reference a field function, you use the field function name that is specified in the Function Name property. Names are case-sensitive and must be entered in the expression exactly as they are shown in the function name.

If the name contains any non-alphanumeric characters apart from ‘_’, enclose the field function name in curly braces, ‘{}’. Also use curly braces if the name begins with a number, or if you are referencing object names that include characters from non-Western alphabets. Some examples of referencing such names are:

  • ${Five Things}
  • ${Temp@X}
  • ${3rdInletMassflow}
  • ${test-Temperature}
When defining spatially-invariant quantities, an expression must only reference spatially-invariant field functions. Variables such as $Time, $TimeStep, and $Iteration, as well as the field functions associated with reports, are valid. Variables such as $Temperature or $Pressure have different values at every different point in space and cannot be used. For more information, see Context and Data Types. If you wish to reference chosen field function data from previous time-steps or iterations, first set up a field history monitor. See Accessing Field Data from Previous Time-Steps or Iterations.
Scalar Field Functions
To reference a scalar field function, use the dollar symbol $ followed by the function name (as defined in the Function Name property). For example:
  • $Temperature
  • 0.5*${Temp@X}
Vector Field Functions
To reference a vector, array, or position field function, use two dollar symbols $$ followed by the function name (as defined in the Function Name property). For example:
  • $$Velocity
  • $${User-defined Force}
Components of a Vector Field Function
To reference the components of a vector, array, or position field function, reference the field function with the relevant component within square brackets. For example, to define a new scalar function as the sum of the Cartesian components of velocity, you define it in terms of the velocity vector as:
$$Velocity[0] + $$Velocity[1] + $$Velocity[2]
Symmetric Tensor Field Functions
To reference a tensor field function, use three dollar symbols $$$ followed by the function name (as defined in the Function Name property). For example:
  • $$$StrainTensor
  • $$$StressTensor
Components of a Symmetric Tensor Field Function
To reference the components of a tensor field function, reference the field function with the relevant component within square brackets. For example, to reference the component a 01 of the symmetric tensor Tensor-1, you use:
$$${Tensor-1}[0,1]

Referencing Local Coordinate Systems

For transformations between coordinate systems, Simcenter STAR-CCM+ makes a distinction between vector and position field functions.

For example, let C denote a local Cartesian coordinate frame with origin (position) O and orientation matrix R, whose columns are the orthonormal basis vectors of C with respect to the Laboratory frame. The transformation of a vector v, from laboratory coordinates into C, is given by:

Figure 1. EQUATION_DISPLAY
vC=RTv
(6)

However, transforming a point p from the Lab frame into C requires subtraction of the local origin O from p, then computing the coordinates of p within the local frame:

Figure 2. EQUATION_DISPLAY
pC=RT(pO)
(7)

The transformations of a vector and a position from C into the Laboratory frame are:

Figure 3. EQUATION_DISPLAY
v=RvC
(8)

and:

Figure 4. EQUATION_DISPLAY
p=RpC+O
(9)

There is a syntax to transform position-type and vector-type fields to different local coordinate systems. For example:

$$Position(@CoordinateSystem("Laboratory.Coordinate System
1"))

transforms the Position field from the Laboratory frame to the Coordinate System 1 frame. For positions, components of the vector are in the units of the coordinate system specified:

  • If the coordinate system is Cartesian, $$Position(@CoordinateSystem("Laboratory.CartesianSystem")) is [X,Y,Z].
  • If the coordinate system is cylindrical, $$Position(@CoordinateSystem("Laboratory.CylindricalSystem")) is [radius, theta, z].
  • If the coordinate system is spherical, $$Position(@CoordinateSystem("Laboratory.SphericalSystem")) is [radius, theta, phi].

For cases where local coordinate systems have one or more levels of nesting, use the qualifier @CoordinateSystem and separate each coordinate system from its parent using the . character. As an example, consider a field function that gives the position in the Spherical 1 local coordinate system for the simulation tree below:



The expression would be written as:

$$Position(@CoordinateSystem("Laboratory.Initial ship
orientation.Spherical 1"))

The Boat-CSys coordinate system would be referred to as:

$$Position(@CoordinateSystem("Laboratory.Boat-CSys"))
NoteThe differences between the Position and Centroid fields are important:
  • Position gives the coordinates of either the vertices or the cell centers, depending on the smooth flag.
  • Centroid specifically gives the geometric centroid of the cells of the simulation mesh.

In general, Position should be used within user field function expressions since it provides the appropriate geometric location without any interpolation, even on derived parts. In post-processing operations, such as reporting and plotting, Position uses the appropriate geometric location on the geometry with respect to the smooth flag. If the smooth flag is set, the vertex locations are used. If the smooth flag is not set, the cell, face, or line segment centers are used. The Centroid field, however, specifically refers to the geometric centroid of the cells or faces of the simulation mesh. If the smooth flag is set during a visualization or analysis operation, Centroid is interpolated like any other field to the vertex locations of the simulation mesh or the derived part, possibly introducing small interpolation errors.

Referencing Velocity in a Local Reference Frame

Using field function syntax, you can convert velocity in the laboratory coordinate system to the equivalent velocity in a local reference frame. For example:

$$Velocity(@ReferenceFrame("Rotating"))

This function yields a vector of Velocity in the local reference frame named Rotating.