8.1
general documentation
cs_cdofb_vecteq.h File Reference
#include "cs_defs.h"
#include "cs_base.h"
#include "cs_cdo_assembly.h"
#include "cs_cdo_connect.h"
#include "cs_cdo_quantities.h"
#include "cs_cdofb_priv.h"
#include "cs_equation_builder.h"
#include "cs_equation_param.h"
#include "cs_field.h"
#include "cs_matrix.h"
#include "cs_mesh.h"
#include "cs_restart.h"
#include "cs_sles.h"
#include "cs_source_term.h"
#include "cs_time_step.h"
+ Include dependency graph for cs_cdofb_vecteq.h:

Go to the source code of this file.

Functions

static void cs_cdofb_vecteq_sourceterm (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_real_t t_eval, const cs_real_t coef, cs_hodge_t *mass_hodge, cs_cell_builder_t *cb, cs_equation_builder_t *eqb, cs_cell_sys_t *csys)
 Compute the source term for a vector-valued CDO-Fb scheme and add it to the local rhs Mass matrix is optional. It can be set to NULL. More...
 
bool cs_cdofb_vecteq_is_initialized (void)
 Check if the generic structures for building a CDO-Fb scheme are allocated. More...
 
void cs_cdofb_vecteq_init_sharing (const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step)
 Allocate work buffer and general structures related to CDO vector-valued face-based schemes. Set shared pointers from the main domain members. More...
 
void cs_cdofb_vecteq_get (cs_cell_sys_t **csys, cs_cell_builder_t **cb)
 Retrieve work buffers used for building a CDO system cellwise. More...
 
void cs_cdofb_vecteq_finalize_sharing (void)
 Free work buffer and general structure related to CDO face-based schemes. More...
 
void * cs_cdofb_vecteq_init_context (const cs_equation_param_t *eqp, int var_id, int bflux_id, cs_equation_builder_t *eqb)
 Initialize a cs_cdofb_vecteq_t structure storing data useful for building and managing such a scheme. More...
 
void * cs_cdofb_vecteq_free_context (void *data)
 Destroy a cs_cdofb_vecteq_t structure. More...
 
