programmer's documentation
cs_gwf_soil.h
Go to the documentation of this file.
1 #ifndef __CS_GWF_SOIL_H__
2 #define __CS_GWF_SOIL_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-2018 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_base.h"
36 #include "cs_cdo_connect.h"
37 #include "cs_cdo_quantities.h"
38 #include "cs_mesh.h"
39 #include "cs_property.h"
40 #include "cs_time_step.h"
41 #include "cs_volume_zone.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Public function pointer prototypes
53  *============================================================================*/
54 
55 /*----------------------------------------------------------------------------*/
70 /*----------------------------------------------------------------------------*/
71 
72 typedef void
74  const cs_cdo_connect_t *connect,
75  const cs_cdo_quantities_t *quant,
76  const cs_time_step_t *ts,
77  const cs_real_t *head_values,
78  const cs_zone_t *zone,
79  void *input);
80 
81 /*----------------------------------------------------------------------------*/
87 /*----------------------------------------------------------------------------*/
88 
89 typedef void
91 
92 
93 /*============================================================================
94  * Type definitions
95  *============================================================================*/
96 
97 /* Predefined hydraulic model of soil
98  *=================================== */
99 
100 /* Type of predefined modelling for the groundwater flows */
101 typedef enum {
102 
103  CS_GWF_SOIL_GENUCHTEN, /* Van Genuchten-Mualem laws for dimensionless
104  moisture content and hydraulic conductivity */
105  CS_GWF_SOIL_SATURATED, /* media is satured */
106  CS_GWF_SOIL_USER, /* User-defined model */
108 
110 
111 /* Structures used to handle soils with a Van Genuchten-Mualen modelling */
112 /* --------------------------------------------------------------------- */
113 
114 /* Parameters defining a van Genuchten-Mualen hydraulic model */
115 typedef struct {
116 
117  double bulk_density;
121 
122  /* Advanced parameters */
123  double n; // 1.25 < n < 6
124  double m; // m = 1 - 1/n
125  double scale; // scale parameter [m^-1]
126  double tortuosity; // tortuosity param. for saturated hydraulic conductivity
127 
129 
130 /* Input structure used to update the physical properties */
131 typedef struct {
132 
137 
139 
140 /* Structures used to handle soils with a saturated modelling */
141 /* ---------------------------------------------------------- */
142 
143 /* Parameters defining a saturated hydraulic model */
144 typedef struct {
145 
146  double bulk_density;
149 
151 
152 typedef struct {
153 
156 
158 
159 /* Set of parameters describing a soil */
160 typedef struct {
161 
162  int id; /* soil id */
163  int zone_id; /* id related to a cs_zone_t structure (based on
164  cells) */
165 
166  /* Physical modelling adopted for this soil */
167  cs_gwf_soil_hydraulic_model_t model;
168 
169  /* Pointer to an input structure according to the hydraulic model */
170  void *input;
171 
172  /* Pointers to functions */
175 
176 } cs_gwf_soil_t;
177 
178 /*============================================================================
179  * User-defined function prototypes
180  *============================================================================*/
181 
182 /*----------------------------------------------------------------------------*/
189 /*----------------------------------------------------------------------------*/
190 
191 void
193  cs_real_t *density);
194 
195 /*============================================================================
196  * Public function prototypes
197  *============================================================================*/
198 
199 /*----------------------------------------------------------------------------*/
209 /*----------------------------------------------------------------------------*/
210 
212 cs_gwf_soil_add(const char *z_name,
213  cs_gwf_soil_hydraulic_model_t model);
214 
215 /*----------------------------------------------------------------------------*/
219 /*----------------------------------------------------------------------------*/
220 
221 void
223 
224 /*----------------------------------------------------------------------------*/
230 /*----------------------------------------------------------------------------*/
231 
232 int
233 cs_gwf_get_n_soils(void);
234 
235 /*----------------------------------------------------------------------------*/
243 /*----------------------------------------------------------------------------*/
244 
246 cs_gwf_soil_by_id(int id);
247 
248 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
259 cs_gwf_soil_by_name(const char *name);
260 
261 /*----------------------------------------------------------------------------*/
269 /*----------------------------------------------------------------------------*/
270 
271 cs_real_t
273 
274 /*----------------------------------------------------------------------------*/
284 /*----------------------------------------------------------------------------*/
285 
286 void
288  double k_s,
289  double theta_s,
290  double rho);
291 
292 /*----------------------------------------------------------------------------*/
302 /*----------------------------------------------------------------------------*/
303 
304 void
306  double *k_s,
307  double theta_s,
308  double rho);
309 
310 /*----------------------------------------------------------------------------*/
321 /*----------------------------------------------------------------------------*/
322 
323 void
325  double k_s,
326  double theta_s,
327  double theta_r,
328  double rho);
329 
330 /*----------------------------------------------------------------------------*/
341 /*----------------------------------------------------------------------------*/
342 
343 void
345  double *k_s,
346  double theta_s,
347  double theta_r,
348  double rho);
349 
350 /*----------------------------------------------------------------------------*/
360 /*----------------------------------------------------------------------------*/
361 
362 void
364  void *input,
365  cs_gwf_soil_update_t *update_func,
366  cs_gwf_soil_finalize_t *free_func);
367 
368 /*----------------------------------------------------------------------------*/
377 /*----------------------------------------------------------------------------*/
378 
379 void
381  cs_property_t *moisture_content,
382  cs_field_t *moisture_field);
383 
384 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 
392 void
394 
395 /*----------------------------------------------------------------------------*/
399 /*----------------------------------------------------------------------------*/
400 
401 const short int *
403 
404 /*----------------------------------------------------------------------------*/
419 /*----------------------------------------------------------------------------*/
420 
421 void
423  cs_field_t *permea_field,
424  cs_property_t *moisture_content,
425  cs_field_t *moisture_field,
426  cs_property_t *soil_capacity,
427  cs_field_t *capacity_field);
428 
429 /*----------------------------------------------------------------------------*/
433 /*----------------------------------------------------------------------------*/
434 
435 void
437 
438 /*----------------------------------------------------------------------------*/
439 
441 
442 #endif /* __CS_GWF_SOIL_H__ */
void cs_gwf_build_cell2soil(cs_lnum_t n_cells)
Build an array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:875
time step descriptor
Definition: cs_time_step.h:51
void cs_gwf_set_iso_genuchten_soil(cs_gwf_soil_t *soil, double k_s, double theta_s, double theta_r, double rho)
Set a soil defined by a Van Genuchten hydraulic model and attached to an anisotropic permeability...
Definition: cs_gwf_soil.c:681
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:173
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:489
Definition: cs_gwf_soil.h:107
double saturated_moisture
Definition: cs_gwf_soil.h:147
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:148
double m
Definition: cs_gwf_soil.h:124
Definition: cs_gwf_soil.h:103
void() cs_gwf_soil_finalize_t(void *input)
Generic function to set free the input of a soil structure.
Definition: cs_gwf_soil.h:90
Field descriptor.
Definition: cs_field.h:124
double bulk_density
Definition: cs_gwf_soil.h:117
Definition: cs_gwf_soil.h:115
int id
Definition: cs_gwf_soil.h:162
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:133
Definition: cs_gwf_soil.h:131
void cs_gwf_set_aniso_genuchten_soil(cs_gwf_soil_t *soil, double *k_s, double theta_s, double theta_r, double rho)
Set a soil defined by a Van Genuchten hydraulic model and attached to an anisotropic permeability...
Definition: cs_gwf_soil.c:730
double residual_moisture
Definition: cs_gwf_soil.h:118
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
cs_gwf_soil_hydraulic_model_t model
Definition: cs_gwf_soil.h:167
double bulk_density
Definition: cs_gwf_soil.h:146
int zone_id
Definition: cs_gwf_soil.h:163
void cs_gwf_soil_set_all_saturated(cs_property_t *permeability, cs_property_t *moisture_content, cs_field_t *moisture_field)
Set the properties of the groundwater flow module all soils are considered as saturated.
Definition: cs_gwf_soil.c:805
Definition: cs_cdo_connect.h:74
void * input
Definition: cs_gwf_soil.h:170
Definition: cs_gwf_soil.h:160
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:94
void cs_user_gwf_get_soil_density(const cs_gwf_soil_t *soil, cs_real_t *density)
Retrieve the bulk density related to a soil structure.
Definition: cs_user_gwf.c:112
Definition: cs_mesh.h:63
void() cs_gwf_soil_update_t(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, const cs_real_t *head_values, const cs_zone_t *zone, void *input)
Generic function to update the physical properties related to a hydraulic model. At least...
Definition: cs_gwf_soil.h:73
cs_gwf_soil_t * cs_gwf_soil_by_name(const char *name)
Retrieve a soil structure from its name.
Definition: cs_gwf_soil.c:524
void cs_gwf_soil_set_by_field(cs_property_t *permeability, cs_field_t *permea_field, cs_property_t *moisture_content, cs_field_t *moisture_field, cs_property_t *soil_capacity, cs_field_t *capacity_field)
Set the properties of the groundwater flow module thanks to cs_field_t structure. The consequence is ...
Definition: cs_gwf_soil.c:947
void cs_gwf_set_user_soil(cs_gwf_soil_t *soil, void *input, cs_gwf_soil_update_t *update_func, cs_gwf_soil_finalize_t *free_func)
Set a soil defined by a user-defined hydraulic model and attached to an anisotropic permeability...
Definition: cs_gwf_soil.c:776
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:154
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:155
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:505
double saturated_moisture
Definition: cs_gwf_soil.h:119
Definition: cs_gwf_soil.h:152
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:120
double scale
Definition: cs_gwf_soil.h:125
cs_real_t cs_gwf_soil_get_bulk_density(const cs_gwf_soil_t *soil)
Retrieve the bulk density associated to the given soil structure.
Definition: cs_gwf_soil.c:553
static int input(void)
double precision, dimension(:,:,:), allocatable density
Definition: atimbr.f90:124
cs_real_t * capacity_values
Definition: cs_gwf_soil.h:136
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:924
double n
Definition: cs_gwf_soil.h:123
cs_real_t * head_values
Definition: cs_gwf_soil.h:134
void cs_gwf_set_iso_saturated_soil(cs_gwf_soil_t *soil, double k_s, double theta_s, double rho)
Set a soil defined by a saturated hydraulic model and attached to an isotropic permeability.
Definition: cs_gwf_soil.c:602
double tortuosity
Definition: cs_gwf_soil.h:126
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:459
cs_gwf_soil_finalize_t * free_input
Definition: cs_gwf_soil.h:174
Definition: cs_gwf_soil.h:106
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:970
cs_gwf_soil_hydraulic_model_t
Definition: cs_gwf_soil.h:101
#define END_C_DECLS
Definition: cs_defs.h:463
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:135
cs_gwf_soil_t * cs_gwf_soil_add(const char *z_name, cs_gwf_soil_hydraulic_model_t model)
Create and add a new cs_gwf_soil_t structure. A first initialization of all members by default is per...
Definition: cs_gwf_soil.c:379
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:316
Definition: cs_field_pointer.h:100
void cs_gwf_set_aniso_saturated_soil(cs_gwf_soil_t *soil, double *k_s, double theta_s, double rho)
Set a soil defined by a saturated hydraulic model and attached to an isotropic permeability.
Definition: cs_gwf_soil.c:642
Definition: cs_gwf_soil.h:105
Definition: cs_property.h:104
Definition: cs_gwf_soil.h:144
Definition: mesh.f90:26
Definition: cs_zone.h:55