8.3
general documentation
cs_gwf_tracer.cpp File Reference
#include <assert.h>
#include <ctype.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_array.h"
#include "cs_field.h"
#include "cs_gwf_soil.h"
#include "cs_hodge.h"
#include "cs_log.h"
#include "cs_math.h"
#include "cs_mesh_location.h"
#include "cs_parall.h"
#include "cs_post.h"
#include "cs_reco.h"
#include "cs_sles_it.h"
#include "cs_gwf_tracer.h"
+ Include dependency graph for cs_gwf_tracer.cpp:

Macros

#define CS_GWF_TRACER_DBG   0
 

Functions

static void _get_time_pty4std_sat_tracer (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], bool dense_output, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in time-dependent term of the simulation of tracer equations. Case of a fully saturated model. This function fits the generic prototype of cs_xdef_eval_t. More...
 
static void _get_time_pty4std_sat_tracer_cw (const cs_cell_mesh_t *cm, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in time-dependent term of the simulation of tracer equations. Case of a fully saturated model. This function fits the generic prototype of cs_xdef_cell_eval_cw_t. More...
 
static void _get_time_pty4std_tracer (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], bool dense_output, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in time-dependent term of the simulation of tracer equations This function fits the generic prototype of cs_xdef_eval_t. More...
 
static void _get_time_pty4std_tracer_cw (const cs_cell_mesh_t *cm, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in time-dependent term of the simulation of tracer equations This function fits the generic prototype of cs_xdef_cell_eval_cw_t. More...
 
static void _get_reaction_pty4std_sat_tracer (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], bool dense_output, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. Case of a fully saturated model This function fits the generic prototype of cs_xdef_cell_eval_t. More...
 
static void _get_reaction_pty4std_sat_tracer_cw (const cs_cell_mesh_t *cm, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. Case of a fully saturated model. This function fits the generic prototype of cs_xdef_cell_eval_cw_t. More...
 
static void _get_reaction_pty4std_tracer (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], bool dense_output, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. This function fits the generic prototype of cs_xdef_cell_eval_t. More...
 
static void _get_reaction_pty4std_tracer_cw (const cs_cell_mesh_t *cm, cs_real_t t_eval, void *context, cs_real_t *result)
 Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. This function fits the generic prototype of cs_xdef_cell_eval_cw_t. More...
 
static void _update_diff_value (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update the diffusion property for a (non-user) tracer model. Only the diffusivity is updated (reaction property and time property are defined and updated thanks to a function). Case of a diffusity defined by a value. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _update_diff_tensor (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update physical properties for a (non-user) tracer model. Only the diffusivity is updated (reaction property and time property are defined by function). Case of an unsaturated model and diffusity defined by a tensor. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _update_precipitation_vb (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update physical properties for a non-user tracer model. Case of a tracer with the precipitation/dissolution modelling and a vertex-based scheme. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _add_precipitation (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_gwf_tracer_t *tracer)
 Add and initialize quantities related to the precipitation model. More...
 
static void _integrate_sat_precip_tracer (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_equation_t *eq, const cs_zone_t *z, void *context, double results[])
 Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. A parallel operation (a sum reduction) is performed inside this function. Case of a fully saturated hydraulic model with precipitation effects. More...
 
static void _integrate_sat_tracer (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_equation_t *eq, const cs_zone_t *z, void *context, double results[])
 Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. Case of a fully saturated hydraulic model. Parallel synchronized is done inside this function. More...
 
static void _integrate_tracer (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_equation_t *eq, const cs_zone_t *z, void *context, double results[])
 Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. Case of a single-phase unsaturated hydraulic model without precipitation. Parallel synchronized is done inside this function. More...
 
static void _integrate_precip_tracer (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_equation_t *eq, const cs_zone_t *z, void *context, double results[])
 Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. Case of a single-phase unsaturated hydraulic model with precipitation. Parallel synchronized is done inside this function. More...
 
static void _free_default_tracer_context (cs_gwf_tracer_t *tracer)
 Free the context related to a standard tracer equation Rely on the generic prototype cs_gwf_tracer_free_context_t. More...
 
static void _create_default_tracer_context (cs_gwf_tracer_t *tracer, double lambda)
 Create and initialize the context by default for a "standard" tracer. More...
 
static cs_gwf_tracer_t_create_tracer (cs_gwf_tracer_model_t tr_model, cs_gwf_model_type_t gwf_model, const char *eq_name, const char *var_name, cs_adv_field_t *adv_field)
 Create a new cs_gwf_tracer_t structure and initialize its members by default. More...
 
static void _vb_sat_decay_chain_molar_st (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update the source term taking into account the decay chain for the current tracer Case of CDO-Vb schemes with saturated soils and mole unit. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _vb_decay_chain_molar_st (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update the source term taking into account the decay chain for the current tracer Case of CDO-Vb schemes with unsaturated soils and mole unit. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _vb_sat_decay_chain_becqu_st (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update the source term taking into account the decay chain for the current tracer. Case of CDO-Vb schemes with saturated soils and Becquerel unit. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _vb_decay_chain_becqu_st (cs_gwf_tracer_t *tracer, void *context, const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update the source term taking into account the decay chain for the current tracer. Case of CDO-Vb schemes with unsaturated soils and Becquerel unit. Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _set_decay_chain_members (cs_gwf_tracer_t *tracer, int chain_id, int chain_position)
 Set the members related to a tracer belonging to a decay chain. More...
 
static void _log_decay_chains (void)
 Display the main features related to each tracer. More...
 
static void _free_all_decay_chains (void)
 Free all decay chain structures used to manage several linked tracers. More...
 
cs_gwf_tracer_tcs_gwf_tracer_by_name (const char *eq_name)
 Retrieve the pointer to the cs_gwf_tracer_t structure associated to the name given as parameter. More...
 
cs_gwf_tracer_tcs_gwf_tracer_add (cs_gwf_tracer_model_t tr_model, cs_gwf_model_type_t gwf_model, const char *eq_name, const char *var_name, cs_adv_field_t *adv_field, double lambda, int chain_position, int chain_id, cs_gwf_tracer_init_setup_t *init_setup, cs_gwf_tracer_finalize_setup_t *finalize_setup)
 Create a new cs_gwf_tracer_t structure and initialize its members. This creation of a new tracer is fully done in the case of a default tracer. Additional settings has to be done in the case of a user-defined tracer. More...
 
void cs_gwf_tracer_free_all (void)
 Free all tracer structures and all decay chains. More...
 
cs_real_t cs_gwf_tracer_get_time_theta_max (void)
 Retrieve the max. value of the theta parameter associated to a time scheme. Loop on all tracer equations. More...
 
void cs_gwf_tracer_set_soil_param (cs_gwf_tracer_t *tracer, const char *soil_name, double wmd, double alpha_l, double alpha_t, double distrib_coef)
 Set the main parameters corresponding to a default modelling of a tracer transport equation for a specified soil. More...
 
void cs_gwf_tracer_set_precip_param (cs_gwf_tracer_t *tracer, const char *soil_name, double conc_l_star)
 For a specified soil set the parameters corresponding to a precipitation modelling of a tracer transport. More...
 
void cs_gwf_tracer_init_setup (void)
 Initial setup step for tracer equations. Soils and equation parameters are defined at this stage. Create new cs_field_t structures according to the setting. More...
 
void cs_gwf_tracer_finalize_setup (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Finalize the tracer setup. More...
 
void cs_gwf_tracer_update_diff_pty (const cs_time_step_t *ts, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Update the diffusion property related to each tracer equation The update strategy depends on the soil/tracer features and also on the hydraulic model. More...
 
void cs_gwf_tracer_log_all (void)
 Display the main features related to each tracer. More...
 
void cs_gwf_tracer_compute_steady_all (const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
 Compute the steady-state for all tracer equations. Nothing is done if all equations are unsteady. More...
 
void cs_gwf_tracer_compute_all (const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
 Compute the new (unsteady) state for all tracer equations. Nothing is done if all equations are steady. More...
 
void cs_gwf_tracer_default_init_setup (cs_gwf_tracer_t *tracer)
 Add terms to the algebraic system related to a tracer equation according to the settings. Case of the default tracer modelling Rely on the generic function: cs_gwf_tracer_add_terms_t. More...
 
void cs_gwf_tracer_sat_finalize_setup (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_adv_field_t *adv, cs_gwf_tracer_t *tracer)
 Set the parameters related to a standard tracer equation. More...
 
void cs_gwf_tracer_unsat_finalize_setup (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_adv_field_t *adv, cs_gwf_tracer_t *tracer)
 Set the parameters related to a standard tracer equation in case of an unsaturated flow model. More...
 
double cs_gwf_tracer_integrate (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_gwf_tracer_t *tracer, const char *z_name)
 Compute the integral of the tracer concentration over a given set of cells. This integral gives the number of moles of tracer inside the related volume. Moreover, it turns out to be exact for linear functions. A parallel operation (a sum reduction) is performed inside this function. More...
 
void cs_gwf_tracer_integrate_by_terms (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_gwf_tracer_t *tracer, const char *z_name, double results[])
 Compute the quantity of tracer using the integral of the tracer concentration over a given set of cells. Two terms are computed: one for the quantity of moles inside the liquid phase and another one for the quantity of tracer inside the precipitation state (in moles). A parallel operation (a sum reduction) is performed inside this function. More...
 
cs_gwf_tracer_decay_chain_tcs_gwf_tracer_create_decay_chain (int n_tracers, const char *chain_name, cs_gwf_tracer_unit_t unit)
 Create a decay chain structure to manage several linked tracers. More...
 
cs_gwf_tracer_decay_chain_tcs_gwf_tracer_decay_chain_by_id (int id)
 Retrieve the decay chain structure associated to the given id If not found, it returns the null pointer. More...
 
cs_gwf_tracer_decay_chain_tcs_gwf_tracer_decay_chain_by_name (const char *chain_name)
 Retrieve the decay chain structure associated to the name given as parameter. If not found, it returns the null pointer. More...
 
cs_gwf_tracer_tcs_gwf_tracer_decay_chain_get_tracer (cs_gwf_tracer_decay_chain_t *tdc, int id)
 Retrieve the tracer structure for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a nullptr pointer is returned. More...
 
cs_equation_tcs_gwf_tracer_decay_chain_get_equation (cs_gwf_tracer_decay_chain_t *tdc, int id)
 Retrieve the equation structure for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a nullptr pointer is returned. More...
 
cs_equation_param_tcs_gwf_tracer_decay_chain_get_equation_param (cs_gwf_tracer_decay_chain_t *tdc, int id)
 Retrieve the equation parameters for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a nullptr pointer is returned. More...
 

Variables

static const char _err_empty_tracer []
 
static int _n_tracers = 0
 
static cs_gwf_tracer_t ** _tracers = nullptr
 
static int _n_decay_chains = 0
 
static cs_gwf_tracer_decay_chain_t ** _decay_chains = nullptr
 
static cs_real_tcs_shared_liquid_saturation = nullptr
 

Macro Definition Documentation

◆ CS_GWF_TRACER_DBG

#define CS_GWF_TRACER_DBG   0

Function Documentation

◆ _add_precipitation()

static void _add_precipitation ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_gwf_tracer_t tracer 
)
static

Add and initialize quantities related to the precipitation model.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in,out]tracerpointer to a cs_gwf_tracer_t structure

◆ _create_default_tracer_context()

static void _create_default_tracer_context ( cs_gwf_tracer_t tracer,
double  lambda 
)
static

Create and initialize the context by default for a "standard" tracer.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_t structure
[in]lambdavalue of the first order decay coefficient

◆ _create_tracer()

static cs_gwf_tracer_t * _create_tracer ( cs_gwf_tracer_model_t  tr_model,
cs_gwf_model_type_t  gwf_model,
const char *  eq_name,
const char *  var_name,
cs_adv_field_t adv_field 
)
static

Create a new cs_gwf_tracer_t structure and initialize its members by default.

Parameters
[in]tr_modelmodel related to this tracer
[in]gwf_modelmain model for the GWF module
[in]eq_namename of the tracer equation
[in]var_namename of the related variable
[in]adv_fieldpointer to a cs_adv_field_t structure
Returns
a pointer to the new allocated structure

◆ _free_all_decay_chains()

static void _free_all_decay_chains ( void  )
static

Free all decay chain structures used to manage several linked tracers.

◆ _free_default_tracer_context()

static void _free_default_tracer_context ( cs_gwf_tracer_t tracer)
static

Free the context related to a standard tracer equation Rely on the generic prototype cs_gwf_tracer_free_context_t.

Parameters
[in,out]tracerpointer to a structure cs_gwf_tracer_t

◆ _get_reaction_pty4std_sat_tracer()

static void _get_reaction_pty4std_sat_tracer ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
bool  dense_output,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. Case of a fully saturated model This function fits the generic prototype of cs_xdef_cell_eval_t.

Parameters
[in]n_eltsnumber of elements to consider
[in]elt_idslist of element ids
[in]dense_outputindirection for output (true or false)
[in]meshpointer 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]t_evaltime at which one performs the evaluation
[in]contextnull or pointer to a structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_reaction_pty4std_sat_tracer_cw()

static void _get_reaction_pty4std_sat_tracer_cw ( const cs_cell_mesh_t cm,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. Case of a fully saturated model. This function fits the generic prototype of cs_xdef_cell_eval_cw_t.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in]contextnull or pointer to a structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_reaction_pty4std_tracer()

static void _get_reaction_pty4std_tracer ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
bool  dense_output,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. This function fits the generic prototype of cs_xdef_cell_eval_t.

Parameters
[in]n_eltsnumber of elements to consider
[in]elt_idslist of element ids
[in]dense_outputindirection for output (true or false)
[in]meshpointer 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]t_evaltime at which one performs the evaluation
[in]contextnull or pointer to a structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_reaction_pty4std_tracer_cw()

static void _get_reaction_pty4std_tracer_cw ( const cs_cell_mesh_t cm,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in the reaction term for the simulation of standard tracer equations. This function fits the generic prototype of cs_xdef_cell_eval_cw_t.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in]contextnull or pointer to a structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_time_pty4std_sat_tracer()

static void _get_time_pty4std_sat_tracer ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
bool  dense_output,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in time-dependent term of the simulation of tracer equations. Case of a fully saturated model. This function fits the generic prototype of cs_xdef_eval_t.

Parameters
[in]n_eltsnumber of elements to consider
[in]elt_idslist of element ids
[in]dense_outputperform an indirection for output (true/false)
[in]meshpointer 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]t_evaltime at which one performs the evaluation
[in]contextnull or pointer to a structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_time_pty4std_sat_tracer_cw()

static void _get_time_pty4std_sat_tracer_cw ( const cs_cell_mesh_t cm,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in time-dependent term of the simulation of tracer equations. Case of a fully saturated model. This function fits the generic prototype of cs_xdef_cell_eval_cw_t.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in]contextpointer to an context structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_time_pty4std_tracer()

static void _get_time_pty4std_tracer ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
bool  dense_output,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in time-dependent term of the simulation of tracer equations This function fits the generic prototype of cs_xdef_eval_t.

Parameters
[in]n_eltsnumber of elements to consider
[in]elt_idslist of element ids
[in]dense_outputperform an indirection for output (true/false)
[in]meshpointer 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]t_evaltime at which one performs the evaluation
[in]contextnull or pointer to a structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _get_time_pty4std_tracer_cw()

static void _get_time_pty4std_tracer_cw ( const cs_cell_mesh_t cm,
cs_real_t  t_eval,
void *  context,
cs_real_t result 
)
inlinestatic

Define the coefficient appearing in time-dependent term of the simulation of tracer equations This function fits the generic prototype of cs_xdef_cell_eval_cw_t.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in]contextpointer to an context structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _integrate_precip_tracer()

static void _integrate_precip_tracer ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_equation_t eq,
const cs_zone_t z,
void *  context,
double  results[] 
)
static

Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. Case of a single-phase unsaturated hydraulic model with precipitation. Parallel synchronized is done inside this function.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]eqequation related to a tracer
[in]zpointer to a volume zone structure
[in]contextpointer to a context structure for a tracer
[in,out]resultsresulting array of values

◆ _integrate_sat_precip_tracer()

static void _integrate_sat_precip_tracer ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_equation_t eq,
const cs_zone_t z,
void *  context,
double  results[] 
)
static

Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. A parallel operation (a sum reduction) is performed inside this function. Case of a fully saturated hydraulic model with precipitation effects.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]eqequation related to a tracer
[in]zpointer to a volume zone structure
[in]contextpointer to a context structure for a tracer
[in,out]resultsresulting array of values

◆ _integrate_sat_tracer()

static void _integrate_sat_tracer ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_equation_t eq,
const cs_zone_t z,
void *  context,
double  results[] 
)
static

Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. Case of a fully saturated hydraulic model. Parallel synchronized is done inside this function.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]eqequation related to a tracer
[in]zpointer to a volume zone structure
[in]contextpointer to a context structure for a tracer
[in,out]resultsresulting array of values

◆ _integrate_tracer()

static void _integrate_tracer ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_equation_t eq,
const cs_zone_t z,
void *  context,
double  results[] 
)
static