void cs_cdofb_vecteq_init_values (cs_real_t t_eval, const int field_id, const cs_mesh_t *mesh, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
 Set the initial values of the variable field taking into account the boundary conditions. Case of vector-valued CDO-Fb schemes. More...
 
void cs_cdofb_vecteq_init_cell_system (const cs_cell_mesh_t *cm, const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, const cs_real_t val_f_n[], const cs_real_t val_c_n[], const cs_real_t val_f_nm1[], const cs_real_t val_c_nm1[], cs_cell_sys_t *csys, cs_cell_builder_t *cb)
 Initialize the local structure for the current cell The algebraic system for time t^{n+1} is going to be built knowing previous field at time t^{n} and potentially the field at time t^{n-1}. Make sure to be consistent between the call to current_to_previous and the parameters vel_{f,c}_n/nm1 given. More...
 
void cs_cdofb_vecteq_setup (cs_real_t t_eval, const cs_mesh_t *mesh, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb)
 Set the boundary conditions known from the settings Define an indirection array for the enforcement of internal DoFs only if needed. This is stored inside eqb. More...
 
void cs_cdofb_vecteq_diffusion (const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, const cs_cdofb_vecteq_t *eqc, const cs_cell_mesh_t *cm, cs_hodge_t *diff_hodge, cs_cell_sys_t *csys, cs_cell_builder_t *cb)
 Build the local matrices arising from the diffusion term in the vector-valued CDO-Fb schemes. More...
 
void cs_cdofb_vecteq_conv_diff_reac (const cs_equation_param_t *eqp, const cs_equation_builder_t *eqb, const cs_cdofb_vecteq_t *eqc, const cs_cell_mesh_t *cm, cs_hodge_t *mass_hodge, cs_hodge_t *diff_hodge, cs_cell_sys_t *csys, cs_cell_builder_t *cb)
 Build the local matrices arising from the convection, diffusion, reaction terms in vector-valued CDO-Fb schemes. mass_hodge could be set to NULL if a Voronoi algo. is used. Otherwise, the mass matrix should be pre-computed. More...
 
void cs_cdofb_vecteq_assembly (const cs_cell_sys_t *csys, cs_cdo_system_block_t *block, cs_real_t *rhs, cs_cdofb_vecteq_t *eqc, cs_cdo_assembly_t *asb)
 Perform the assembly stage for a vector-valued system obtained with CDO-Fb scheme. More...
 
void cs_cdofb_vecteq_update_cell_fields (cs_timer_counter_t *tce, cs_field_t *fld, cs_cdofb_vecteq_t *eqc, bool cur2prev)
 Update the variables associated to cells in case of a CDO-Fb scheme. This has to be done after a resolution. More...
 
void cs_cdofb_vecteq_solve_steady_state (bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
 Build and solve the linear system arising from a vector steady-state diffusion equation with a CDO-Fb scheme One works cellwise and then process to the assembly. More...
 
void cs_cdofb_vecteq_solve_implicit (bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
 Build and solve the linear system arising from a vector diffusion equation with a CDO-Fb scheme and an implicit Euler scheme. One works cellwise and then process to the assembly. More...
 
void cs_cdofb_vecteq_solve_theta (bool cur2prev, const cs_mesh_t *mesh, const int field_id, const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
 Build and solve the linear system arising from a vector diffusion equation with a CDO-Fb scheme and an implicit/explicit theta scheme. One works cellwise and then process to the assembly. More...
 
void cs_cdofb_vecteq_current_to_previous (const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
 Operate a current to previous operation for the field associated to this equation and potentially for related fields/arrays. More...
 
void cs_cdofb_vecteq_extra_post (const cs_equation_param_t *eqp, cs_equation_builder_t *eqb, void *context)
 Predefined extra-operations related to this equation. More...
 
cs_real_tcs_cdofb_vecteq_get_cell_values (void *context, bool previous)
 Get the computed values at mesh cells from the inverse operation w.r.t. the static condensation (DoF used in the linear system are located at primal faces) The lifecycle of this array is managed by the code. So one does not have to free the return pointer. More...
 
cs_real_tcs_cdofb_vecteq_get_face_values (void *context, bool previous)
 Retrieve an array of values at mesh faces for the current context. The lifecycle of this array is managed by the code. So one does not have to free the return pointer. More...
 
void cs_cdofb_vecteq_read_restart (cs_restart_t *restart, const char *eqname, void *scheme_context)
 Read additional arrays (not defined as fields) but useful for the checkpoint/restart process. More...
 
void cs_cdofb_vecteq_write_restart (cs_restart_t *restart, const char *eqname, void *scheme_context)
 Write additional arrays (not defined as fields) but useful for the checkpoint/restart process. More...
 

Function Documentation

◆ cs_cdofb_vecteq_assembly()

void cs_cdofb_vecteq_assembly ( const cs_cell_sys_t csys,
cs_cdo_system_block_t block,
cs_real_t rhs,
cs_cdofb_vecteq_t *  eqc,
cs_cdo_assembly_t *  asb 
)

Perform the assembly stage for a vector-valued system obtained with CDO-Fb scheme.

Parameters
[in]csyspointer to a cs_cell_sys_t structure
[in,out]blockpointer to a block structure
[in,out]rhsarray of values for the rhs
[in,out]eqccontext structure for a vector-valued Fb
[in,out]asbpointer to cs_cdo_assembly_t

◆ cs_cdofb_vecteq_conv_diff_reac()

void cs_cdofb_vecteq_conv_diff_reac ( const cs_equation_param_t eqp,
const cs_equation_builder_t eqb,
const cs_cdofb_vecteq_t *  eqc,
const cs_cell_mesh_t cm,
cs_hodge_t mass_hodge,
cs_hodge_t diff_hodge,
cs_cell_sys_t csys,
cs_cell_builder_t cb 
)

Build the local matrices arising from the convection, diffusion, reaction terms in vector-valued CDO-Fb schemes. mass_hodge could be set to NULL if a Voronoi algo. is used. Otherwise, the mass matrix should be pre-computed.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]eqbpointer to a cs_equation_builder_t structure
[in]eqccontext for this kind of discretization
[in]cmpointer to a cellwise view of the mesh
[in,out]mass_hodgepointer to a cs_hodge_t structure for reaction
[in,out]diff_hodgepointer to a cs_hodge_t structure for diffusion
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_cdofb_vecteq_current_to_previous()

void cs_cdofb_vecteq_current_to_previous ( const cs_equation_param_t eqp,
cs_equation_builder_t eqb,
void *  context 
)

Operate a current to previous operation for the field associated to this equation and potentially for related fields/arrays.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]contextpointer to cs_cdofb_vecteq_t structure

◆ cs_cdofb_vecteq_diffusion()

void cs_cdofb_vecteq_diffusion ( const cs_equation_param_t eqp,
const cs_equation_builder_t eqb,
const cs_cdofb_vecteq_t *  eqc,
const cs_cell_mesh_t cm,
cs_hodge_t diff_hodge,
cs_cell_sys_t csys,
cs_cell_builder_t cb 
)

Build the local matrices arising from the diffusion term in the vector-valued CDO-Fb schemes.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]eqbpointer to a cs_equation_builder_t structure
[in]eqccontext for this kind of discretization
[in]cmpointer to a cellwise view of the mesh
[in,out]diff_hodgepointer to a cs_hodge_t structure for diffusion
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_cdofb_vecteq_extra_post()

void cs_cdofb_vecteq_extra_post ( const cs_equation_param_t eqp,
cs_equation_builder_t eqb,
void *  context 
)

Predefined extra-operations related to this equation.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]contextpointer to cs_cdofb_vecteq_t structure

◆ cs_cdofb_vecteq_finalize_sharing()

void cs_cdofb_vecteq_finalize_sharing ( void  )

Free work buffer and general structure related to CDO face-based schemes.

◆ cs_cdofb_vecteq_free_context()

void* cs_cdofb_vecteq_free_context ( void *  data)

Destroy a cs_cdofb_vecteq_t structure.

Parameters
[in,out]datapointer to a cs_cdofb_vecteq_t structure
Returns
a NULL pointer

◆ cs_cdofb_vecteq_get()

void cs_cdofb_vecteq_get ( cs_cell_sys_t **  csys,
cs_cell_builder_t **  cb 
)

Retrieve work buffers used for building a CDO system cellwise.

Parameters
[out]csysdouble pointer to a cs_cell_sys_t structure
[out]cbdouble pointer to a cs_cell_builder_t structure

◆ cs_cdofb_vecteq_get_cell_values()

cs_real_t* cs_cdofb_vecteq_get_cell_values ( void *  context,
bool  previous 
)

Get the computed values at mesh cells from the inverse operation w.r.t. the static condensation (DoF used in the linear system are located at primal faces) The lifecycle of this array is managed by the code. So one does not have to free the return pointer.

Parameters
[in,out]contextpointer to a data structure cast on-the-fly
[in]previousretrieve the previous state (true/false)
Returns
a pointer to an array of cs_real_t (size 3*n_cells)

◆ cs_cdofb_vecteq_get_face_values()

cs_real_t* cs_cdofb_vecteq_get_face_values ( void *  context,
bool  previous 
)

Retrieve an array of values at mesh faces for the current context. The lifecycle of this array is managed by the code. So one does not have to free the return pointer.

Parameters
[in,out]contextpointer to a data structure cast on-the-fly
[in]previousretrieve the previous state (true/false)
Returns
a pointer to an array of cs_real_t (size 3*n_faces)

◆ cs_cdofb_vecteq_init_cell_system()

void cs_cdofb_vecteq_init_cell_system ( const cs_cell_mesh_t cm,
const cs_equation_param_t eqp,
const cs_equation_builder_t eqb,
const cs_real_t  val_f_n[],
const cs_real_t  val_c_n[],
const cs_real_t  val_f_nm1[],
const cs_real_t  val_c_nm1[],
cs_cell_sys_t csys,
cs_cell_builder_t cb 
)

Initialize the local structure for the current cell The algebraic system for time t^{n+1} is going to be built knowing previous field at time t^{n} and potentially the field at time t^{n-1}. Make sure to be consistent between the call to current_to_previous and the parameters vel_{f,c}_n/nm1 given.

Parameters
[in]cmpointer to a cellwise view of the mesh
[in]eqppointer to a cs_equation_param_t structure
[in]eqbpointer to a cs_equation_builder_t structure
[in]val_f_nface DoFs at time step n
[in]val_c_ncell DoFs at time step n
[in]val_f_nm1face DoFs at time step n-1 or NULL
[in]val_c_nm1cell DoFs at time step n-1 or NULL
[in,out]csyspointer to a cellwise view of the system
[in,out]cbpointer to a cellwise builder

◆ cs_cdofb_vecteq_init_context()

void* cs_cdofb_vecteq_init_context ( const cs_equation_param_t eqp,
int  var_id,
int  bflux_id,
cs_equation_builder_t eqb 
)

Initialize a cs_cdofb_vecteq_t structure storing data useful for building and managing such a scheme.

Parameters
[in]eqppointer to a cs_equation_param_t structure
[in]var_idid of the variable field
[in]bflux_idid of the boundary flux field
[in,out]eqbpointer to a cs_equation_builder_t structure
Returns
a pointer to a new allocated cs_cdofb_vecteq_t structure

◆ cs_cdofb_vecteq_init_sharing()

void cs_cdofb_vecteq_init_sharing ( const cs_cdo_quantities_t quant,
const cs_cdo_connect_t connect,
const cs_time_step_t time_step 
)

Allocate work buffer and general structures related to CDO vector-valued face-based schemes. Set shared pointers from the main domain members.

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

◆ cs_cdofb_vecteq_init_values()

void cs_cdofb_vecteq_init_values ( cs_real_t  t_eval,
const int  field_id,
const cs_mesh_t mesh,
const cs_equation_param_t eqp,
cs_equation_builder_t eqb,
void *  context 
)

Set the initial values of the variable field taking into account the boundary conditions. Case of vector-valued CDO-Fb schemes.

Parameters
[in]t_evaltime at which one evaluates BCs
[in]field_idid related to the variable field of this equation
[in]meshpointer to a cs_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]contextpointer to the scheme context (cast on-the-fly)

