8.0
general documentation
Loading...
Searching...
No Matches
cs_gwf_tracer.h
Go to the documentation of this file.
1#ifndef __CS_GWF_TRACER_H__
2#define __CS_GWF_TRACER_H__
3
4/*============================================================================
5 * Set of main functions to handle soils in the groundwater flow module
6 * when using CDO schemes
7 *============================================================================*/
8
9/*
10 This file is part of code_saturne, a general-purpose CFD tool.
11
12 Copyright (C) 1998-2023 EDF S.A.
13
14 This program is free software; you can redistribute it and/or modify it under
15 the terms of the GNU General Public License as published by the Free Software
16 Foundation; either version 2 of the License, or (at your option) any later
17 version.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22 details.
23
24 You should have received a copy of the GNU General Public License along with
25 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26 Street, Fifth Floor, Boston, MA 02110-1301, USA.
27*/
28
29/*----------------------------------------------------------------------------*/
30
31/*----------------------------------------------------------------------------
32 * Local headers
33 *----------------------------------------------------------------------------*/
34
35#include "cs_advection_field.h"
36#include "cs_base.h"
37#include "cs_equation.h"
38#include "cs_gwf_param.h"
39
40/*----------------------------------------------------------------------------*/
41
43
44/*============================================================================
45 * Typedef definition
46 *============================================================================*/
47
52
53typedef struct _gwf_tracer_t cs_gwf_tracer_t;
54
55/* \struct cs_gwf_tracer_default_context_t
56 *
57 * \brief Set of parameters related to a tracer equation attached to a standard
58 * modelling
59 */
60
61typedef struct _gwf_tracer_default_context_t cs_gwf_tracer_default_context_t;
62
63/*============================================================================
64 * Public function pointer prototypes
65 *============================================================================*/
66
67/*----------------------------------------------------------------------------*/
74/*----------------------------------------------------------------------------*/
75
76typedef void
78
79/*----------------------------------------------------------------------------*/
90/*----------------------------------------------------------------------------*/
91
92typedef void
94 const cs_cdo_quantities_t *quant,
95 const cs_adv_field_t *adv,
96 cs_gwf_tracer_t *tracer);
97
98/*----------------------------------------------------------------------------*/
110/*----------------------------------------------------------------------------*/
111
112typedef void
114 void *context,
115 const cs_time_step_t *ts,
116 const cs_mesh_t *mesh,
117 const cs_cdo_connect_t *connect,
118 const cs_cdo_quantities_t *quant);
119
120/*----------------------------------------------------------------------------*/
126/*----------------------------------------------------------------------------*/
127
128typedef void
130
131/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148typedef void
150 const cs_cdo_quantities_t *cdoq,
151 const cs_equation_t *eq,
152 const cs_zone_t *zone,
153 void *context,
154 double results[]);
155
156/*============================================================================
157 * Structure definitions
158 *============================================================================*/
159
160/* Structure to handle of radioactive decay chain */
161
162typedef struct {
163
164 char *name; /* Name of the decay chain */
165 int id; /* Position in the array of chain decays */
166
167 int n_tracers; /* Number of tracers in the decay chain */
168 cs_gwf_tracer_unit_t unit; /* Type of unit measure:
169 * - mole (classical tracer)
170 * - Becquerel (activity)
171 */
172
173 cs_gwf_tracer_t **tracers; /* Array of tracers associated to the
174 decay chain. tracers[0] is the parent
175 without any ancestor. */
176
177 cs_xdef_t **st_defs; /* List of source term definitions */
178
180
181/* Set of parameters related to a tracer equation attached to a standard
182 modelling */
183
185
186 /* Common settings shared by all physical modelling */
187 /* ------------------------------------------------ */
188
189 double decay_coef; /* First order decay coefficient (related to the
190 reaction term). This value is intrinsic to the
191 component (a radioactive element for instance)
192 and not to the soil. */
193
194 /* The following parameters are defined for each soil (arrays of size equal
195 * to n_soils) */
196
197 double *rho_bulk; /* bulk density (kg.m^-3) */
198 double *kd0; /* reference value of the distribution coefficient
199 (m^".kg^-1) */
200 double *rho_kd; /* Derived quantity: rho_bulk*kd0 */
201
202 double *alpha_l; /* Longitudinal dispersivity */
203 double *alpha_t; /* Transversal dispersivity */
204
205 double *wmd; /* Water molecular diffusivity (m^2.s^-1) */
206
207 /* Precipitation members (set to NULL if not used) */
208 /* ----------------------------------------------- */
209
210 double *conc_l_star; /* maximal value of the concentraction of
211 * tracer in the liquid phase in mol/m^3. There
212 * is one user-defined value for each soil. The
213 * exceeded quantities are stored in the solid
214 * phase (-> precip_mass). These values
215 * corresponds to the user settings
216 */
217
218 cs_real_t *precip_mass; /* array storing the mass of precipitate
219 * (solid) in the dedicated auxiliary
220 * storage. The size of this array may vary
221 * w.r.t. to the discretization scheme.
222 */
223
224 cs_field_t *precip_field; /* Field structure storing the (interpolated)
225 * values of the concentration of precipitate
226 * in mol/kg in each cell.
227 */
228
229 /* Sorption members (set to NULL if not used) */
230 /* ------------------------------------------ */
231
232 double *k0_plus; /* kinetic coefficient towards site 2 locations
233 (m^3.kg^-1.s^-1) */
234 double *k0_minus; /* kinetic coefficient from site 2 locations
235 (s^-1) */
236
237 cs_real_t *conc_site2; /* array allocated to n_cells */
238
239 /* Variables used for the update of physical properties (shared pointers) */
240
242
243};
244
245/* Set of parameters describing a tracer structure */
246/* ----------------------------------------------- */
247
373
374/*============================================================================
375 * Public function prototypes
376 *============================================================================*/
377
378/*----------------------------------------------------------------------------*/
387/*----------------------------------------------------------------------------*/
388
390cs_gwf_tracer_by_name(const char *eq_name);
391
392/*----------------------------------------------------------------------------*/
418/*----------------------------------------------------------------------------*/
419
422 cs_gwf_model_type_t gwf_model,
423 const char *eq_name,
424 const char *var_name,
425 cs_adv_field_t *adv_field,
426 double lambda,
427 int chain_position,
428 int chain_id,
429 cs_gwf_tracer_init_setup_t *init_setup,
430 cs_gwf_tracer_finalize_setup_t *finalize_setup);
431
432/*----------------------------------------------------------------------------*/
436/*----------------------------------------------------------------------------*/
437
438void
440
441/*----------------------------------------------------------------------------*/
448/*----------------------------------------------------------------------------*/
449
452
453/*----------------------------------------------------------------------------*/
466/*----------------------------------------------------------------------------*/
467
468void
470 const char *soil_name,
471 double wmd,
472 double alpha_l,
473 double alpha_t,
474 double distrib_coef);
475
476/*----------------------------------------------------------------------------*/
487/*----------------------------------------------------------------------------*/
488
489void
491 const char *soil_name,
492 double conc_l_star);
493
494/*----------------------------------------------------------------------------*/
500/*----------------------------------------------------------------------------*/
501
502void
504
505/*----------------------------------------------------------------------------*/
512/*----------------------------------------------------------------------------*/
513
514void
516 const cs_cdo_quantities_t *quant);
517
518/*----------------------------------------------------------------------------*/
529/*----------------------------------------------------------------------------*/
530
531void
533 const cs_mesh_t *mesh,
534 const cs_cdo_connect_t *connect,
535 const cs_cdo_quantities_t *quant);
536
537/*----------------------------------------------------------------------------*/
541/*----------------------------------------------------------------------------*/
542
543void
545
546/*----------------------------------------------------------------------------*/
556/*----------------------------------------------------------------------------*/
557
558void
560 const cs_time_step_t *time_step,
561 const cs_cdo_connect_t *connect,
562 const cs_cdo_quantities_t *cdoq);
563
564/*----------------------------------------------------------------------------*/
574/*----------------------------------------------------------------------------*/
575
576void
578 const cs_time_step_t *time_step,
579 const cs_cdo_connect_t *connect,
580 const cs_cdo_quantities_t *cdoq);
581
582/*----------------------------------------------------------------------------*/
591/*----------------------------------------------------------------------------*/
592
593void
595
596/*----------------------------------------------------------------------------*/
606/*----------------------------------------------------------------------------*/
607
608void
610 const cs_cdo_quantities_t *quant,
611 const cs_adv_field_t *adv,
612 cs_gwf_tracer_t *tracer);
613
614/*----------------------------------------------------------------------------*/
624/*----------------------------------------------------------------------------*/
625
626void
628 const cs_cdo_quantities_t *quant,
629 const cs_adv_field_t *adv,
630 cs_gwf_tracer_t *tracer);
631
632/*----------------------------------------------------------------------------*/
648/*----------------------------------------------------------------------------*/
649
650double
652 const cs_cdo_quantities_t *cdoq,
653 const cs_gwf_tracer_t *tracer,
654 const char *z_name);
655
656/*----------------------------------------------------------------------------*/
674/*----------------------------------------------------------------------------*/
675
676void
678 const cs_cdo_quantities_t *cdoq,
679 const cs_gwf_tracer_t *tracer,
680 const char *z_name,
681 double results[]);
682
683/*----------------------------------------------------------------------------*/
693/*----------------------------------------------------------------------------*/
694
697 const char *chain_name,
699
700/*----------------------------------------------------------------------------*/
709/*----------------------------------------------------------------------------*/
710
713
714/*----------------------------------------------------------------------------*/
723/*----------------------------------------------------------------------------*/
724
726cs_gwf_tracer_decay_chain_by_name(const char *chain_name);
727
728/*----------------------------------------------------------------------------*/
739/*----------------------------------------------------------------------------*/
740
743 int id);
744
745/*----------------------------------------------------------------------------*/
756/*----------------------------------------------------------------------------*/
757
760 int id);
761
762/*----------------------------------------------------------------------------*/
773/*----------------------------------------------------------------------------*/
774
777 int id);
778
779/*----------------------------------------------------------------------------*/
780
782
783#endif /* __CS_GWF_TRACER_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:509
double cs_real_t
Floating-point value.
Definition cs_defs.h:319
#define END_C_DECLS
Definition cs_defs.h:510
@ lambda
Definition cs_field_pointer.h:106
cs_flag_t cs_gwf_tracer_model_t
Definition cs_gwf_param.h:272
cs_gwf_model_type_t
Type of system of equation(s) to consider for the physical modelling.
Definition cs_gwf_param.h:118
cs_gwf_tracer_unit_t
Type of unit for the expression of the radioactive inventory.
Definition cs_gwf_param.h:102
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 stead...
Definition cs_gwf_tracer.c:2619
void cs_gwf_tracer_free_context_t(cs_gwf_tracer_t *tracer)
Generic function to free the input of a tracer model.
Definition cs_gwf_tracer.h:129
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.
Definition cs_gwf_tracer.c:2570
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 f...
Definition cs_gwf_tracer.c:2083
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.
Definition cs_gwf_tracer.c:2976
void cs_gwf_tracer_free_all(void)
Free all tracer structures and all decay chains.
Definition cs_gwf_tracer.c:2139
void cs_gwf_tracer_finalize_setup(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
Finalize the tracer setup.
Definition cs_gwf_tracer.c:2373
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...
Definition cs_gwf_tracer.c:2459
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 n...
Definition cs_gwf_tracer.c:3105
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....
Definition cs_gwf_tracer.c:3313
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.
Definition cs_gwf_tracer.c:3199
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....
Definition cs_gwf_tracer.c:3344
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....
Definition cs_gwf_tracer.c:2674
void cs_gwf_tracer_update_t(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)
Generic function to update the properties related to a tracer. This function depends on a numerical s...
Definition cs_gwf_tracer.h:113
void cs_gwf_tracer_init_setup_t(cs_gwf_tracer_t *tracer)
Generic function to update the first setup stage (the one done before building mesh and its related q...
Definition cs_gwf_tracer.h:77
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 equati...
Definition cs_gwf_tracer.c:2190
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 case of a fully saturated flow model.
Definition cs_gwf_tracer.c:2836
void cs_gwf_tracer_log_all(void)
Display the main features related to each tracer.
Definition cs_gwf_tracer.c:2491
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.
Definition cs_gwf_tracer.c:2030
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,...
Definition cs_gwf_tracer.c:3274
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....
Definition cs_gwf_tracer.c:3374
void cs_gwf_tracer_init_setup(void)
Initial setup step for tracer equations. Soils and equation parameters are defined at this stage....
Definition cs_gwf_tracer.c:2336
void cs_gwf_tracer_finalize_setup_t(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_adv_field_t *adv, cs_gwf_tracer_t *tracer)
Generic function to finalize the setup of parameters related to a tracer equation....
Definition cs_gwf_tracer.h:93
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 cel...
Definition cs_gwf_tracer.c:3155
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 transp...
Definition cs_gwf_tracer.c:2292
void cs_gwf_tracer_integrate_t(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_equation_t *eq, const cs_zone_t *zone, void *context, double results[])
Compute the quantity of tracer using an integral of the tracer concentration over a given set of cell...
Definition cs_gwf_tracer.h:149
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 point...
Definition cs_gwf_tracer.c:3250
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 spe...
Definition cs_gwf_tracer.c:2229
Definition mesh.f90:26
Definition cs_gwf_tracer.h:184
cs_real_t * precip_mass
Definition cs_gwf_tracer.h:218
double * kd0
Definition cs_gwf_tracer.h:198
double decay_coef
Definition cs_gwf_tracer.h:189
double * rho_bulk
Definition cs_gwf_tracer.h:197
double * conc_l_star
Definition cs_gwf_tracer.h:210
cs_real_t * conc_site2
Definition cs_gwf_tracer.h:237
cs_field_t * precip_field
Definition cs_gwf_tracer.h:224
double * k0_plus
Definition cs_gwf_tracer.h:232
double * alpha_t
Definition cs_gwf_tracer.h:203
double * k0_minus
Definition cs_gwf_tracer.h:234
const cs_field_t * darcy_velocity_field
Definition cs_gwf_tracer.h:241
double * rho_kd
Definition cs_gwf_tracer.h:200
double * wmd
Definition cs_gwf_tracer.h:205
double * alpha_l
Definition cs_gwf_tracer.h:202
Definition cs_gwf_tracer.h:248
cs_gwf_tracer_update_t * update_diff_pty
Definition cs_gwf_tracer.h:359
cs_field_t * diffusivity
Definition cs_gwf_tracer.h:274
cs_gwf_tracer_update_t * update_decay_chain_st
Definition cs_gwf_tracer.h:361
cs_gwf_model_type_t hydraulic_model
Definition cs_gwf_tracer.h:260
cs_gwf_tracer_integrate_t * integrate
Definition cs_gwf_tracer.h:363
cs_gwf_tracer_update_t * update_precipitation
Definition cs_gwf_tracer.h:360
cs_gwf_tracer_init_setup_t * init_setup
Definition cs_gwf_tracer.h:365
cs_equation_t * equation
Definition cs_gwf_tracer.h:294
cs_gwf_tracer_model_t model
Definition cs_gwf_tracer.h:267
int reaction_id
Definition cs_gwf_tracer.h:282
int chain_id
Definition cs_gwf_tracer.h:316
int chain_position_id
Definition cs_gwf_tracer.h:309
cs_gwf_tracer_free_context_t * free_context
Definition cs_gwf_tracer.h:367
void * context
Definition cs_gwf_tracer.h:301
cs_gwf_tracer_finalize_setup_t * finalize_setup
Definition cs_gwf_tracer.h:366
Definition cs_advection_field.h:150
Definition cs_cdo_connect.h:61
Definition cs_cdo_quantities.h:137
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition cs_equation_param.h:192
Main structure to handle the discretization and the resolution of an equation.
Field descriptor.
Definition cs_field.h:130
Definition cs_gwf_tracer.h:162
char * name
Definition cs_gwf_tracer.h:164
cs_xdef_t ** st_defs
Definition cs_gwf_tracer.h:177
int id
Definition cs_gwf_tracer.h:165
cs_gwf_tracer_t ** tracers
Definition cs_gwf_tracer.h:173
int n_tracers
Definition cs_gwf_tracer.h:167
cs_gwf_tracer_unit_t unit
Definition cs_gwf_tracer.h:168
Set of parameters describing a tracer structure.
Definition cs_mesh.h:85
time step descriptor
Definition cs_time_step.h:64
Structure storing medata for defining a quantity in a very flexible way.
Definition cs_xdef.h:160
Definition cs_zone.h:55