My Project
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-2019 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
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 typedef enum {
101 
102  CS_GWF_SOIL_GENUCHTEN, /* Van Genuchten-Mualem laws for dimensionless
103  moisture content and hydraulic conductivity */
104  CS_GWF_SOIL_SATURATED, /* media is satured */
105  CS_GWF_SOIL_USER, /* User-defined model */
107 
109 
110 /* Structures used to handle soils with a Van Genuchten-Mualen modelling */
111 /* --------------------------------------------------------------------- */
112 
113 /* Parameters defining a van Genuchten-Mualen hydraulic model */
114 typedef struct {
115 
116  double bulk_density;
120 
121  /* Advanced parameters */
122  double n; // 1.25 < n < 6
123  double m; // m = 1 - 1/n
124  double scale; // scale parameter [m^-1]
125  double tortuosity; // tortuosity param. for saturated hydraulic conductivity
126 
128 
129 /* Input structure used to update the physical properties */
130 typedef struct {
131 
136 
138 
139 /* Structures used to handle soils with a saturated modelling */
140 /* ---------------------------------------------------------- */
141 
142 /* Parameters defining a saturated hydraulic model */
143 typedef struct {
144 
145  double bulk_density;
148 
150 
151 typedef struct {
152 
155 
157 
158 /* Set of parameters describing a soil */
159 typedef struct {
160 
161  int id; /* soil id */
162  int zone_id; /* id related to a cs_zone_t structure (based on
163  cells) */
164 
165  /* Physical modelling adopted for this soil */
167 
168  /* Pointer to an input structure according to the hydraulic model */
169  void *input;
170 
171  /* Pointers to functions */
174 
175 } cs_gwf_soil_t;
176 
177 /*============================================================================
178  * User-defined function prototypes
179  *============================================================================*/
180 
181 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 void
192  cs_real_t *density);
193 
194 /*============================================================================
195  * Public function prototypes
196  *============================================================================*/
197 
198 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
211 cs_gwf_soil_add(const char *z_name,
213 
214 /*----------------------------------------------------------------------------*/
218 /*----------------------------------------------------------------------------*/
219 
220 void
222 
223 /*----------------------------------------------------------------------------*/
229 /*----------------------------------------------------------------------------*/
230 
231 int
232 cs_gwf_get_n_soils(void);
233 
234 /*----------------------------------------------------------------------------*/
242 /*----------------------------------------------------------------------------*/
243 
245 cs_gwf_soil_by_id(int id);
246 
247 /*----------------------------------------------------------------------------*/
255 /*----------------------------------------------------------------------------*/
256 
258 cs_gwf_soil_by_name(const char *name);
259 
260 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 cs_real_t
272 
273 /*----------------------------------------------------------------------------*/
283 /*----------------------------------------------------------------------------*/
284 
285 void
287  double k_s,
288  double theta_s,
289  double rho);
290 
291 /*----------------------------------------------------------------------------*/
301 /*----------------------------------------------------------------------------*/
302 
303 void
305  double *k_s,
306  double theta_s,
307  double rho);
308 
309 /*----------------------------------------------------------------------------*/
320 /*----------------------------------------------------------------------------*/
321 
322 void
324  double k_s,
325  double theta_s,
326  double theta_r,
327  double rho);
328 
329 /*----------------------------------------------------------------------------*/
340 /*----------------------------------------------------------------------------*/
341 
342 void
344  double *k_s,
345  double theta_s,
346  double theta_r,
347  double rho);
348 
349 /*----------------------------------------------------------------------------*/
359 /*----------------------------------------------------------------------------*/
360 
361 void
363  void *input,
364  cs_gwf_soil_update_t *update_func,
365  cs_gwf_soil_finalize_t *free_func);
366 
367 /*----------------------------------------------------------------------------*/
376 /*----------------------------------------------------------------------------*/
377 
378 void
380  cs_property_t *moisture_content,
381  cs_field_t *moisture_field);
382 
383 /*----------------------------------------------------------------------------*/
389 /*----------------------------------------------------------------------------*/
390 
391 void
393 
394 /*----------------------------------------------------------------------------*/
398 /*----------------------------------------------------------------------------*/
399 
400 const short int *
402 
403 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
420 void
422  cs_field_t *permea_field,
423  cs_property_t *moisture_content,
424  cs_field_t *moisture_field,
425  cs_property_t *soil_capacity,
426  cs_field_t *capacity_field);
427 
428 /*----------------------------------------------------------------------------*/
432 /*----------------------------------------------------------------------------*/
433 
434 void
436 
437 /*----------------------------------------------------------------------------*/
438 
440 
441 #endif /* __CS_GWF_SOIL_H__ */
cs_gwf_soil_saturated_param_t::saturated_permeability
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:147
input
static int input(void)
CS_GWF_SOIL_N_HYDRAULIC_MODELS
Definition: cs_gwf_soil.h:106
cs_gwf_soil_t::id
int id
Definition: cs_gwf_soil.h:161
CS_GWF_SOIL_GENUCHTEN
Definition: cs_gwf_soil.h:102
cs_gwf_soil_saturated_param_t::bulk_density
double bulk_density
Definition: cs_gwf_soil.h:145
cs_zone_t
Definition: cs_zone.h:55
cs_gwf_soil_genuchten_param_t::m
double m
Definition: cs_gwf_soil.h:123
cs_gwf_genuchten_update_input_t::moisture_values
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:134
rho
Definition: cs_field_pointer.h:103
cs_gwf_soil_genuchten_param_t::n
double n
Definition: cs_gwf_soil.h:122
cs_gwf_soil_t
Definition: cs_gwf_soil.h:159
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_gwf_soil_finalize_t
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
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
cs_gwf_set_user_soil
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:778
cs_gwf_soil_t::model
cs_gwf_soil_hydraulic_model_t model
Definition: cs_gwf_soil.h:166
cs_gwf_soil_t::zone_id
int zone_id
Definition: cs_gwf_soil.h:162
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_gwf_set_aniso_genuchten_soil
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:732
cs_gwf_soil_set_all_saturated
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:807
cs_gwf_soil_by_name
cs_gwf_soil_t * cs_gwf_soil_by_name(const char *name)
Retrieve a soil structure from its name.
Definition: cs_gwf_soil.c:526
cs_cdo_quantities.h
atimbr::density
double precision, dimension(:,:,:), allocatable density
Definition: atimbr.f90:124
mesh
Definition: mesh.f90:26
cs_gwf_soil_by_id
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:507
cs_mesh.h
cs_gwf_soil_t::input
void * input
Definition: cs_gwf_soil.h:169
cs_volume_zone.h
cs_gwf_soil_update_t
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
cs_user_gwf_get_soil_density
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
cs_gwf_get_cell2soil
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:926
CS_GWF_SOIL_USER
Definition: cs_gwf_soil.h:105
cs_gwf_soil_set_by_field
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:949
cs_property.h
cs_gwf_soil_genuchten_param_t::residual_moisture
double residual_moisture
Definition: cs_gwf_soil.h:117
cs_gwf_saturated_update_input_t::moisture_values
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:154
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:94
cs_gwf_soil_genuchten_param_t::bulk_density
double bulk_density
Definition: cs_gwf_soil.h:116
cs_property_t
Definition: cs_property.h:104
cs_gwf_soil_genuchten_param_t::tortuosity
double tortuosity
Definition: cs_gwf_soil.h:125
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_cdo_connect_t
Definition: cs_cdo_connect.h:74
cs_gwf_soil_genuchten_param_t::saturated_moisture
double saturated_moisture
Definition: cs_gwf_soil.h:118
cs_gwf_genuchten_update_input_t::head_values
cs_real_t * head_values
Definition: cs_gwf_soil.h:133
cs_gwf_set_aniso_saturated_soil
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:644
cs_cdo_connect.h
cs_gwf_soil_get_bulk_density
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:555
cs_gwf_soil_saturated_param_t
Definition: cs_gwf_soil.h:143
cs_gwf_set_iso_saturated_soil
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:604
cs_real_33_t
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:321
cs_gwf_saturated_update_input_t
Definition: cs_gwf_soil.h:151
cs_gwf_soil_hydraulic_model_t
cs_gwf_soil_hydraulic_model_t
Definition: cs_gwf_soil.h:100
cs_gwf_soil_t::free_input
cs_gwf_soil_finalize_t * free_input
Definition: cs_gwf_soil.h:173
cs_gwf_soil_genuchten_param_t::saturated_permeability
cs_real_33_t saturated_permeability
Definition: cs_gwf_soil.h:119
cs_gwf_build_cell2soil
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:877
cs_gwf_soil_add
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_gwf_soil_free_all
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:461
cs_gwf_soil_genuchten_param_t
Definition: cs_gwf_soil.h:114
cs_gwf_soil_log_setup
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:972
cs_gwf_set_iso_genuchten_soil
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:683
cs_gwf_get_n_soils
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:491
cs_gwf_genuchten_update_input_t::capacity_values
cs_real_t * capacity_values
Definition: cs_gwf_soil.h:135
cs_gwf_soil_genuchten_param_t::scale
double scale
Definition: cs_gwf_soil.h:124
cs_gwf_genuchten_update_input_t
Definition: cs_gwf_soil.h:130
cs_field_t
Field descriptor.
Definition: cs_field.h:124
CS_GWF_SOIL_SATURATED
Definition: cs_gwf_soil.h:104
cs_gwf_genuchten_update_input_t::permeability_values
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:132
cs_gwf_soil_saturated_param_t::saturated_moisture
double saturated_moisture
Definition: cs_gwf_soil.h:146
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h
cs_gwf_saturated_update_input_t::permeability_values
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:153
cs_gwf_soil_t::update_properties
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:172