7.2
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-2022 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"
39 #include "cs_gwf_priv.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 
56 typedef struct _gwf_soil_t cs_gwf_soil_t;
57 
58 /*----------------------------------------------------------------------------*/
71 /*----------------------------------------------------------------------------*/
72 
73 typedef void
75  const cs_mesh_t *mesh,
76  const cs_cdo_connect_t *connect,
77  const cs_cdo_quantities_t *quant,
78  const cs_zone_t *zone,
79  cs_gwf_soil_t *soil);
80 
81 /*----------------------------------------------------------------------------*/
88 /*----------------------------------------------------------------------------*/
89 
90 typedef void
91 (cs_gwf_soil_free_param_t)(void **p_param);
92 
93 /*============================================================================
94  * Type definitions
95  *============================================================================*/
96 
106 typedef struct {
107 
127 
128  double n;
129  double m;
130  double scale;
131  double tortuosity;
132 
134 
135 
145 struct _gwf_soil_t {
146 
219  int id;
220  int zone_id;
221 
224 
225 
226  double bulk_density;
227  double porosity;
229  double abs_permeability[3][3];
230 
232  void *model_param;
233 
234  /* Pointers to functions */
235 
238 
239 };
240 
241 /*============================================================================
242  * User-defined function prototypes
243  *============================================================================*/
244 
245 /*============================================================================
246  * Public function prototypes
247  *============================================================================*/
248 
249 /*----------------------------------------------------------------------------*/
255 /*----------------------------------------------------------------------------*/
256 
257 int
258 cs_gwf_get_n_soils(void);
259 
260 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 cs_gwf_soil_t *
271 cs_gwf_soil_by_id(int id);
272 
273 /*----------------------------------------------------------------------------*/
281 /*----------------------------------------------------------------------------*/
282 
283 cs_gwf_soil_t *
284 cs_gwf_soil_by_name(const char *name);
285 
286 /*----------------------------------------------------------------------------*/
294 /*----------------------------------------------------------------------------*/
295 
296 cs_real_t
298 
299 /*----------------------------------------------------------------------------*/
306 /*----------------------------------------------------------------------------*/
307 
308 int
310 
311 /*----------------------------------------------------------------------------*/
317 /*----------------------------------------------------------------------------*/
318 
319 bool
321 
322 /*----------------------------------------------------------------------------*/
328 /*----------------------------------------------------------------------------*/
329 
330 void
331 cs_gwf_soil_check(void);
332 
333 /*----------------------------------------------------------------------------*/
349 /*----------------------------------------------------------------------------*/
350 
351 cs_gwf_soil_t *
352 cs_gwf_soil_create(const cs_zone_t *zone,
355  cs_property_type_t perm_type,
356  double k_abs[3][3],
357  double porosity,
358  double bulk_density,
359  void *hydraulic_context);
360 
361 /*----------------------------------------------------------------------------*/
367 /*----------------------------------------------------------------------------*/
368 
369 void
371 
372 /*----------------------------------------------------------------------------*/
376 /*----------------------------------------------------------------------------*/
377 
378 const short int *
380 
381 /*----------------------------------------------------------------------------*/
385 /*----------------------------------------------------------------------------*/
386 
387 void
389 
390 /*----------------------------------------------------------------------------*/
394 /*----------------------------------------------------------------------------*/
395 
396 void
398 
399 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
420 void
421 cs_gwf_soil_set_genuchten_param(cs_gwf_soil_t *soil,
422  double theta_r,
423  double alpha,
424  double n,
425  double L);
426 
427 /*----------------------------------------------------------------------------*/
436 /*----------------------------------------------------------------------------*/
437 
438 void
439 cs_gwf_soil_set_user(cs_gwf_soil_t *soil,
440  void *context,
441  cs_gwf_soil_update_t *update_func,
442  cs_gwf_soil_free_param_t *free_param_func);
443 
444 /*----------------------------------------------------------------------------*/
453 /*----------------------------------------------------------------------------*/
454 
455 void
457  cs_property_t *soil_porosity);
458 
459 /*----------------------------------------------------------------------------*/
467 /*----------------------------------------------------------------------------*/
468 
469 void
471 
472 /*----------------------------------------------------------------------------*/
480 /*----------------------------------------------------------------------------*/
481 
482 void
484 
485 /*----------------------------------------------------------------------------*/
494 /*----------------------------------------------------------------------------*/
495 
496 void
497 cs_gwf_soil_update(cs_real_t time_eval,
498  const cs_mesh_t *mesh,
499  const cs_cdo_connect_t *connect,
500  const cs_cdo_quantities_t *quant);
501 
502 /*----------------------------------------------------------------------------*/
510 /*----------------------------------------------------------------------------*/
511 
512 void
514 
515 /*----------------------------------------------------------------------------*/
523 /*----------------------------------------------------------------------------*/
524 
525 void
527 
528 /*----------------------------------------------------------------------------*/
537 /*----------------------------------------------------------------------------*/
538 
539 void
541  cs_gwf_two_phase_t *mc);
542 
543 /*----------------------------------------------------------------------------*/
554 /*----------------------------------------------------------------------------*/
555 
556 void
558  const cs_cdo_connect_t *connect,
559  cs_gwf_two_phase_t *mc);
560 
561 /*----------------------------------------------------------------------------*/
562 
564 
565 #endif /* __CS_GWF_SOIL_H__ */
cs_gwf_soil_model_t
Predefined hydraulic model of soils used in the groundwater flow module.
Definition: cs_gwf_param.h:240
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:541
time step descriptor
Definition: cs_time_step.h:64
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:234
double m
Definition: cs_gwf_soil.h:129
void cs_gwf_soil_set_shared_properties(cs_property_t *abs_permeability, cs_property_t *soil_porosity)
Set the definition of the soil porosity and absolute porosity (which are properties always defined)...
Definition: cs_gwf_soil.c:817
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:74
bool cs_gwf_soil_all_are_saturated(void)
Check if all soils have been set as CS_GWF_SOIL_SATURATED.
Definition: cs_gwf_soil.c:350
Main structure to handle a soil in the groundwater flow module.
Definition: cs_gwf_soil.h:145
void cs_gwf_soil_saturated_set_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.c:869
cs_gwf_soil_free_param_t * free_model_param
Definition: cs_gwf_soil.h:237
double precision, dimension(ncharm), save alpha
Definition: cpincl.f90:99
int zone_id
Definition: cs_gwf_soil.h:220
void cs_gwf_soil_iso_update_itpf_terms_incr(const cs_time_step_t *ts, cs_gwf_two_phase_t *mc)
Update arrays associated to the definition of terms involved in the immiscible two-phase flow model...
Definition: cs_gwf_soil.c:1207
Structure to handle the modelling of miscible or immiscible two-phase flows in a porous media...
Definition: cs_gwf_priv.h:295
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:944
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
int id
Definition: cs_gwf_soil.h:219
void * model_param
Definition: cs_gwf_soil.h:232
int abs_permeability_dim
Definition: cs_gwf_soil.h:228
Definition: cs_cdo_connect.h:61
double abs_permeability[3][3]
Definition: cs_gwf_soil.h:229
cs_gwf_model_type_t
Type of system of equation(s) to consider for the physical modelling.
Definition: cs_gwf_param.h:102
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
Definition: cs_cdo_quantities.h:132
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:91
void cs_gwf_soil_tpf_set_property(cs_gwf_two_phase_t *mc)
Set the definition of some property(ies) in specific situations for the two-phase flow models This re...
Definition: cs_gwf_soil.c:906
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:269
double scale
Definition: cs_gwf_soil.h:130
double n
Definition: cs_gwf_soil.h:128
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:250
cs_gwf_soil_model_t model
Definition: cs_gwf_soil.h:231
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.c:414
Structure to handle the Van Genuchten-Mualen model of soil.
Definition: cs_gwf_soil.h:106
double bulk_density
Definition: cs_gwf_soil.h:226
const short int * cs_gwf_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:587
void cs_gwf_soil_set_user(cs_gwf_soil_t *soil, void *context, cs_gwf_soil_update_t *update_func, cs_gwf_soil_free_param_t *free_param_func)
Set a soil defined by a user-defined hydraulic model.
Definition: cs_gwf_soil.c:787
void cs_gwf_soil_set_genuchten_param(cs_gwf_soil_t *soil, double theta_r, double alpha, double n, double L)
Set a soil defined by a Van Genuchten-Mualen model.
Definition: cs_gwf_soil.c:744
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:372
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
double tortuosity
Definition: cs_gwf_soil.h:131
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:599
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:653
cs_gwf_model_type_t hydraulic_model
Definition: cs_gwf_soil.h:222
#define END_C_DECLS
Definition: cs_defs.h:511
double residual_moisture
Definition: cs_gwf_soil.h:126
void cs_gwf_soil_iso_update_mtpf_terms(cs_gwf_two_phase_t *mc)
Update arrays associated to the definition of terms involved in the miscible two-phase flow model...
Definition: cs_gwf_soil.c:991
cs_flag_t cs_property_type_t
Definition: cs_property.h:117
void cs_gwf_soil_iso_update_itpf_terms_incr_submesh(const cs_time_step_t *ts, const cs_cdo_connect_t *connect, cs_gwf_two_phase_t *mc)
Update arrays associated to the definition of terms involved in the immiscible two-phase flow model...
Definition: cs_gwf_soil.c:1336
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:298
double porosity
Definition: cs_gwf_soil.h:227
void * hydraulic_context
Definition: cs_gwf_soil.h:223
void cs_gwf_soil_iso_update_itpf_terms(cs_gwf_two_phase_t *mc)
Update arrays associated to the definition of terms involved in the immiscible two-phase flow model...
Definition: cs_gwf_soil.c:1074
Structure associated to the definition of a property relying on the cs_xdef_t structure.
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:236
Definition: mesh.f90:26
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.c:318
Definition: cs_zone.h:55