7.1
general documentation
Code coupling

Introduction

C user functions for code coupling.

Several functions are present in the file, each specific to different kind of couplings.

Global options for coupling

One can define global options for coupling with the user function cs_user_parameters. using cs_coupling_set_sync_flag allows defining the time step synchronization policy:

cs_coupling_set_sync_flag(PLE_COUPLING_TS_MIN);

A time step multiplier between coupled tools may also be defined. The apparent time step for the current instance times (as viewed by coupled codes) is equal to the true time step times this multiplier.

When coupling with SYRTHES, it is recommended to use the same multiplier here as for the thermal variable time step (this is not automated, so as to allow for more advanced combinations if necessary, so the user should ensure this when using a time step multiplier). For example:

Code coupling with SYRTHES

The cs_user_syrthes_coupling subroutine defines a or multiple couplings between Code_Saturne and SYRTHES by calling the cs_syr_coupling_define function for each coupling to add.

The following lines of code show different examples of coupling with SYRTHES.

Example 1

{
int verbosity = 1, plot = 1;
float tolerance = 0.1;
bool allow_nonmatching = false;
/*-------------------------------------------------------------------------
* Example 1:
*
* Boundary faces of group '3' coupled with instance named 'SYRTHES_01'.
*-------------------------------------------------------------------------*/
cs_syr_coupling_define("SYRTHES_01",
"3", /* boundary criteria */
NULL, /* volume_criteria */
' ', /* projection_axis */
allow_nonmatching,
tolerance,
verbosity,
plot);
}

Example 2

{
int verbosity = 1, plot = 1;
float tolerance = 0.1;
bool allow_nonmatching = false;
/*-------------------------------------------------------------------------
* Example 2:
*
* Boundary faces of group 'Wall' coupled with 2D SYRTHES instance
* named 'SYRTHES_02'.
*-------------------------------------------------------------------------*/
cs_syr_coupling_define("SYRTHES_02",
"Wall", /* boundary criteria */
NULL, /* volume_criteria */
'z', /* projection_axis */
allow_nonmatching,
tolerance,
verbosity,
plot);
}

Example 3

{
int verbosity = 1, plot = 1;
float tolerance = 0.1;
bool allow_nonmatching = false;
/*-------------------------------------------------------------------------
* Example 3:
*
* Cells in box with corners (0, 0, 0) and (1, 1, 1) coupled with
* SYRTHES instance named 'Solid' (volume coupling).
*-------------------------------------------------------------------------*/
NULL, /* boundary */
"box[0., 0., 0., 1., 1., 1.]", /* volume */
' ', /* projection */
allow_nonmatching,
tolerance,
verbosity,
plot);
}

Code coupling with other instances of Code_Saturne

The cs_user_saturne_coupling allows one to couple different instances of Code_Saturne by calling the cs_sat_coupling_define function for each coupling to add.

Two examples are provided hereafter.

Example 1

{
int verbosity = 1;
/*-------------------------------------------------------------------------
* Example 1: coupling with instance "SATURNE_01".
*
* - coupled faces of groups "3" or "4"
* - all cells available as location support
*-------------------------------------------------------------------------*/
cs_sat_coupling_define("SATURNE_01",
"3 or 4",
NULL,
NULL,
"all[]",
verbosity);
}

Example 2

{
int verbosity = 1;
/*-------------------------------------------------------------------------
* Example 2: coupling with instance "SATURNE_03".
*
* - coupled faces of groups "coupled_faces"
* - coupled cells (every cell overlapping the distant mesh)
* - all cells available as location support
*-------------------------------------------------------------------------*/
cs_sat_coupling_define("SATURNE_03",
"coupled_faces",
"all[]",
NULL,
"all[]",
verbosity);
}