Compute the integral of the molar concentration of a tracer field over a given set of cells. This integral turns out to be exact for linear functions. Case of a single-phase unsaturated hydraulic model without precipitation. Parallel synchronized is done inside this function.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]eqequation related to a tracer
[in]zpointer to a volume zone structure
[in]contextpointer to a context structure for a tracer
[in,out]resultsresulting array of values

◆ _log_decay_chains()

static void _log_decay_chains ( void  )
static

Display the main features related to each tracer.

◆ _set_decay_chain_members()

static void _set_decay_chain_members ( cs_gwf_tracer_t tracer,
int  chain_id,
int  chain_position 
)
static

Set the members related to a tracer belonging to a decay chain.

Parameters
[in,out]tracerpointer to the tracer to update
[in]chain_id-1 or id of the associated decay chain
[in]chain_position-1 or id in the chain (position)

◆ _update_diff_tensor()

static void _update_diff_tensor ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update physical properties for a (non-user) tracer model. Only the diffusivity is updated (reaction property and time property are defined by function). Case of an unsaturated model and diffusity defined by a tensor. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ _update_diff_value()

static void _update_diff_value ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update the diffusion property for a (non-user) tracer model. Only the diffusivity is updated (reaction property and time property are defined and updated thanks to a function). Case of a diffusity defined by a value. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ _update_precipitation_vb()

