My Project
programmer's documentation
Functions
cs_coupling.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <ple_defs.h>
#include <ple_coupling.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "fvm_nodal_extract.h"
#include "fvm_point_location.h"
#include "cs_coupling.h"
Include dependency graph for cs_coupling.c:

Functions

void CS_PROCF (cplsyn, CPLSYN)
 
void CS_PROCF (cplact, CPLACT)
 
void cs_coupling_discover_mpi_apps (const char *app_name, const char *forced_app_type)
 Discover other applications in the same MPI root communicator. More...
 
void cs_coupling_finalize (void)
 Finalize MPI coupling helper structures. More...
 
const ple_coupling_mpi_set_t * cs_coupling_get_mpi_apps (void)
 Return info on other applications in the same MPI root communicator. More...
 
int cs_coupling_get_sync_flag (void)
 Return the optional synchronization flag for external couplings. More...
 
void cs_coupling_set_sync_flag (int flag)
 Define an optional synchronization flag for external couplings. More...
 
double cs_coupling_get_ts_multiplier (void)
 Return the time step multiplier for external couplings. More...
 
void cs_coupling_set_ts_multiplier (double m)
 Define a time step multiplier for external couplings. More...
 
void cs_coupling_sync_apps (int flags, int current_ts_id, int *max_ts_id, double *ts)
 Synchronize with applications in the same PLE coupling group. More...
 
bool cs_coupling_is_sync_active (void)
 Indicate is synchronization with applications in the same PLE group is active. More...
 
ple_lnum_t cs_coupling_mesh_extents (const void *mesh, ple_lnum_t n_max_extents, double tolerance, double extents[])
 Compute extents of a mesh representation. More...
 
void cs_coupling_point_in_mesh (const void *mesh, float tolerance_base, float tolerance_fraction, ple_lnum_t n_points, const ple_coord_t point_coords[], const int point_tag[], ple_lnum_t location[], float distance[])
 Find elements in a given mesh containing points: updates the location[] and distance[] arrays associated with a set of points for points that are in an element of this mesh, or closer to one than to previously encountered elements. More...
 
void cs_coupling_point_in_mesh_p (const void *mesh, float tolerance_base, float tolerance_fraction, ple_lnum_t n_points, const ple_coord_t point_coords[], const int point_tag[], ple_lnum_t location[], float distance[])
 Find elements in a given mesh containing points: updates the location[] and distance[] arrays associated with a set of points for points that are in an element of this mesh, or closer to one than to previously encountered elements. More...
 

Function Documentation

◆ cs_coupling_discover_mpi_apps()

void cs_coupling_discover_mpi_apps ( const char *  app_name,
const char *  forced_app_type 
)

Discover other applications in the same MPI root communicator.

Parameters
[in]app_namename of this instance of Code_Saturne

◆ cs_coupling_finalize()

void cs_coupling_finalize ( void  )

Finalize MPI coupling helper structures.

◆ cs_coupling_get_mpi_apps()

const ple_coupling_mpi_set_t* cs_coupling_get_mpi_apps ( void  )

Return info on other applications in the same MPI root communicator.

Returns
info on other applications structure

◆ cs_coupling_get_sync_flag()

int cs_coupling_get_sync_flag ( void  )

Return the optional synchronization flag for external couplings.

See cs_coupling_set_sync_flag for details.

Returns
synchronization flag to apply to couplings

◆ cs_coupling_get_ts_multiplier()

double cs_coupling_get_ts_multiplier ( void  )

Return the time step multiplier for external couplings.

See cs_coupling_get_ts_multiplier for details.

Returns
time step multiplier for external couplings

◆ cs_coupling_is_sync_active()

bool cs_coupling_is_sync_active ( void  )

Indicate is synchronization with applications in the same PLE group is active.

Returns
true if synchronization is required, false otherwise

◆ cs_coupling_mesh_extents()

ple_lnum_t cs_coupling_mesh_extents ( const void *  mesh,
ple_lnum_t  n_max_extents,
double  tolerance,
double  extents[] 
)

Compute extents of a mesh representation.

Parameters
[in]meshpointer to mesh representation structure
[in]n_max_extentsmaximum number of sub-extents (such as element extents) to compute, or -1 to query
[in]toleranceaddition to local extents of each element: extent = base_extent * (1 + tolerance)
[in,out]extentsextents associated with mesh: x_min, y_min, ..., x_max, y_max, ... (size: 2*dim)
Returns
the number of extents computed

◆ cs_coupling_point_in_mesh()

