programmer's documentation
Functions
cs_cdo_advection.c File Reference

Build discrete advection operators for CDO vertex-based schemes. More...

#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <limits.h>
#include <assert.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_cdo_scheme_geometry.h"
#include "cs_math.h"
#include "cs_cdo_advection.h"
Include dependency graph for cs_cdo_advection.c:

Functions

static double _upwind_weight (double criterion, const cs_param_advection_t adv_info)
 Compute the value of the weighting function related to upwinding. More...
 
static short int _set_fquant (const cs_cell_mesh_t *cm, short int e, short int f, const double *tef, double *wvf)
 Retrieve the face edge id from a given cell edge id. Compute the weights related to each vertex of face from pre-computed quantities. More...
 
static void _build_local_epcd (const cs_cell_mesh_t *cm, const cs_param_advection_t a_info, cs_cdo_adv_t *b)
 Define the local convection operator between primal edges and dual cells. (Non-conservative formulation) More...
 
static void _build_local_vpfd (const cs_cell_mesh_t *cm, const cs_param_advection_t a_info, cs_cdo_adv_t *b)
 Define the local convection operator between primal vertices and dual faces. (Conservative formulation) More...
 
static void _vcb_cellwise_consistent_part (const cs_nvec3_t adv_cell, const cs_cell_mesh_t *cm, const cs_face_mesh_t *fm, cs_cdo_adv_t *b)
 Compute the consistent part of the convection operator attached to a cell with a CDO vertex+cell-based scheme when the advection is considered as constant inside a cell. More...
 
static void _vcb_consistent_part (const cs_adv_field_t *adv_field, const cs_nvec3_t adv_cell, const cs_cell_mesh_t *cm, const cs_face_mesh_t *fm, cs_cdo_adv_t *b)
 Compute the consistent part of the convection operator attached to a cell with a CDO vertex+cell-based scheme when the advection field is not considered constant inside the current cell. More...
 
static void _vcb_stabilization_part1 (const cs_cell_mesh_t *cm, const cs_face_mesh_t *fm, const double stab_coef, cs_cdo_adv_t *b)
 Compute the stabilization part of the convection operator attached to a cell with a CDO vertex+cell-based scheme (inside pfc) More...
 
static void _vcb_stabilization_part2 (const cs_cell_mesh_t *cm, const double stab_coef, cs_cdo_adv_t *b)
 Compute the stabilization part of the convection operator attached to a cell with a CDO vertex+cell-based scheme (between pfc) More...
 
void cs_cdo_advection_set_cip_coef (double new_value)
 Set the value of the stabilization coefficient used in CIP scheme. More...
 
double cs_cdo_advection_get_cip_coef (void)
 Get the value of the stabilization coefficient used in CIP scheme. More...
 
cs_cdo_adv_tcs_cdo_advection_builder_init (const cs_cdo_connect_t *connect, const cs_equation_param_t *eqp, bool do_diffusion)
 Initialize a builder structure for the convection operator. More...
 
cs_cdo_adv_tcs_cdo_advection_builder_free (cs_cdo_adv_t *b)
 Destroy a builder structure for the convection operator. More...
 
cs_locmat_tcs_cdovb_advection_build (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_real_33_t diffmat, cs_cdo_adv_t *b)
 Compute the convection operator attached to a cell with a CDO vertex-based scheme. More...
 
cs_locmat_tcs_cdovcb_advection_build (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, cs_cdo_adv_t *b)
 Compute the convection operator attached to a cell with a CDO vertex+cell-based scheme. More...
 
void cs_cdovb_advection_add_bc (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, cs_cdo_adv_t *b, cs_cdo_locsys_t *ls)
 Compute the BC contribution for the convection operator. More...
 
void cs_cdovcb_advection_add_bc (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, cs_cdo_adv_t *b, cs_cdo_locsys_t *ls)
 Compute the BC contribution for the convection operator with CDO V+C schemes. More...
 
