programmer's documentation
Macros | Functions | Variables
cs_cdovb_codits.c File Reference
#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#include <string.h>
#include <limits.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_mesh.h"
#include "cs_timer.h"
#include "cs_timer_stats.h"
#include "cs_log.h"
#include "cs_search.h"
#include "cs_quadrature.h"
#include "cs_evaluate.h"
#include "cs_prototypes.h"
#include "cs_field.h"
#include "cs_matrix.h"
#include "cs_sles.h"
#include "cs_cdo_bc.h"
#include "cs_hodge.h"
#include "cs_cdovb_codits.h"
Include dependency graph for cs_cdovb_codits.c:

Macros

#define CDOVB_CODITS_DBG   0
 

Functions

static void _init_bc_structures (const cs_mesh_t *m, cs_cdovb_codits_t *sys)
 Initialize structures related to boundary conditions. More...
 
static void _compute_rhs (const cs_mesh_t *m, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_sla_matrix_t *ad, double tcur, cs_cdovb_codits_t *sys)
 Compute the right hand side (rhs) for a convection/diffusion equation. Take into account several contributions: –> Dirichlet, Neumann and Robin BCs –> Source terms. More...
 
static cs_sla_matrix_t_init_stiffness (cs_lnum_t n_vertices, const cs_cdo_connect_t *connect)
 Initialize a stiffness matrix. More...
 
static void _encode_edge_masks (cs_lnum_t c_id, int n_bits, int n_blocks, const cs_cdo_connect_t *connect, const short int vtag[], cs_flag_t masks[])
 Encode E_c cap E_v sets for all vertices of a cell using a mask of bits. More...
 
static cs_sla_matrix_t_build_stiffness_matrix (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_cdovb_codits_t *sys)
 Define the full stiffness matrix and the matrix related to the discrete Hodge operator from a cellwise assembly process. More...
 
static cs_sla_matrix_t_build_diffusion_system (const cs_mesh_t *m, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double tcur, cs_cdovb_codits_t *sys)
 Define the matrix "Ad" for the diffusion term and its right hand side (rhs). rhs potentially collects these contributions: More...
 
static void _map_to_matrix (cs_cdovb_codits_t *sys, cs_sla_matrix_t *sla_mat)
 Switch the matrix represenation from a cs_sla_matrix_t struct. to a cs_matrix_t struct. sla_mat is freed inside this routine. More...
 
static void _solve_linear_system (const cs_param_eq_t *eq, const cs_matrix_t *a, const cs_real_t *rhs, cs_real_t *x)
 Solve a linear system Ax = b arising from a CDO vertex-based scheme. More...
 
void cs_cdovb_codits_create_all (int n_scal_systems)
 Allocate the required number of scalar equations based on a vertex based discretization. More...
 
void cs_cdovb_codits_init (const cs_param_eq_t *eq, const cs_mesh_t *m, int eq_id)
 Initialize a cs_cdovb_codits_t. More...
 
void cs_cdovb_codits_free_all (void)
 Destroy all cs_cdovb_codits_t structures. More...
 
void cs_cdovb_codits_solve (const cs_mesh_t *m, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double tcur, int eq_id)
 Solve a scalar convection/diffusion equation with a CDO vertex-based scheme. More...
 
void cs_cdovb_codits_post (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, int eq_id)
 Post-process the solution of a scalar convection/diffusion equation solved with a CDO vertex-based scheme. More...
 

Variables

static int cs_cdovb_n_scal_systems = 0
 
static cs_cdovb_codits_t * cs_cdovb_scal_systems = NULL
 

Macro Definition Documentation

#define CDOVB_CODITS_DBG   0

Function Documentation

static cs_sla_matrix_t* _build_diffusion_system ( const cs_mesh_t m,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
double  tcur,
cs_cdovb_codits_t *  sys 
)
static

Define the matrix "Ad" for the diffusion term and its right hand side (rhs). rhs potentially collects these contributions:

  • Source terms
  • Neumann boundary conditions
  • Robin boundary conditions (TODO) [the explicit part]
  • Dirichlet boundary conditions : full Ad*Tbc
