9.0
general documentation
Loading...
Searching...
No Matches
cs_cdovb_scalsys.cpp File Reference

Build an algebraic CDO vertex-based system for a set of coupled unsteady convection-diffusion-reaction of scalar-valued equations with source terms. More...

#include "base/cs_defs.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft/bft_mem.h"
#include "base/cs_array.h"
#include "cdo/cs_cdo_assembly.h"
#include "cdo/cs_cdo_system.h"
#include "cdo/cs_cdovb_priv.h"
#include "cdo/cs_cdovb_scaleq.h"
#include "alge/cs_matrix.h"
#include "base/cs_parameters.h"
#include "alge/cs_sles.h"
#include "cdo/cs_cdovb_scalsys.h"
Include dependency graph for cs_cdovb_scalsys.cpp:

Macros

#define CS_CDOVB_SCALSYS_DBG   0

Typedefs

typedef void cs_cdovb_scalsys_build_t(bool cur2prev, int n_equations, cs_equation_core_t **blocks, cs_cdovb_scalsys_t *scalsys, cs_field_t **fields, cs_cdo_system_helper_t *sh)
 Build the linear system of equations. The number of rows in the system is equal to the number of equations. Thus there are n_eqs*n_eqs blocks in the system. Each block corresponds potentially to a scalar-valued unsteady convection/diffusion/reaction equation with a CDO-Vb scheme.
typedef void cs_cdovb_scalsys_asb_t(const cs_cell_sys_t *csys, cs_cdo_system_helper_t *sh, cs_equation_builder_t *eqb, cs_cdo_assembly_t *asb)
 Generic function pointer to perform the assembly step. Add the block attached to the block (row_id, col_id) in the full (coupled) system.
typedef int cs_cdovb_scalsys_solve_t(int n_eqs, cs_lnum_t n_dofs, const cs_equation_system_param_t *sysp, cs_cdo_system_helper_t *sh, cs_real_t *vals)
 Solve a linear system arising for a system of equations relying on scalar-valued CDO vertex-based schemes.

Functions

