programmer's 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-2018 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_soil.h"
37 #include "cs_gwf_tracer.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
87 #define CS_GWF_FORCE_RICHARDS_ITERATIONS (1 << 0)
88 #define CS_GWF_GRAVITATION (1 << 1)
89 #define CS_GWF_POST_CAPACITY (1 << 2)
90 #define CS_GWF_POST_MOISTURE (1 << 3)
91 #define CS_GWF_POST_PERMEABILITY (1 << 4)
92 #define CS_GWF_RESCALE_HEAD_TO_ZERO_MEAN_VALUE (1 << 5)
93 #define CS_GWF_RICHARDS_UNSTEADY (1 << 6)
94 #define CS_GWF_SOIL_PROPERTY_UNSTEADY (1 << 7)
95 #define CS_GWF_SOIL_ALL_SATURATED (1 << 8)
96 
99 /*============================================================================
100  * Type definitions
101  *============================================================================*/
102 
103 typedef struct _gwf_t cs_gwf_t;
104 
105 /*============================================================================
106  * Public function prototypes
107  *============================================================================*/
108 
109 /*----------------------------------------------------------------------------*/
115 /*----------------------------------------------------------------------------*/
116 
117 bool
118 cs_gwf_is_activated(void);
119 
120 /*----------------------------------------------------------------------------*/
129 /*----------------------------------------------------------------------------*/
130 
131 cs_gwf_t *
133  cs_flag_t flag);
134 
135 /*----------------------------------------------------------------------------*/
141 /*----------------------------------------------------------------------------*/
142 
143 cs_gwf_t *
144 cs_gwf_destroy_all(void);
145 
146 /*----------------------------------------------------------------------------*/
150 /*----------------------------------------------------------------------------*/
151 
152 void
153 cs_gwf_log_setup(void);
154 
155 /*----------------------------------------------------------------------------*/
161 /*----------------------------------------------------------------------------*/
162 
163 void
165 
166 /*----------------------------------------------------------------------------*/
174 /*----------------------------------------------------------------------------*/
175 
176 void
178 
179 /*----------------------------------------------------------------------------*/
191 /*----------------------------------------------------------------------------*/
192 
194 cs_gwf_add_tracer(const char *eq_name,
195  const char *var_name);
196 
197 /*----------------------------------------------------------------------------*/
212 /*----------------------------------------------------------------------------*/
213 
215 cs_gwf_add_tracer_user(const char *eq_name,
216  const char *var_name,
217  cs_gwf_tracer_setup_t *setup,
218  cs_gwf_tracer_add_terms_t *add_terms);
219 
220 /*----------------------------------------------------------------------------*/
229 /*----------------------------------------------------------------------------*/
230 
232 cs_gwf_tracer_by_name(const char *eq_name);
233 
234 /*----------------------------------------------------------------------------*/
240 /*----------------------------------------------------------------------------*/
241 
242 void
243 cs_gwf_init_setup(void);
244 
245 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
251 
252 void
254 
255 /*----------------------------------------------------------------------------*/
262 /*----------------------------------------------------------------------------*/
263 
264 void
266  const cs_cdo_quantities_t *quant);
267 
268 /*----------------------------------------------------------------------------*/
280 /*----------------------------------------------------------------------------*/
281 
282 void
284  const cs_cdo_connect_t *connect,
285  const cs_cdo_quantities_t *quant,
286  const cs_time_step_t *ts,
287  double dt_cur,
288  bool cur2prev);
289 
290 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 void
304  const cs_time_step_t *time_step,
305  const cs_cdo_connect_t *connect,
306  const cs_cdo_quantities_t *cdoq);
307 
308 /*----------------------------------------------------------------------------*/
318 /*----------------------------------------------------------------------------*/
319 
320 void
322  const cs_time_step_t *time_step,
323  double dt_cur,
324  const cs_cdo_connect_t *connect,
325  const cs_cdo_quantities_t *cdoq);
326 
327 /*----------------------------------------------------------------------------*/
341 /*----------------------------------------------------------------------------*/
342 
343 cs_real_t
345  const cs_cdo_quantities_t *cdoq,
346  const cs_gwf_tracer_t *tracer,
347  const char *z_name);
348 
349 /*----------------------------------------------------------------------------*/
371 /*----------------------------------------------------------------------------*/
372 
373 void
375  int mesh_id,
376  int cat_id,
377  int ent_flag[5],
378  cs_lnum_t n_cells,
379  cs_lnum_t n_i_faces,
380  cs_lnum_t n_b_faces,
381  const cs_lnum_t cell_ids[],
382  const cs_lnum_t i_face_ids[],
383  const cs_lnum_t b_face_ids[],
384  const cs_time_step_t *time_step);
385 
386 /*----------------------------------------------------------------------------*/
387 
389 
390 #endif /* __CS_GWF_H__ */
void cs_gwf_init_setup(void)
Predefined settings for the Richards equation and the related equations defining the groundwater flow...
Definition: cs_gwf.c:978
time step descriptor
Definition: cs_time_step.h:51
void cs_gwf_log_setup(void)
Summary of the main cs_gwf_t structure.
Definition: cs_gwf.c:770
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:1390
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, double dt_cur, bool cur2prev)
Update the groundwater system (pressure head, head in law, moisture content, darcian velocity...
Definition: cs_gwf.c:1300
cs_gwf_t * cs_gwf_activate(cs_property_type_t pty_type, cs_flag_t flag)
Initialize the module dedicated to groundwater flows.
Definition: cs_gwf.c:677
cs_property_type_t
Type of property to consider.
Definition: cs_property.h:93
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
cs_real_t cs_gwf_integrate_tracer(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_gwf_tracer_t *tracer, const char *z_name)
Compute the integral over a given set of cells of the field related to a tracer equation. This integral turns out to be exact for linear functions.
Definition: cs_gwf.c:1541
void() cs_gwf_tracer_setup_t(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_gwf_tracer_t *tracer)
Generic function to set the parameters related to a tracer equation.
Definition: cs_gwf_tracer.h:153
Definition: cs_cdo_connect.h:74
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Definition: cs_cdo_quantities.h:94
void cs_gwf_compute(const cs_mesh_t *mesh, const cs_time_step_t *time_step, double dt_cur, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Compute the system related to groundwater flows module.
Definition: cs_gwf.c:1464
Definition: cs_mesh.h:63
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.
Definition: cs_gwf.c:1156
bool cs_gwf_is_activated(void)
Check if the groundwater flow module has been activated.
Definition: cs_gwf.c:657
void cs_gwf_set_darcian_flux_location(cs_flag_t location_flag)
Advanced setting: indicate where the darcian flux is stored cs_flag_primal_cell is the default settin...
Definition: cs_gwf.c:837
static int input(void)
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:310
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
cs_gwf_tracer_t * cs_gwf_add_tracer_user(const char *eq_name, const char *var_name, cs_gwf_tracer_setup_t *setup, cs_gwf_tracer_add_terms_t *add_terms)
Add a new equation related to the groundwater flow module This equation is a particular type of unste...
Definition: cs_gwf.c:907
#define END_C_DECLS
Definition: cs_defs.h:463
unsigned short int cs_flag_t
Definition: cs_defs.h:299
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 prototype of this function is fixed...
Definition: cs_gwf.c:1651
void cs_gwf_set_gravity_vector(const cs_real_3_t gvec)
Activate the gravity and set the gravitaty vector.
Definition: cs_gwf.c:814
void cs_gwf_add_tracer_terms(void)
Add new terms if needed (such as diffusion or reaction) to tracer equations according to the settings...
Definition: cs_gwf.c:1128
cs_gwf_t * cs_gwf_destroy_all(void)
Free the main structure related to groundwater flows.
Definition: cs_gwf.c:734
Definition: cs_gwf_tracer.h:116
Definition: mesh.f90:26
void() cs_gwf_tracer_add_terms_t(cs_gwf_tracer_t *tracer)
Generic function to update the terms to build in the algebraic system for a tracer equation according...
Definition: cs_gwf_tracer.h:167
cs_gwf_tracer_t * cs_gwf_add_tracer(const char *eq_name, const char *var_name)
Add a new equation related to the groundwater flow module This equation is a particular type of unste...
Definition: cs_gwf.c:861
cs_gwf_tracer_t * cs_gwf_tracer_by_name(const char *eq_name)
Retrieve the pointer to the cs_gwf_tracer_t structure associated to the name given as parameter...
Definition: cs_gwf.c:950