9.2
general documentation
cs_gwf.h
Go to the documentation of this file.
1#ifndef CS_GWF_H
2#define CS_GWF_H
3
4/*============================================================================
5 * Set of main functions to handle the groundwater flow module with CDO
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_base.h"
35#include "cdo/cs_equation.h"
36#include "gwf/cs_gwf_param.h"
38#include "gwf/cs_gwf_soil.h"
39#include "gwf/cs_gwf_tracer.h"
40
41/*============================================================================
42 * Macro definitions
43 *============================================================================*/
44
45/*============================================================================
46 * Type definitions
47 *============================================================================*/
48
49/*============================================================================
50 * Public function prototypes
51 *============================================================================*/
52
53/*----------------------------------------------------------------------------*/
59/*----------------------------------------------------------------------------*/
60
61bool
63
64/*----------------------------------------------------------------------------*/
74/*----------------------------------------------------------------------------*/
75
78 cs_flag_t option_flag,
79 cs_flag_t post_flag);
80
81/*----------------------------------------------------------------------------*/
87/*----------------------------------------------------------------------------*/
88
91
92/*----------------------------------------------------------------------------*/
98/*----------------------------------------------------------------------------*/
99
102
103/*----------------------------------------------------------------------------*/
111/*----------------------------------------------------------------------------*/
112
113void
116 bool pg_pos);
117
118/*----------------------------------------------------------------------------*/
132/*----------------------------------------------------------------------------*/
133
134void
136 cs_real_t l_viscosity,
137 cs_real_t g_viscosity,
138 cs_real_t l_diffusivity_h,
139 cs_real_t h_molar_mass,
140 cs_real_t ref_temperature,
141 cs_real_t henry_constant);
142
143/*----------------------------------------------------------------------------*/
154/*----------------------------------------------------------------------------*/
155
156void
158 cs_real_t l_viscosity,
159 cs_real_t g_viscosity,
160 cs_real_t h_molar_mass,
161 cs_real_t ref_temperature);
162
163/*----------------------------------------------------------------------------*/
167/*----------------------------------------------------------------------------*/
168
169void
170cs_gwf_log_setup(void);
171
172/*----------------------------------------------------------------------------*/
179/*----------------------------------------------------------------------------*/
180
181void
183 bool reset);
184
185/*----------------------------------------------------------------------------*/
192/*----------------------------------------------------------------------------*/
193
196
197/*----------------------------------------------------------------------------*/
211/*----------------------------------------------------------------------------*/
212
213cs_gwf_soil_t *
214cs_gwf_add_iso_soil(const char *z_name,
215 double density,
216 double k_abs,
217 double porosity,
218 cs_gwf_soil_model_t model);
219
220/*----------------------------------------------------------------------------*/
233/*----------------------------------------------------------------------------*/
234
235cs_gwf_soil_t *
236cs_gwf_add_aniso_soil(const char *z_name,
237 double density,
238 double k_abs[3][3],
239 double porosity,
240 cs_gwf_soil_model_t model);
241
242/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
260
263 const char *eq_name,
264 const char *var_name);
265
266/*----------------------------------------------------------------------------*/
285/*----------------------------------------------------------------------------*/
286
289 const char *eq_name,
290 const char *var_name,
291 double lambda);
292
293/*----------------------------------------------------------------------------*/
310/*----------------------------------------------------------------------------*/
311
313cs_gwf_add_user_tracer(const char *eq_name,
314 const char *var_name,
315 cs_gwf_tracer_init_setup_t *init_setup,
316 cs_gwf_tracer_finalize_setup_t *finalize_setup);
317
318/*----------------------------------------------------------------------------*/
341/*----------------------------------------------------------------------------*/
342
344cs_gwf_add_decay_chain(int n_tracers,
346 const char *chain_name,
347 const char *var_names[],
348 cs_gwf_tracer_model_t models[],
349 double lambda_vals[]);
350
351/*----------------------------------------------------------------------------*/
358/*----------------------------------------------------------------------------*/
359
360void
362 const cs_cdo_connect_t *connect);
363
364/*----------------------------------------------------------------------------*/
370/*----------------------------------------------------------------------------*/
371
372void
374
375/*----------------------------------------------------------------------------*/
386/*----------------------------------------------------------------------------*/
387
388void
390
391/*----------------------------------------------------------------------------*/
399/*----------------------------------------------------------------------------*/
400
401void
403 const cs_cdo_quantities_t *quant);
404
405/*----------------------------------------------------------------------------*/
419/*----------------------------------------------------------------------------*/
420
421void
423 const cs_cdo_connect_t *connect,
424 const cs_cdo_quantities_t *quant,
425 const cs_time_step_t *ts,
426 cs_flag_t update_flag);
427
428/*----------------------------------------------------------------------------*/
439/*----------------------------------------------------------------------------*/
440
441void
443 const cs_cdo_connect_t *connect,
444 const cs_cdo_quantities_t *quant,
445 const cs_time_step_t *ts);
446
447/*----------------------------------------------------------------------------*/
457/*----------------------------------------------------------------------------*/
458
459void
461 const cs_time_step_t *time_step,
462 const cs_cdo_connect_t *connect,
463 const cs_cdo_quantities_t *cdoq);
464
465/*----------------------------------------------------------------------------*/
474/*----------------------------------------------------------------------------*/
475
476void
478 const cs_time_step_t *time_step,
479 const cs_cdo_connect_t *connect,
480 const cs_cdo_quantities_t *cdoq);
481
482/*----------------------------------------------------------------------------*/
490/*----------------------------------------------------------------------------*/
491
492void
493cs_gwf_extra_op(const cs_cdo_connect_t *connect,
494 const cs_cdo_quantities_t *cdoq,
495 const cs_time_step_t *ts);
496
497/*----------------------------------------------------------------------------*/
520/*----------------------------------------------------------------------------*/
521
522void
523cs_gwf_extra_post(void *input,
524 int mesh_id,
525 int cat_id,
526 int ent_flag[5],
527 cs_lnum_t n_cells,
528 cs_lnum_t n_i_faces,
529 cs_lnum_t n_b_faces,
530 const cs_lnum_t cell_ids[],
531 const cs_lnum_t i_face_ids[],
532 const cs_lnum_t b_face_ids[],
533 const cs_time_step_t *time_step);
534
535/*----------------------------------------------------------------------------*/
536
537#endif /* CS_GWF_H */
time step descriptor
Definition: cs_time_step.h:60
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
unsigned short int cs_flag_t
Definition: cs_defs.h:334
@ lambda
Definition: cs_field_pointer.h:105
void cs_gwf_compute_steady_state(const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Compute the steady-state of the groundwater flows module. Nothing is done if all equations are unstea...
Definition: cs_gwf.cpp:1422
cs_gwf_tracer_decay_chain_t * cs_gwf_add_decay_chain(int n_tracers, cs_gwf_tracer_unit_t unit, const char *chain_name, const char *var_names[], cs_gwf_tracer_model_t models[], double lambda_vals[])
Add a set of tracer equations corresponding to a radioactive decay chain in the groundwater flow modu...
Definition: cs_gwf.cpp:1015
cs_gwf_soil_t * cs_gwf_add_aniso_soil(const char *z_name, double density, double k_abs[3][3], double porosity, cs_gwf_soil_model_t model)
Create and add a new cs_gwf_soil_t structure. An initialization by default of all members is performe...
Definition: cs_gwf.cpp:771
cs_gwf_t * cs_gwf_activate(cs_gwf_model_type_t model, cs_flag_t option_flag, cs_flag_t post_flag)
Initialize the module dedicated to groundwater flows.
Definition: cs_gwf.cpp:236
void cs_gwf_extra_op(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *ts)
Predefined extra-operations for the groundwater flow module.
Definition: cs_gwf.cpp:1569
void cs_gwf_compute(const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Compute the system related to groundwater flows module.
Definition: cs_gwf.cpp:1490
void cs_gwf_set_post_options(cs_flag_t post_flag, bool reset)
Set the flag dedicated to the post-processing of the GWF module.
Definition: cs_gwf.cpp:647
void cs_gwf_init_sharing(const cs_cdo_quantities_t *cdoq, const cs_cdo_connect_t *connect)
Set shared pointers to main domain members.
Definition: cs_gwf.cpp:1111
void cs_gwf_set_miscible_two_phase_model(cs_real_t l_mass_density, cs_real_t l_viscosity, cs_real_t g_viscosity, cs_real_t l_diffusivity_h, cs_real_t h_molar_mass, cs_real_t ref_temperature, cs_real_t henry_constant)
Set the parameters defining the two-phase flow model in the miscible case. Use SI unit if not prescri...
Definition: cs_gwf.cpp:539
void cs_gwf_extra_post(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *time_step)
Predefined post-processing output for the groundwater flow module. According to the model,...
Definition: cs_gwf.cpp:1629
cs_gwf_tpf_t * cs_gwf_get_two_phase_model(void)
Get the main structure which manages a two-phase flow model.
Definition: cs_gwf.cpp:470
cs_gwf_soil_t * cs_gwf_add_iso_soil(const char *z_name, double density, double k_abs, double porosity, cs_gwf_soil_model_t model)
Create and add a new cs_gwf_soil_t structure. An initialization by default of all members is performe...
Definition: cs_gwf.cpp:718
cs_gwf_t * cs_gwf_destroy_all(void)
Free all structures related to groundwater flows.
Definition: cs_gwf.cpp:300
void cs_gwf_finalize_setup(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
Last initialization step of the groundwater flow module. At this stage, the mesh quantities are defin...
Definition: cs_gwf.cpp:1253
void cs_gwf_hydraulic_update(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, cs_flag_t update_flag)
Update the groundwater system related to the hydraulic model: pressure head, head in law,...
Definition: cs_gwf.cpp:1316
cs_gwf_tracer_t * cs_gwf_add_user_tracer(const char *eq_name, const char *var_name, cs_gwf_tracer_init_setup_t *init_setup, cs_gwf_tracer_finalize_setup_t *finalize_setup)
Add a new equation related to the groundwater flow module.
Definition: cs_gwf.cpp:959
void cs_gwf_init_values(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts)
Initialize the GWF module (done after all the setup phase and after the initialization of all equatio...
Definition: cs_gwf.cpp:1372
cs_adv_field_t * cs_gwf_get_adv_field(void)
Retrieve the advection field related to the Darcy flux in the liquid phase.
Definition: cs_gwf.cpp:691
void cs_gwf_set_two_phase_numerical_options(cs_gwf_tpf_approx_type_t approx, cs_gwf_tpf_solver_type_t solver, bool pg_pos)
Set the numerical options related to the two phase flow models.
Definition: cs_gwf.cpp:500
cs_gwf_tracer_t * cs_gwf_add_tracer(cs_gwf_tracer_model_t tr_model, const char *eq_name, const char *var_name)
Add a new equation related to the groundwater flow module.
Definition: cs_gwf.cpp:827
void cs_gwf_log_setup(void)
Summary of the main cs_gwf_t structure.
Definition: cs_gwf.cpp:355
void cs_gwf_init_model_context(void)
Initialize the context of the model after the activation of the module and make first settings of the...
Definition: cs_gwf.cpp:1129
cs_gwf_tracer_t * cs_gwf_add_radioactive_tracer(cs_gwf_tracer_model_t tr_model, const char *eq_name, const char *var_name, double lambda)
Add a new equation related to the groundwater flow module.
Definition: cs_gwf.cpp:894
bool cs_gwf_is_activated(void)
Check if the groundwater flow module has been activated.
Definition: cs_gwf.cpp:215
void cs_gwf_init_setup(void)
Predefined settings for the groundwater flow model and its related equations.
Definition: cs_gwf.cpp:1197
void cs_gwf_set_immiscible_two_phase_model(cs_real_t l_mass_density, cs_real_t l_viscosity, cs_real_t g_viscosity, cs_real_t h_molar_mass, cs_real_t ref_temperature)
Set the parameters defining the immiscible two-phase flow model. Use SI unit if not prescribed otherw...
Definition: cs_gwf.cpp:596
cs_gwf_tpf_approx_type_t
Type of approximation used for the computation of unsteady or diffusion properties.
Definition: cs_gwf_hydraulic_model.h:288
cs_gwf_tpf_solver_type_t
Type of solver considered for a two-phase flow model.
Definition: cs_gwf_hydraulic_model.h:273
cs_flag_t cs_gwf_tracer_model_t
Flags specifying the general behavior of a tracer associated to the groundwater flow module.
Definition: cs_gwf_param.h:296
cs_gwf_model_type_t
Type of system of equation(s) to consider for the physical modelling.
Definition: cs_gwf_param.h:123
cs_gwf_soil_model_t
Predefined hydraulic model of soils used in the groundwater flow module.
Definition: cs_gwf_param.h:279
cs_gwf_tracer_unit_t
Type of unit for the expression of the radioactive inventory.
Definition: cs_gwf_param.h:107
void() cs_gwf_tracer_init_setup_t(cs_gwf_tracer_t *tracer)
Generic function to update the first setup stage (the one done before building mesh and its related q...
Definition: cs_gwf_tracer.h:73
void() cs_gwf_tracer_finalize_setup_t(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_adv_field_t *adv, cs_gwf_tracer_t *tracer)
Generic function to finalize the setup of parameters related to a tracer equation....
Definition: cs_gwf_tracer.h:89
Definition: mesh.f90:26
Definition: cs_advection_field.h:151
Definition: cs_cdo_connect.h:57
Definition: cs_cdo_quantities.h:142
Main set of parameters/structures to manage the groundwater flow (GWF) module. This is an explicit de...
Definition: cs_gwf_hydraulic_model.h:640
Structure to handle the modelling of miscible or immiscible two-phase flows in a porous media.
Definition: cs_gwf_hydraulic_model.h:328
Definition: cs_gwf_tracer.h:158
Set of parameters describing a tracer structure.
Definition: cs_mesh.h:85