void cs_cdovb_scalsys_init_sharing (const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
 Set pointers to the main shared structures.
void * cs_cdovb_scalsys_define (int n_eqs, const cs_equation_system_param_t *sysp, cs_equation_core_t **block_factories, cs_cdo_system_helper_t **p_sh)
 Create and initialize factories for extra-diagonal blocks Build equation builders and scheme context structures for each equation which are in the extra-diagonal blocks related to a system of equations. Structures associated to diagonal blocks should be already initialized during the treatment of the classical full equations.
void * cs_cdovb_scalsys_free (int n_eqs, cs_equation_core_t **blocks, void *sys_context)
 Free an array of structures (equation parameters, equation builders or scheme context) for each equation which are in the extra-diagonal blocks related to a system of equations. Structures associated to diagonal blocks are freed during the treatment of the classical full equations.
void cs_cdovb_scalsys_solve_implicit (bool cur2prev, const cs_time_step_t *time_step, int n_equations, cs_equation_system_param_t *sysp, cs_equation_core_t **blocks, void *sys_context, cs_cdo_system_helper_t *sh)
 Build and solve the linear system of equations. The number of rows in the system is equal to the number of equations. Thus there are n_eqs*n_eqs blocks in the system. Each block corresponds potentially to a scalar-valued unsteady convection/diffusion/reaction equation with a CDO-Vb scheme using an implicit time scheme.
void cs_cdovb_scalsys_solve_implicit_incr (bool cur2prev, const cs_time_step_t *time_step, int n_equations, cs_equation_system_param_t *sysp, cs_equation_core_t **blocks, void *sys_context, cs_cdo_system_helper_t *sh)
 Build and solve the system of equations. The number of rows in the system is equal to the number of equations. Thus there are n_eqs*n_eqs blocks in the system. Each block corresponds potentially to a scalar-valued unsteady convection/diffusion/reaction equation with a CDO-Vb scheme using an implicit time scheme and an incremental resolution.

Detailed Description

Build an algebraic CDO vertex-based system for a set of coupled unsteady convection-diffusion-reaction of scalar-valued equations with source terms.

Macro Definition Documentation

◆ CS_CDOVB_SCALSYS_DBG

#define CS_CDOVB_SCALSYS_DBG   0

Typedef Documentation

◆ cs_cdovb_scalsys_asb_t

typedef void cs_cdovb_scalsys_asb_t(const cs_cell_sys_t *csys, cs_cdo_system_helper_t *sh, cs_equation_builder_t *eqb, cs_cdo_assembly_t *asb)

Generic function pointer to perform the assembly step. Add the block attached to the block (row_id, col_id) in the full (coupled) system.

Parameters
[in]csyspointer to a cellwise view of the system
[in,out]shpointer to the system helper of the coupled sys.
[in,out]eqccontext for this kind of discretization
[in,out]asbpointer to a cs_cdo_assembly_t structure

◆ cs_cdovb_scalsys_build_t

typedef void cs_cdovb_scalsys_build_t(bool cur2prev, int n_equations, cs_equation_core_t **blocks, cs_cdovb_scalsys_t *scalsys, cs_field_t **fields, cs_cdo_system_helper_t *sh)

Build the linear system of equations. The number of rows in the system is equal to the number of equations. Thus there are n_eqs*n_eqs blocks in the system. Each block corresponds potentially to a scalar-valued unsteady convection/diffusion/reaction equation with a CDO-Vb scheme.

Parameters
[in]cur2prevdo a "current to previous" operation ?
[in]n_eqsnumber of equations
[in,out]blocksarray of the core members for an equation
[in,out]scalsyspointer to a cs_cdovb_scalsys_t structure
[in,out]fieldsarray of pointers to the associated fields
[in,out]shpointer to a system helper structure

◆ cs_cdovb_scalsys_solve_t

typedef int cs_cdovb_scalsys_solve_t(int n_eqs, cs_lnum_t n_dofs, const cs_equation_system_param_t *sysp, cs_cdo_system_helper_t *sh, cs_real_t *vals)

Solve a linear system arising for a system of equations relying on scalar-valued CDO vertex-based schemes.

Parameters
[in]n_eqsnumber of equations constituting the system
[in]n_dofslocal number of DoFs (may be != n_gather_elts)
[in]syspparameter settings
[in,out]shpointer to the system helper structure
[in,out]valsvalues to compute
Returns
the number of iterations of the linear solver

Function Documentation

◆ cs_cdovb_scalsys_define()

void * cs_cdovb_scalsys_define ( int n_eqs,
const cs_equation_system_param_t * sysp,
cs_equation_core_t ** block_factories,
cs_cdo_system_helper_t ** p_sh )

Create and initialize factories for extra-diagonal blocks Build equation builders and scheme context structures for each equation which are in the extra-diagonal blocks related to a system of equations. Structures associated to diagonal blocks should be already initialized during the treatment of the classical full equations.

Case of scalar-valued CDO-Vb scheme in each block

Parameters
[in]n_eqsnumber of equations
[in]syspset of parameters to specify a system of eqs
[in,out]block_factoriesarray of the core members for an equation
[out]p_shsystem helper structure to initialize
Returns
a pointer to a new allocated system context structure

◆ cs_cdovb_scalsys_free()

void * cs_cdovb_scalsys_free ( int n_eqs,
cs_equation_core_t ** blocks,
void * sys_context )

Free an array of structures (equation parameters, equation builders or scheme context) for each equation which are in the extra-diagonal blocks related to a system of equations. Structures associated to diagonal blocks are freed during the treatment of the classical full equations.

Case of scalar-valued CDO-Vb scheme in each block

Parameters
[in]n_eqsnumber of equations
[in,out]blocksarray of the core structures for an equation
[in,out]sys_contextpointer to a structure cast on-the-fly

◆ cs_cdovb_scalsys_init_sharing()

void cs_cdovb_scalsys_init_sharing ( const cs_mesh_t * mesh,
const cs_cdo_connect_t * connect,
const cs_cdo_quantities_t * quant,
const cs_time_step_t * time_step )

Set pointers to the main shared structures.

Parameters
[in]meshbasic mesh structure
[in]connectpointer to a cs_cdo_connect_t struct.
[in]quantadditional mesh quantities struct.
[in]time_steppointer to a time step structure

◆ cs_cdovb_scalsys_solve_implicit()

void cs_cdovb_scalsys_solve_implicit ( bool cur2prev,
const cs_time_step_t * time_step,
int n_equations,
cs_equation_system_param_t * sysp,
cs_equation_core_t ** blocks,
void * sys_context,
cs_cdo_system_helper_t * sh )

Build and solve the linear system of equations. The number of rows in the system is equal to the number of equations. Thus there are n_eqs*n_eqs blocks in the system. Each block corresponds potentially to a scalar-valued unsteady convection/diffusion/reaction equation with a CDO-Vb scheme using an implicit time scheme.

Parameters
[in]cur2prevdo a "current to previous" operation ?
[in]time_steppointer to a time step structure
[in]n_equationsnumber of equations
[in]syspset of paremeters for the system of equations
[in,out]blocksarray of the core members for an equation
[in,out]sys_contextpointer to a structure cast on-the-fly
[in,out]shpointer to a system helper structure

◆ cs_cdovb_scalsys_solve_implicit_incr()

void cs_cdovb_scalsys_solve_implicit_incr ( bool cur2prev,
const cs_time_step_t * time_step,
int n_equations,
cs_equation_system_param_t * sysp,
cs_equation_core_t ** blocks,
void * sys_context,
cs_cdo_system_helper_t * sh )

Build and solve the system of equations. The number of rows in the system is equal to the number of equations. Thus there are n_eqs*n_eqs blocks in the system. Each block corresponds potentially to a scalar-valued unsteady convection/diffusion/reaction equation with a CDO-Vb scheme using an implicit time scheme and an incremental resolution.

Parameters
[in]cur2prevdo a "current to previous" operation ?
[in]time_steppointer to a time step structure
[in]n_equationsnumber of equations
[in]syspset of paremeters for the system of equations
[in,out]blocksarray of the core members for an equation
[in,out]sys_contextpointer to a structure cast on-the-fly
[in,out]shpointer to a system helper structure