8.0
general documentation
cs_equation_bc.c File Reference
#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"
+ Include dependency graph for cs_equation_bc.c:

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

Macro Definition Documentation

◆ CS_EQUATION_BC_DBG

#define CS_EQUATION_BC_DBG   0

Function Documentation

◆ _assign_vb_dirichlet_values()

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[] 
)
inlinestatic

Set the Dirichlet BC values to the face vertices. Case of vertex-based schemes.

Parameters
[in]dimnumber of values to assign to each vertex
[in]n_vfnumber of vertices in a face
[in]lstlist of vertex numbering
[in]evalresult of the evaluation to set
[in]is_constantsame value for all vertices ?
[in,out]vvalsvertex values to update
[in,out]countercounter to update

◆ _init_cell_sys_bc()

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 
)
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.

Parameters
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]csyspointer to a cs_cell_system_t structure

◆ _sync_circulation_def_at_edges()

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[] 
)
static

Synchronize the boundary definitions related to the enforcement of a circulation along a boundary edge.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]n_defsnumber of definitions
[in]defsnumber of times the values has been updated
[in,out]def2e_idxindex array to define
[in,out]def2e_idsarray of ids to define

◆ cs_equation_bc_set_cw_cb()

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.

Parameters
[in]cmpointer to a cellwise view of the mesh
[in]eqppointer to a cs_equation_param_t structure
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]dir_valuesDirichlet values associated to each vertex
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_equation_bc_set_cw_eb()

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.

Parameters
[in]cmpointer to a cellwise view of the mesh
[in]eqppointer to a cs_equation_param_t structure
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]dir_valuesDirichlet values associated to each vertex
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_equation_bc_set_cw_fb()

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.

Parameters
[in]cmpointer to a cellwise view of the mesh
[in]eqppointer to a cs_equation_param_t structure
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]dir_valuesDirichlet values associated to each vertex
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_equation_bc_set_cw_vb()

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.

Parameters
[in]cmpointer to a cellwise view of the mesh
[in]eqppointer to a cs_equation_param_t structure
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]vtx_bc_flagBC flags associated to vertices
[in]dir_valuesDirichlet values associated to each vertex
[in]t_evaltime at which one performs the evaluation
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_equation_bc_set_edge_flag()

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]face_bcpointer to a structure collecting boundary conditions applied to faces
[in,out]edge_flagBC flag on edges to define

◆ cs_equation_bc_set_vertex_flag()

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.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]face_bcpointer to a structure collecting boundary conditions applied to faces
[in,out]vflagBC flag on vertices to define

◆ cs_equation_bc_update_for_increment()

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.

Parameters
[in,out]csyspointer to the cell system structure

◆ cs_equation_compute_circulation_eb()

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.

Parameters
[in]t_evaltime at which one evaluates the boundary cond.
[in]meshpointer to a cs_mesh_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]connectpointer to a cs_cdo_connect_t struct.
[in]eqppointer to a cs_equation_param_t
[in,out]valuespointer to the array of values to set

◆ cs_equation_compute_dirichlet_cb()

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.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]connectpointer to a cs_cdo_connect_t struct.
[in]eqppointer to a cs_equation_param_t
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]t_evaltime at which one evaluates the boundary cond.
[in,out]valuespointer to the array of values to set

◆ cs_equation_compute_dirichlet_fb()

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.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]connectpointer to a cs_cdo_connect_t struct.
[in]eqppointer to a cs_equation_param_t
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in]t_evaltime at which one evaluates the boundary cond.
[in,out]cbpointer to a cs_cell_builder_t structure
[in,out]valuespointer to the array of values to set

◆ cs_equation_compute_dirichlet_vb()

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.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]meshpointer to a cs_mesh_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]connectpointer to a cs_cdo_connect_t struct.
[in]eqppointer to a cs_equation_param_t
[in]face_bcpointer to a cs_cdo_bc_face_t structure
[in,out]cbpointer to a cs_cell_builder_t structure
[in,out]bcflagpointer to an array storing type of BC
[in,out]valuespointer to the array of values to set

◆ cs_equation_compute_full_neumann_sfb()

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.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]neu_valuesarray storing Neumann values for all DoFs

◆ cs_equation_compute_full_neumann_svb()

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.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]neu_valuesarray storing the Neumann values for all DoFs

◆ cs_equation_compute_neumann_cb()

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.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]neu_valuesarray storing the Neumann values for all DoFs

◆ cs_equation_compute_neumann_sfb()

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)

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]neu_valuesarray storing Neumann values for all DoFs

◆ cs_equation_compute_neumann_svb()

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.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]neu_valuesarray storing the Neumann values for all DoFs

◆ cs_equation_compute_neumann_vfb()

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)

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]neu_valuesarray storing Neumann values at DoFs

◆ cs_equation_compute_robin()

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.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]def_idid of the definition for setting the Neumann BC
[in]flocal face number in the cs_cell_mesh_t
[in]eqppointer to a cs_equation_param_t
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]rob_valuesarray storing Robin values to use

◆ cs_equation_init_boundary_flux_from_bc()

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)

Parameters
[in]t_evaltime at which one performs the evaluation
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]valuespointer to the array of values to set