static void _update_precipitation_vb ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update physical properties for a non-user tracer model. Case of a tracer with the precipitation/dissolution modelling and a vertex-based scheme. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ _vb_decay_chain_becqu_st()

static void _vb_decay_chain_becqu_st ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update the source term taking into account the decay chain for the current tracer. Case of CDO-Vb schemes with unsaturated soils and Becquerel unit. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ _vb_decay_chain_molar_st()

static void _vb_decay_chain_molar_st ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update the source term taking into account the decay chain for the current tracer Case of CDO-Vb schemes with unsaturated soils and mole unit. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ _vb_sat_decay_chain_becqu_st()

static void _vb_sat_decay_chain_becqu_st ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update the source term taking into account the decay chain for the current tracer. Case of CDO-Vb schemes with saturated soils and Becquerel unit. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ _vb_sat_decay_chain_molar_st()

static void _vb_sat_decay_chain_molar_st ( cs_gwf_tracer_t tracer,
void *  context,
const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)
static

Update the source term taking into account the decay chain for the current tracer Case of CDO-Vb schemes with saturated soils and mole unit. Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_structure
[in,out]contextnull or pointer to a structure cast on-the-fly
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_tracer_add()

cs_gwf_tracer_t * cs_gwf_tracer_add ( cs_gwf_tracer_model_t  tr_model,
cs_gwf_model_type_t  gwf_model,
const char *  eq_name,
const char *  var_name,
cs_adv_field_t adv_field,
double  lambda,
int  chain_position,
int  chain_id,
cs_gwf_tracer_init_setup_t init_setup,
cs_gwf_tracer_finalize_setup_t finalize_setup 
)