void cs_cdo_advection_get_upwind_coef_cell (const cs_cdo_quantities_t *cdoq, const cs_param_advection_t a_info, cs_real_t coefval[])
 Compute the value in each cell of the upwinding coefficient given a related Peclet number. More...
 

Detailed Description

Build discrete advection operators for CDO vertex-based schemes.

Function Documentation

◆ _build_local_epcd()

static void _build_local_epcd ( const cs_cell_mesh_t cm,
const cs_param_advection_t  a_info,
cs_cdo_adv_t b 
)
static

Define the local convection operator between primal edges and dual cells. (Non-conservative formulation)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]a_infoset of parameters related to the advection operator
[in,out]bpointer to a cs_cdo_adv_t structure

◆ _build_local_vpfd()

static void _build_local_vpfd ( const cs_cell_mesh_t cm,
const cs_param_advection_t  a_info,
cs_cdo_adv_t b 
)
static

Define the local convection operator between primal vertices and dual faces. (Conservative formulation)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]a_infoset of parameters related to the advection operator
[in,out]bpointer to a cs_cdo_adv_t structure

◆ _set_fquant()

static short int _set_fquant ( const cs_cell_mesh_t cm,
short int  e,
short int  f,
const double *  tef,
double *  wvf 
)
inlinestatic

Retrieve the face edge id from a given cell edge id. Compute the weights related to each vertex of face from pre-computed quantities.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]eedge id in the cell numbering
[in]fface id in the cell numbering
[in]tefvalue of the area of the triangles tef
[in,out]wvfweights of vertices for the current face
Returns
the face edge id

◆ _upwind_weight()

static double _upwind_weight ( double  criterion,
const cs_param_advection_t  adv_info 
)
inlinestatic

Compute the value of the weighting function related to upwinding.

(end ignore by Doxygen)

Parameters
[in]criteriondot product between advection and normal vectors or estimation of a local Peclet number
[in]adv_infoset of options for the computation
Returns
the weight value

◆ _vcb_cellwise_consistent_part()

static void _vcb_cellwise_consistent_part ( const cs_nvec3_t  adv_cell,
const cs_cell_mesh_t cm,
const cs_face_mesh_t fm,
cs_cdo_adv_t b 
)
static

Compute the consistent part of the convection operator attached to a cell with a CDO vertex+cell-based scheme when the advection is considered as constant inside a cell.

Parameters
[in]adv_cellconstant vector field inside the current cell
[in]cmpointer to a cs_cell_mesh_t structure
[in]fmpointer to a cs_face_mesh_t structure
[in,out]bpointer to a convection builder structure

◆ _vcb_consistent_part()

static void _vcb_consistent_part ( const cs_adv_field_t *  adv_field,
const cs_nvec3_t  adv_cell,
const cs_cell_mesh_t cm,
const cs_face_mesh_t fm,
cs_cdo_adv_t b 
)
static

Compute the consistent part of the convection operator attached to a cell with a CDO vertex+cell-based scheme when the advection field is not considered constant inside the current cell.

Parameters
[in]adv_fieldpointer to a cs_adv_field_t structure
[in]adv_cellconstant vector field inside the current cell
[in]cmpointer to a cs_cell_mesh_t structure
[in]fmpointer to a cs_face_mesh_t structure
[in,out]bpointer to a convection builder structure

◆ _vcb_stabilization_part1()

static void _vcb_stabilization_part1 ( const cs_cell_mesh_t cm,
const cs_face_mesh_t fm,
const double  stab_coef,
cs_cdo_adv_t b 
)
static

Compute the stabilization part of the convection operator attached to a cell with a CDO vertex+cell-based scheme (inside pfc)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]fmpointer to a cs_face_mesh_t structure
[in]stab_coefdefault value of the stabilization coefficient
[in,out]bpointer to a convection builder structure