◆ cs_cdofb_vecteq_is_initialized()

bool cs_cdofb_vecteq_is_initialized ( void  )

Check if the generic structures for building a CDO-Fb scheme are allocated.

Returns
true or false

◆ cs_cdofb_vecteq_read_restart()

void cs_cdofb_vecteq_read_restart ( cs_restart_t restart,
const char *  eqname,
void *  scheme_context 
)

Read additional arrays (not defined as fields) but useful for the checkpoint/restart process.

Parameters
[in,out]restartpointer to cs_restart_t structure
[in]eqnamename of the related equation
[in]scheme_contextpointer to a data structure cast on-the-fly

◆ cs_cdofb_vecteq_setup()

void cs_cdofb_vecteq_setup ( cs_real_t  t_eval,
const cs_mesh_t mesh,
const cs_equation_param_t eqp,
cs_equation_builder_t eqb 
)

Set the boundary conditions known from the settings Define an indirection array for the enforcement of internal DoFs only if needed. This is stored inside eqb.

Parameters
[in]t_evaltime at which one evaluates BCs
[in]meshpointer to a cs_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure

DOXYGEN_SHOULD_SKIP_THIS

Parameters
[in]t_evaltime at which one evaluates BCs
[in]meshpointer to a cs_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure

◆ cs_cdofb_vecteq_solve_implicit()

