My Project
programmer's documentation
Loading...
Searching...
No Matches
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
71typedef void
72(cs_gwf_soil_update_t) (const cs_real_t t_eval,
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
88typedef 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 */
100typedef 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 */
114typedef struct {
115
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 */
138
139/* Structures used to handle soils with a saturated modelling */
140/* ---------------------------------------------------------- */
141
142/* Parameters defining a saturated hydraulic model */
150
157
158/* Set of parameters describing a soil */
159typedef 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
176
177/*============================================================================
178 * User-defined function prototypes
179 *============================================================================*/
180
181/*----------------------------------------------------------------------------*/
188/*----------------------------------------------------------------------------*/
189
190void
192 cs_real_t *density);
193
194/*============================================================================
195 * Public function prototypes
196 *============================================================================*/
197
198/*----------------------------------------------------------------------------*/
208/*----------------------------------------------------------------------------*/
209
211cs_gwf_soil_add(const char *z_name,
213
214/*----------------------------------------------------------------------------*/
218/*----------------------------------------------------------------------------*/
219
220void
222
223/*----------------------------------------------------------------------------*/
229/*----------------------------------------------------------------------------*/
230
231int
233
234/*----------------------------------------------------------------------------*/
242/*----------------------------------------------------------------------------*/
243
245cs_gwf_soil_by_id(int id);
246
247/*----------------------------------------------------------------------------*/
255/*----------------------------------------------------------------------------*/
256
258cs_gwf_soil_by_name(const char *name);
259
260/*----------------------------------------------------------------------------*/
268/*----------------------------------------------------------------------------*/
269
272
273/*----------------------------------------------------------------------------*/
283/*----------------------------------------------------------------------------*/
284
285void
287 double k_s,
288 double theta_s,
289 double rho);
290
291/*----------------------------------------------------------------------------*/
301/*----------------------------------------------------------------------------*/
302
303void
305 double *k_s,
306 double theta_s,
307 double rho);
308
309/*----------------------------------------------------------------------------*/
320/*----------------------------------------------------------------------------*/
321
322void
324 double k_s,
325 double theta_s,
326 double theta_r,
327 double rho);
328
329/*----------------------------------------------------------------------------*/
340/*----------------------------------------------------------------------------*/
341
342void
344 double *k_s,
345 double theta_s,
346 double theta_r,
347 double rho);
348
349/*----------------------------------------------------------------------------*/
359/*----------------------------------------------------------------------------*/
360
361void
363 void *input,
364 cs_gwf_soil_update_t *update_func,
365 cs_gwf_soil_finalize_t *free_func);
366
367/*----------------------------------------------------------------------------*/
376/*----------------------------------------------------------------------------*/
377
378void
380 cs_property_t *moisture_content,
381 cs_field_t *moisture_field);
382
383/*----------------------------------------------------------------------------*/
389/*----------------------------------------------------------------------------*/
390
391void
393
394/*----------------------------------------------------------------------------*/
398/*----------------------------------------------------------------------------*/
399
400const short int *
402
403/*----------------------------------------------------------------------------*/
418/*----------------------------------------------------------------------------*/
419
420void
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
434void
436
437/*----------------------------------------------------------------------------*/
438
440
441#endif /* __CS_GWF_SOIL_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define END_C_DECLS
Definition cs_defs.h:468
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition cs_defs.h:321
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
@ rho
Definition cs_field_pointer.h:103
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_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition cs_gwf_soil.c:507
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
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition cs_gwf_soil.c:491
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
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
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition cs_gwf_soil.c:926
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
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition cs_gwf_soil.c:461
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
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
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_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
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
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
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_hydraulic_model_t
Definition cs_gwf_soil.h:100
@ CS_GWF_SOIL_N_HYDRAULIC_MODELS
Definition cs_gwf_soil.h:106
@ CS_GWF_SOIL_USER
Definition cs_gwf_soil.h:105
@ CS_GWF_SOIL_SATURATED
Definition cs_gwf_soil.h:104
@ CS_GWF_SOIL_GENUCHTEN
Definition cs_gwf_soil.h:102
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
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
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
static int input(void)
Definition mesh.f90:26
Definition cs_cdo_connect.h:74
Definition cs_cdo_quantities.h:94
Field descriptor.
Definition cs_field.h:124
Definition cs_gwf_soil.h:130
cs_real_t * moisture_values
Definition cs_gwf_soil.h:134
cs_real_t * capacity_values
Definition cs_gwf_soil.h:135
cs_real_t * permeability_values
Definition cs_gwf_soil.h:132
cs_real_t * head_values
Definition cs_gwf_soil.h:133
Definition cs_gwf_soil.h:151
cs_real_t * moisture_values
Definition cs_gwf_soil.h:154
cs_real_t * permeability_values
Definition cs_gwf_soil.h:153
Definition cs_gwf_soil.h:114
cs_real_33_t saturated_permeability
Definition cs_gwf_soil.h:119
double m
Definition cs_gwf_soil.h:123
double scale
Definition cs_gwf_soil.h:124
double bulk_density
Definition cs_gwf_soil.h:116
double saturated_moisture
Definition cs_gwf_soil.h:118
double n
Definition cs_gwf_soil.h:122
double residual_moisture
Definition cs_gwf_soil.h:117
double tortuosity
Definition cs_gwf_soil.h:125
Definition cs_gwf_soil.h:143
cs_real_33_t saturated_permeability
Definition cs_gwf_soil.h:147
double bulk_density
Definition cs_gwf_soil.h:145
double saturated_moisture
Definition cs_gwf_soil.h:146
Definition cs_gwf_soil.h:159
cs_gwf_soil_hydraulic_model_t model
Definition cs_gwf_soil.h:166
int id
Definition cs_gwf_soil.h:161
void * input
Definition cs_gwf_soil.h:169
cs_gwf_soil_update_t * update_properties
Definition cs_gwf_soil.h:172
cs_gwf_soil_finalize_t * free_input
Definition cs_gwf_soil.h:173
int zone_id
Definition cs_gwf_soil.h:162
Definition cs_mesh.h:63
Definition cs_property.h:104
Definition cs_zone.h:55