Specifying the Scalar Values Exchanged with the FMU

The FMU model exposes the scalar variables that are available for exchange in the co-simulation. These variables can represent input, output, parameter, or local variables, as defined by their causality.

For more information on FMU variables and their attributes, see the official documentation.
During co-simulation, Simcenter STAR-CCM+ can:
  • export single-value data to the FMU for it to use as input variables
  • import output variables that are computed by the FMU and use them to set boundary conditions in the Simcenter STAR-CCM+ simulation
  • set parameters that are used in the FMU model
  • track the value of FMU local variables
Simcenter STAR-CCM+ provides two methods for exchanging input and output data with the FMU—co-simulation zones and link value specifications:

  • Co-simulation zones specify a set of Simcenter STAR-CCM+ model parts (boundaries or regions) that exchange data with the FMU. Values that are imported from the FMU through a co-simulation zone are stored as spatially-uniform fields that can be used to set boundary and region settings.
  • Link value specifications are generally useful for exchanging general data that are not necessarily applied to the boundaries or regions. Values that are imported from the FMU through link specifications are stored as single values.

For more information, see FMU Link Reference.

To define the exchange quantities in Simcenter STAR-CCM+, you import the variable settings defined in the FMU. During import, Simcenter STAR-CCM+ automatically populates the relevant nodes (zone Exported Values and Imported Fields, or link Exported Values and Imported Values) based on the FMU input and output variables. Simcenter STAR-CCM+ also populates the Parameters and Tracked Values nodes, located under the [Link 1] > Conditions node, based on the FMU parameters and local variables, respectively. As parameters and local variables only apply to the FMU, they are not exchanged through co-simulation zones.

To determine whether Simcenter STAR-CCM+ creates import and export specifications under co-simulation zones or under the link, you specify the naming convention that Simcenter STAR-CCM+ uses to parse the FMU variable names:

  1. Select the User Libraries > [Imported Library] node and set Variable Naming Convention to one of the following options:
    • Flat—variable names are treated as a single flat string. Depending on the type of variable, Simcenter STAR-CCM+ creates the following nodes:
      FMU Variable Type Example Variable Name Simcenter STAR-CCM+ Imported/Exported Value Node
      Input component1.force [Link 1] > Conditions > Exported Values > component1.force
      Output component1.displacement [Link 1] > Conditions > Imported Values > component1.displacement
      Parameter component1.parameter1 [Link 1] > Conditions > Parameters > component1.parameter1
      Local Variable component1.local1 [Link 1] > Conditions > Tracked Values > component1.local1
    • Structured—variable names that contain a separator are treated as hierarchical names. Simcenter STAR-CCM+ uses hierarchical names to create zones (parameter names, however, are always treated as flat strings). Depending on the type of variable, Simcenter STAR-CCM+ creates the following nodes:
      FMU Variable Type Example Variable Name Simcenter STAR-CCM+ Imported/Exported Value Node
      Input component1.force [Link 1] > Zones > component1 > Conditions > Exported Values > force
      Output component1.displacement [Link 1] > Zones > component1 > Conditions > Imported Fields > displacement
      Parameter component1.parameter1 [Link 1] > Conditions > Parameters > component1.parameter1
      Local Variable component1.local1 [Link 1] > Conditions > Tracked Values > component1.local1
  2. If you selected the Structured option, select the [Imported Library] node and set the following properties:
    Property Setting
    Name Parsing Direction To specify the direction for determining the hierarchy in variable names, choose either Forward (default) or Reverse.
    Hierarchy Separator Specify the character that defines the hierarchy separator (default is ".").
To import the FMU variable settings:
  1. Right-click the [Link 1] node and select Import Settings.
    Simcenter STAR-CCM+ populates the relevant nodes as described previously.
If you are exchanging values using co-simulation zones, specify the model parts (either regions or boundaries) that exchange data with the FMU through the zone. The procedure for assigning boundaries and regions to a zone is similar. For example, to assign a boundary to a zone:
  1. Expand the boundary node of interest, Regions > [Region] > Boundaries > [Boundary].
  2. Select the [Boundary] > Physics Conditions > External Code Coupling Specification node and set External Code Coupling Specification to the relevant co-simulation zone.
To complete the definition of fields imported under a co-simulation zone:
  1. For each node under the [Link 1] > Zones > [Zone] > Conditions > Imported Fields node:
    1. Select the [Imported Field] node and specify where the imported data is mapped by setting the Field Stencil property.
    2. Select the [Zone] > Values > Initialization Values > [Imported Field] node and specify a constant initialization value.
  2. For each zone-imported field, Simcenter STAR-CCM+ creates a field function named Co-Simulation: [Field Name]. Use these field functions to set the relevant boundary conditions. For example, you can use imported displacements to set morphing specifications at boundaries.
To complete the definition of values imported under a link:
  1. For each node under the [Link 1] > Conditions > Imported Values node, select the corresponding [Link 1] > Values > Initialization Values > [Imported Value] node and specify a constant initialization value.
    Simcenter STAR-CCM+ stores the imported value with the name [Link 1].[FMU variable name]. You can reference this value when writing expressions.
To complete the definition of exported values:
  1. Expand the Exported Values node (either under the link or under a co-simulation zone).
  2. For each Exported Values > [Exported Value] node, set Value to the single-value quantity that you want to export to the FMU. Depending on the data type required by the FMU, use one of the following methods:
    Data Type Method for Setting a Value in Simcenter STAR-CCM+
    Integer Type an integer number. You cannot use an expression.
    Real Provide any expression that evaluates to a single value. As FMU variables are spatially-invariant, Simcenter STAR-CCM+ must export single-value data. To convert space-dependent fields to single-values, you can use reports. In Simcenter STAR-CCM+, all reports automatically generate a field function that returns the value of the report at each iteration. You can export this single-value field function to the FMU model.

    Although you can export any data type supported by FMU (real, integer, boolean, string, enumeration), you typically export scalar quantities of type real.

    Enumeration Select an option from a drop-down menu (the FMU model description file contains enumeration type definitions that dictate the available methods)
    String Type the string. You cannot use an expression.
    Boolean Activate the checkbox for true, deactivate the checkbox for false.
    You can visualize the data type of any FMU variable and type definitions by expanding the relevant nodes under the imported library node:



If the FMU model contains adjustable parameters, you can set them in Simcenter STAR-CCM+. To set a parameter:
  1. Select the relevant [Link 1] > Conditions > Parameters > [Parameter] node and set the parameter value.
    Depending on the parameter data type, you can specify the parameter value in different ways, using the same procedure outlined for exported values.
To run the co-simulation:
  1. Click (Run).
    Simcenter STAR-CCM+ loads the FMI library and runs the co-simulation.