7.1
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 /*----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------*/
67 
68 typedef void
70  const cs_mesh_t *mesh,
71  const cs_cdo_connect_t *connect,
72  const cs_cdo_quantities_t *quant,
73  const cs_zone_t *zone,
74  void *soil_context);
75 
76 /*----------------------------------------------------------------------------*/
82 /*----------------------------------------------------------------------------*/
83 
84 typedef void
85 (cs_gwf_soil_free_context_t)(void **p_context);
86 
87 /*============================================================================
88  * Type definitions
89  *============================================================================*/
90 
119 typedef enum {
120 
124 
126 
128 
138 typedef struct {
139 
171  double saturated_permeability[3][3];
172 
173  double n;
174  double m;
175  double scale;
176  double tortuosity;
177 
187 
193 
194 
206 typedef struct {
207 
209  double saturated_permeability[3][3];
210 
212 
213 
221 typedef struct {
222 
256  int id;
257  int zone_id;
258 
259  double bulk_density;
261 
262  cs_gwf_soil_hydraulic_model_t model;
263 
264  void *context;
265 
266  /* Pointers to functions */
267 
270 
271 } cs_gwf_soil_t;
272 
273 /*============================================================================
274  * User-defined function prototypes
275  *============================================================================*/
276 
277 /*============================================================================
278  * Public function prototypes
279  *============================================================================*/
280 
281 /*----------------------------------------------------------------------------*/
287 /*----------------------------------------------------------------------------*/
288 
289 int
290 cs_gwf_get_n_soils(void);
291 
292 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
303 cs_gwf_soil_by_id(int id);
304 
305 /*----------------------------------------------------------------------------*/
313 /*----------------------------------------------------------------------------*/
314 
316 cs_gwf_soil_by_name(const char *name);
317 
318 /*----------------------------------------------------------------------------*/
326 /*----------------------------------------------------------------------------*/
327 
328 cs_real_t
330 
331 /*----------------------------------------------------------------------------*/
337 /*----------------------------------------------------------------------------*/
338 
339 bool
341 
342 /*----------------------------------------------------------------------------*/
348 /*----------------------------------------------------------------------------*/
349 
350 void
351 cs_gwf_soil_check(void);
352 
353 /*----------------------------------------------------------------------------*/
366 /*----------------------------------------------------------------------------*/
367 
369 cs_gwf_soil_create(const cs_zone_t *zone,
370  cs_gwf_soil_hydraulic_model_t model,
371  cs_property_type_t perm_type,
372  double saturated_moisture,
373  double bulk_density);
374 
375 /*----------------------------------------------------------------------------*/
381 /*----------------------------------------------------------------------------*/
382 
383 void
385 
386 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 
392 const short int *
394 
395 /*----------------------------------------------------------------------------*/
399 /*----------------------------------------------------------------------------*/
400 
401 void
403 
404 /*----------------------------------------------------------------------------*/
408 /*----------------------------------------------------------------------------*/
409 
410 void
412 
413 /*----------------------------------------------------------------------------*/
421 /*----------------------------------------------------------------------------*/
422 
423 void
425  double k_s);
426 
427 /*----------------------------------------------------------------------------*/
435 /*----------------------------------------------------------------------------*/
436 
437 void
439  double k_s[3][3]);
440 
441 /*----------------------------------------------------------------------------*/
462 /*----------------------------------------------------------------------------*/
463 
464 void
466  double k_s,
467  double theta_r,
468  double alpha,
469  double n,
470  double L);
471 
472 /*----------------------------------------------------------------------------*/
493 /*----------------------------------------------------------------------------*/
494 
495 void
497  double k_s[3][3],
498  double theta_r,
499  double alpha,
500  double n,
501  double L);
502 
503 /*----------------------------------------------------------------------------*/
512 /*----------------------------------------------------------------------------*/
513 
514 void
516  void *context,
517  cs_gwf_soil_update_t *update_func,
518  cs_gwf_soil_free_context_t *free_context_func);
519 
520 /*----------------------------------------------------------------------------*/
528 /*----------------------------------------------------------------------------*/
529 
530 void
532  cs_property_t *moisture_content);
533 
534 /*----------------------------------------------------------------------------*/
544 /*----------------------------------------------------------------------------*/
545 
546 void
548  cs_real_t permeability[],
549  cs_real_t moisture_content[],
550  cs_real_t capacity[]);
551 
552 /*----------------------------------------------------------------------------*/
561 /*----------------------------------------------------------------------------*/
562 
563 void
564 cs_gwf_soil_update(cs_real_t time_eval,
565  const cs_mesh_t *mesh,
566  const cs_cdo_connect_t *connect,
567  const cs_cdo_quantities_t *quant);
568 
569 /*----------------------------------------------------------------------------*/
570 
572 
573 #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:482
Definition: cs_field_pointer.h:196
int zone_id
Definition: cs_gwf_soil.h:257
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:222
Definition: cs_gwf_soil.h:125
void cs_gwf_soil_set_aniso_genuchten(cs_gwf_soil_t *soil, double k_s[3][3], double theta_r, double alpha, double n, double L)
Set a soil defined by a Van Genuchten-Mualen hydraulic model and attached to an anisotropic saturated...
Definition: cs_gwf_soil.c:833
cs_real_t * moisture_values
Definition: cs_gwf_soil.h:185
cs_real_t * capacity_values
Definition: cs_gwf_soil.h:186
double precision, dimension(ncharm), save alpha
Definition: cpincl.f90:99
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:268
void() cs_gwf_soil_free_context_t(void **p_context)
Generic function to set free the soil context of a soil structure.
Definition: cs_gwf_soil.h:85
cs_gwf_soil_t * cs_gwf_soil_create(const cs_zone_t *zone, cs_gwf_soil_hydraulic_model_t model, cs_property_type_t perm_type, double saturated_moisture, double bulk_density)
Create a new cs_gwf_soil_t structure and add it to the array of soils. An initialization by default o...
Definition: cs_gwf_soil.c:366
double bulk_density
Definition: cs_gwf_soil.h:259
void cs_gwf_soil_update(cs_real_t time_eval, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
Update the soil properties.
Definition: cs_gwf_soil.c:1022
cs_gwf_soil_free_context_t * free_context
Definition: cs_gwf_soil.h:269
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void cs_gwf_soil_set_iso_saturated(cs_gwf_soil_t *soil, double k_s)
Set a soil defined by a saturated hydraulic model and attached to an isotropic permeability.
Definition: cs_gwf_soil.c:698
double scale
Definition: cs_gwf_soil.h:175
Definition: cs_gwf_soil.h:123
Definition: cs_cdo_connect.h:79
bool cs_gwf_soil_all_saturated(void)
Check if all soils have been set as CS_GWF_SOIL_SATURATED.
Definition: cs_gwf_soil.c:305
double saturated_moisture
Definition: cs_gwf_soil.h:170
Structure to handle the Van Genuchten-Mualen model of soil.
Definition: cs_gwf_soil.h:138
Main structure to handle a soil in the groundawater flow module. Store a set of parameters and pointe...
Definition: cs_gwf_soil.h:221
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
Definition: cs_cdo_quantities.h:129
void cs_gwf_soil_uspf_set_arrays(cs_real_t head[], cs_real_t permeability[], cs_real_t moisture_content[], cs_real_t capacity[])
Set the different arrays used in soil context for a GWF model set to unsaturated single-phase flows i...
Definition: cs_gwf_soil.c:979
cs_gwf_soil_hydraulic_model_t model
Definition: cs_gwf_soil.h:262
void * context
Definition: cs_gwf_soil.h:264
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:257
cs_real_t * head_values
Definition: cs_gwf_soil.h:184
Definition: cs_gwf_soil.h:121
void cs_gwf_soil_saturated_set_properties(cs_property_t *permeability, cs_property_t *moisture_content)
Set the properties of the groundwater flow module in the case where all soils are considered as satur...
Definition: cs_gwf_soil.c:909
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:238
double saturated_moisture
Definition: cs_gwf_soil.h:208
cs_real_t * permeability_values
Definition: cs_gwf_soil.h:183
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:528
double residual_moisture
Definition: cs_gwf_soil.h:169
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_zone_t *zone, void *soil_context)
Generic function to update the physical properties related to a hydraulic model. The soil context dep...
Definition: cs_gwf_soil.h:69
int id
Definition: cs_gwf_soil.h:256
void cs_gwf_soil_check(void)
Check that at least one soil has been defined and the model of soil exists. Raise an error if a probl...
Definition: cs_gwf_soil.c:327
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:540
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:599
double saturated_moisture
Definition: cs_gwf_soil.h:260
cs_gwf_soil_hydraulic_model_t
Predefined hydraulic model of soils used in the groundwater flow module.
Definition: cs_gwf_soil.h:119
double m
Definition: cs_gwf_soil.h:174
#define END_C_DECLS
Definition: cs_defs.h:511
void cs_gwf_soil_set_user(cs_gwf_soil_t *soil, void *context, cs_gwf_soil_update_t *update_func, cs_gwf_soil_free_context_t *free_context_func)
Set a soil defined by a user-defined hydraulic model.
Definition: cs_gwf_soil.c:881
Definition: cs_gwf_soil.h:122
cs_flag_t cs_property_type_t
Definition: cs_property.h:102
Parameters defining a saturated soil in a given zone.
Definition: cs_gwf_soil.h:206
double tortuosity
Definition: cs_gwf_soil.h:176
cs_real_t cs_gwf_soil_get_saturated_moisture(int soil_id)
Get the saturated moisture for the given soil id.
Definition: cs_gwf_soil.c:286
double n
Definition: cs_gwf_soil.h:173
void cs_gwf_soil_set_aniso_saturated(cs_gwf_soil_t *soil, double k_s[3][3])
Set a soil defined by a saturated hydraulic model and attached to an anisotropic permeability.
Definition: cs_gwf_soil.c:729
Structure associated to the definition of a property relying on the cs_xdef_t structure.
void cs_gwf_soil_set_iso_genuchten(cs_gwf_soil_t *soil, double k_s, double theta_r, double alpha, double n, double L)
Set a soil defined by a Van Genuchten-Mualen hydraulic model and attached to an isotropic saturated p...
Definition: cs_gwf_soil.c:772
Definition: mesh.f90:26
Definition: cs_zone.h:55