#include "cs_defs.h"
#include "cs_base.h"
#include "cs_cdo_connect.h"
#include "cs_cdo_quantities.h"
#include "cs_cdofb_priv.h"
#include "cs_equation_assemble.h"
#include "cs_equation_common.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"
Go to the source code of this file.
Functions | |
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_common (const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step, const cs_matrix_structure_t *ms) |
Allocate work buffer and general structures related to CDO vector-valued face-based schemes. Set shared pointers from the main domain members. More... | |
const cs_matrix_structure_t * | cs_cdofb_vecteq_matrix_structure (void) |
Get the pointer to the related cs_matrix_structure_t. 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_common (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, const cs_range_set_t *rs, const cs_cell_mesh_t *cm, const bool has_sourceterm, cs_cdofb_vecteq_t *eqc, cs_equation_assemble_t *eqa, cs_matrix_assembler_values_t *mav, cs_real_t rhs[]) |
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_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. More... | |
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. 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... | |
void cs_cdofb_vecteq_assembly | ( | const cs_cell_sys_t * | csys, |
const cs_range_set_t * | rs, | ||
const cs_cell_mesh_t * | cm, | ||
const bool | has_sourceterm, | ||
cs_cdofb_vecteq_t * | eqc, | ||
cs_equation_assemble_t * | eqa, | ||
cs_matrix_assembler_values_t * | mav, | ||
cs_real_t | rhs[] | ||
) |
Perform the assembly stage for a vector-valued system obtained with CDO-Fb scheme.
[in] | csys | pointer to a cs_cell_sys_t structure |
[in] | rs | pointer to a cs_range_set_t structure |
[in] | cm | pointer to a cs_cell_mesh_t structure |
[in] | has_sourceterm | has the equation a source term? |
[in,out] | eqc | context structure for a vector-valued Fb |
[in,out] | eqa | pointer to cs_equation_assemble_t |
[in,out] | mav | pointer to cs_matrix_assembler_values_t |
[in,out] | rhs | right-end side of the system |
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.
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | eqb | pointer to a cs_equation_builder_t structure |
[in] | eqc | context for this kind of discretization |
[in] | cm | pointer to a cellwise view of the mesh |
[in,out] | mass_hodge | pointer to a cs_hodge_t structure for reaction |
[in,out] | diff_hodge | pointer to a cs_hodge_t structure for diffusion |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
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.
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
[in,out] | context | pointer to cs_cdofb_vecteq_t structure |
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.
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | eqb | pointer to a cs_equation_builder_t structure |
[in] | eqc | context for this kind of discretization |
[in] | cm | pointer to a cellwise view of the mesh |
[in,out] | diff_hodge | pointer to a cs_hodge_t structure for diffusion |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
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.
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
[in,out] | context | pointer to cs_cdofb_vecteq_t structure |
void cs_cdofb_vecteq_finalize_common | ( | void | ) |
Free work buffer and general structure related to CDO face-based schemes.
void* cs_cdofb_vecteq_free_context | ( | void * | data | ) |
Destroy a cs_cdofb_vecteq_t structure.
[in,out] | data | pointer to a cs_cdofb_vecteq_t structure |
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.
[out] | csys | double pointer to a cs_cell_sys_t structure |
[out] | cb | double pointer to a cs_cell_builder_t structure |
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.
[in,out] | context | pointer to a data structure cast on-the-fly |
[in] | previous | retrieve the previous state (true/false) |
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.
[in,out] | context | pointer to a data structure cast on-the-fly |
[in] | previous | retrieve the previous state (true/false) |
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.
[in] | cm | pointer to a cellwise view of the mesh |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | eqb | pointer to a cs_equation_builder_t structure |
[in] | val_f_n | face DoFs at time step n |
[in] | val_c_n | cell DoFs at time step n |
[in] | val_f_nm1 | face DoFs at time step n-1 or NULL |
[in] | val_c_nm1 | cell DoFs at time step n-1 or NULL |
[in,out] | csys | pointer to a cellwise view of the system |
[in,out] | cb | pointer to a cellwise builder |
void cs_cdofb_vecteq_init_common | ( | const cs_cdo_quantities_t * | quant, |
const cs_cdo_connect_t * | connect, | ||
const cs_time_step_t * | time_step, | ||
const cs_matrix_structure_t * | ms | ||
) |
Allocate work buffer and general structures related to CDO vector-valued face-based schemes. Set shared pointers from the main domain members.
[in] | quant | additional mesh quantities struct. |
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | time_step | pointer to a time step structure |
[in] | ms | pointer to a cs_matrix_structure_t structure |
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.
[in] | eqp | pointer to a cs_equation_param_t structure |
[in] | var_id | id of the variable field |
[in] | bflux_id | id of the boundary flux field |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
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.
[in] | t_eval | time at which one evaluates BCs |
[in] | field_id | id related to the variable field of this equation |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
[in,out] | context | pointer to the scheme context (cast on-the-fly) |
bool cs_cdofb_vecteq_is_initialized | ( | void | ) |
Check if the generic structures for building a CDO-Fb scheme are allocated.
const cs_matrix_structure_t* cs_cdofb_vecteq_matrix_structure | ( | void | ) |
Get the pointer to the related cs_matrix_structure_t.
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.
[in,out] | restart | pointer to cs_restart_t structure |
[in] | eqname | name of the related equation |
[in] | scheme_context | pointer to a data structure cast on-the-fly |
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.
[in] | t_eval | time at which one evaluates BCs |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
DOXYGEN_SHOULD_SKIP_THIS
[in] | t_eval | time at which one evaluates BCs |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
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.
[in] | cur2prev | true="current to previous" operation is performed |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | field_id | id of the variable field related to this equation |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
[in,out] | context | pointer to cs_cdofb_vecteq_t structure |
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.
[in] | cur2prev | true="current to previous" operation is performed |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | field_id | id of the variable field related to this equation |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
[in,out] | context | pointer to cs_cdofb_vecteq_t structure |
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.
[in] | cur2prev | true="current to previous" operation is performed |
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | field_id | id of the variable field related to this equation |
[in] | eqp | pointer to a cs_equation_param_t structure |
[in,out] | eqb | pointer to a cs_equation_builder_t structure |
[in,out] | context | pointer to cs_cdofb_vecteq_t structure |
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.
[in,out] | tce | pointer to a timer counter |
[in,out] | fld | pointer to a cs_field_t structure |
[in,out] | eqc | pointer to a context structure |
[in] | cur2prev | true if one performs "current to previous" op. |
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.
[in,out] | restart | pointer to cs_restart_t structure |
[in] | eqname | name of the related equation |
[in] | scheme_context | pointer to a data structure cast on-the-fly |