Parameters
[in]mpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]tcurcurrent physical time of the simulation
[in,out]syspointer to a cs_cdovb_codits_t struct.
Returns
a pointer to a cs_sla_matrix_t structure
static cs_sla_matrix_t* _build_stiffness_matrix ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_cdovb_codits_t *  sys 
)
static

Define the full stiffness matrix and the matrix related to the discrete Hodge operator from a cellwise assembly process.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in,out]syspointer to a cs_cdovb_codits_t struct.
Returns
a pointer to the full stiffness matrix
static void _compute_rhs ( const cs_mesh_t m,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_sla_matrix_t ad,
double  tcur,
cs_cdovb_codits_t *  sys 
)
static

Compute the right hand side (rhs) for a convection/diffusion equation. Take into account several contributions: –> Dirichlet, Neumann and Robin BCs –> Source terms.

Parameters
[in]mpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]adpointer to the (full) diffusion matrix
[in]tcurcurrent physical time of the simulation
[in,out]syspointer to a cs_cdovb_codits_t structure
static void _encode_edge_masks ( cs_lnum_t  c_id,
int  n_bits,
int  n_blocks,
const cs_cdo_connect_t connect,
const short int  vtag[],
cs_flag_t  masks[] 
)
static

Encode E_c cap E_v sets for all vertices of a cell using a mask of bits.

Parameters
[in]c_idcell id
[in]n_bitsnumber of bits in a block
[in]n_blocksnumber of blocks in a mask
[in]connectpoint to a cs_cdo_connect_t struct.
[in]vtagbuffer of tag indicating the local vertex id
[in,out]maskslist of masks
static void _init_bc_structures ( const cs_mesh_t m,
cs_cdovb_codits_t *  sys 
)
static

Initialize structures related to boundary conditions.

Parameters
[in]mpointer to the mesh structure
[in,out]syspointer to a cs_cdovb_codits_t structure
static cs_sla_matrix_t* _init_stiffness ( cs_lnum_t  n_vertices,
const cs_cdo_connect_t connect 
)
static

Initialize a stiffness matrix.

Parameters
[in]n_verticesnumber of vertices
[in]connectpointer to a cs_cdo_connect_t structure
Returns
a pointer to an initialized stiffness matrix
static void _map_to_matrix ( cs_cdovb_codits_t *  sys,
cs_sla_matrix_t sla_mat 
)
static

Switch the matrix represenation from a cs_sla_matrix_t struct. to a cs_matrix_t struct. sla_mat is freed inside this routine.

Parameters
[in,out]syspointer to a cs_cdovb_codits_t struct.
[in,out]sla_matpointer to a cs_sla_matrix_t struct.
static void _solve_linear_system ( const cs_param_eq_t eq,
const cs_matrix_t a,
const cs_real_t rhs,
cs_real_t x 
)
static

Solve a linear system Ax = b arising from a CDO vertex-based scheme.

Parameters
[in]eqpointer to a cs_param_eq_t structure
[in]apointer to a cs_matrix_t struct.
[in]rhsright-hand side
[in,out]xarray of unkowns
void cs_cdovb_codits_create_all ( int  n_scal_systems)

Allocate the required number of scalar equations based on a vertex based discretization.

Parameters
[in]n_scal_systemsnumber of scalar equations
void cs_cdovb_codits_free_all ( void  )

Destroy all cs_cdovb_codits_t structures.

void cs_cdovb_codits_init ( const cs_param_eq_t eq,
const cs_mesh_t m,
int  eq_id 
)

Initialize a cs_cdovb_codits_t.

Parameters
[in]eqpointer to a structure storing parameters of an eq.
[in]mpointer to a mesh structure
[in]eq_idid related to the equation/system to treat
void cs_cdovb_codits_post ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
int  eq_id 
)

Post-process the solution of a scalar convection/diffusion equation solved with a CDO vertex-based scheme.

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]eq_idid of the equation/system to treat
void cs_cdovb_codits_solve ( const cs_mesh_t m,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
double  tcur,
int  eq_id 
)

Solve a scalar convection/diffusion equation with a CDO vertex-based scheme.

Parameters
[in]mpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]tcurcurrent physical time of the simulation
[in]eq_idpointer to a cs_cdovb_codits_t struct.

Variable Documentation

int cs_cdovb_n_scal_systems = 0
static
cs_cdovb_codits_t* cs_cdovb_scal_systems = NULL
static