My Project
programmer's documentation
|
#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"
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... | |
void cs_coupling_discover_mpi_apps | ( | const char * | app_name, |
const char * | forced_app_type | ||
) |
Discover other applications in the same MPI root communicator.
[in] | app_name | name of this instance of Code_Saturne |
void cs_coupling_finalize | ( | void | ) |
Finalize MPI coupling helper structures.
const ple_coupling_mpi_set_t* cs_coupling_get_mpi_apps | ( | void | ) |
Return info on other applications in the same MPI root communicator.
int cs_coupling_get_sync_flag | ( | void | ) |
Return the optional synchronization flag for external couplings.
See cs_coupling_set_sync_flag for details.
double cs_coupling_get_ts_multiplier | ( | void | ) |
Return the time step multiplier for external couplings.
See cs_coupling_get_ts_multiplier for details.
bool cs_coupling_is_sync_active | ( | void | ) |
Indicate is synchronization with applications in the same PLE group is active.
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.
[in] | mesh | pointer to mesh representation structure |
[in] | n_max_extents | maximum number of sub-extents (such as element extents) to compute, or -1 to query |
[in] | tolerance | addition to local extents of each element: extent = base_extent * (1 + tolerance) |
[in,out] | extents | extents associated with mesh: x_min, y_min, ..., x_max, y_max, ... (size: 2*dim) |
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.
[in] | mesh | pointer to mesh representation structure |
[in] | tolerance_base | associated base tolerance (for bounding box check only, not for location test) |
[in] | tolerance_fraction | associated fraction of element bounding boxes added to tolerance |
[in] | n_points | number of points to locate |
[in] | point_coords | point coordinates |
[in] | point_tag | optional point tag |
[in,out] | location | number of element containing or closest to each point (size: n_points) |
[in,out] | distance | distance 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) |
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.
[in] | mesh | pointer to mesh representation structure |
[in] | tolerance_base | associated base tolerance (for bounding box check only, not for location test) |
[in] | tolerance_fraction | associated fraction of element bounding boxes added to tolerance |
[in] | n_points | number of points to locate |
[in] | point_coords | point coordinates |
[in] | point_tag | optional point tag |
[in,out] | location | number of element containing or closest to each point (size: n_points) |
[in,out] | distance | distance 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) |
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.
[in] | flag | synchronization flag to apply to couplings |
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.
[in] | m | time step multipier to aply to couplings |
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.
[in] | flags | optional additional synchronization flags |
[in] | current_ts_id | current time step id |
[in,out] | max_ts_id | maximum time step id |
[in,out] | ts | suggested time step value |
void CS_PROCF | ( | cplact | , |
CPLACT | |||
) |
void CS_PROCF | ( | cplsyn | , |
CPLSYN | |||
) |