4.2. Using the Function Editor

The Function Editor defines an equation or a function (a series of equations). You use a set of primary variables, equation variables, and mathematical functions to build the equations. Each equation applies to a particular regime. The equations defined for each regime, taken together, define a function, and the function as a whole is applied (for example, as a boundary condition, or to define the nonlinear material behavior for a joint).

The following topics related to the Function Editor component of the Function Tool are available:

4.2.1. How the Function Editor Works

Using the Function Editor is similar to using a scientific calculator. For example, when building an equation, you can:

  • Click buttons on the on-screen keypad.

    The keypad includes the numbers 0-9, parentheses, and a set of mathematical operators. In addition to the default set of operators, you can also click the INV key to access an alternate set of operators.

  • Use any variable name.

    The editor interprets any variable name you type as an equation variable. You can use up to 10 user-defined equation variables in a function (up to six regimes). You can use any name you wish, but Ansys, Inc. recommends against using the same name as one of the primary variables. You define the values for these variables when you load the function (described in Using the Function Loader).

  • Select a primary variable from a drop-down list.

As you build an equation, it appears in standard mathematical syntax in the equation box above the keypad. The various components (primary variables, equation variables, mathematical operators, and numbers) appear in different colors so that you can more easily verify the equation you are entering. You can also graph or list the equation using the GRAPH/LIST button in the Function Editor dialog box; see Graphing a Function for more information about this feature.

Ensuring the Validity of Your Equation

The Function Editor does not validate the equation construction. (Mechanical APDL generates an error message if you enter an inappropriate equation construction.) You must also ensure the mathematical validity of any equation.

Hint: A common error is a divide-by-zero scenario. Another common problem is a negative primary variable; in such a case, multiply the primary variable by -1.

Saving and Retrieving Your Equation

If you intend to use an equation or part of an equation later in the function (such as in another regime), click the STO button to store it. The numbers on the keypad change to a series of memory buffers. Click one of them to store the equation in that memory buffer. Example: To store your equation in the Memory1 buffer, click STO and then M1.)

To retrieve a stored equation, click INV and then INS MEM, followed by the appropriate memory button. The contents of that memory buffer are then displayed in the equation box. You can also recall an abbreviated form of the contents by clicking RCL. If you pause the cursor over a memory button, a tool tip displays the contents of that memory buffer.

4.2.1.1. Selecting Primary Variables in the Function Editor

You can select from among the available primary variables in the Function Editor's drop-down list. Primary variables marked with an asterisk (*) are also available for tabular boundary conditions (BCs). The remaining primary variables are appropriate for use with function BCs only.

  • Time* (TIME)

  • X location* (X) in local global coordinates

  • Y location* (Y) in local global coordinates

  • Z location* (Z) in local global coordinates

    (coordinate system applicability is determined by the *DIM command)

  • Temperature* (TEMP degree of freedom)

  • Fluid temperature (TFLUID) (computed fluid temperature in FLUID116 elements for SURF151 or SURF152 elements)

  • Velocity* (VELOCITY) (magnitude of the Velocity degrees of freedom or the computed fluid velocity in FLUID116 elements)

  • Applied surface pressure* (PRES)

  • Tsurf* (TS) (element surface temperature for SURF151 or SURF152 elements)

  • Density (ρ) (material property DENS)

  • Specific heat (material property C)

  • Thermal conductivity (material property kxx)

  • Thermal conductivity (material property kyy)

  • Thermal conductivity (material property kzz)

  • Viscosity (material property μ)

  • Emissivity (material property ε)

  • Reference location* (Xr) (ALE formulations only)

  • Reference location* (Yr) (ALE formulations only)

  • Reference location* (Zr) (ALE formulations only)

  • Contact pressure (PRESSURE) (used only to define certain real constants for contact elements CONTA172, CONTA174, CONTA175, CONTA177, and CONTA178)

  • Geometrical contact gap/penetration (GAP) (used only to define certain real constants for contact elements CONTA172, CONTA174, CONTA175, CONTA177, and CONTA178)

  • Rotational speed (OMEGS) (rotational speed for SURF151, SURF152, and COMBI214 elements)

  • Rotational speed (OMEGF) (rotational speed for FLUID116 elements)

  • Slip factor (SLIP) (slip factor for FLUID116 elements)

  • Tabular data as a function of frequency of excitation (FREQ)

  • Relative displacement (DJU)

  • Relative velocity (DJV)

4.2.2. Creating a Function with the Function Editor

Access the Function Editor via the GUI in either of the following ways:

  • Main Menu> Solution> Define Loads> Apply> Functions> Define/Edit

  • Utility Menu> Parameters> Functions> Define/Edit

Create a function as follows:

  1. Select the function type. Select either a single equation or a multivalued function. If you select the latter, you must type in the name of your regime variable. This is the variable that governs the equations in the function. When you select a multivalued function, the six regime tabs become active.

  2. Select degrees or radians. This setting determines only how the equation is evaluated and has no effect on *AFUN settings.

  3. Define the result equation (if a single equation) or the equation describing the regime variable (if a multivalued function) using primary variables, equation variables, and the keypad. If you are defining a single-equation function, go to Step 10 to comment and save the equation. If you are defining a multivalued function, continue with Step 5.

  4. Select the Regime 1 tab. Type in the appropriate lower and upper limits for the regime variable you defined under the Function tab.

  5. Define the equation for this regime.

  6. Select the Regime 2 tab. Notice that the lower limit for the regime variable is already defined and unchangeable. This feature ensures that the regimes remain continuous, with no gaps. Define the upper limit for this regime.

  7. Define the equation for this regime.

  8. Continue this process for up to six regimes. You do not have to store or save the individual equations in each regime, unless you wish to reuse the equation in another regime.

  9. Optional: Enter a comment to describe the function. Select Editor> Comment and type your comment in the area provided.

  10. Save the function. Select Editor> Save and type in a name. The filename must have a .func extension.

4.2.3. Using Your Function

After you have defined and saved your function, you can use it in any applicable Mechanical APDL analysis, and any other Mechanical APDL user with access to the file can use it. For example, you could create a corporate library of functions and place them in a common directory that all users can access via a network.

To use the function, you must load it, assign values to any equation variables, and provide a table parameter name for use in a given analysis. Functions are stored in a table array in equation format, not as discrete table values. All of these tasks occur via the Function Loader.