ExpressionFunction (object)

Use ExpressionFunction objects to make the return value(s) from external Python functions available for use in expressions. For example, an external Python function that parses simulation output and returns a real value could be used to adaptively set the time step size.

Expression function objects are assigned default internal names according to the convention Function<#>, where "#" is an index indicating the order in which functions were created. For example, if three expression functions are added to an analysis, then they are named Function1, Function2, and Function3.

Expression function objects and their parameters must conform to Python's naming and definition requirements. For more detailed information, see the resources published by the Python Software Foundation.

Once the expression function object has been added to the data model, you can reference it by name in expressions. Each time the coupled analysis is opened, its module is loaded at initialization and the function becomes available for use. Once in use, a function cannot be deleted.

For more information, see Python Expression Functions in the System Coupling User's Guide.


Note:  The default internal object name assigned by System Coupling must be used when referencing the function from the command line.



Tip:  Shown in the GUI as the Library | Expression Function branch.


*Module (setting)

Python module containing the definition of the Function to be added to the coupled analysis.

A module of the specified name must exist in the user-created Modules subdirectory in System Coupling's working directory.

Modules are processed once per System Coupling session. Any changes made to a module during a coupling session are not saved to the session and will not be applied until the next session.


Tip:  Shown in the GUI as the Library | Expression Function | Module setting.


*Function (setting)

Python name of the function to be added to the coupled analysis.

The specified function must be defined in the Python module specified by the Module setting.

Duplicate functions may exist in the analysis, but each must have a unique FunctionName. Note that the Python function name may differ from the FunctionName defined in System Coupling, which in turn may differ from the name of the ExpressionFunction object.


Tip:  Shown in the GUI as the Library | Expression Function | Function setting.


*FunctionName (setting)

Name to be referenced when using the function in an expression.

This value is shown in user-facing communications, including System Coupling's GUI, Transcript/Log files, and EnSight-formatted results.

If not specified, the FunctionName setting will default to the same value as the Function setting.

Expression function names must be unique within the analysis. If duplicate function names are detected, then you will receive a validation error and must correct the duplication by editing the FunctionName value for one or more function objects.

The name must conform to Python's naming requirements. For more detailed information, see the resources published by the Python Software Foundation.

Note that the FunctionName defined in System Coupling may differ from the Python function name defined in the associated module.


Tip:  Shown in the GUI as the Library | Expression Function | Function Name setting.