#include "cs_defs.h"
#include <assert.h>
#include <string.h>
#include <bft_mem.h>
#include "cs_array.h"
#include "cs_boundary_zone.h"
#include "cs_cdo_toolbox.h"
#include "cs_evaluate.h"
#include "cs_xdef.h"
#include "cs_equation_bc.h"
Macros | |
#define | CS_EQUATION_BC_DBG 0 |
Functions | |
static void | _assign_vb_dirichlet_values (int dim, int n_vf, const cs_lnum_t *lst, const cs_real_t *eval, bool is_constant, cs_real_t *vvals, int counter[]) |
Set the Dirichlet BC values to the face vertices. Case of vertex-based schemes. More... | |
static void | _init_cell_sys_bc (const cs_cdo_bc_face_t *face_bc, const cs_cell_mesh_t *cm, cs_cell_sys_t *csys) |
Set members of the cs_cell_sys_t structure related to the boundary conditions. Only the generic part is done here. The remaining part is performed specifically for each scheme. More... | |
static void | _sync_circulation_def_at_edges (const cs_cdo_connect_t *connect, int n_defs, cs_xdef_t **defs, cs_lnum_t def2e_idx[], cs_lnum_t def2e_ids[]) |
Synchronize the boundary definitions related to the enforcement of a circulation along a boundary edge. More... | |
void | cs_equation_init_boundary_flux_from_bc (cs_real_t t_eval, const cs_cdo_quantities_t *cdoq, const cs_equation_param_t *eqp, cs_real_t *values) |
Set the values for the normal boundary flux stemming from the Neumann boundary conditions (zero is left where a Dirichlet is set. This can be updated later on) More... | |
void | cs_equation_bc_set_cw_vb (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, const cs_flag_t vtx_bc_flag[], const cs_real_t dir_values[], cs_real_t t_eval, cs_cell_sys_t *csys, cs_cell_builder_t *cb) |
Set the BC into a cellwise view of the current system. Case of vertex-based schemes. More... | |
void | cs_equation_bc_set_cw_eb (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, const cs_real_t dir_values[], cs_cell_sys_t *csys, cs_cell_builder_t *cb) |
Set the BC into a cellwise view of the current system. Case of edge-based schemes. More... | |
void | cs_equation_bc_set_cw_fb (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, const cs_real_t dir_values[], cs_cell_sys_t *csys, cs_cell_builder_t *cb) |
Set the BC into a cellwise view of the current system. Case of Face-based schemes. More... | |
void | cs_equation_bc_set_cw_cb (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, const cs_real_t dir_values[], cs_cell_sys_t *csys, cs_cell_builder_t *cb) |
Set the BC into a cellwise view of the current system. Case of Cell-based schemes. More... | |
void | cs_equation_bc_set_vertex_flag (const cs_cdo_connect_t *connect, const cs_cdo_bc_face_t *face_bc, cs_flag_t *vflag) |
Define an array of flags for each vertex collecting the flags of associated boundary faces. More... | |
void | cs_equation_bc_set_edge_flag (const cs_cdo_connect_t *connect, const cs_cdo_bc_face_t *face_bc, cs_flag_t *edge_flag) |
Define an array of flags for each edge collecting the flags of associated boundary faces. More... | |
void | cs_equation_compute_dirichlet_vb (cs_real_t t_eval, const cs_mesh_t *mesh, const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, cs_cell_builder_t *cb, cs_flag_t *bcflag, cs_real_t *values) |
Compute the values of the Dirichlet BCs when DoFs are attached to vertices. More... | |
void | cs_equation_compute_dirichlet_fb (const cs_mesh_t *mesh, const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, cs_real_t t_eval, cs_cell_builder_t *cb, cs_real_t *values) |
Compute the values of the Dirichlet BCs when DoFs are attached to CDO face-based schemes. More... | |
void | cs_equation_compute_dirichlet_cb (const cs_mesh_t *mesh, const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_equation_param_t *eqp, const cs_cdo_bc_face_t *face_bc, cs_real_t t_eval, cs_real_t *values) |
Compute the values of the Dirichlet BCs when DoFs are attached to CDO cell-based schemes. More... | |
void | cs_equation_compute_neumann_cb (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *neu_values) |
Compute the values of the Neumann BCs when DoFs are scalar-valued and attached to a cell-based schemes Case of the Neumann BCs i.e. Neumann is defined by a scalar. More... | |
void | cs_equation_compute_neumann_svb (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *neu_values) |
Compute the values of the Neumann BCs when DoFs are scalar-valued and attached to a vertex-based schemes (Vb or VCb) Case of the Neumann BCs i.e. Neumann is defined by a scalar. More... | |
void | cs_equation_compute_full_neumann_svb (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *neu_values) |
Compute the values of the Neumann BCs when DoFs are scalar-valued and attached to a vertex-based schemes (Vb or VCb) Case of the full Neumann BCs i.e. Neumann is defined by a vector. More... | |
void | cs_equation_compute_neumann_sfb (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *neu_values) |
Compute the values of the Neumann BCs when DoFs are attached to the face f. Case of scalar-valued equation (not full Neumann BCs) More... | |
void | cs_equation_compute_full_neumann_sfb (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *neu_values) |
Compute the values of the Neumann BCs when DoFs are attached to the face f. Case of scalar-valued equation with a full Neumann BC definition. More... | |
void | cs_equation_compute_neumann_vfb (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *neu_values) |
Compute the values of the Neumann BCs at the face f when DoFs are attached to faces. Case of vector-valued equation (not the full Neumann) More... | |
void | cs_equation_compute_robin (cs_real_t t_eval, short int def_id, short int f, const cs_equation_param_t *eqp, const cs_cell_mesh_t *cm, double *rob_values) |
Compute the values of the Robin BCs. More... | |
void | cs_equation_compute_circulation_eb (cs_real_t t_eval, const cs_mesh_t *mesh, const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_equation_param_t *eqp, cs_real_t *values) |
Compute the values of the tangential component lying on the domain boundary. Kind of BCs used when DoFs are attached to CDO (primal) edge-based schemes. One sets the values of the circulation. More... | |
void | cs_equation_bc_update_for_increment (cs_cell_sys_t *csys) |
Update the boundary conditions to fullfill the constraint when an incremental solve is set. More... | |
#define CS_EQUATION_BC_DBG 0 |
|
inlinestatic |
Set the Dirichlet BC values to the face vertices. Case of vertex-based schemes.
[in] | dim | number of values to assign to each vertex |
[in] | n_vf | number of vertices in a face |
[in] | lst | list of vertex numbering |
[in] | eval | result of the evaluation to set |
[in] | is_constant | same value for all vertices ? |
[in,out] | vvals | vertex values to update |
[in,out] | counter | counter to update |
|
inlinestatic |
Set members of the cs_cell_sys_t structure related to the boundary conditions. Only the generic part is done here. The remaining part is performed specifically for each scheme.
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | csys | pointer to a cs_cell_system_t structure |
|
static |
Synchronize the boundary definitions related to the enforcement of a circulation along a boundary edge.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | n_defs | number of definitions |
[in] | defs | number of times the values has been updated |
[in,out] | def2e_idx | index array to define |
[in,out] | def2e_ids | array of ids to define |
void cs_equation_bc_set_cw_cb | ( | const cs_cell_mesh_t * | cm, |
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
const cs_real_t | dir_values[], | ||
cs_cell_sys_t * | csys, | ||
cs_cell_builder_t * | cb | ||
) |
Set the BC into a cellwise view of the current system. Case of Cell-based schemes.
Set the BC into a cellwise view of the current system. Case of Face-based schemes.
[in] | cm | pointer to a cellwise view of the mesh |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | dir_values | Dirichlet values associated to each vertex |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
void cs_equation_bc_set_cw_eb | ( | const cs_cell_mesh_t * | cm, |
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
const cs_real_t | dir_values[], | ||
cs_cell_sys_t * | csys, | ||
cs_cell_builder_t * | cb | ||
) |
Set the BC into a cellwise view of the current system. Case of edge-based schemes.
[in] | cm | pointer to a cellwise view of the mesh |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | dir_values | Dirichlet values associated to each vertex |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
void cs_equation_bc_set_cw_fb | ( | const cs_cell_mesh_t * | cm, |
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
const cs_real_t | dir_values[], | ||
cs_cell_sys_t * | csys, | ||
cs_cell_builder_t * | cb | ||
) |
Set the BC into a cellwise view of the current system. Case of Face-based schemes.
[in] | cm | pointer to a cellwise view of the mesh |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | dir_values | Dirichlet values associated to each vertex |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
void cs_equation_bc_set_cw_vb | ( | const cs_cell_mesh_t * | cm, |
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
const cs_flag_t | vtx_bc_flag[], | ||
const cs_real_t | dir_values[], | ||
cs_real_t | t_eval, | ||
cs_cell_sys_t * | csys, | ||
cs_cell_builder_t * | cb | ||
) |
Set the BC into a cellwise view of the current system. Case of vertex-based schemes.
[in] | cm | pointer to a cellwise view of the mesh |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | vtx_bc_flag | BC flags associated to vertices |
[in] | dir_values | Dirichlet values associated to each vertex |
[in] | t_eval | time at which one performs the evaluation |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
void cs_equation_bc_set_edge_flag | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_bc_face_t * | face_bc, | ||
cs_flag_t * | edge_flag | ||
) |
Define an array of flags for each edge collecting the flags of associated boundary faces.
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | face_bc | pointer to a structure collecting boundary conditions applied to faces |
[in,out] | edge_flag | BC flag on edges to define |
void cs_equation_bc_set_vertex_flag | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_bc_face_t * | face_bc, | ||
cs_flag_t * | vflag | ||
) |
Define an array of flags for each vertex collecting the flags of associated boundary faces.
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | face_bc | pointer to a structure collecting boundary conditions applied to faces |
[in,out] | vflag | BC flag on vertices to define |
void cs_equation_bc_update_for_increment | ( | cs_cell_sys_t * | csys | ) |
Update the boundary conditions to fullfill the constraint when an incremental solve is set.
[in,out] | csys | pointer to the cell system structure |
void cs_equation_compute_circulation_eb | ( | cs_real_t | t_eval, |
const cs_mesh_t * | mesh, | ||
const cs_cdo_quantities_t * | quant, | ||
const cs_cdo_connect_t * | connect, | ||
const cs_equation_param_t * | eqp, | ||
cs_real_t * | values | ||
) |
Compute the values of the tangential component lying on the domain boundary. Kind of BCs used when DoFs are attached to CDO (primal) edge-based schemes. One sets the values of the circulation.
[in] | t_eval | time at which one evaluates the boundary cond. |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | quant | pointer to a cs_cdo_quantities_t structure |
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | eqp | pointer to a cs_equation_param_t |
[in,out] | values | pointer to the array of values to set |
void cs_equation_compute_dirichlet_cb | ( | const cs_mesh_t * | mesh, |
const cs_cdo_quantities_t * | quant, | ||
const cs_cdo_connect_t * | connect, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
cs_real_t | t_eval, | ||
cs_real_t * | values | ||
) |
Compute the values of the Dirichlet BCs when DoFs are attached to CDO cell-based schemes.
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | quant | pointer to a cs_cdo_quantities_t structure |
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | t_eval | time at which one evaluates the boundary cond. |
[in,out] | values | pointer to the array of values to set |
void cs_equation_compute_dirichlet_fb | ( | const cs_mesh_t * | mesh, |
const cs_cdo_quantities_t * | quant, | ||
const cs_cdo_connect_t * | connect, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
cs_real_t | t_eval, | ||
cs_cell_builder_t * | cb, | ||
cs_real_t * | values | ||
) |
Compute the values of the Dirichlet BCs when DoFs are attached to CDO face-based schemes.
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | quant | pointer to a cs_cdo_quantities_t structure |
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in] | t_eval | time at which one evaluates the boundary cond. |
[in,out] | cb | pointer to a cs_cell_builder_t structure |
[in,out] | values | pointer to the array of values to set |
void cs_equation_compute_dirichlet_vb | ( | cs_real_t | t_eval, |
const cs_mesh_t * | mesh, | ||
const cs_cdo_quantities_t * | quant, | ||
const cs_cdo_connect_t * | connect, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cdo_bc_face_t * | face_bc, | ||
cs_cell_builder_t * | cb, | ||
cs_flag_t * | bcflag, | ||
cs_real_t * | values | ||
) |
Compute the values of the Dirichlet BCs when DoFs are attached to vertices.
[in] | t_eval | time at which one performs the evaluation |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | quant | pointer to a cs_cdo_quantities_t structure |
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | face_bc | pointer to a cs_cdo_bc_face_t structure |
[in,out] | cb | pointer to a cs_cell_builder_t structure |
[in,out] | bcflag | pointer to an array storing type of BC |
[in,out] | values | pointer to the array of values to set |
void cs_equation_compute_full_neumann_sfb | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | neu_values | ||
) |
Compute the values of the Neumann BCs when DoFs are attached to the face f. Case of scalar-valued equation with a full Neumann BC definition.
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | neu_values | array storing Neumann values for all DoFs |
void cs_equation_compute_full_neumann_svb | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | neu_values | ||
) |
Compute the values of the Neumann BCs when DoFs are scalar-valued and attached to a vertex-based schemes (Vb or VCb) Case of the full Neumann BCs i.e. Neumann is defined by a vector.
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | neu_values | array storing the Neumann values for all DoFs |
void cs_equation_compute_neumann_cb | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | neu_values | ||
) |
Compute the values of the Neumann BCs when DoFs are scalar-valued and attached to a cell-based schemes Case of the Neumann BCs i.e. Neumann is defined by a scalar.
Compute the values of the Neumann BCs when DoFs are attached to CDO cell-based schemes.
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | neu_values | array storing the Neumann values for all DoFs |
void cs_equation_compute_neumann_sfb | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | neu_values | ||
) |
Compute the values of the Neumann BCs when DoFs are attached to the face f. Case of scalar-valued equation (not full Neumann BCs)
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | neu_values | array storing Neumann values for all DoFs |
void cs_equation_compute_neumann_svb | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | neu_values | ||
) |
Compute the values of the Neumann BCs when DoFs are scalar-valued and attached to a vertex-based schemes (Vb or VCb) Case of the Neumann BCs i.e. Neumann is defined by a scalar.
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | neu_values | array storing the Neumann values for all DoFs |
void cs_equation_compute_neumann_vfb | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | neu_values | ||
) |
Compute the values of the Neumann BCs at the face f when DoFs are attached to faces. Case of vector-valued equation (not the full Neumann)
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | neu_values | array storing Neumann values at DoFs |
void cs_equation_compute_robin | ( | cs_real_t | t_eval, |
short int | def_id, | ||
short int | f, | ||
const cs_equation_param_t * | eqp, | ||
const cs_cell_mesh_t * | cm, | ||
double * | rob_values | ||
) |
Compute the values of the Robin BCs.
[in] | t_eval | time at which one performs the evaluation |
[in] | def_id | id of the definition for setting the Neumann BC |
[in] | f | local face number in the cs_cell_mesh_t |
[in] | eqp | pointer to a cs_equation_param_t |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in,out] | rob_values | array storing Robin values to use |
void cs_equation_init_boundary_flux_from_bc | ( | cs_real_t | t_eval, |
const cs_cdo_quantities_t * | cdoq, | ||
const cs_equation_param_t * | eqp, | ||
cs_real_t * | values | ||
) |
Set the values for the normal boundary flux stemming from the Neumann boundary conditions (zero is left where a Dirichlet is set. This can be updated later on)
Set the values for the normal boundary flux stemming from the Neumann boundary conditions (zero is left where a Dirichlet is set. This can be updated later one)
[in] | t_eval | time at which one performs the evaluation |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | values | pointer to the array of values to set |