Create a new cs_gwf_tracer_t structure and initialize its members. This creation of a new tracer is fully done in the case of a default tracer. Additional settings has to be done in the case of a user-defined tracer.

Add a new equation related to the groundwater flow module. This equation is a specific transport equation. The tracer is advected thanks to the darcian velocity (in the liquid phase) which is given by the resolution of the Richards equation. Diffusion and reaction coefficients result from a physical modelling.

Parameters
[in]tr_modelmodel related to this tracer
[in]gwf_modelmain model for the GWF module
[in]eq_namename of the tracer equation
[in]var_namename of the related variable
[in]adv_fieldpointer to a cs_adv_field_t structure
[in]lambdavalue of the first order decay coefficient
[in]chain_position-1 if not used or the id in the chain position
[in]chain_id-1 or id of the associated decay chain
[in]init_setupfunction pointer (predefined prototype)
[in]finalize_setupfunction pointer (predefined prototype)
Returns
a pointer to the new allocated structure

◆ cs_gwf_tracer_by_name()

cs_gwf_tracer_t * cs_gwf_tracer_by_name ( const char *  eq_name)

Retrieve the pointer to the cs_gwf_tracer_t structure associated to the name given as parameter.

Parameters
[in]eq_namename of the tracer equation
Returns
the pointer to a cs_gwf_tracer_t structure

