programmer's documentation
Macros | Functions | Variables
cs_cdofb_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 <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_cdofb_codits.h"
Include dependency graph for cs_cdofb_codits.c:

Macros

#define CDOFB_CODITS_DBG   0
 

Functions

static void _compute_cell_field (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, int sys_id)
 Post-process the solution of a scalar convection/diffusion equation solved with a CDO face-based scheme. More...
 
static void _init_bc_structures (const cs_mesh_t *m, cs_cdofb_codits_t *sys)
 Initialize structures related to boundary conditions. More...
 
static cs_sla_matrix_t_init_diffusion_matrix (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Allocate and initialize the matrix related to the diffusion op. Note: values are filled in a second step. 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, cs_real_t tcur, cs_cdofb_codits_t *sys)
 Define the final (reduced) matrix for diffusion and its right hand side (RHS). RHS is the sum of three contributions. More...
 
static void _map_to_matrix (cs_cdofb_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_cdofb_codits_create_all (int n_scal_systems)
 Allocate the required number of scalar equations based on a face based discretization. More...
 
void cs_cdofb_codits_init (const cs_param_eq_t *eq, const cs_mesh_t *m, int eq_id)
 Initialize a cs_cdofb_codits_t. More...
 
void cs_cdofb_codits_free_all (void)
 Destroy all cs_cdofb_codits_t structures. More...
 
void cs_cdofb_codits_solve (const cs_mesh_t *m, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, double tcur, int sys_id)
 Solve a scalar convection/diffusion equation with a CDO face-based scheme. More...
 
void cs_cdofb_codits_post (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, int sys_id)
 Post-process the solution of a scalar convection/diffusion equation solved with a CDO face-based scheme. More...
 
const double * cs_cdofb_codits_get_face_values (int eq_id)
 Get the computed values at each face. More...
 

Variables

static int cs_cdofb_n_scal_systems = 0
 
static cs_cdofb_codits_t * cs_cdofb_scal_systems = NULL
 

Macro Definition Documentation

#define CDOFB_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,
cs_real_t  tcur,
cs_cdofb_codits_t *  sys 
)
static

Define the final (reduced) matrix for diffusion and its right hand side (RHS). RHS is the sum of three contributions.

  • Source terms
  • Neumann boundary conditions
  • Dirichlet boundary conditions
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_cdofb_codits_t struct.
Returns
a pointer to the full stiffness matrix
static void _compute_cell_field ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
int  sys_id 
)
static

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

Parameters
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantpointer to a cs_cdo_quantities_t struct.
[in]sys_idid of the equation/system to treat
static void _init_bc_structures ( const cs_mesh_t m,
cs_cdofb_codits_t *  sys 
)
static

Initialize structures related to boundary conditions.

Parameters
[in]mpointer to the mesh structure
[in,out]syspointer to a cs_cdofb_codits_t structure
static cs_sla_matrix_t* _init_diffusion_matrix ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Allocate and initialize the matrix related to the diffusion op. Note: values are filled in a second step.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
Returns
a pointer to a cs_sla_matrix_t structure
static void _map_to_matrix ( cs_cdofb_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_cdofb_codits_create_all ( int  n_scal_systems)

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

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

Destroy all cs_cdofb_codits_t structures.

const double* cs_cdofb_codits_get_face_values ( int  eq_id)

Get the computed values at each face.

Parameters
[in]eq_idid related to a cs_param_eq_t struct.
Returns
a pointer to an array of double (size n_faces)
void cs_cdofb_codits_init ( const cs_param_eq_t eq,
const cs_mesh_t m,
int  eq_id 
)

Initialize a cs_cdofb_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 to treat
void cs_cdofb_codits_post ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
int  sys_id 
)

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

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

Solve a scalar convection/diffusion equation with a CDO face-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]sys_idpointer to a cs_cdofb_codits_t struct.

Variable Documentation

int cs_cdofb_n_scal_systems = 0
static
cs_cdofb_codits_t* cs_cdofb_scal_systems = NULL
static