8.0
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-2023 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 "cs_base.h"
35 #include "cs_equation.h"
36 #include "cs_gwf_param.h"
37 #include "cs_gwf_priv.h"
38 #include "cs_gwf_soil.h"
39 #include "cs_gwf_tracer.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Public function prototypes
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------*/
63 /*----------------------------------------------------------------------------*/
64 
65 bool
67 
68 /*----------------------------------------------------------------------------*/
78 /*----------------------------------------------------------------------------*/
79 
80 cs_gwf_t *
82  cs_flag_t option_flag,
83  cs_flag_t post_flag);
84 
85 /*----------------------------------------------------------------------------*/
91 /*----------------------------------------------------------------------------*/
92 
93 cs_gwf_t *
94 cs_gwf_destroy_all(void);
95 
96 /*----------------------------------------------------------------------------*/
102 /*----------------------------------------------------------------------------*/
103 
106 
107 /*----------------------------------------------------------------------------*/
116 /*----------------------------------------------------------------------------*/
117 
118 void
119 cs_gwf_set_two_phase_numerical_options(bool use_coupled_solver,
120  bool use_incremental_solver,
121  bool use_properties_on_submesh,
122  bool use_explicit_dsldt_liquid);
123 
124 /*----------------------------------------------------------------------------*/
139 /*----------------------------------------------------------------------------*/
140 
141 void
143  cs_real_t l_viscosity,
144  cs_real_t g_viscosity,
145  cs_real_t l_diffusivity_h,
146  cs_real_t w_molar_mass,
147  cs_real_t h_molar_mass,
148  cs_real_t ref_temperature,
149  cs_real_t henry_constant);
150 
151 /*----------------------------------------------------------------------------*/
162 /*----------------------------------------------------------------------------*/
163 
164 void
166  cs_real_t l_viscosity,
167  cs_real_t g_viscosity,
168  cs_real_t h_molar_mass,
169  cs_real_t ref_temperature);
170 
171 /*----------------------------------------------------------------------------*/
175 /*----------------------------------------------------------------------------*/
176 
177 void
178 cs_gwf_log_setup(void);
179 
180 /*----------------------------------------------------------------------------*/
187 /*----------------------------------------------------------------------------*/
188 
189 void
191  bool reset);
192 
193 /*----------------------------------------------------------------------------*/
200 /*----------------------------------------------------------------------------*/
201 
204 
205 /*----------------------------------------------------------------------------*/
219 /*----------------------------------------------------------------------------*/
220 
221 cs_gwf_soil_t *
222 cs_gwf_add_iso_soil(const char *z_name,
223  double density,
224  double k_abs,
225  double porosity,
226  cs_gwf_soil_model_t model);
227 
228 /*----------------------------------------------------------------------------*/
241 /*----------------------------------------------------------------------------*/
242 
243 cs_gwf_soil_t *
244 cs_gwf_add_aniso_soil(const char *z_name,
245  double density,
246  double k_abs[3][3],
247  double porosity,
248  cs_gwf_soil_model_t model);
249 
250 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
271  const char *eq_name,
272  const char *var_name);
273 
274 /*----------------------------------------------------------------------------*/
293 /*----------------------------------------------------------------------------*/
294 
297  const char *eq_name,
298  const char *var_name,
299  double lambda);
300 
301 /*----------------------------------------------------------------------------*/
318 /*----------------------------------------------------------------------------*/
319 
321 cs_gwf_add_user_tracer(const char *eq_name,
322  const char *var_name,
323  cs_gwf_tracer_init_setup_t *init_setup,
324  cs_gwf_tracer_finalize_setup_t *finalize_setup);
325 
326 /*----------------------------------------------------------------------------*/
349 /*----------------------------------------------------------------------------*/
350 
352 cs_gwf_add_decay_chain(int n_tracers,
354  const char *chain_name,
355  const char *var_names[],
356  cs_gwf_tracer_model_t models[],
357  double lambda_vals[]);
358 
359 /*----------------------------------------------------------------------------*/
365 /*----------------------------------------------------------------------------*/
366 
367 void
369 
370 /*----------------------------------------------------------------------------*/
378 /*----------------------------------------------------------------------------*/
379 
380 void
381 cs_gwf_init_setup(void);
382 
383 /*----------------------------------------------------------------------------*/
391 /*----------------------------------------------------------------------------*/
392 
393 void
395  const cs_cdo_quantities_t *quant);
396 
397 /*----------------------------------------------------------------------------*/
408 /*----------------------------------------------------------------------------*/
409 
410 void
412  const cs_cdo_connect_t *connect,
413  const cs_cdo_quantities_t *quant,
414  const cs_time_step_t *ts);
415 
416 /*----------------------------------------------------------------------------*/
428 /*----------------------------------------------------------------------------*/
429 
430 void
432  const cs_cdo_connect_t *connect,
433  const cs_cdo_quantities_t *quant,
434  const cs_time_step_t *ts,
435  cs_flag_t update_flag);
436 
437 /*----------------------------------------------------------------------------*/
447 /*----------------------------------------------------------------------------*/
448 
449 void
451  const cs_time_step_t *time_step,
452  const cs_cdo_connect_t *connect,
453  const cs_cdo_quantities_t *cdoq);
454 
455 /*----------------------------------------------------------------------------*/
464 /*----------------------------------------------------------------------------*/
465 
466 void
468  const cs_time_step_t *time_step,
469  const cs_cdo_connect_t *connect,
470  const cs_cdo_quantities_t *cdoq);
471 
472 /*----------------------------------------------------------------------------*/
479 /*----------------------------------------------------------------------------*/
480 
481 void
482 cs_gwf_extra_op(const cs_cdo_connect_t *connect,
483  const cs_cdo_quantities_t *cdoq);
484 
485 /*----------------------------------------------------------------------------*/
508 /*----------------------------------------------------------------------------*/
509 
510 void
511 cs_gwf_extra_post_sspf(void *input,
512  int mesh_id,
513  int cat_id,
514  int ent_flag[5],
515  cs_lnum_t n_cells,
516  cs_lnum_t n_i_faces,
517  cs_lnum_t n_b_faces,
518  const cs_lnum_t cell_ids[],
519  const cs_lnum_t i_face_ids[],
520  const cs_lnum_t b_face_ids[],
521  const cs_time_step_t *time_step);
522 
523 /*----------------------------------------------------------------------------*/
546 /*----------------------------------------------------------------------------*/
547 
548 void
549 cs_gwf_extra_post_uspf(void *input,
550  int mesh_id,
551  int cat_id,
552  int ent_flag[5],
553  cs_lnum_t n_cells,
554  cs_lnum_t n_i_faces,
555  cs_lnum_t n_b_faces,
556  const cs_lnum_t cell_ids[],
557  const cs_lnum_t i_face_ids[],
558  const cs_lnum_t b_face_ids[],
559  const cs_time_step_t *time_step);
560 
561 /*----------------------------------------------------------------------------*/
584 /*----------------------------------------------------------------------------*/
585 
586 void
587 cs_gwf_extra_post_mtpf(void *input,
588  int mesh_id,
589  int cat_id,
590  int ent_flag[5],
591  cs_lnum_t n_cells,
592  cs_lnum_t n_i_faces,
593  cs_lnum_t n_b_faces,
594  const cs_lnum_t cell_ids[],
595  const cs_lnum_t i_face_ids[],
596  const cs_lnum_t b_face_ids[],
597  const cs_time_step_t *time_step);
598 
599 /*----------------------------------------------------------------------------*/
600 
602 
603 #endif /* __CS_GWF_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
unsigned short int cs_flag_t
Definition: cs_defs.h:321
@ lambda
Definition: cs_field_pointer.h:106
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.c:4446
cs_gwf_two_phase_t * cs_gwf_get_two_phase_model(void)
Get the main structure which manages a two-phase flow model.
Definition: cs_gwf.c:3516
cs_gwf_t * cs_gwf_destroy_all(void)
Free all structures related to groundwater flows.
Definition: cs_gwf.c:3341
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.c:3921
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.c:3800
void cs_gwf_extra_post_mtpf(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 in case of miscible two-phase flows...
Definition: cs_gwf.c:4809
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.c:4499
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.c:3677
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.c:4040
void cs_gwf_extra_post_sspf(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 in case of saturated single-phase f...
Definition: cs_gwf.c:4614
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.c:4234
void cs_gwf_extra_post_uspf(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 in case of unsaturated single-phase...
Definition: cs_gwf.c:4726
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.c:4291
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.c:3721
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.c:3855
void cs_gwf_extra_op(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Predefined extra-operations for the groundwater flow module.
Definition: cs_gwf.c:4558
void cs_gwf_set_two_phase_numerical_options(bool use_coupled_solver, bool use_incremental_solver, bool use_properties_on_submesh, bool use_explicit_dsldt_liquid)
Set the numerical options related to the two phase flow models.
Definition: cs_gwf.c:3546
void cs_gwf_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 (pressure head, head in law, moisture content, darcian velocity,...
Definition: cs_gwf.c:4388
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 w_molar_mass, 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. Use SI unit if not prescribed otherwise.
Definition: cs_gwf.c:3582
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.c:3276
void cs_gwf_log_setup(void)
Summary of the main cs_gwf_t structure.
Definition: cs_gwf.c:3402
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.c:4132
bool cs_gwf_is_activated(void)
Check if the groundwater flow module has been activated.
Definition: cs_gwf.c:3255
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.c:3748
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.c:3985
void cs_gwf_init_setup(void)
Predefined settings for the groundwater flow model and its related equations. At this stage,...
Definition: cs_gwf.c:4190
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.c:3633
cs_flag_t cs_gwf_tracer_model_t
Definition: cs_gwf_param.h:272
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_gwf_tracer_unit_t
Type of unit for the expression of the radioactive inventory.
Definition: cs_gwf_param.h:102
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:77
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:93
double precision, dimension(:,:,:), allocatable density
Definition: atimbr.f90:124
Definition: mesh.f90:26
Definition: cs_advection_field.h:150
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:137
Main set of parameters/structures to manage the groundwater flow (GWF) module. This is an explicit de...
Definition: cs_gwf_priv.h:721
Definition: cs_gwf_tracer.h:162
Set of parameters describing a tracer structure.
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
time step descriptor
Definition: cs_time_step.h:64