9.0
general documentation
Loading...
Searching...
No Matches
cs_equation_bc.cpp File Reference
#include "base/cs_defs.h"
#include <assert.h>
#include <string.h>
#include "bft/bft_printf.h"
#include "bft/bft_mem.h"
#include "base/cs_array.h"
#include "base/cs_boundary_zone.h"
#include "cdo/cs_cdo_toolbox.h"
#include "cdo/cs_evaluate.h"
#include "cdo/cs_xdef.h"
#include "cdo/cs_equation_bc.h"
Include dependency graph for cs_equation_bc.cpp:

Macros

#define CS_EQUATION_BC_DBG   0

Functions

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.
static void _init_cell_sys_macfb_bc (const cs_cdo_bc_face_t *face_bc, const cs_cell_mesh_t *cm, const cs_macfb_builder_t *macb, 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. Only for MAC-fb scheme.
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.
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.
void cs_equation_bc_init_boundary_flux (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)
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.
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.
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 CDO Face-based schemes.
void cs_equation_bc_set_cw_macfb (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_macfb_builder_t *macb, cs_cell_sys_t *csys)
 Set the BC into a cellwise view of the current system. Case of MAC Face-based schemes.
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.
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.
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.
void cs_equation_bc_dirichlet_at_vertices (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_flag_t *bcflag, cs_real_t *values)
 Compute the values of the Dirichlet BCs at mesh vertices. This is done for CDO vertex-based and CDO vertex+cell-based schemes.
void cs_equation_bc_dirichlet_at_faces (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 at boundary faces. This can be applied to CDO face-based schemes (DoFs are attached to primal faces), to CDO cell-based schemes or even to FV schemes.
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.
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.
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)
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.
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)
void cs_equation_bc_cw_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 for a face (cell-wise compute relying on the cs_cell_mesh_t structure)
void cs_equation_bc_circulation_at_edges (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 circulation along primal edges lying on the domain boundary (the integral of the tangential component of vector-valued field). This is used for CDO edge-based schemes where DoFs are attached to (primal) edge-based schemes.
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.

Macro Definition Documentation

◆ CS_EQUATION_BC_DBG

#define CS_EQUATION_BC_DBG   0

Function Documentation

◆ _assign_vb_dirichlet_values()

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

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

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

◆ _init_cell_sys_macfb_bc()

void _init_cell_sys_macfb_bc ( const cs_cdo_bc_face_t * face_bc,
const cs_cell_mesh_t * cm,
const cs_macfb_builder_t * macb,
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. Only for MAC-fb scheme.

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

◆ _sync_circulation_def_at_edges()

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_circulation_at_edges()

void cs_equation_bc_circulation_at_edges ( 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 circulation along primal edges lying on the domain boundary (the integral of the tangential component of vector-valued field). This is used for CDO edge-based schemes where DoFs are attached to (primal) edge-based schemes.

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_bc_cw_robin()

void cs_equation_bc_cw_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 for a face (cell-wise compute relying on the cs_cell_mesh_t structure)

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_bc_dirichlet_at_faces()

void cs_equation_bc_dirichlet_at_faces ( 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 at boundary faces. This can be applied to CDO face-based schemes (DoFs are attached to primal faces), to CDO cell-based schemes or even to FV 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_bc_dirichlet_at_vertices()

void cs_equation_bc_dirichlet_at_vertices ( 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_flag_t * bcflag,
cs_real_t * values )

Compute the values of the Dirichlet BCs at mesh vertices. This is done for CDO vertex-based and CDO vertex+cell-based schemes.

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]bcflagpointer to an array storing type of BC
[in,out]valuespointer to the array of values to set

◆ cs_equation_bc_init_boundary_flux()

void cs_equation_bc_init_boundary_flux ( 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)

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

◆ 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 CDO 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_macfb()

void cs_equation_bc_set_cw_macfb ( 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_macfb_builder_t * macb,
cs_cell_sys_t * csys )

Set the BC into a cellwise view of the current system. Case of MAC 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 faces
[in,out]macbpointer to a cs_macfb_builder_t strucuture
[in,out]csyspointer to a cellwise view of the system

◆ 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_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_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