void cs_coupling_point_in_mesh ( const void *  mesh,
float  tolerance_base,
float  tolerance_fraction,
ple_lnum_t  n_points,
const ple_coord_t  point_coords[],
const int  point_tag[],
ple_lnum_t  location[],
float  distance[] 
)

Find elements in a given mesh containing points: updates the location[] and distance[] arrays associated with a set of points for points that are in an element of this mesh, or closer to one than to previously encountered elements.

Location is relative to the id of a given element + 1 in concatenated sections of same element dimension.

Parameters
[in]meshpointer to mesh representation structure
[in]tolerance_baseassociated base tolerance (for bounding box check only, not for location test)
[in]tolerance_fractionassociated fraction of element bounding boxes added to tolerance
[in]n_pointsnumber of points to locate
[in]point_coordspoint coordinates
[in]point_tagoptional point tag
[in,out]locationnumber of element containing or closest to each point (size: n_points)
[in,out]distancedistance from point to element indicated by location[]: < 0 if unlocated, 0 - 1 if inside, and > 1 if outside a volume element, or absolute distance to a surface element (size: n_points)

◆ cs_coupling_point_in_mesh_p()

void cs_coupling_point_in_mesh_p ( const void *  mesh,
float  tolerance_base,
float  tolerance_fraction,
ple_lnum_t  n_points,
const ple_coord_t  point_coords[],
const int  point_tag[],
ple_lnum_t  location[],
float  distance[] 
)

Find elements in a given mesh containing points: updates the location[] and distance[] arrays associated with a set of points for points that are in an element of this mesh, or closer to one than to previously encountered elements.

Location is relative to parent element numbers.

Parameters
[in]meshpointer to mesh representation structure
[in]tolerance_baseassociated base tolerance (for bounding box check only, not for location test)
[in]tolerance_fractionassociated fraction of element bounding boxes added to tolerance
[in]n_pointsnumber of points to locate
[in]point_coordspoint coordinates
[in]point_tagoptional point tag
[in,out]locationnumber of element containing or closest to each point (size: n_points)
[in,out]distancedistance from point to element indicated by location[]: < 0 if unlocated, 0 - 1 if inside, and > 1 if outside a volume element, or absolute distance to a surface element (size: n_points)

◆ cs_coupling_set_sync_flag()

void cs_coupling_set_sync_flag ( int  flag)

Define an optional synchronization flag for external couplings.

This flag is used by all couplings based on the PLE (Parallel Location and Exchange) group synchronization mechanism, which include couplings with SYRTHES 4, Code_Saturne, and NEPTUNE_CFD.

It is defined by a mask, so for example flags f1, f2, and f3 may be combined using the "f1 | f2 | f2" syntax.

Note also that for Code_Saturne, in the case of a variable time step, the reference time step is synchronized at the beginning of each iteration, but the actual time step is recomputed later.

Possible flags are: PLE_COUPLING_TS_MIN Use smallest time step PLE_COUPLING_TS_LEADER Prescribe time step for the group (only one member may set this flag) PLE_COUPLING_UNSTEADY Inform others that this instance is using an unsteady solution approach PLE_COUPLING_STEADY Inform others that this instance is using a teady solution approach PLE_COUPLING_USER_1 User definable flag PLE_COUPLING_USER_2 User definable flag PLE_COUPLING_USER_3 User definable flag PLE_COUPLING_USER_4 User definable flag

To force stopping, PLE_COUPLING_STOP may be set. In this case, the calculation will stop at the first synchronization, even if this function is called again with another flag.

Parameters
[in]flagsynchronization flag to apply to couplings

◆ cs_coupling_set_ts_multiplier()

void cs_coupling_set_ts_multiplier ( double  m)

Define a 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.

If the synchronization flag contains "time step min" (PLE_COUPLING_TS_MIN), the apparent time step is used to determine which code has the smallest time step.

Parameters
[in]mtime step multipier to aply to couplings

◆ cs_coupling_sync_apps()

void cs_coupling_sync_apps ( int  flags,
int  current_ts_id,
int *  max_ts_id,
double *  ts 
)

Synchronize with applications in the same PLE coupling group.

This function should be called before starting a new time step. The current time step id is that of the last finished time step, or 0 at initialization.

Default synchronization flags indicating a new iteration or end of calculation are set automatically, but the user may set additional flags to this function if necessary.

Parameters
[in]flagsoptional additional synchronization flags
[in]current_ts_idcurrent time step id
[in,out]max_ts_idmaximum time step id
[in,out]tssuggested time step value

◆ CS_PROCF() [1/2]

void CS_PROCF ( cplact  ,
CPLACT   
)

◆ CS_PROCF() [2/2]

void CS_PROCF ( cplsyn  ,
CPLSYN   
)