◆ cs_gwf_tracer_compute_all()

void cs_gwf_tracer_compute_all ( const cs_mesh_t mesh,
const cs_time_step_t time_step,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq 
)

Compute the new (unsteady) state for all tracer equations. Nothing is done if all equations are steady.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]time_steppointer to a cs_time_step_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_tracer_compute_steady_all()

void cs_gwf_tracer_compute_steady_all ( const cs_mesh_t mesh,
const cs_time_step_t time_step,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq 
)

Compute the steady-state for all tracer equations. Nothing is done if all equations are unsteady.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]time_steppointer to a cs_time_step_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_tracer_create_decay_chain()

cs_gwf_tracer_decay_chain_t * cs_gwf_tracer_create_decay_chain ( int  n_tracers,
const char *  chain_name,
cs_gwf_tracer_unit_t  unit 
)

Create a decay chain structure to manage several linked tracers.

Parameters
[in]n_tracersnumber of tracers equations
[in]chain_namename of the decay chain
[in]unittype of unit used in the tracer equations
Returns
a pointer to the new cs_gwf_tracer_decay_chain_t structure

◆ cs_gwf_tracer_decay_chain_by_id()

cs_gwf_tracer_decay_chain_t * cs_gwf_tracer_decay_chain_by_id ( int  id)

