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  * Public function prototypes
180  *============================================================================*/
181 
182 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
193 
195 cs_gwf_soil_add(const char *z_name,
196  cs_gwf_soil_hydraulic_model_t model);
197 
198 /*----------------------------------------------------------------------------*/
202 /*----------------------------------------------------------------------------*/
203 
204 void
206 
207 /*----------------------------------------------------------------------------*/
213 /*----------------------------------------------------------------------------*/
214 
215 int
216 cs_gwf_get_n_soils(void);
217 
218 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
229 cs_gwf_soil_by_id(int id);
230 
231 /*----------------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------------*/
240 
242 cs_gwf_soil_by_name(const char *name);
243 
244 /*----------------------------------------------------------------------------*/
252 /*----------------------------------------------------------------------------*/
253 
254 cs_real_t
256 
257 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 void
271  double k_s,
272  double theta_s,
273  double rho);
274 
275 /*----------------------------------------------------------------------------*/
285 /*----------------------------------------------------------------------------*/
286 
287 void
289  double *k_s,
290  double theta_s,
291  double rho);
292 
293 /*----------------------------------------------------------------------------*/
304 /*----------------------------------------------------------------------------*/
305 
306 void
308  double k_s,
309  double theta_s,
310  double theta_r,
311  double rho);
312 
313 /*----------------------------------------------------------------------------*/
324 /*----------------------------------------------------------------------------*/
325 
326 void
328  double *k_s,
329  double theta_s,
330  double theta_r,
331  double rho);
332 
333 /*----------------------------------------------------------------------------*/
343 /*----------------------------------------------------------------------------*/
344 
345 void
347  void *input,
348  cs_gwf_soil_update_t *update_func,
349  cs_gwf_soil_finalize_t *free_func);
350 
351 /*----------------------------------------------------------------------------*/
360 /*----------------------------------------------------------------------------*/
361 
362 void
364  cs_property_t *moisture_content,
365  cs_field_t *moisture_field);
366 
367 /*----------------------------------------------------------------------------*/
373 /*----------------------------------------------------------------------------*/
374 
375 void
377 
378 /*----------------------------------------------------------------------------*/
382 /*----------------------------------------------------------------------------*/
383 
384 const short int *
386 
387 /*----------------------------------------------------------------------------*/
402 /*----------------------------------------------------------------------------*/
403 
404 void
406  cs_field_t *permea_field,
407  cs_property_t *moisture_content,
408  cs_field_t *moisture_field,
409  cs_property_t *soil_capacity,
410  cs_field_t *capacity_field);
411 
412 /*----------------------------------------------------------------------------*/
416 /*----------------------------------------------------------------------------*/
417 
418 void
420 
421 /*----------------------------------------------------------------------------*/
422 
424 
425 #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:461
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:69
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
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:940
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)
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:917
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:963
cs_gwf_soil_hydraulic_model_t
Definition: cs_gwf_soil.h:101
#define END_C_DECLS
Definition: cs_defs.h:462
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:315
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:63
Definition: cs_gwf_soil.h:144
Definition: mesh.f90:26
Definition: cs_zone.h:55