8.0
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-2023 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
74 (cs_gwf_soil_update_t) (const cs_real_t t_eval,
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,
353  cs_gwf_model_type_t hydraulic_model,
354  cs_gwf_soil_model_t model,
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 /*----------------------------------------------------------------------------*/
368 /*----------------------------------------------------------------------------*/
369 
370 void
372 
373 /*----------------------------------------------------------------------------*/
379 /*----------------------------------------------------------------------------*/
380 
381 const short int *
383 
384 /*----------------------------------------------------------------------------*/
396 /*----------------------------------------------------------------------------*/
397 
398 void
400  const cs_cdo_connect_t *connect);
401 
402 /*----------------------------------------------------------------------------*/
409 /*----------------------------------------------------------------------------*/
410 
411 const double *
413 
414 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
420 void
422 
423 /*----------------------------------------------------------------------------*/
427 /*----------------------------------------------------------------------------*/
428 
429 void
431 
432 /*----------------------------------------------------------------------------*/
451 /*----------------------------------------------------------------------------*/
452 
453 void
454 cs_gwf_soil_set_genuchten_param(cs_gwf_soil_t *soil,
455  double theta_r,
456  double alpha,
457  double n,
458  double L);
459 
460 /*----------------------------------------------------------------------------*/
469 /*----------------------------------------------------------------------------*/
470 
471 void
472 cs_gwf_soil_set_user(cs_gwf_soil_t *soil,
473  void *param,
474  cs_gwf_soil_update_t *update_func,
475  cs_gwf_soil_free_param_t *free_param_func);
476 
477 /*----------------------------------------------------------------------------*/
486 /*----------------------------------------------------------------------------*/
487 
488 void
490  cs_property_t *soil_porosity);
491 
492 /*----------------------------------------------------------------------------*/
500 /*----------------------------------------------------------------------------*/
501 
502 void
504 
505 /*----------------------------------------------------------------------------*/
513 /*----------------------------------------------------------------------------*/
514 
515 void
517 
518 /*----------------------------------------------------------------------------*/
527 /*----------------------------------------------------------------------------*/
528 
529 void
530 cs_gwf_soil_update(cs_real_t time_eval,
531  const cs_mesh_t *mesh,
532  const cs_cdo_connect_t *connect,
533  const cs_cdo_quantities_t *quant);
534 
535 /*----------------------------------------------------------------------------*/
543 /*----------------------------------------------------------------------------*/
544 
545 void
547 
548 /*----------------------------------------------------------------------------*/
556 /*----------------------------------------------------------------------------*/
557 
558 void
560 
561 /*----------------------------------------------------------------------------*/
570 /*----------------------------------------------------------------------------*/
571 
572 void
574  cs_gwf_two_phase_t *mc);
575 
576 /*----------------------------------------------------------------------------*/
587 /*----------------------------------------------------------------------------*/
588 
589 void
591  const cs_cdo_connect_t *connect,
592  cs_gwf_two_phase_t *mc);
593 
594 /*----------------------------------------------------------------------------*/
595 
597 
598 #endif /* __CS_GWF_SOIL_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
cs_gwf_model_type_t
Type of system of equation(s) to consider for the physical modelling.
Definition: cs_gwf_param.h:118
cs_gwf_soil_model_t
Predefined hydraulic model of soils used in the groundwater flow module.
Definition: cs_gwf_param.h:256
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:306
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:932
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:1188
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:1105
int cs_gwf_get_n_soils(void)
Get the number of allocated soils.
Definition: cs_gwf_soil.c:241
void cs_gwf_soil_build_cell2soil(cs_lnum_t n_cells)
Build an array storing the associated soil for each cell The lifecycle of this array is managed by th...
Definition: cs_gwf_soil.c:565
void cs_gwf_soil_free_all(void)
Free all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:713
const short int * cs_gwf_soil_get_cell2soil(void)
Get the array storing the associated soil for each cell.
Definition: cs_gwf_soil.c:612
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:1321
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:1021
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:859
cs_gwf_soil_t * cs_gwf_soil_by_id(int id)
Retrieve a soil structure from its id.
Definition: cs_gwf_soil.c:257
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:380
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:1059
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.c:701
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
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:984
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:437
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.c:632
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:326
cs_gwf_soil_t * cs_gwf_soil_by_name(const char *name)
Retrieve a soil structure from its name.
Definition: cs_gwf_soil.c:276
void cs_gwf_soil_set_user(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.c:902
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:358
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:1450
void cs_gwf_soil_log_setup(void)
Summary of the settings related to all cs_gwf_soil_t structures.
Definition: cs_gwf_soil.c:768
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
cs_flag_t cs_property_type_t
Definition: cs_property.h:117
double precision, dimension(ncharm), save alpha
Definition: cpincl.f90:99
Definition: mesh.f90:26
Main structure to handle a soil in the groundwater flow module.
Definition: cs_gwf_soil.h:145
double abs_permeability[3][3]
Definition: cs_gwf_soil.h:229
cs_gwf_soil_free_param_t * free_model_param
Definition: cs_gwf_soil.h:237
void * model_param
Definition: cs_gwf_soil.h:232
double porosity
Definition: cs_gwf_soil.h:227
cs_gwf_soil_model_t model
Definition: cs_gwf_soil.h:231
void * hydraulic_context
Definition: cs_gwf_soil.h:223
int abs_permeability_dim
Definition: cs_gwf_soil.h:228
cs_gwf_soil_update_t * update_properties
Definition: cs_gwf_soil.h:236
double bulk_density
Definition: cs_gwf_soil.h:226
cs_gwf_model_type_t hydraulic_model
Definition: cs_gwf_soil.h:222
int id
Definition: cs_gwf_soil.h:219
int zone_id
Definition: cs_gwf_soil.h:220
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:137
Structure to handle the Van Genuchten-Mualen model of soil.
Definition: cs_gwf_soil.h:106
double tortuosity
Definition: cs_gwf_soil.h:131
double residual_moisture
Definition: cs_gwf_soil.h:126
double m
Definition: cs_gwf_soil.h:129
double scale
Definition: cs_gwf_soil.h:130
double n
Definition: cs_gwf_soil.h:128
Structure to handle the modelling of miscible or immiscible two-phase flows in a porous media.
Definition: cs_gwf_priv.h:332
Definition: cs_mesh.h:85
Structure associated to the definition of a property relying on the cs_xdef_t structure.
time step descriptor
Definition: cs_time_step.h:64
Definition: cs_zone.h:55