Retrieve the decay chain structure associated to the given id If not found, it returns the null pointer.

Parameters
[in]idid of the decay chain to retrieve
Returns
a pointer to a new cs_gwf_tracer_decay_chain_t structure or nullptr

◆ cs_gwf_tracer_decay_chain_by_name()

cs_gwf_tracer_decay_chain_t * cs_gwf_tracer_decay_chain_by_name ( const char *  chain_name)

Retrieve the decay chain structure associated to the name given as parameter. If not found, it returns the null pointer.

Parameters
[in]chain_namename of the decay chain
Returns
a pointer to a new cs_gwf_tracer_decay_chain_t structure or nullptr

◆ cs_gwf_tracer_decay_chain_get_equation()

cs_equation_t * cs_gwf_tracer_decay_chain_get_equation ( cs_gwf_tracer_decay_chain_t tdc,
int  id 
)

Retrieve the equation structure for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a nullptr pointer is returned.

Retrieve the equation structure for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a null pointer is returned.

Parameters
[in]tdcpointer to a decay chain structure
[in]idposition of the tracer in the decay chain
Returns
a pointer to a cs_equation_t structure or nullptr

◆ cs_gwf_tracer_decay_chain_get_equation_param()

cs_equation_param_t * cs_gwf_tracer_decay_chain_get_equation_param ( cs_gwf_tracer_decay_chain_t tdc,
int  id 
)