void cs_cdofb_vecteq_solve_implicit ( bool  cur2prev,
const cs_mesh_t mesh,
const int  field_id,
const cs_equation_param_t eqp,
cs_equation_builder_t eqb,
void *  context 
)

Build and solve the linear system arising from a vector diffusion equation with a CDO-Fb scheme and an implicit Euler scheme. One works cellwise and then process to the assembly.

Parameters
[in]cur2prevtrue="current to previous" operation is performed
[in]meshpointer to a cs_mesh_t structure
[in]field_idid of the variable field related to this equation
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]contextpointer to cs_cdofb_vecteq_t structure

◆ cs_cdofb_vecteq_solve_steady_state()

void cs_cdofb_vecteq_solve_steady_state ( bool  cur2prev,
const cs_mesh_t mesh,
const int  field_id,
const cs_equation_param_t eqp,
cs_equation_builder_t eqb,
void *  context 
)

Build and solve the linear system arising from a vector steady-state diffusion equation with a CDO-Fb scheme One works cellwise and then process to the assembly.

Parameters
[in]cur2prevtrue="current to previous" operation is performed
[in]meshpointer to a cs_mesh_t structure
[in]field_idid of the variable field related to this equation
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]contextpointer to cs_cdofb_vecteq_t structure

◆ cs_cdofb_vecteq_solve_theta()

