7.0
general documentation
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-2021 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 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Typedef definition
45  *============================================================================*/
46 
48 typedef struct _gwf_tracer_t cs_gwf_tracer_t;
49 
50 /*============================================================================
51  * Public function pointer prototypes
52  *============================================================================*/
53 
54 /*----------------------------------------------------------------------------*/
65 /*----------------------------------------------------------------------------*/
66 
67 typedef void
68 (cs_gwf_tracer_update_t) (cs_gwf_tracer_t *tracer,
69  cs_real_t t_eval,
70  const cs_mesh_t *mesh,
71  const cs_cdo_connect_t *connect,
72  const cs_cdo_quantities_t *quant);
73 
74 /*----------------------------------------------------------------------------*/
80 /*----------------------------------------------------------------------------*/
81 
82 typedef void
83 (cs_gwf_tracer_free_input_t) (cs_gwf_tracer_t *tracer);
84 
85 /*============================================================================
86  * Structure definitions
87  *============================================================================*/
88 
89 
116 /* Type of predefined modelling for the groundwater flows */
117 typedef enum {
118 
119  CS_GWF_TRACER_USER = 1<< 0, /* = 1 */
120 
121  /* Physical phenomena to consider */
122  /* ------------------------------ */
123 
126 
127 
128  CS_GWF_TRACER_PRECIPITATION = 1<< 4, /* = 16 */
129 
131 
134 /* Set of parameters related to a tracer equation attached to a standard
135  modelling */
136 
137 typedef struct {
138 
139  /* Parameters to determine the behavior in each soil
140  * (array of size: n_soils)
141  */
142 
143  /* Common settings shared by all physical modelling */
144  /* ------------------------------------------------ */
145 
146  double *rho_bulk; /* bulk density (kg.m^-3) */
147  double *kd0; /* reference value of the distribution coefficient
148  (m^".kg^-1) */
149  double *rho_kd; /* Derived quantity: rho_bulk*kd0 */
150 
151  double *alpha_l; /* Longitudinal dispersivity */
152  double *alpha_t; /* Transversal dispersivity */
153 
154  double *wmd; /* Water molecular diffusivity (m^2.s^-1) */
155 
156  double *reaction_rate; /* First order decay coefficient (related to the
157  reaction term) */
158 
159  /* Precipitation members (set to NULL if not used) */
160  /* ----------------------------------------------- */
161 
162  double *conc_w_star; /* maximal value of the concentraction of tracer
163  in the liquid phase. Exceeded quantities are
164  stored in the solid phase (->
165  conc_precip). These values corresponds to the
166  user settings */
167 
168  cs_real_t *conc_satura; /* array storing the value of the saturated
169  concentration in the liquid phase at vertices
170  (only used in case of CDOVB schemes or CDOVCB
171  schemes */
172  cs_real_t *conc_precip; /* array storing the concentration in the
173  precipitation (solid) storage. The size may
174  vary w.r.t. to the discrtization scheme.
175  */
176 
178 
179  /* Sorption members (set to NULL if not used) */
180  /* ------------------------------------------ */
181 
182  double *k0_plus; /* kinetic coefficient towards site 2 locations
183  (m^3.kg^-1.s^-1) */
184  double *k0_minus; /* kinetic coefficient from site 2 locations
185  (s^-1) */
186 
187  cs_real_t *conc_site2; /* array allocated to n_cells */
188 
189  /* Variables used for the update of physical properties (shared pointers) */
190 
192  cs_field_t *moisture_content; /* also called the saturation, denoted by
193  \theta (-) */
194 
196 
197 /* Set of parameters describing a tracer structure */
198 /* ----------------------------------------------- */
199 
201 
202  int id; /* tracer id */
203  cs_equation_t *eq; /* related equation */
204 
205  /* Physical modelling adopted for this tracer */
207 
208  cs_field_t *diffusivity; /* NULL if no diffusion term is
209  build in the tracer equation */
210  int reaction_id; /* id related to the reaction
211  term in the tracer equation */
212 
213  /* Pointer to an input structure according to the model */
214  void *input;
215 
216  /* Pointers to functions */
220 
221 };
222 
223 /*============================================================================
224  * Public function pointer prototypes
225  *============================================================================*/
226 
227 /*----------------------------------------------------------------------------*/
235 /*----------------------------------------------------------------------------*/
236 
237 typedef void
239  const cs_cdo_quantities_t *quant,
240  cs_gwf_tracer_t *tracer);
241 
242 /*----------------------------------------------------------------------------*/
249 /*----------------------------------------------------------------------------*/
250 
251 typedef void
252 (cs_gwf_tracer_add_terms_t) (cs_gwf_tracer_t *tracer);
253 
254 /*============================================================================
255  * Public function prototypes
256  *============================================================================*/
257 
258 /*----------------------------------------------------------------------------*/
276 /*----------------------------------------------------------------------------*/
277 
278 cs_gwf_tracer_t *
279 cs_gwf_tracer_init(int tracer_id,
280  const char *eq_name,
281  const char *var_name,
282  cs_adv_field_t *adv_field,
284 
285 /*----------------------------------------------------------------------------*/
293 /*----------------------------------------------------------------------------*/
294 
295 cs_gwf_tracer_t *
296 cs_gwf_tracer_free(cs_gwf_tracer_t *tracer);
297 
298 /*----------------------------------------------------------------------------*/
312 /*----------------------------------------------------------------------------*/
313 
314 void
315 cs_gwf_set_main_tracer_param(cs_gwf_tracer_t *tracer,
316  const char *soil_name,
317  double wmd,
318  double alpha_l,
319  double alpha_t,
320  double distrib_coef,
321  double reaction_rate);
322 
323 /*----------------------------------------------------------------------------*/
334 /*----------------------------------------------------------------------------*/
335 
336 void
337 cs_gwf_set_precip_tracer_param(cs_gwf_tracer_t *tracer,
338  const char *soil_name,
339  double conc_w_star);
340 
341 /*----------------------------------------------------------------------------*/
350 /*----------------------------------------------------------------------------*/
351 
352 void
353 cs_gwf_tracer_add_terms(cs_gwf_tracer_t *tracer);
354 
355 /*----------------------------------------------------------------------------*/
363 /*----------------------------------------------------------------------------*/
364 
365 void
367  const cs_cdo_quantities_t *quant,
368  cs_gwf_tracer_t *tracer);
369 
370 /*----------------------------------------------------------------------------*/
376 /*----------------------------------------------------------------------------*/
377 
378 void
379 cs_gwf_tracer_log_setup(const cs_gwf_tracer_t *tracer);
380 
381 /*----------------------------------------------------------------------------*/
382 
384 
385 #endif /* __CS_GWF_TRACER_H__ */
int id
Definition: cs_gwf_tracer.h:202
cs_equation_t * eq
Definition: cs_gwf_tracer.h:203
Definition: cs_gwf_tracer.h:137
Definition: cs_advection_field.h:149
cs_gwf_tracer_model_t model
Definition: cs_gwf_tracer.h:206
void cs_gwf_set_main_tracer_param(cs_gwf_tracer_t *tracer, const char *soil_name, double wmd, double alpha_l, double alpha_t, double distrib_coef, double reaction_rate)
For a specified soil set the main parameters corresponding to a default modelling of a tracer transpo...
Definition: cs_gwf_tracer.c:687
Field descriptor.
Definition: cs_field.h:125
cs_field_t * moisture_content
Definition: cs_gwf_tracer.h:192
cs_flag_t cs_gwf_tracer_model_t
Definition: cs_gwf_tracer.h:47
double * rho_bulk
Definition: cs_gwf_tracer.h:146
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
double * rho_kd
Definition: cs_gwf_tracer.h:149
int reaction_id
Definition: cs_gwf_tracer.h:210
void() cs_gwf_tracer_setup_t(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_gwf_tracer_t *tracer)
Generic function to set the parameters related to a tracer equation.
Definition: cs_gwf_tracer.h:238
cs_gwf_tracer_free_input_t * free_input
Definition: cs_gwf_tracer.h:219
Definition: cs_cdo_connect.h:76
Definition: cs_gwf_tracer.h:125
double * alpha_l
Definition: cs_gwf_tracer.h:151
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
Definition: cs_cdo_quantities.h:124
void cs_gwf_tracer_log_setup(const cs_gwf_tracer_t *tracer)
Display the main features related to a tracer.
Definition: cs_gwf_tracer.c:1078
cs_field_t * diffusivity
Definition: cs_gwf_tracer.h:208
double * k0_minus
Definition: cs_gwf_tracer.h:184
Definition: cs_mesh.h:84
cs_gwf_tracer_update_t * update_precipitation
Definition: cs_gwf_tracer.h:218
double * wmd
Definition: cs_gwf_tracer.h:154
double * kd0
Definition: cs_gwf_tracer.h:147
cs_gwf_tracer_model_bit_t
elemental modelling choice either from the physical viewpoint or the numerical viewpoint for the tran...
Definition: cs_gwf_tracer.h:117
Definition: cs_gwf_tracer.h:124
double * conc_w_star
Definition: cs_gwf_tracer.h:162
cs_gwf_tracer_update_t * update_diff_tensor
Definition: cs_gwf_tracer.h:217
cs_gwf_tracer_t * cs_gwf_tracer_free(cs_gwf_tracer_t *tracer)
Free a cs_gwf_tracer_t structure.
Definition: cs_gwf_tracer.c:655
void() cs_gwf_tracer_free_input_t(cs_gwf_tracer_t *tracer)
Generic function to free the input of a tracer model.
Definition: cs_gwf_tracer.h:83
void() cs_gwf_tracer_update_t(cs_gwf_tracer_t *tracer, cs_real_t t_eval, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
Generic function to update the phisical properties related to a tracer modelling. ...
Definition: cs_gwf_tracer.h:68
double * alpha_t
Definition: cs_gwf_tracer.h:152
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 rela...
Definition: cs_gwf_tracer.c:544
cs_field_t * precip_field
Definition: cs_gwf_tracer.h:177
void cs_gwf_set_precip_tracer_param(cs_gwf_tracer_t *tracer, const char *soil_name, double conc_w_star)
For a specified soil set the parameters corresponding to a precipitation modelling of a tracer transp...
Definition: cs_gwf_tracer.c:756
cs_real_t * conc_site2
Definition: cs_gwf_tracer.h:187
Definition: cs_gwf_tracer.h:128
#define END_C_DECLS
Definition: cs_defs.h:496
void cs_gwf_tracer_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.
Definition: cs_gwf_tracer.c:916
void * input
Definition: cs_gwf_tracer.h:214
unsigned short int cs_flag_t
Definition: cs_defs.h:309
Definition: cs_gwf_tracer.h:119
void cs_gwf_tracer_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 standard tracer modelling Rely on the generic function: cs_gwf_tracer_add_terms_t.
Definition: cs_gwf_tracer.c:804
double * reaction_rate
Definition: cs_gwf_tracer.h:156
cs_real_t * conc_satura
Definition: cs_gwf_tracer.h:168
double * k0_plus
Definition: cs_gwf_tracer.h:182
Main structure to handle the discretization and the resolution of an equation.
cs_real_t * conc_precip
Definition: cs_gwf_tracer.h:172
Definition: mesh.f90:26
cs_field_t * darcy_velocity_field
Definition: cs_gwf_tracer.h:191
void() cs_gwf_tracer_add_terms_t(cs_gwf_tracer_t *tracer)
Generic function to update the terms to build in the algebraic system for a tracer equation according...
Definition: cs_gwf_tracer.h:252
Definition: cs_gwf_tracer.h:200