8.3
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-2024 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_gwf_param.h"
40#include "cs_mesh.h"
41#include "cs_property.h"
42#include "cs_volume_zone.h"
43
44/*----------------------------------------------------------------------------*/
45
47
48/*============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52/*============================================================================
53 * Public function pointer prototypes
54 *============================================================================*/
55
57typedef struct _gwf_soil_t cs_gwf_soil_t;
58
59/*----------------------------------------------------------------------------*/
72/*----------------------------------------------------------------------------*/
73
74typedef void
75(cs_gwf_soil_update_t) (const cs_real_t t_eval,
76 const cs_mesh_t *mesh,
77 const cs_cdo_connect_t *connect,
78 const cs_cdo_quantities_t *quant,
79 const cs_zone_t *zone,
80 cs_gwf_soil_t *soil);
81
82/*----------------------------------------------------------------------------*/
89/*----------------------------------------------------------------------------*/
90
91typedef void
92(cs_gwf_soil_free_param_t)(void **p_param);
93
94/*----------------------------------------------------------------------------*/
105/*----------------------------------------------------------------------------*/
106
107typedef void
109 const double pc,
110 double *sl,
111 double *dsldpc,
112 double *krl,
113 double *krg);
114
115/*============================================================================
116 * Type definitions
117 *============================================================================*/
118
137typedef enum {
138
143
145
147
163typedef enum {
164
168
170
172
182typedef struct {
183
203
204 double n;
205 double m;
206 double scale;
208
210
222
251 double n;
252 double m;
253 double inv_m;
254 double pr_r;
255 double inv_pr_r;
256 double sl_r;
257 double sl_s;
258 double sl_range;
259
319 double sle_thres;
320
321 /* Function pointer */
322
324
325 /* Derived quantities */
326
327 double pc_star;
329 double sle_alpha;
330 double sle_beta;
331
332 double krg_star;
334 double krg_alpha;
335
336 double krl_star;
338 double krl_alpha;
339
340};
341
343
355
428 int id;
430
433
434
436 double porosity;
438 double abs_permeability[3][3];
439
442
443 /* Pointers to functions */
444
447
448};
449
450/*============================================================================
451 * User-defined function prototypes
452 *============================================================================*/
453
454/*============================================================================
455 * Public function prototypes
456 *============================================================================*/
457
458/*----------------------------------------------------------------------------*/
464/*----------------------------------------------------------------------------*/
465
466int
468
469/*----------------------------------------------------------------------------*/
485/*----------------------------------------------------------------------------*/
486
487cs_gwf_soil_t *
488cs_gwf_soil_create(const cs_zone_t *zone,
489 cs_gwf_model_type_t hydraulic_model,
491 cs_property_type_t perm_type,
492 double k_abs[3][3],
493 double porosity,
494 double bulk_density,
495 void *hydraulic_context);
496
497/*----------------------------------------------------------------------------*/
505/*----------------------------------------------------------------------------*/
506
507cs_gwf_soil_t *
508cs_gwf_soil_by_id(int id);
509
510/*----------------------------------------------------------------------------*/
518/*----------------------------------------------------------------------------*/
519
520cs_gwf_soil_t *
521cs_gwf_soil_by_name(const char *name);
522
523/*----------------------------------------------------------------------------*/
531/*----------------------------------------------------------------------------*/
532
533const cs_zone_t *
534cs_gwf_soil_get_zone(int soil_id);
535
536/*----------------------------------------------------------------------------*/
540/*----------------------------------------------------------------------------*/
541
542void
544
545/*----------------------------------------------------------------------------*/
553/*----------------------------------------------------------------------------*/
554
555void
557 cs_flag_t post_flag,
558 cs_lnum_t n_cells);
559
560/*----------------------------------------------------------------------------*/
564/*----------------------------------------------------------------------------*/
565
566void
568
569/*----------------------------------------------------------------------------*/
578/*----------------------------------------------------------------------------*/
579
580void
582 const cs_mesh_t *mesh,
583 const cs_cdo_connect_t *connect,
584 const cs_cdo_quantities_t *cdoq);
585
586/*----------------------------------------------------------------------------*/
594/*----------------------------------------------------------------------------*/
595
596void
598 const cs_real_t *sliq);
599
600/*----------------------------------------------------------------------------*/
609/*----------------------------------------------------------------------------*/
610
611void
613 cs_property_t *soil_porosity);
614
615/*----------------------------------------------------------------------------*/
623/*----------------------------------------------------------------------------*/
624
625void
627
628/*----------------------------------------------------------------------------*/
638/*----------------------------------------------------------------------------*/
639
640void
642 const cs_cdo_connect_t *connect);
643
644/*----------------------------------------------------------------------------*/
651/*----------------------------------------------------------------------------*/
652
653const double *
655
656/*----------------------------------------------------------------------------*/
662/*----------------------------------------------------------------------------*/
663
664const short int *
666
667/*----------------------------------------------------------------------------*/
673/*----------------------------------------------------------------------------*/
674
675const int *
677
678/*----------------------------------------------------------------------------*/
686/*----------------------------------------------------------------------------*/
687
689cs_gwf_soil_get_porosity(int soil_id);
690
691/*----------------------------------------------------------------------------*/
699/*----------------------------------------------------------------------------*/
700
703
704/*----------------------------------------------------------------------------*/
711/*----------------------------------------------------------------------------*/
712
713int
715
716/*----------------------------------------------------------------------------*/
736/*----------------------------------------------------------------------------*/
737
738void
739cs_gwf_soil_set_vgm_spf_param(cs_gwf_soil_t *soil,
740 double theta_r,
741 double alpha,
742 double n,
743 double L);
744
745/*----------------------------------------------------------------------------*/
767/*----------------------------------------------------------------------------*/
768
769void
770cs_gwf_soil_set_vgm_tpf_param(cs_gwf_soil_t *soil,
771 double n,
772 double pr_r,
773 double sl_r,
774 double sl_s);
775
776/*----------------------------------------------------------------------------*/
787/*----------------------------------------------------------------------------*/
788
789void
791 cs_gwf_soil_join_type_t sle_jtype,
793 double sle_thres);
794
795/*----------------------------------------------------------------------------*/
804/*----------------------------------------------------------------------------*/
805
806void
807cs_gwf_soil_set_user_model_param(cs_gwf_soil_t *soil,
808 void *param,
809 cs_gwf_soil_update_t *update_func,
810 cs_gwf_soil_free_param_t *free_param_func);
811
812/*----------------------------------------------------------------------------*/
822/*----------------------------------------------------------------------------*/
823
824void
826
827/*----------------------------------------------------------------------------*/
828
830
831#endif /* __CS_GWF_SOIL_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
unsigned short int cs_flag_t
Definition: cs_defs.h:344
cs_gwf_model_type_t
Type of system of equation(s) to consider for the physical modelling.
Definition: cs_gwf_param.h:127
cs_gwf_soil_model_t
Predefined hydraulic model of soils used in the groundwater flow module.
Definition: cs_gwf_param.h:280
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.cpp:1716
void cs_gwf_soil_set_user_model_param(cs_gwf_soil_t *soil, void *param, cs_gwf_soil_update_t *update_func, cs_gwf_soil_free_param_t *free_param_func)
Set a soil defined by a user-defined model.
Definition: cs_gwf_soil.cpp:1992
const int * cs_gwf_soil_get_soil_state(void)
Get the array storing the soil state associated to each cell.
Definition: cs_gwf_soil.cpp:1679
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.cpp:1089
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.cpp:917
cs_gwf_soil_state_t
Kind of state in which a cell is.
Definition: cs_gwf_soil.h:163
@ CS_GWF_SOIL_STATE_UNSATURATED
Definition: cs_gwf_soil.h:166
@ CS_GWF_SOIL_STATE_SATURATED
Definition: cs_gwf_soil.h:165
@ CS_GWF_SOIL_STATE_DRY
Definition: cs_gwf_soil.h:167
@ CS_GWF_SOIL_N_STATES
Definition: cs_gwf_soil.h:169
void cs_gwf_soil_finalize_setup(cs_gwf_model_type_t gwf_model, cs_flag_t post_flag, cs_lnum_t n_cells)
Last initialization step for the soil structures/parameters.
Definition: cs_gwf_soil.cpp:1227
cs_gwf_soil_t * cs_gwf_soil_by_name(const char *name)
Retrieve a soil structure from its name.
Definition: cs_gwf_soil.cpp:1108
cs_gwf_soil_t * cs_gwf_soil_create(const cs_zone_t *zone, cs_gwf_model_type_t hydraulic_model, cs_gwf_soil_model_t model, cs_property_type_t perm_type, double k_abs[3][3], double porosity, double bulk_density, void *hydraulic_context)
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.cpp:941
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.cpp:1157
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 *cdoq)
Update the soil properties.
Definition: cs_gwf_soil.cpp:1419
void cs_gwf_soil_set_vgm_tpf_advanced_param(cs_gwf_soil_t *soil, cs_gwf_soil_join_type_t sle_jtype, cs_gwf_soil_join_type_t kr_jtype, double sle_thres)
Set advanced parameter settings related to a Van Genuchten-Mualen soil model.
Definition: cs_gwf_soil.cpp:1898
void cs_gwf_soil_update_soil_state(cs_lnum_t n_cells, const cs_real_t *sliq)
Update the soil state associated to each cell w.r.t. the given liquid saturation.
Definition: cs_gwf_soil.cpp:1462
void() cs_gwf_soil_tpf_eval_t(const cs_gwf_soil_vgm_tpf_param_t *sp, const double pc, double *sl, double *dsldpc, double *krl, double *krg)
Compute the values of the different properties related to a soil in the case of a Van Genuchten-Muale...
Definition: cs_gwf_soil.h:108
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, cs_gwf_soil_t *soil)
Generic function to update the properties related to a hydraulic model given the soil model....
Definition: cs_gwf_soil.h:75
void cs_gwf_soil_define_shared_properties(cs_property_t *abs_permeability, cs_property_t *soil_porosity)
Set the definition of the soil porosity and absolute permeability (which are properties always define...
Definition: cs_gwf_soil.cpp:1491
void cs_gwf_soil_set_vgm_spf_param(cs_gwf_soil_t *soil, double theta_r, double alpha, double n, double L)
Set a soil defined by a Van Genuchten-Mualem model in the case of single-phase flow in an (unsaturate...
Definition: cs_gwf_soil.cpp:1779
void cs_gwf_soil_build_dual_porous_volume(const cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect)
Build an array storing the dual volume associated to each vertex taking into account the porosity of ...
Definition: cs_gwf_soil.cpp:1582
int cs_gwf_soil_get_permeability_max_dim(void)
Retrieve the max dim (aniso=9; iso=1) for the absolute permeability associated to each soil.
Definition: cs_gwf_soil.cpp:1733
void cs_gwf_soil_define_sspf_property(cs_property_t *moisture_content)
Set the definition of the soil porosity and absolute porosity (which are properties always defined)....
Definition: cs_gwf_soil.cpp:1543
const short int * cs_gwf_soil_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.cpp:1665
const double * cs_gwf_soil_get_dual_porous_volume(void)
Get the array storing the dual volume weighted by the soil porosity Array of size n_vertices.
Definition: cs_gwf_soil.cpp:1651
cs_real_t cs_gwf_soil_get_porosity(int soil_id)
Get the porosity value for the given soil id.
Definition: cs_gwf_soil.cpp:1695
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.cpp:1260
const cs_zone_t * cs_gwf_soil_get_zone(int soil_id)
Retrieve a zone associated to a soil from its id.
Definition: cs_gwf_soil.cpp:1138
void cs_gwf_soil_set_vgm_tpf_param(cs_gwf_soil_t *soil, double n, double pr_r, double sl_r, double sl_s)
Set the parameters related to a Van Genuchten-Mualen model to defined the behavior of a soil in the c...
Definition: cs_gwf_soil.cpp:1837
cs_gwf_soil_join_type_t
Kind of joining function used with closure laws.
Definition: cs_gwf_soil.h:137
@ CS_GWF_SOIL_JOIN_C1_POLY_ORDER2
Definition: cs_gwf_soil.h:142
@ CS_GWF_SOIL_JOIN_C1_HYPERBOLIC
Definition: cs_gwf_soil.h:140
@ CS_GWF_SOIL_JOIN_C1_EXPONENTIAL
Definition: cs_gwf_soil.h:141
@ CS_GWF_SOIL_N_JOINS
Definition: cs_gwf_soil.h:144
@ CS_GWF_SOIL_JOIN_NOTHING
Definition: cs_gwf_soil.h:139
void() cs_gwf_soil_free_param_t(void **p_param)
Generic function to set free the parameter structure associated to a soil.
Definition: cs_gwf_soil.h:92
void cs_gwf_soil_set_joining_poly_order(int order)
Set the value of the polynomial order considered when regularizing the Van Genuchten-Mualen soil law ...
cs_flag_t cs_property_type_t
Definition: cs_property.h:123
Definition: mesh.f90:26
Main structure to handle a soil in the groundwater flow module: its definition, the way to update its...
Definition: cs_gwf_soil.h:354
double abs_permeability[3][3]
Definition: cs_gwf_soil.h:438
cs_gwf_soil_free_param_t * free_model_param
Definition: cs_gwf_soil.h:446
void * model_param
Definition: cs_gwf_soil.h:441
double porosity
Definition: cs_gwf_soil.h:436
cs_gwf_soil_model_t model
Definition: cs_gwf_soil.h:440
void * hydraulic_context
Definition: cs_gwf_soil.h:432
int abs_permeability_dim
Definition: cs_gwf_soil.h:437
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:445
double bulk_density
Definition: cs_gwf_soil.h:435
cs_gwf_model_type_t hydraulic_model
Definition: cs_gwf_soil.h:431
int id
Definition: cs_gwf_soil.h:428
int zone_id
Definition: cs_gwf_soil.h:429
Definition: cs_gwf_soil.h:221
cs_gwf_soil_join_type_t kr_jtype
Definition: cs_gwf_soil.h:318
cs_gwf_soil_join_type_t sle_jtype
Definition: cs_gwf_soil.h:317
double dkrldsl_star
Definition: cs_gwf_soil.h:337
double dsldpc_star
Definition: cs_gwf_soil.h:328
double sl_r
Definition: cs_gwf_soil.h:256
double pc_star
Definition: cs_gwf_soil.h:327
double inv_pr_r
Definition: cs_gwf_soil.h:255
double sl_range
Definition: cs_gwf_soil.h:258
double krl_star
Definition: cs_gwf_soil.h:336
double krl_alpha
Definition: cs_gwf_soil.h:338
double m
Definition: cs_gwf_soil.h:252
double sle_thres
Definition: cs_gwf_soil.h:319
double sl_s
Definition: cs_gwf_soil.h:257
double sle_beta
Definition: cs_gwf_soil.h:330
double krg_star
Definition: cs_gwf_soil.h:332
double inv_m
Definition: cs_gwf_soil.h:253
double n
Definition: cs_gwf_soil.h:251
cs_gwf_soil_tpf_eval_t * eval_properties
Definition: cs_gwf_soil.h:323
double sle_alpha
Definition: cs_gwf_soil.h:329
double krg_alpha
Definition: cs_gwf_soil.h:334
double dkrgdsl_star
Definition: cs_gwf_soil.h:333
double pr_r
Definition: cs_gwf_soil.h:254
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:139
Structure to handle the Van Genuchten-Mualem model of soil in the case of a single-phase flow in a po...
Definition: cs_gwf_soil.h:182
double tortuosity
Definition: cs_gwf_soil.h:207
double residual_moisture
Definition: cs_gwf_soil.h:202
double m
Definition: cs_gwf_soil.h:205
double scale
Definition: cs_gwf_soil.h:206
double n
Definition: cs_gwf_soil.h:204
Structure to handle the Van Genuchten-Mualem model of soil in the case of a two-phase flow in a porou...
Definition: cs_mesh.h:85
Structure associated to the definition of a property relying on the cs_xdef_t structure.
Definition: cs_zone.h:55