Completing the System Coupling Participant Setup
Last update: 10.07.2023
Completing the System Coupling Participant Setup
During the setup stage, the participant setup information is communicated to System Coupling. As mentioned earlier, there are two approaches to communicate the setup. The first approach is the SCP file approach and the direct setup apprach.
The SCP File Approach
The SCP file approach entails generating an XML-formatted file that contains the participant setup information that is relevant to System Coupling. More information about the SCP file format can be found in the System Coupling User's Guide.
Some of the advantages of this approach are:
- The user can easily review and modify the SCP files before starting System Coupling.
- It is a light-weight file in the sense that it does not contain the actual mesh and solution data.
- If desired, the participant library APIs can be implemented to generate the SCP files.
Some of the disadvantages of this approach are:
- This is an extra file that needs to be generated during the setup.
- The SCP file must be consistent with the participant setup. If the setup changes, the SCP file may have to be re-generated.
The Heat Transfer in Square Channel Air Flow tutorial demonstrates how the SCP file can be used during the setup stage to add the participant to the coupled analysis.
The Direct Aproach
The direct setup approach requires starting System Coupling first, and then adding the participant by specifying the path to the participant executable (as well as working directory and any additional command line arguments). System Coupling invokes the participant in setup mode by adding --scsetup
command line argument, along with the host, port, and participant name arguments. See Command Line Arguments for Participant Solvers for more details on the command line arguments. The participant in setup mode connects to System Coupling and the setup is communicated. Once the participant in setup mode is shut down, the participant is added to the System Coupling datamodel and the participant setup is complete.
Some of the advantages of this approach are:
- Fewer files are involved in the coupled analysis setup (i.e. no SCP files)
- It is easier to ensure that System Coupling always has updated setup information (SCP files can go out-of-sync).
- This is potentially a more streamlined approach - the participant setup and the coupled analysis setup can be merged into a single step.
Some of the disadvantages of this approach are:
- Adding the participant may take longer if the participant has to read the mesh during the setup
The Oscillating Plate Damping tutorial demonstrates how the participant library can be used during the setup stage to add the participant to the coupled analysis.
Note that it is not necessary that the same executable is invoked during the setup and during the solve stages. The recommended approach is to create a wrapper (e.g. batch or shell script) that can parse the command line arguments provided by System Coupling, as is shown in the tutorials. If it is desirable to invoke a different executable depending on whether it is a setup or a solve stage then this wrapper script can decide which executable to invoke based on whether the --scsetup
argument is provided. This wrapper script should then be provided to System Coupling as the participant executable.
Steps to Complete the Participant Setup
The sequence of steps to be traversed during the participant setup is shown in Figure 1.
Figure 1: Sequence of Coupled Participant Setup Steps
Step 1: Start in Standalone Mode or Connect to System Coupling
If using the SCP file approach, start the participant in standalone mode. If using the direct setup approach, connect to System Coupling by providing the host name, port number, participant name, and build information.
C++
SCP file approach:
Direct setup approach:
C
SCP file approach: nothing to be done.
Direct setup approach:
Fortran
SCP file approach: nothing to be done.
Direct setup approach:
Python
SCP file approach.
Direct setup approach:
Step 2: Set Up the Coupled Participant
Create and register regions and variables relevant to the coupled analysis.
In the following code example, two regions (region A and region B) are registered. Also, two variables (variable X and variable Y) are registered as inputs and outputs on regions A and B.
C++
C
Fortran
Python
Step 3: Complete Setup
Specify other participant setup information and complete the coupled analysis setup.
C++
C
Fortran
Python
Step 4: Write the Setup File/Shutdown
This step is reached after the participant setup is complete.
Write the SCP file (if using the SCP file approach).
System Coupling will be disconnected (if using the direct approach). The participant in setup mode should proceed to an orderly shutdown after this step.
C++
SCP file approach:
Direct setup approach: in C++, disconnection occurs when sysc::SystemCoupling
object is destroyed.
C
SCP file approach:
Direct setup approach:
Fortran
SCP file approach:
Direct setup approach:
Python
SCP file approach:
Direct setup approach: in Python, disconnection occurs when sysc.SystemCoupling
object is destroyed.