Retrieve the equation parameters for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a nullptr pointer is returned.

Retrieve the equation parameters for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a null pointer is returned.

Parameters
[in]tdcpointer to a decay chain structure
[in]idposition of the tracer in the decay chain
Returns
a pointer to a cs_equation_param_t structure or nullptr

◆ cs_gwf_tracer_decay_chain_get_tracer()

cs_gwf_tracer_t * cs_gwf_tracer_decay_chain_get_tracer ( cs_gwf_tracer_decay_chain_t tdc,
int  id 
)

Retrieve the tracer structure for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a nullptr pointer is returned.

Retrieve the tracer structure for the tracer at the position "id" in the decay chain structure. If "id" is not valid, then a null pointer is returned.

Parameters
[in]tdcpointer to a decay chain structure
[in]idposition of the tracer in the decay chain
Returns
a pointer to a cs_gwf_tracer_t structure or nullptr

◆ cs_gwf_tracer_default_init_setup()

void cs_gwf_tracer_default_init_setup ( cs_gwf_tracer_t tracer)

Add terms to the algebraic system related to a tracer equation according to the settings. Case of the default tracer modelling Rely on the generic function: cs_gwf_tracer_add_terms_t.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_t structure

◆ cs_gwf_tracer_finalize_setup()

void cs_gwf_tracer_finalize_setup ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)

Finalize the tracer setup.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_tracer_free_all()

void cs_gwf_tracer_free_all ( void  )

Free all tracer structures and all decay chains.

◆ cs_gwf_tracer_get_time_theta_max()

cs_real_t cs_gwf_tracer_get_time_theta_max ( void  )

Retrieve the max. value of the theta parameter associated to a time scheme. Loop on all tracer equations.

Returns
the computed value

◆ cs_gwf_tracer_init_setup()

void cs_gwf_tracer_init_setup ( void  )

Initial setup step for tracer equations. Soils and equation parameters are defined at this stage. Create new cs_field_t structures according to the setting.

◆ cs_gwf_tracer_integrate()

double cs_gwf_tracer_integrate ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_gwf_tracer_t tracer,
const char *  z_name 
)

Compute the integral of the tracer concentration over a given set of cells. This integral gives the number of moles of tracer inside the related volume. Moreover, it turns out to be exact for linear functions. A parallel operation (a sum reduction) is performed inside this function.

Compute the integral of the tracer concentration over a given set of cells. This integral gives the number of moles of tracer inside the related volume. Moreover, it turns out to be exact for linear functions. A parallel operation (a sum reduction) is performed.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]tracerpointer to a cs_gwf_tracer_t structure
[in]z_namename of the volumic zone where the integral is done (if null or "" all cells are considered)
Returns
the value of the integral (number of moles in the zone) parallel synchronization is done

