My Project
programmer's 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_coupling . These options allow defining the time step synchronization policy, as well as a time step multiplier.

{
/*-------------------------------------------------------------------------
* Example for time step multiplier for external couplings.
*
* 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,
* to allow for more advanced combinations if necessary, so the user
* should ensure this when using a time step multiplier).
*-------------------------------------------------------------------------*/
}

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);
}
cs_coupling_set_ts_multiplier
void cs_coupling_set_ts_multiplier(double m)
Define a time step multiplier for external couplings.
Definition: cs_coupling.c:386
cs_syr_coupling_define
void cs_syr_coupling_define(const char *syrthes_name, const char *boundary_criteria, const char *volume_criteria, char projection_axis, bool allow_nonmatching, float tolerance, int verbosity, int visualization)
Define new SYRTHES coupling.
Definition: cs_syr_coupling.c:801
cs_sat_coupling_define
void cs_sat_coupling_define(const char *saturne_name, const char *boundary_cpl_criteria, const char *volume_cpl_criteria, const char *boundary_loc_criteria, const char *volume_loc_criteria, int verbosity)
Define new Code_Saturne coupling.
Definition: cs_sat_coupling.c:1895