My Project
programmer's documentation
Macros | Functions | Variables
cs_gwf_tracer.c 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 "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_param.h"
#include "cs_post.h"
#include "cs_reco.h"
#include "cs_gwf_tracer.h"
Include dependency graph for cs_gwf_tracer.c:

Macros

#define CS_GWF_TRACER_DBG   0
 

Functions

static void _get_time_pty4std_tracer (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], bool compact, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval, void *input, 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_t. More...
 
static void _get_time_pty4std_tracer_cw (const cs_cell_mesh_t *cm, cs_real_t t_eval, void *input, 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_tracer (cs_lnum_t n_elts, const cs_lnum_t elt_ids[], bool compact, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval, void *input, 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 *input, 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_pty4std_tracer (void *input, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval)
 Update physical properties for a standard tracer model. Only the diffusivity needs an update (reaction property and time property are defined by function). Generic function relying on the prototype cs_gwf_tracer_update_t. More...
 
static void _free_std_tracer (void *input)
 Free the input related to a standard tracer equation Rely on the generic prototype cs_gwf_tracer_free_input_t. More...
 
cs_gwf_tracer_tcs_gwf_tracer_init (int tracer_id, const char *eq_name, const char *var_name, cs_adv_field_t *adv_field, cs_gwf_tracer_model_t model)
 Create a new cs_gwf_tracer_t structure and initialize its members by default. Add a new equation related to the groundwater flow module. This equation is a specific transport equation. Tracer is advected thanks to the darcian velocity which is given by the resolution of the Richards equation. Diffusion/reaction parameters result from a physical modelling. More...
 
cs_gwf_tracer_tcs_gwf_tracer_free (cs_gwf_tracer_t *tracer)
 Free a cs_gwf_tracer_t structure. More...
 
void cs_gwf_set_standard_tracer (cs_gwf_tracer_t *tracer, const char *soil_name, double wmd, double alpha_l, double alpha_t, double distrib_coef, double reaction_rate)
 Set a tracer for a specified soil when the tracer is attached to the default model. More...
 
void cs_gwf_tracer_standard_add_terms (cs_gwf_tracer_t *tracer)
 Add terms to the algebraic system related to a tracer equation according to the settings. Case of the standar tracer modelling Rely on the generic function: cs_gwf_tracer_add_terms_t. More...
 
void cs_gwf_tracer_standard_setup (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_gwf_tracer_t *tracer)
 Set the parameters related to a standard tracer equation. More...
 

Variables

static const char _err_empty_tracer []
 

Macro Definition Documentation

◆ CS_GWF_TRACER_DBG

#define CS_GWF_TRACER_DBG   0

Function Documentation

◆ _free_std_tracer()

static void _free_std_tracer ( void *  input)
static

Free the input related to a standard tracer equation Rely on the generic prototype cs_gwf_tracer_free_input_t.

Parameters
[in,out]inputpointer to a structure cast on-the-fly

◆ _get_reaction_pty4std_tracer()

static void _get_reaction_pty4std_tracer ( cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[],
bool  compact,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval,
void *  input,
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]compactindirection 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]inputpointer to an input 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 *  input,
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]inputpointer to an input 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  compact,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval,
void *  input,
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_t.

Parameters
[in]n_eltsnumber of elements to consider
[in]elt_idslist of element ids
[in]compactindirection 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]inputpointer to an input 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 *  input,
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]inputpointer to an input structure cast on-the_fly
[in,out]resultarray storing the result (must be allocated)

◆ _update_diff_pty4std_tracer()

static void _update_diff_pty4std_tracer ( void *  input,
const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_real_t  t_eval 
)
static

Update physical properties for a standard tracer model. Only the diffusivity needs an update (reaction property and time property are defined by function). Generic function relying on the prototype cs_gwf_tracer_update_t.

Parameters
[in,out]inputpointer to a structure cast on-the-fly
[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

◆ cs_gwf_set_standard_tracer()

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

Set a tracer for a specified soil when the tracer is attached to the default model.

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
[in]reaction_ratevalue of the first order rate of reaction

◆ cs_gwf_tracer_free()

cs_gwf_tracer_t* cs_gwf_tracer_free ( cs_gwf_tracer_t tracer)

Free a cs_gwf_tracer_t structure.

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_t structure
Returns
a NULL pointer

◆ cs_gwf_tracer_init()

cs_gwf_tracer_t* cs_gwf_tracer_init ( int  tracer_id,
const char *  eq_name,
const char *  var_name,
cs_adv_field_t adv_field,
cs_gwf_tracer_model_t  model 
)

Create a new cs_gwf_tracer_t structure and initialize its members by default. Add a new equation related to the groundwater flow module. This equation is a specific transport equation. Tracer is advected thanks to the darcian velocity which is given by the resolution of the Richards equation. Diffusion/reaction parameters result from a physical modelling.

Parameters
[in]tracer_idid number of the soil
[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]modelmodel related to this tracer
Returns
a pointer to the new allocated structure

◆ cs_gwf_tracer_standard_add_terms()

void cs_gwf_tracer_standard_add_terms ( cs_gwf_tracer_t tracer)

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

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

Parameters
[in,out]tracerpointer to a cs_gwf_tracer_t structure

◆ cs_gwf_tracer_standard_setup()

void cs_gwf_tracer_standard_setup ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
cs_gwf_tracer_t tracer 
)

Set the parameters related to a standard tracer equation.

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

Variable Documentation

◆ _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"