◆ _vcb_stabilization_part2()

static void _vcb_stabilization_part2 ( const cs_cell_mesh_t cm,
const double  stab_coef,
cs_cdo_adv_t b 
)
static

Compute the stabilization part of the convection operator attached to a cell with a CDO vertex+cell-based scheme (between pfc)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]stab_coefvalue of the stabilization coefficient
[in,out]bpointer to a convection builder structure

◆ cs_cdo_advection_builder_free()

cs_cdo_adv_t* cs_cdo_advection_builder_free ( cs_cdo_adv_t b)

Destroy a builder structure for the convection operator.

Parameters
[in,out]bpointer to a cs_cdo_adv_t struct. to free
Returns
a NULL pointer

◆ cs_cdo_advection_builder_init()

cs_cdo_adv_t* cs_cdo_advection_builder_init ( const cs_cdo_connect_t connect,
const cs_equation_param_t eqp,
bool  do_diffusion 
)

Initialize a builder structure for the convection operator.

Parameters
[in]connectpointer to the connectivity structure
[in]eqppointer to a cs_equation_param_t structure
[in]do_diffusiontrue is diffusion is activated
Returns
a pointer to a new allocated builder structure

◆ cs_cdo_advection_get_cip_coef()

double cs_cdo_advection_get_cip_coef ( void  )

Get the value of the stabilization coefficient used in CIP scheme.

Returns
the value the stabilization coefficient

◆ cs_cdo_advection_get_upwind_coef_cell()

void cs_cdo_advection_get_upwind_coef_cell ( const cs_cdo_quantities_t cdoq,
const cs_param_advection_t  a_info,
cs_real_t  coefval[] 
)

Compute the value in each cell of the upwinding coefficient given a related Peclet number.

Parameters
[in]cdoqpointer to the cdo quantities structure
[in]a_infoset of options for the advection term
[in,out]coefvalpointer to the pointer of real numbers to fill in: Peclet number in each cell out: value of the upwind coefficient

◆ cs_cdo_advection_set_cip_coef()

void cs_cdo_advection_set_cip_coef ( double  new_value)

Set the value of the stabilization coefficient used in CIP scheme.

Parameters
[in]new_valuevalue of the stabilization coefficient

◆ cs_cdovb_advection_add_bc()

void cs_cdovb_advection_add_bc ( const cs_cell_mesh_t cm,
const cs_equation_param_t eqp,
cs_cdo_adv_t b,
cs_cdo_locsys_t ls 
)

Compute the BC contribution for the convection operator.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]bpointer to a convection builder structure
[in,out]lscell-wise structure sotring the local system

◆ cs_cdovb_advection_build()

cs_locmat_t* cs_cdovb_advection_build ( const cs_cell_mesh_t cm,
const cs_equation_param_t eqp,
const cs_real_33_t  diffmat,
cs_cdo_adv_t b 
)

Compute the convection operator attached to a cell with a CDO vertex-based scheme.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in]diffmattensor related to the diffusion property
[in,out]bpointer to a convection builder structure
Returns
a pointer to a local dense matrix structure

◆ cs_cdovcb_advection_add_bc()

void cs_cdovcb_advection_add_bc ( const cs_cell_mesh_t cm,
const cs_equation_param_t eqp,
cs_cdo_adv_t b,
cs_cdo_locsys_t ls 
)

Compute the BC contribution for the convection operator with CDO V+C schemes.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]bpointer to a convection builder structure
[in,out]lscell-wise structure sotring the local system

◆ cs_cdovcb_advection_build()

cs_locmat_t* cs_cdovcb_advection_build ( const cs_cell_mesh_t cm,
const cs_equation_param_t eqp,
cs_cdo_adv_t b 
)

Compute the convection operator attached to a cell with a CDO vertex+cell-based scheme.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]bpointer to a convection builder structure
Returns
a pointer to a local dense matrix structure