programmer's documentation
cs_groundwater.h
Go to the documentation of this file.
1 #ifndef __CS_GROUNDWATER_H__
2 #define __CS_GROUNDWATER_H__
3 
4 /*============================================================================
5  * Compute the wall distance using the CDO framework
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2016 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_base.h"
35 #include "cs_equation.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*============================================================================
42  * Macro definitions
43  *============================================================================*/
44 
45 /*============================================================================
46  * Type definitions
47  *============================================================================*/
48 
49 /* List of available keys for setting the groundwater flow module */
50 typedef enum {
51 
52  CS_GWKEY_GRAVITATION, // Take into acount gravitation effect
53  CS_GWKEY_OUTPUT_MOISTURE, // Activate post-processing for the moisture
55 
57 
58 typedef enum {
59 
60  CS_SOILKEY_SAT_MOISTURE, // Set the saturated moisture content
61  CS_SOILKEY_RES_MOISTURE, // Set the residual moisture content
62 
63  /* Keys specific to the Tracy model */
64  CS_SOILKEY_TRACY_SAT_H, // Head related to the saturated moisture content
65  CS_SOILKEY_TRACY_RES_H, // Head related to the residual moisture content
66 
68 
70 
71 
72 /* Type of predefined modelling for the groundwater flows */
73 typedef enum {
74 
75  CS_GROUNDWATER_MODEL_COMPOSITE, /* Mixed of predefined groundwater model */
76  CS_GROUNDWATER_MODEL_GENUCHTEN, /* Van Genuchten-Mualem laws for dimensionless
77  moisture content and hydraulic conductivity
78  */
79  CS_GROUNDWATER_MODEL_SATURATED, /* media is satured */
80  CS_GROUNDWATER_MODEL_TRACY, /* Tracy model for unsaturated soils */
81  CS_GROUNDWATER_MODEL_USER, /* User-defined model */
83 
85 
86 /* Parameters defining the van Genuchten-Mualen law */
87 typedef struct {
88 
89  double n; // 1.25 < n < 6
90  double m; // m = 1 - 1/n
91  double scale; // scale parameter [m^-1]
92  double tortuosity; // tortuosity param. for saturated hydraulic conductivity
93 
95 
96 typedef struct {
97 
98  double h_r;
99  double h_s;
100 
101 } cs_gw_tracy_t;
102 
103 typedef struct _groundwater_t cs_groundwater_t;
104 
105 /*============================================================================
106  * Public function prototypes
107  *============================================================================*/
108 
109 /*----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------*/
116 
117 cs_groundwater_t *
119 
120 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 cs_groundwater_t *
131 cs_groundwater_finalize(cs_groundwater_t *gw);
132 
133 /*----------------------------------------------------------------------------*/
141 /*----------------------------------------------------------------------------*/
142 
143 int
144 cs_groundwater_get_n_soils(const cs_groundwater_t *gw);
145 
146 /*----------------------------------------------------------------------------*/
154 /*----------------------------------------------------------------------------*/
155 
156 void
157 cs_groundwater_set_param(cs_groundwater_t *gw,
159  const char *keyval);
160 
161 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
169 void
170 cs_groundwater_summary(const cs_groundwater_t *gw);
171 
172 /*----------------------------------------------------------------------------*/
187 /*----------------------------------------------------------------------------*/
188 
189 cs_equation_t *
191  int richards_eq_id,
192  int n_soils,
193  int n_tracer_eqs,
194  cs_property_t *permeability,
195  cs_property_t *soil_capacity,
196  cs_adv_field_t *adv_field,
197  cs_groundwater_t *gw);
198 
199 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
210 void
211 cs_groundwater_add_soil_by_value(cs_groundwater_t *gw,
212  const char *ml_name,
213  const char *model_kw,
214  const char *pty_val);
215 
216 /*----------------------------------------------------------------------------*/
225 /*----------------------------------------------------------------------------*/
226 
227 void
228 cs_groundwater_set_soil_param(cs_groundwater_t *gw,
229  const char *ml_name,
231  const char *keyval);
232 
233 /*----------------------------------------------------------------------------*/
248 /*----------------------------------------------------------------------------*/
249 
250 cs_equation_t *
251 cs_groundwater_add_tracer(cs_groundwater_t *gw,
252  int tracer_eq_id,
253  const char *eqname,
254  const char *varname);
255 
256 /*----------------------------------------------------------------------------*/
274 /*----------------------------------------------------------------------------*/
275 
276 void
277 cs_groundwater_set_tracer_param(cs_groundwater_t *gw,
278  int tracer_eq_id,
279  const char *ml_name,
280  double wmd,
281  double alpha_l,
282  double alpha_t,
283  double bulk_density,
284  double distrib_coef,
285  double reaction_rate);
286 
287 /*----------------------------------------------------------------------------*/
294 /*----------------------------------------------------------------------------*/
295 
296 void
297 cs_groundwater_richards_setup(cs_groundwater_t *gw,
298  cs_equation_t *richards);
299 
300 /*----------------------------------------------------------------------------*/
309 /*----------------------------------------------------------------------------*/
310 
311 bool
312 cs_groundwater_tracer_needs_reaction(const cs_groundwater_t *gw,
313  int eq_id);
314 
315 /*----------------------------------------------------------------------------*/
324 /*----------------------------------------------------------------------------*/
325 
326 bool
327 cs_groundwater_tracer_needs_diffusion(const cs_groundwater_t *gw,
328  int eq_id);
329 
330 /*----------------------------------------------------------------------------*/
338 /*----------------------------------------------------------------------------*/
339 
340 void
341 cs_groundwater_tracer_setup(int tracer_eq_id,
342  cs_equation_t *eq,
343  cs_groundwater_t *gw);
344 
345 /*----------------------------------------------------------------------------*/
358 /*----------------------------------------------------------------------------*/
359 
360 void
362  const cs_time_step_t *time_step,
363  double dt_cur,
364  const cs_cdo_connect_t *connect,
365  const cs_cdo_quantities_t *cdoq,
366  bool do_logcvg,
367  cs_equation_t *eqs[],
368  cs_groundwater_t *gw);
369 
370 /*----------------------------------------------------------------------------*/
392 /*----------------------------------------------------------------------------*/
393 
394 void
396  int mesh_id,
397  int cat_id,
398  int ent_flag[5],
399  cs_lnum_t n_cells,
400  cs_lnum_t n_i_faces,
401  cs_lnum_t n_b_faces,
402  const cs_lnum_t cell_list[],
403  const cs_lnum_t i_face_list[],
404  const cs_lnum_t b_face_list[],
405  const cs_time_step_t *time_step);
406 
407 /*----------------------------------------------------------------------------*/
408 
410 
411 #endif /* __CS_GROUNDWATER_H__ */
Definition: cs_groundwater.h:87
time step descriptor
Definition: cs_time_step.h:51
Definition: cs_groundwater.h:60
Definition: cs_groundwater.h:61
Definition: cs_groundwater.h:79
double h_r
Definition: cs_groundwater.h:98
cs_equation_t * cs_groundwater_initialize(const cs_cdo_connect_t *connect, int richards_eq_id, int n_soils, int n_tracer_eqs, cs_property_t *permeability, cs_property_t *soil_capacity, cs_adv_field_t *adv_field, cs_groundwater_t *gw)
Initialize the module dedicated to groundwater flows.
Definition: cs_groundwater.c:1168
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
Definition: cs_groundwater.h:54
cs_equation_t * cs_groundwater_add_tracer(cs_groundwater_t *gw, int tracer_eq_id, const char *eqname, const char *varname)
Add a new equation related to the groundwater flow module This equation is a specific unsteady advect...
Definition: cs_groundwater.c:1457
double m
Definition: cs_groundwater.h:90
double tortuosity
Definition: cs_groundwater.h:92
void cs_groundwater_set_soil_param(cs_groundwater_t *gw, const char *ml_name, cs_groundwater_soilkey_t key, const char *keyval)
Set parameters related to a cs_groundwater_t structure.
Definition: cs_groundwater.c:1310
void cs_groundwater_set_tracer_param(cs_groundwater_t *gw, int tracer_eq_id, const char *ml_name, double wmd, double alpha_l, double alpha_t, double bulk_density, double distrib_coef, double reaction_rate)
Add a new equation related to the groundwater flow module This equation is a specific unsteady advect...
Definition: cs_groundwater.c:1524
Definition: cs_cdo_connect.h:67
Definition: cs_groundwater.h:81
Definition: cs_groundwater.h:82
void cs_groundwater_set_param(cs_groundwater_t *gw, cs_groundwater_key_t key, const char *keyval)
Set parameters related to a cs_groundwater_t structure.
Definition: cs_groundwater.c:984
Definition: cs_cdo_quantities.h:100
Definition: cs_groundwater.h:65
Definition: cs_mesh.h:62
cs_groundwater_soilkey_t
Definition: cs_groundwater.h:58
Definition: cs_groundwater.h:80
Definition: cs_groundwater.h:76
void cs_groundwater_richards_setup(cs_groundwater_t *gw, cs_equation_t *richards)
Predefined settings for the Richards equation.
Definition: cs_groundwater.c:1602
double h_s
Definition: cs_groundwater.h:99
cs_groundwater_key_t
Definition: cs_groundwater.h:50
Definition: cs_groundwater.h:96
static int input(void)
bool cs_groundwater_tracer_needs_reaction(const cs_groundwater_t *gw, int eq_id)
Check if one needs to add a reaction term for a given tracer.
Definition: cs_groundwater.c:1840
void cs_groundwater_tracer_setup(int tracer_eq_id, cs_equation_t *eq, cs_groundwater_t *gw)
Predefined settings for a tracer equation.
Definition: cs_groundwater.c:1899
Definition: cs_groundwater.h:52
double n
Definition: cs_groundwater.h:89
Definition: cs_groundwater.h:75
Definition: cs_groundwater.h:67
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
void cs_groundwater_extra_post(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_list[], const cs_lnum_t i_face_list[], const cs_lnum_t b_face_list[], const cs_time_step_t *time_step)
Predefined post-processing output for the groundwater flow module prototype of this function is fixed...
Definition: cs_groundwater.c:2136
Definition: cs_groundwater.h:53
#define END_C_DECLS
Definition: cs_defs.h:449
int cs_groundwater_get_n_soils(const cs_groundwater_t *gw)
Get the number of requested soils.
Definition: cs_groundwater.c:965
bool cs_groundwater_tracer_needs_diffusion(const cs_groundwater_t *gw, int eq_id)
Check if one needs to add a diffusion term for a given tracer.
Definition: cs_groundwater.c:1869
cs_groundwater_model_t
Definition: cs_groundwater.h:73
cs_groundwater_t * cs_groundwater_finalize(cs_groundwater_t *gw)
Free the main structure related to groundwater flows.
Definition: cs_groundwater.c:928
void cs_groundwater_summary(const cs_groundwater_t *gw)
Summary of a cs_groundwater_t structure.
Definition: cs_groundwater.c:1035
subroutine richards(icvrge, dt)
Definition: richards.f90:79
void cs_groundwater_add_soil_by_value(cs_groundwater_t *gw, const char *ml_name, const char *model_kw, const char *pty_val)
Add a new type of soil to consider in the groundwater module.
Definition: cs_groundwater.c:1250
void cs_groundwater_compute(const cs_mesh_t *mesh, const cs_time_step_t *time_step, double dt_cur, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, bool do_logcvg, cs_equation_t *eqs[], cs_groundwater_t *gw)
Compute the system related to groundwater flows module.
Definition: cs_groundwater.c:1997
cs_groundwater_t * cs_groundwater_create(void)
Create a structure dedicated to manage groundwater flows.
Definition: cs_groundwater.c:884
Definition: cs_groundwater.h:64
double scale
Definition: cs_groundwater.h:91
Definition: mesh.f90:26