programmer's documentation
Functions
cs_cdovb_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_evaluate.h"
#include "cs_cdovb_advection.h"
Include dependency graph for cs_cdovb_advection.c:

Functions

static cs_real_t _upwind_weight (cs_real_t criterion, const cs_param_advection_t adv_info)
 Compute the value of the weighting function related to upwinding. More...
 
static void _init_with_diffusion (cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_33_t matpty, cs_cdovb_adv_t *b)
 Initialize the builder structure and the local matrix related to the convection operator when diffusion is also activated. More...
 
static void _init (cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_cdovb_adv_t *b)
 Initialize the builder structure and the local matrix related to the convection operator. More...
 
static void _build_local_epcd (cs_lnum_t c_id, const cs_connect_index_t *c2e, const cs_sla_matrix_t *e2v, const cs_lnum_t *loc_ids, cs_cdovb_adv_t *builder)
 Define the local EpCd convection operator. More...
 
static void _build_local_vpfd (cs_lnum_t c_id, const cs_connect_index_t *c2e, const cs_sla_matrix_t *e2v, const cs_lnum_t *loc_ids, cs_cdovb_adv_t *builder)
 Define the local VpCd convection operator. More...
 
cs_cdovb_adv_tcs_cdovb_advection_builder_init (const cs_cdo_connect_t *connect, const cs_adv_field_t *adv, const cs_param_advection_t a_info, bool do_diffusion)
 Initialize a builder structure for the convection operator. More...
 
cs_cdovb_adv_tcs_cdovb_advection_builder_free (cs_cdovb_adv_t *b)
 Destroy a builder structure for the convection operator. More...
 
cs_locmat_tcs_cdovb_advection_build_local (cs_lnum_t c_id, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_lnum_t *loc_ids, const cs_real_33_t diffmat, cs_cdovb_adv_t *builder)
 Compute the convection operator for pure convection. More...
 
void cs_cdovb_advection_add_bc (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_real_t *dir_vals, cs_cdovb_adv_t *builder, cs_real_t rhs_contrib[], cs_real_t diag_contrib[])
 Compute the convection operator for pure convection. More...
 
void cs_cdovb_advection_get_peclet_cell (const cs_cdo_quantities_t *cdoq, const cs_adv_field_t *adv, const cs_property_t *diff_property, const cs_real_3_t dir_vect, cs_real_t *p_peclet[])
 Compute the Peclet number in each cell in a given direction. More...
 
void cs_cdovb_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

static void _build_local_epcd ( cs_lnum_t  c_id,
const cs_connect_index_t c2e,
const cs_sla_matrix_t e2v,
const cs_lnum_t loc_ids,
cs_cdovb_adv_t builder 
)
static

Define the local EpCd convection operator.

Parameters
[in]c_idcell id
[in]c2ecell -> edges connectivity structure
[in]e2vedge -> vertices connectivity structure
[in]loc_idsstore the value of the local id for each entity
[in,out]builderpointer to a builder structure
static void _build_local_vpfd ( cs_lnum_t  c_id,
const cs_connect_index_t c2e,
const cs_sla_matrix_t e2v,
const cs_lnum_t loc_ids,
cs_cdovb_adv_t builder 
)
static

Define the local VpCd convection operator.

Parameters
[in]c_idcell id
[in]c2ecell -> edges connectivity structure
[in]e2vedge -> vertices connectivity structure
[in]loc_idsstore the value of the local id for each entity
[in,out]builderpointer to a builder structure
static void _init ( cs_lnum_t  c_id,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_cdovb_adv_t b 
)
static

Initialize the builder structure and the local matrix related to the convection operator.

Parameters
[in]c_idcell id
[in]connectpointer to the connectivity structure
[in]quantpointer to the cdo quantities structure
[in,out]bpointer to a convection builder structure
static void _init_with_diffusion ( cs_lnum_t  c_id,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_real_33_t  matpty,
cs_cdovb_adv_t b 
)
static

Initialize the builder structure and the local matrix related to the convection operator when diffusion is also activated.

Parameters
[in]c_idcell id
[in]connectpointer to the connectivity structure
[in]quantpointer to the cdo quantities structure
[in]matptytensor related to the diffusion property
[in,out]bpointer to a convection builder structure
static cs_real_t _upwind_weight ( cs_real_t  criterion,
const cs_param_advection_t  adv_info 
)
static

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
void cs_cdovb_advection_add_bc ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_real_t dir_vals,
cs_cdovb_adv_t builder,
cs_real_t  rhs_contrib[],
cs_real_t  diag_contrib[] 
)

Compute the convection operator for pure convection.

Parameters
[in]connectpointer to the connectivity structure
[in]quantpointer to the cdo quantities structure
[in]dir_valsvalues of the Dirichlet boundary condition
[in,out]builderpointer to a convection builder structure
[in,out]rhs_contribarray storing the rhs contribution
[in,out]diag_contribarray storing the diagonal contribution
cs_locmat_t* cs_cdovb_advection_build_local ( cs_lnum_t  c_id,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_lnum_t loc_ids,
const cs_real_33_t  diffmat,
cs_cdovb_adv_t builder 
)

Compute the convection operator for pure convection.

Parameters
[in]c_idcell id
[in]connectpointer to the connectivity structure
[in]quantpointer to the cdo quantities structure
[in]loc_idsstore the local entity ids for this cell
[in]diffmattensor related to the diffusion property
[in,out]builderpointer to a convection builder structure
Returns
a pointer to a local dense matrix structure
cs_cdovb_adv_t* cs_cdovb_advection_builder_free ( cs_cdovb_adv_t b)

Destroy a builder structure for the convection operator.

Parameters
[in,out]bpointer to a cs_cdovb_adv_t struct. to free
Returns
a NULL pointer
cs_cdovb_adv_t* cs_cdovb_advection_builder_init ( const cs_cdo_connect_t connect,
const cs_adv_field_t *  adv,
const cs_param_advection_t  a_info,
bool  do_diffusion 
)

Initialize a builder structure for the convection operator.

Parameters
[in]connectpointer to the connectivity structure
[in]adv_fieldpointer to a cs_adv_field_t structure
[in]a_infoset of options for the advection term
[in]do_diffusiontrue is diffusion is activated
Returns
a pointer to a new allocated builder structure
void cs_cdovb_advection_get_peclet_cell ( const cs_cdo_quantities_t cdoq,
const cs_adv_field_t *  adv,
const cs_property_t *  diff_property,
const cs_real_3_t  dir_vect,
cs_real_t p_peclet[] 
)

Compute the Peclet number in each cell in a given direction.

Parameters
[in]cdoqpointer to the cdo quantities structure
[in]advpointer to the advection field struct.
[in]diff_propertypointer to the diffusion property struct.
[in]dir_vectdirection for estimating the Peclet number
[in,out]pecletpointer to the pointer of real numbers to fill
void cs_cdovb_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