◆ cs_gwf_tracer_integrate_by_terms()

void cs_gwf_tracer_integrate_by_terms ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_gwf_tracer_t tracer,
const char *  z_name,
double  results[] 
)

Compute the quantity of tracer using the integral of the tracer concentration over a given set of cells. Two terms are computed: one for the quantity of moles inside the liquid phase and another one for the quantity of tracer inside the precipitation state (in moles). A parallel operation (a sum reduction) is performed inside this function.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]tracerpointer to a cs_gwf_tracer_t structure
[in]z_namename of the volume zone where the integral is done (if null or "" all cells are considered)
[in,out]resultsarray of values. [0]= the quantity of moles in the liquid phase, [1]= the quantity of moles inside the precipitation state

◆ cs_gwf_tracer_log_all()

void cs_gwf_tracer_log_all ( void  )

Display the main features related to each tracer.

◆ cs_gwf_tracer_sat_finalize_setup()

void cs_gwf_tracer_sat_finalize_setup ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_adv_field_t adv,
cs_gwf_tracer_t tracer 
)

Set the parameters related to a standard tracer equation.

Set the parameters related to a standard tracer equation case of a fully saturated flow model.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]advpointer to an advection field structure
[in,out]tracerpointer to a cs_gwf_tracer_t structure

◆ cs_gwf_tracer_set_precip_param()

void cs_gwf_tracer_set_precip_param ( cs_gwf_tracer_t tracer,
const char *  soil_name,
double  conc_l_star 
)

For a specified soil set the parameters corresponding to a precipitation modelling of a tracer transport.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_t structure
[in]soil_namename of the related soil (or null if all soils are selected)
[in]conc_l_starvalue of the saturated concentration in the liquid phase

◆ cs_gwf_tracer_set_soil_param()

void cs_gwf_tracer_set_soil_param ( cs_gwf_tracer_t tracer,
const char *  soil_name,
double  wmd,
double  alpha_l,
double  alpha_t,
double  distrib_coef 
)

Set the main parameters corresponding to a default modelling of a tracer transport equation for a specified soil.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_t structure
[in]soil_namename of the related soil (or null if all soils are selected)
[in]wmdvalue of the water molecular diffusivity
[in]alpha_lvalue of the longitudinal dispersivity
[in]alpha_tvalue of the transversal dispersivity
[in]distrib_coefvalue of the distribution coefficient

◆ cs_gwf_tracer_unsat_finalize_setup()

void cs_gwf_tracer_unsat_finalize_setup ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_adv_field_t adv,
cs_gwf_tracer_t tracer 
)

Set the parameters related to a standard tracer equation in case of an unsaturated flow model.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]advpointer to an advection field structure
[in,out]tracerpointer to a cs_gwf_tracer_t structure

◆ cs_gwf_tracer_update_diff_pty()

void cs_gwf_tracer_update_diff_pty ( const cs_time_step_t ts,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)

Update the diffusion property related to each tracer equation The update strategy depends on the soil/tracer features and also on the hydraulic model.

Parameters
[in]tspointer to a cs_time_step_t structure
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

Variable Documentation

◆ _decay_chains

cs_gwf_tracer_decay_chain_t** _decay_chains = nullptr
static

◆ _err_empty_tracer

const char _err_empty_tracer[]
static
Initial value:
=
" Stop execution. The structure related to a tracer is empty.\n"
" Please check your settings.\n"

◆ _n_decay_chains

int _n_decay_chains = 0
static

◆ _n_tracers

int _n_tracers = 0
static

◆ _tracers

cs_gwf_tracer_t** _tracers = nullptr
static

◆ cs_shared_liquid_saturation

cs_real_t* cs_shared_liquid_saturation = nullptr
static