7.0
general 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-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_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_volume_zone.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Public function pointer prototypes
52  *============================================================================*/
53 
54 /*----------------------------------------------------------------------------*/
69 /*----------------------------------------------------------------------------*/
70 
71 typedef void
73  const cs_mesh_t *mesh,
74  const cs_cdo_connect_t *connect,
75  const cs_cdo_quantities_t *quant,
76  const cs_real_t *head_values,
77  const cs_zone_t *zone,
78  void *input);
79 
80 /*----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------*/
87 
88 typedef void
89 (cs_gwf_soil_finalize_t)(void *input);
90 
91 
92 /*============================================================================
93  * Type definitions
94  *============================================================================*/
95 
96 /* Predefined hydraulic model of soil
97  *=================================== */
98 
99 /* Type of predefined modelling for the groundwater flows */
100 
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 */
107 
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 
117 typedef struct {
118 
119  double bulk_density;
123 
124  /* Advanced parameters */
125 
126  double n; /* 1.25 < n < 6 */
127  double m; /* m = 1 - 1/n */
128  double scale; /* scale parameter [m^-1] */
129  double tortuosity; /* tortuosity param. for saturated hydraulic
130  conductivity */
131 
133 
134 /* Input structure used to update the physical properties */
135 
136 typedef struct {
137 
142 
144 
145 /* Structures used to handle soils with a saturated modelling */
146 /* ---------------------------------------------------------- */
147 
148 /* Parameters defining a saturated hydraulic model */
149 typedef struct {
150 
151  double bulk_density;
154 
156 
157 typedef struct {
158 
161 
163 
164 /* Set of parameters describing a soil */
165 /* ----------------------------------- */
166 
167 typedef struct {
168 
169  int id; /* soil id */
170  int zone_id; /* id related to a cs_zone_t structure (based on
171  cells) */
172 
173  /* Physical modelling adopted for this soil */
174  cs_gwf_soil_hydraulic_model_t model;
175 
176  /* Pointer to an input structure according to the hydraulic model */
177  void *input;
178 
179  /* Pointers to functions */
182 
183 } cs_gwf_soil_t;
184 
185 /*============================================================================
186  * User-defined function prototypes
187  *============================================================================*/
188 
189 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 void
200  cs_real_t *density);
201 
202 /*============================================================================
203  * Public function prototypes
204  *============================================================================*/
205 
206 /*----------------------------------------------------------------------------*/
216 /*----------------------------------------------------------------------------*/
217 
219 cs_gwf_soil_add(const char *z_name,
220  cs_gwf_soil_hydraulic_model_t model);
221 
222 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
228 void
230 
231 /*----------------------------------------------------------------------------*/
237 /*----------------------------------------------------------------------------*/
238 
239 int
240 cs_gwf_get_n_soils(void);
241 
242 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
251 
253 cs_gwf_soil_by_id(int id);
254 
255 /*----------------------------------------------------------------------------*/
263 /*----------------------------------------------------------------------------*/
264 
266 cs_gwf_soil_by_name(const char *name);
267 
268 /*----------------------------------------------------------------------------*/
276 /*----------------------------------------------------------------------------*/
277 
278 cs_real_t
280 
281 /*----------------------------------------------------------------------------*/
291 /*----------------------------------------------------------------------------*/
292 
293 void
295  double k_s,
296  double theta_s,
297  double rho);
298 
299 /*----------------------------------------------------------------------------*/
309 /*----------------------------------------------------------------------------*/
310 
311 void
313  double *k_s,
314  double theta_s,
315  double rho);
316 
317 /*----------------------------------------------------------------------------*/
328 /*----------------------------------------------------------------------------*/
329 
330 void
332  double k_s,
333  double theta_s,
334  double theta_r,
335  double rho);
336 
337 /*----------------------------------------------------------------------------*/
348 /*----------------------------------------------------------------------------*/
349 
350 void
352  double *k_s,
353  double theta_s,
354  double theta_r,
355  double rho);
356 
357 /*----------------------------------------------------------------------------*/
367 /*----------------------------------------------------------------------------*/
368 
369 void
371  void *input,
372  cs_gwf_soil_update_t *update_func,
373  cs_gwf_soil_finalize_t *free_func);
374 
375 /*----------------------------------------------------------------------------*/
384 /*----------------------------------------------------------------------------*/
385 
386 void
388  cs_property_t *moisture_content,
389  cs_field_t *moisture_field);
390 
391 /*----------------------------------------------------------------------------*/
397 /*----------------------------------------------------------------------------*/
398 
399 void
401 
402 /*----------------------------------------------------------------------------*/
406 /*----------------------------------------------------------------------------*/
407 
408 const short int *
410 
411 /*----------------------------------------------------------------------------*/
426 /*----------------------------------------------------------------------------*/
427 
428 void
430  cs_field_t *permea_field,
431  cs_property_t *moisture_content,
432  cs_field_t *moisture_field,
433  cs_property_t *soil_capacity,
434  cs_field_t *capacity_field);
435 
436 /*----------------------------------------------------------------------------*/
440 /*----------------------------------------------------------------------------*/
441 
442 void
444 
445 /*----------------------------------------------------------------------------*/
446 
448 
449 #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:865
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:678
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:180
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:486
Definition: cs_gwf_soil.h:108
double saturated_moisture
Definition: cs_gwf_soil.h:152
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:153
double m
Definition: cs_gwf_soil.h:127
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:89
Field descriptor.
Definition: cs_field.h:125
double bulk_density
Definition: cs_gwf_soil.h:119
Definition: cs_gwf_soil.h:117
int id
Definition: cs_gwf_soil.h:169
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:138
Definition: cs_gwf_soil.h:136
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:727
double residual_moisture
Definition: cs_gwf_soil.h:120
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
cs_gwf_soil_hydraulic_model_t model
Definition: cs_gwf_soil.h:174
double bulk_density
Definition: cs_gwf_soil.h:151
int zone_id
Definition: cs_gwf_soil.h:170
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:802
Definition: cs_cdo_connect.h:76
void * input
Definition: cs_gwf_soil.h:177
Definition: cs_gwf_soil.h:167
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
Definition: cs_cdo_quantities.h:124
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:99
void() cs_gwf_soil_update_t(const cs_real_t t_eval, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, 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:72
Definition: cs_mesh.h:84
cs_gwf_soil_t * cs_gwf_soil_by_name(const char *name)
Retrieve a soil structure from its name.
Definition: cs_gwf_soil.c:521
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:937
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:773
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:159
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:160
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:502
double saturated_moisture
Definition: cs_gwf_soil.h:121
Definition: cs_gwf_soil.h:157
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:122
double scale
Definition: cs_gwf_soil.h:128
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:550
double precision, dimension(:,:,:), allocatable density
Definition: atimbr.f90:124
cs_real_t * capacity_values
Definition: cs_gwf_soil.h:141
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:914
double n
Definition: cs_gwf_soil.h:126
cs_real_t * head_values
Definition: cs_gwf_soil.h:139
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:599
double tortuosity
Definition: cs_gwf_soil.h:129
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:456
cs_gwf_soil_finalize_t * free_input
Definition: cs_gwf_soil.h:181
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:960
cs_gwf_soil_hydraulic_model_t
Definition: cs_gwf_soil.h:101
#define END_C_DECLS
Definition: cs_defs.h:496
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:140
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:381
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:327
Definition: cs_field_pointer.h:103
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:639
Definition: cs_gwf_soil.h:105
Structure associated to the definition of a property relying on the cs_xdef_t structure.
Definition: cs_gwf_soil.h:149
Definition: mesh.f90:26
Definition: cs_zone.h:55