Building valid expressions

Expression fields describe the variation of a parameter for selected interactions and prescribed conditions (such as a pressure magnitude) at a point in space. You create an expression field by building a mathematical expression in the expression field editor. To locate the expression field editor, select ToolsAnalytical FieldCreate from the main menu bar.

Expression fields indicate points in space using coordinates of the global coordinate system or of a local coordinate system. In the expression field editor, these coordinates are listed as Parameter Names. By default, the expression is built using the coordinates of the global coordinate system (X, Y, and Z parameter names). The parameter names that are available depend on the type of coordinate system that you select, as shown in Table 1. For cylindrical and spherical coordinate systems, the values for Th and P are evaluated in radians in the range from -π to π.

Table 1. Relationship between coordinate system types and parameter names in the expression field editor.
Coordinate system type Parameter Parameter names
Rectangular or Global (default) X-, Y-, and Z-axes X, Y, Z
Cylindrical R-, θ-, and Z-axes R, Th, Z
Spherical R-, θ-, and ϕ-axes R, Th, P

An expression is composed using one or more parameter names and one or more operators. You can build the mathematical expression in the expression window of the editor by selecting the parameter names and operators from lists or by typing the parameter names and operators directly into the expression window. Parameter names and operators are case sensitive. Expressions use the syntax required by Python; entries containing errors will generate standard Python errors. See Operations and functions in expressions for information on supported operators.

The following examples demonstrate valid expressions.

Example 1

To define a spatial variation with linear distance along a face, type:

4.5 * X + 2.75

in the expression window of the editor. X is the parameter name representing the distance along the face.

Example 2

To define a more complex spatial variation in a cylindrical coordinate system, type:

R + sin(Th*pi/2)

in the expression window of the editor.

For detailed information, see Creating expression fields.