#include <ple_locator.h>
#include "cs_base.h"
#include "cs_field.h"
#include "cs_math.h"
#include "cs_mesh_location.h"
Go to the source code of this file.
Functions | |
void | cs_boundary_conditions_error (const int *bc_type, const char *type_name) |
Handling of boundary condition definition errors and associated output. More... | |
ple_locator_t * | cs_boundary_conditions_map (cs_mesh_location_type_t location_type, cs_lnum_t n_location_elts, cs_lnum_t n_faces, const cs_lnum_t *location_elts, const cs_lnum_t *faces, cs_real_3_t *coord_shift, int coord_stride, double tolerance) |
Locate shifted boundary face coordinates on possibly filtered cells or boundary faces for later interpolation. More... | |
void | cs_boundary_conditions_mapped_set (const cs_field_t *f, ple_locator_t *locator, cs_mesh_location_type_t location_type, int normalize, int interpolate, cs_lnum_t n_faces, const cs_lnum_t *faces, cs_real_t *balance_w) |
Set mapped boundary conditions for a given field and mapping locator. More... | |
int | cs_boundary_conditions_add_map (int bc_location_id, int source_location_id, cs_real_t coord_shift[3], double tolerance) |
Add location of locate shifted boundary face coordinates on cells or boundary faces for automatic interpolation. More... | |
void | cs_boundary_conditions_create (void) |
Create the legacy boundary conditions face type and face zone arrays. More... | |
void | cs_boundary_conditions_free (void) |
Free the boundary conditions face type and face zone arrays. More... | |
static void | cs_boundary_conditions_set_neumann_scalar (cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t qimp, cs_real_t hint) |
Set Neumann BC for a scalar for a given face. More... | |
static void | cs_boundary_conditions_set_neumann_vector (cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t qimpv[3], cs_real_t hint) |
Set Neumann BC for a scalar for a given face. More... | |
static void | cs_boundary_conditions_set_dirichlet_scalar (cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t pimp, cs_real_t hint, cs_real_t hext) |
Set Dirichlet BC for a scalar for a given face. More... | |
static void | cs_boundary_conditions_set_dirichlet_vector (cs_real_3_t a, cs_real_3_t af, cs_real_33_t b, cs_real_33_t bf, cs_real_3_t pimpv, cs_real_t hint, cs_real_3_t hextv) |
Set Dirichlet BC for a vector for a given face. More... | |
void | cs_boundary_conditions_set_convective_outlet_scalar (cs_real_t *coefa, cs_real_t *cofaf, cs_real_t *coefb, cs_real_t *cofbf, cs_real_t pimp, cs_real_t cfl, cs_real_t hint) |
Set convective oulet boundary condition for a scalar. More... | |
static void | cs_boundary_conditions_set_dirichlet_vector_aniso (cs_real_3_t a, cs_real_3_t af, cs_real_33_t b, cs_real_33_t bf, cs_real_3_t pimpv, cs_real_6_t hintt, cs_real_3_t hextv) |
Set Dirichlet BC for a vector for a given face with left anisotropic diffusion. More... | |
void | cs_boundary_conditions_reset (void) |
Prepare (reset) condition coefficients for all variable fields. More... | |
void | cs_boundary_conditions_compute (int itypfb[]) |
Update per variable boundary condition codes. More... | |
void | cs_boundary_conditions_complete (int itypfb[]) |
Automatic adjustments for boundary condition codes. More... | |
Variables | |
const int * | cs_glob_bc_type |
const int * | cs_glob_bc_face_zone |
int cs_boundary_conditions_add_map | ( | int | bc_location_id, |
int | source_location_id, | ||
cs_real_t | coord_shift[3], | ||
double | tolerance | ||
) |
Add location of locate shifted boundary face coordinates on cells or boundary faces for automatic interpolation.
[in] | bc_location_id | id of selected boundary mesh location; currently restricted to subsets of boundary faces (i.e. boundary zone location ids). |
[in] | source_location_id | id of selected location mesh location (usually CS_MESH_LOCATION_CELLS but can be a more restricted cell or boundary face zone location location id). |
[in] | coord_shift | coordinates shift relative to selected boundary faces |
[in] | tolerance | relative tolerance for point location. |
void cs_boundary_conditions_complete | ( | int | itypfb[] | ) |
Automatic adjustments for boundary condition codes.
Currently handles mapped inlets, after the call to stdtcl. As portions of stdtcl are migrated to C, they should be called here, before mapped inlets.
[in] | itypfb | type of boundary for each face |
void cs_boundary_conditions_compute | ( | int | itypfb[] | ) |
Update per variable boundary condition codes.
[in] | itypfb | type of boundary for each face |
void cs_boundary_conditions_create | ( | void | ) |
Create the legacy boundary conditions face type and face zone arrays.
void cs_boundary_conditions_error | ( | const int * | bc_flag, |
const char * | type_name | ||
) |
Handling of boundary condition definition errors and associated output.
This function checks for errors, and simply returns if no error is encountered. In case of error, it outputs helpful information so as to make it easier to locate the matching faces.
For each boundary face, bc_type defines the boundary condition type. As a convention here, zero values correspond to undefined types, positive values to defined types (with no error), and negative values to defined types with inconsistent or incompatible values, the absolute value indicating the original boundary condition type.
An optional label may be used if the error is related to another attribute than the boundary type, for appropriate error reporting.
[in] | bc_flag | array of BC type ids |
[in] | type_name | name of attribute in error, or NULL |
void cs_boundary_conditions_free | ( | void | ) |
Free the boundary conditions face type and face zone arrays.
This also frees boundary condition mappings which may have been defined.
ple_locator_t* cs_boundary_conditions_map | ( | cs_mesh_location_type_t | location_type, |
cs_lnum_t | n_location_elts, | ||
cs_lnum_t | n_faces, | ||
const cs_lnum_t * | location_elts, | ||
const cs_lnum_t * | faces, | ||
cs_real_3_t * | coord_shift, | ||
int | coord_stride, | ||
double | tolerance | ||
) |
Locate shifted boundary face coordinates on possibly filtered cells or boundary faces for later interpolation.
[in] | location_type | matching values location (CS_MESH_LOCATION_CELLS or CS_MESH_LOCATION_BOUNDARY_FACES) |
[in] | n_location_elts | number of selected location elements |
[in] | n_faces | number of selected boundary faces |
[in] | location_elts | list of selected location elements (0 to n-1), or NULL if no indirection is needed |
[in] | faces | list of selected boundary faces (0 to n-1), or NULL if no indirection is needed |
[in] | coord_shift | array of coordinates shift relative to selected boundary faces |
[in] | coord_stride | access stride in coord_shift: 0 for uniform shift, 1 for "per face" shift. |
[in] | tolerance | relative tolerance for point location. |
void cs_boundary_conditions_mapped_set | ( | const cs_field_t * | f, |
ple_locator_t * | locator, | ||
cs_mesh_location_type_t | location_type, | ||
int | normalize, | ||
int | interpolate, | ||
cs_lnum_t | n_faces, | ||
const cs_lnum_t * | faces, | ||
cs_real_t * | balance_w | ||
) |
Set mapped boundary conditions for a given field and mapping locator.
[in] | f | field whose boundary conditions are set |
[in] | locator | associated mapping locator, as returned by cs_boundary_conditions_map. |
[in] | location_type | matching values location (CS_MESH_LOCATION_CELLS or CS_MESH_LOCATION_BOUNDARY_FACES) |
[in] | normalize | normalization option: 0: values are simply mapped 1: values are mapped, then multiplied by a constant factor so that their surface integral on selected faces is preserved (relative to the input values) 2: as 1, but with a boundary-defined weight, defined by balance_w 3: as 1, but with a cell-defined weight, defined by balance_w |
[in] | interpolate | interpolation option: 0: values are simply based on matching cell or face center values 1: values are based on matching cell or face center values, corrected by gradient interpolation |
[in] | n_faces | number of selected boundary faces |
[in] | faces | list of selected boundary faces (0 to n-1), or NULL if no indirection is needed |
[in] | balance_w | optional balance weight, or NULL |
void cs_boundary_conditions_reset | ( | void | ) |
Prepare (reset) condition coefficients for all variable fields.
void cs_boundary_conditions_set_convective_outlet_scalar | ( | cs_real_t * | coefa, |
cs_real_t * | cofaf, | ||
cs_real_t * | coefb, | ||
cs_real_t * | cofbf, | ||
cs_real_t | pimp, | ||
cs_real_t | cfl, | ||
cs_real_t | hint | ||
) |
Set convective oulet boundary condition for a scalar.
Parameters:
[out] | coefa | explicit BC coefficient for gradients |
[out] | cofaf | explicit BC coefficient for diffusive flux |
[out] | coefb | implicit BC coefficient for gradients |
[out] | cofbf | implicit BC coefficient for diffusive flux |
[in] | pimp | Flux value to impose |
[in] | cfl | Local Courant number used to convect |
[in] | hint | Internal exchange coefficient |
[out] | coefa | explicit BC coefficient for gradients |
[out] | cofaf | explicit BC coefficient for diffusive flux |
[out] | coefb | implicit BC coefficient for gradients |
[out] | cofbf | implicit BC coefficient for diffusive flux |
[in] | pimp | Flux value to impose |
[in] | cfl | Local Courant number used to convect |
[in] | hint | Internal exchange coefficient |
|
inlinestatic |
Set Dirichlet BC for a scalar for a given face.
[out] | a | explicit BC coefficient for gradients |
[out] | af | explicit BC coefficient for diffusive flux |
[out] | b | implicit BC coefficient for gradients |
[out] | bf | implicit BC coefficient for diffusive flux |
[in] | pimp | dirichlet value to impose |
[in] | hint | internal exchange coefficient |
[in] | hext | external exchange coefficient (assumed infinite/ignored if < 0) |
|
inlinestatic |
Set Dirichlet BC for a vector for a given face.
[out] | a | explicit BC coefficient for gradients |
[out] | af | explicit BC coefficient for diffusive flux |
[out] | b | implicit BC coefficient for gradients |
[out] | bf | implicit BC coefficient for diffusive flux |
[in] | pimpv | dirichlet value to impose |
[in] | hint | internal exchange coefficient |
[in] | hextv | external exchange coefficient (assumed infinite/ignored if < 0) |
|
inlinestatic |
Set Dirichlet BC for a vector for a given face with left anisotropic diffusion.
[out] | a | explicit BC coefficient for gradients |
[out] | af | explicit BC coefficient for diffusive flux |
[out] | b | implicit BC coefficient for gradients |
[out] | bf | implicit BC coefficient for diffusive flux |
[in] | pimpv | dirichlet value to impose |
[in] | hintt | internal exchange coefficient |
[in] | hextv | external exchange coefficient (assumed infinite/ignored if < 0) |
|
inlinestatic |
Set Neumann BC for a scalar for a given face.
[out] | a | explicit BC coefficient for gradients |
[out] | af | explicit BC coefficient for diffusive flux |
[out] | b | implicit BC coefficient for gradients |
[out] | bf | implicit BC coefficient for diffusive flux |
[in] | qimp | flux value to impose |
[in] | hint | internal exchange coefficient |
|
inlinestatic |
Set Neumann BC for a scalar for a given face.
[out] | a | explicit BC coefficient for gradients |
[out] | af | explicit BC coefficient for diffusive flux |
[out] | b | implicit BC coefficient for gradients |
[out] | bf | implicit BC coefficient for diffusive flux |
[in] | qimpv | flux value to impose |
[in] | hint | internal exchange coefficient |
|
extern |
boundary zone number associated with each boundary face (specific physical models)
|
extern |
Boundary condition type (code) associated with each boundary face