programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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.h"
37 #include "cs_cdo_connect.h"
38 #include "cs_cdo_quantities.h"
39 #include "cs_mesh.h"
40 #include "cs_property.h"
41 #include "cs_time_step.h"
42 #include "cs_volume_zone.h"
43 
44 /*----------------------------------------------------------------------------*/
45 
47 
48 /*============================================================================
49  * Macro definitions
50  *============================================================================*/
51 
52 /*============================================================================
53  * Public function pointer prototypes
54  *============================================================================*/
55 
56 /*----------------------------------------------------------------------------*/
71 /*----------------------------------------------------------------------------*/
72 
73 typedef void
75  const cs_cdo_connect_t *connect,
76  const cs_cdo_quantities_t *quant,
77  const cs_time_step_t *ts,
78  const cs_real_t *head_values,
79  const cs_volume_zone_t *zone,
80  void *input);
81 
82 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
89 
90 typedef void
91 (cs_gwf_soil_finalize_t)(void *input);
92 
93 
94 /*============================================================================
95  * Type definitions
96  *============================================================================*/
97 
98 /* Predefined hydraulic model of soil
99  *=================================== */
100 
101 /* Type of predefined modelling for the groundwater flows */
102 typedef enum {
103 
104  CS_GWF_SOIL_GENUCHTEN, /* Van Genuchten-Mualem laws for dimensionless
105  moisture content and hydraulic conductivity */
106  CS_GWF_SOIL_SATURATED, /* media is satured */
107  CS_GWF_SOIL_USER, /* User-defined model */
109 
111 
112 /* Structures used to handle soils with a Van Genuchten-Mualen modelling */
113 /* --------------------------------------------------------------------- */
114 
115 /* Parameters defining a van Genuchten-Mualen hydraulic model */
116 typedef struct {
117 
118  double bulk_density;
122 
123  /* Advanced parameters */
124  double n; // 1.25 < n < 6
125  double m; // m = 1 - 1/n
126  double scale; // scale parameter [m^-1]
127  double tortuosity; // tortuosity param. for saturated hydraulic conductivity
128 
130 
131 /* Input structure used to update the physical properties */
132 typedef struct {
133 
138 
140 
141 /* Structures used to handle soils with a saturated modelling */
142 /* ---------------------------------------------------------- */
143 
144 /* Parameters defining a saturated hydraulic model */
145 typedef struct {
146 
147  double bulk_density;
150 
152 
153 typedef struct {
154 
157 
159 
160 /* Set of parameters describing a soil */
161 typedef struct {
162 
163  int id; /* soil id */
164  int zone_id; /* id related to a cs_volume_zone_t structure (based on
165  cells) */
166 
167  /* Physical modelling adopted for this soil */
169 
170  /* Pointer to an input structure according to the hydraulic model */
171  void *input;
172 
173  /* Pointers to functions */
176 
177 } cs_gwf_soil_t;
178 
179 /*============================================================================
180  * Public function prototypes
181  *============================================================================*/
182 
183 /*----------------------------------------------------------------------------*/
193 /*----------------------------------------------------------------------------*/
194 
196 cs_gwf_soil_add(const char *z_name,
198 
199 /*----------------------------------------------------------------------------*/
203 /*----------------------------------------------------------------------------*/
204 
205 void
207 
208 /*----------------------------------------------------------------------------*/
214 /*----------------------------------------------------------------------------*/
215 
216 int
217 cs_gwf_get_n_soils(void);
218 
219 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
230 cs_gwf_soil_by_id(int id);
231 
232 /*----------------------------------------------------------------------------*/
240 /*----------------------------------------------------------------------------*/
241 
243 cs_gwf_soil_by_name(const char *name);
244 
245 /*----------------------------------------------------------------------------*/
253 /*----------------------------------------------------------------------------*/
254 
255 cs_real_t
257 
258 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 void
272  double k_s,
273  double theta_s,
274  double rho);
275 
276 /*----------------------------------------------------------------------------*/
286 /*----------------------------------------------------------------------------*/
287 
288 void
290  double *k_s,
291  double theta_s,
292  double rho);
293 
294 /*----------------------------------------------------------------------------*/
305 /*----------------------------------------------------------------------------*/
306 
307 void
309  double k_s,
310  double theta_s,
311  double theta_r,
312  double rho);
313 
314 /*----------------------------------------------------------------------------*/
325 /*----------------------------------------------------------------------------*/
326 
327 void
329  double *k_s,
330  double theta_s,
331  double theta_r,
332  double rho);
333 
334 /*----------------------------------------------------------------------------*/
344 /*----------------------------------------------------------------------------*/
345 
346 void
348  void *input,
349  cs_gwf_soil_update_t *update_func,
350  cs_gwf_soil_finalize_t *free_func);
351 
352 /*----------------------------------------------------------------------------*/
361 /*----------------------------------------------------------------------------*/
362 
363 void
365  cs_property_t *moisture_content,
366  cs_field_t *moisture_field);
367 
368 /*----------------------------------------------------------------------------*/
374 /*----------------------------------------------------------------------------*/
375 
376 void
378 
379 /*----------------------------------------------------------------------------*/
383 /*----------------------------------------------------------------------------*/
384 
385 const short int *
387 
388 /*----------------------------------------------------------------------------*/
403 /*----------------------------------------------------------------------------*/
404 
405 void
407  cs_field_t *permea_field,
408  cs_property_t *moisture_content,
409  cs_field_t *moisture_field,
410  cs_property_t *soil_capacity,
411  cs_field_t *capacity_field);
412 
413 /*----------------------------------------------------------------------------*/
417 /*----------------------------------------------------------------------------*/
418 
419 void
421 
422 /*----------------------------------------------------------------------------*/
423 
425 
426 #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:866
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:672
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:174
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:480
Definition: cs_gwf_soil.h:108
double saturated_moisture
Definition: cs_gwf_soil.h:148
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:149
double m
Definition: cs_gwf_soil.h:125
Definition: cs_gwf_soil.h:104
Field descriptor.
Definition: cs_field.h:124
double bulk_density
Definition: cs_gwf_soil.h:118
Definition: cs_gwf_soil.h:116
int id
Definition: cs_gwf_soil.h:163
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:134
Definition: cs_gwf_soil.h:132
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:721
double residual_moisture
Definition: cs_gwf_soil.h:119
#define BEGIN_C_DECLS
Definition: cs_defs.h:453
cs_gwf_soil_hydraulic_model_t model
Definition: cs_gwf_soil.h:168
double bulk_density
Definition: cs_gwf_soil.h:147
int zone_id
Definition: cs_gwf_soil.h:164
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:796
Definition: cs_cdo_connect.h:55
void * input
Definition: cs_gwf_soil.h:171
Definition: cs_gwf_soil.h:161
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:89
Definition: cs_mesh.h:63
cs_gwf_soil_t * cs_gwf_soil_by_name(const char *name)
Retrieve a soil structure from its name.
Definition: cs_gwf_soil.c:515
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:931
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:767
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:155
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:156
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:496
double saturated_moisture
Definition: cs_gwf_soil.h:120
Definition: cs_gwf_soil.h:153
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:121
double scale
Definition: cs_gwf_soil.h:126
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:544
cs_real_t * capacity_values
Definition: cs_gwf_soil.h:137
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:908
double n
Definition: cs_gwf_soil.h:124
cs_real_t * head_values
Definition: cs_gwf_soil.h:135
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:593
double tortuosity
Definition: cs_gwf_soil.h:127
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:450
cs_gwf_soil_finalize_t * free_input
Definition: cs_gwf_soil.h:175
Definition: cs_gwf_soil.h:107
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:954
cs_gwf_soil_hydraulic_model_t
Definition: cs_gwf_soil.h:102
#define END_C_DECLS
Definition: cs_defs.h:454
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:136
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_volume_zone_t *zone, void *input)
Generic function to update the physical properties related to a hydraulic model. At least...
Definition: cs_gwf_soil.h:74
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:370
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:315
void( cs_gwf_soil_finalize_t)(void *input)
Generic function to set free the input of a soil structure.
Definition: cs_gwf_soil.h:91
Definition: cs_field_pointer.h:100
Definition: cs_volume_zone.h:85
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:633
Definition: cs_gwf_soil.h:106
Definition: cs_property.h:62
Definition: cs_gwf_soil.h:145