Skip to main content

Steps to perform mapping

This section describes the mapping workflow. It also provides simple APIs implementation examples. The details of the mapping algorithms can be found in the System Coupling User’s Guide. The steps involved in setting up and executing mapping of data are shown in Figure 1 and described in more details below. Figure 1: Sequence of steps to execute mapping
Figure 1: Sequence of steps to execute mapping
The steps are described in more detail below. A couple of code examples for each target language is provided at the end of this section.

Step 1: Start

Start by initializing the participant library in standalone mode. If using C++ or Python languages, this step involves instantiating the SystemCoupling class (there can only be a single instance of this class at a time) after providing the ParticipantInfo structure with appropriate value set correctly. If using C or Fortran languages, in most cases nothing needs to be done for this step. However, if distributed parallel capabilities of the SCP are required, then syscStartStandaloneParallel function in C or syscStartStandaloneF function in Fortran must be called and appropriate arguments (for example, the MPI communicator) should be provided to those functions. See Execution in a Parallel Environment for more details.

Mapping across multiple applications

See Steps to perform data transfers for details on how to establish communication between multiple applications using SCP library.

Step 2: Set up mapping

Create and register variables, regions and coupling interfaces.

Step 3: Register heavyweight data access

In this step, the callback functions to access the participant’s mesh and solution data must be registered. See Access to heavyweight data for more details.

Step 4: Update inputs

During this step, mapping will be performed, and inputs (target values) will be brought up-to-date. The latest output (source) values on the source side of the interface will be used to fill the inputs. Inputs update can be performed multiple times. If the source values change, this will be reflected in the target values.

Mapping examples

Sample code is provided, demonstrating the use of the participant library APIs to perform mapping. For information on how to compile the code in these examples, see Compiling, linking, and executing applications that use the Participant library.

Surface mapping example

In this example, the solution data is mapped between two surface regions. The mesh in each region consists of a single (unit square) quadrilateral element. The variable to be transferred from source to target is a scalar defined on elements. The variable is set to be extensive, although the choice of whether the variable is extensive or intensive is insignificant here, since the meshes are conformal. The value on the source element is set to 33.3. Since the meshes are identical on source and target, the expected result of mapping is that the target value also becomes 33.3. Figure 2 illustrates the problem setup. Figure 2: Simple surface mapping example
Figure 2: Simple surface mapping example

C++

If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

C

If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

Fortran

If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

Python

If the participant is 2D, the surface mesh is defined on a two-dimensional plane. Thus, 2D vector data can be used to express nodal coordinates. The above code can be modified as follows:

Volume mapping example

In this example, the solution data is mapped between two volume regions. The mesh in each region consists of a single (unit cube) hexahedral element. The variable to be transferred from source to target is a scalar defined on nodes. The variable is set to be intensive. The values on the source element are set to 33.3. Since the meshes are identical on source and target, the expected result of mapping is that the target values also become 33.3. Figure 3 illustrates the problem setup. Figure 3: Simple volume mapping example
Figure 3: Simple volume mapping example

C++

C

Fortran

Python