void cs_cdofb_vecteq_solve_theta ( bool  cur2prev,
const cs_mesh_t mesh,
const int  field_id,
const cs_equation_param_t eqp,
cs_equation_builder_t eqb,
void *  context 
)

Build and solve the linear system arising from a vector diffusion equation with a CDO-Fb scheme and an implicit/explicit theta scheme. One works cellwise and then process to the assembly.

Parameters
[in]cur2prevtrue="current to previous" operation is performed
[in]meshpointer to a cs_mesh_t structure
[in]field_idid of the variable field related to this equation
[in]eqppointer to a cs_equation_param_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]contextpointer to cs_cdofb_vecteq_t structure

◆ cs_cdofb_vecteq_sourceterm()

static void cs_cdofb_vecteq_sourceterm ( const cs_cell_mesh_t cm,
const cs_equation_param_t eqp,
const cs_real_t  t_eval,
const cs_real_t  coef,
cs_hodge_t mass_hodge,
cs_cell_builder_t cb,
cs_equation_builder_t eqb,
cs_cell_sys_t csys 
)
inlinestatic

Compute the source term for a vector-valued CDO-Fb scheme and add it to the local rhs Mass matrix is optional. It can be set to NULL.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]eqppointer to a cs_equation_param_t structure
[in]t_evaltime at which the source term is evaluated
[in]coefscaling of the time source (for theta schemes)
[in,out]mass_hodgepointer to a cs_hodge_t(mass matrix)
[in,out]cbpointer to a cs_cell_builder_t structure
[in,out]eqbpointer to a cs_equation_builder_t structure
[in,out]csyspointer to a cs_cell_sys_t structure

◆ cs_cdofb_vecteq_update_cell_fields()

void cs_cdofb_vecteq_update_cell_fields ( cs_timer_counter_t tce,
cs_field_t fld,
cs_cdofb_vecteq_t *  eqc,
bool  cur2prev 
)

Update the variables associated to cells in case of a CDO-Fb scheme. This has to be done after a resolution.

Parameters
[in,out]tcepointer to a timer counter
[in,out]fldpointer to a cs_field_t structure
[in,out]eqcpointer to a context structure
[in]cur2prevtrue if one performs "current to previous" op.

◆ cs_cdofb_vecteq_write_restart()

void cs_cdofb_vecteq_write_restart ( cs_restart_t restart,
const char *  eqname,
void *  scheme_context 
)

Write additional arrays (not defined as fields) but useful for the checkpoint/restart process.

Parameters
[in,out]restartpointer to cs_restart_t structure
[in]eqnamename of the related equation
[in]scheme_contextpointer to a data structure cast on-the-fly