My Project
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-2019 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 
80 #define CS_GWF_GRAVITATION (1 << 0)
81 #define CS_GWF_FORCE_RICHARDS_ITERATIONS (1 << 1)
82 #define CS_GWF_RESCALE_HEAD_TO_ZERO_MEAN_VALUE (1 << 2)
83 #define CS_GWF_ENFORCE_DIVERGENCE_FREE (1 << 3)
84 #define CS_GWF_RICHARDS_UNSTEADY (1 << 4)
85 #define CS_GWF_SOIL_PROPERTY_UNSTEADY (1 << 5)
86 #define CS_GWF_SOIL_ALL_SATURATED (1 << 6)
87 
117 #define CS_GWF_POST_CAPACITY (1 << 0)
118 #define CS_GWF_POST_MOISTURE (1 << 1)
119 #define CS_GWF_POST_PERMEABILITY (1 << 2)
120 #define CS_GWF_POST_DARCY_FLUX_BALANCE (1 << 3)
121 #define CS_GWF_POST_DARCY_FLUX_DIVERGENCE (1 << 4)
122 #define CS_GWF_POST_DARCY_FLUX_AT_BOUNDARY (1 << 5)
123 
126 /*============================================================================
127  * Type definitions
128  *============================================================================*/
129 
130 typedef struct _gwf_t cs_gwf_t;
131 
132 /*============================================================================
133  * Public function prototypes
134  *============================================================================*/
135 
136 /*----------------------------------------------------------------------------*/
142 /*----------------------------------------------------------------------------*/
143 
144 bool
145 cs_gwf_is_activated(void);
146 
147 /*----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------*/
157 
158 cs_gwf_t *
160  cs_flag_t flag);
161 
162 /*----------------------------------------------------------------------------*/
168 /*----------------------------------------------------------------------------*/
169 
170 cs_gwf_t *
171 cs_gwf_destroy_all(void);
172 
173 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 void
180 cs_gwf_log_setup(void);
181 
182 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 void
192 
193 /*----------------------------------------------------------------------------*/
199 /*----------------------------------------------------------------------------*/
200 
201 void
203 
204 /*----------------------------------------------------------------------------*/
212 /*----------------------------------------------------------------------------*/
213 
214 void
216 
217 /*----------------------------------------------------------------------------*/
229 /*----------------------------------------------------------------------------*/
230 
232 cs_gwf_add_tracer(const char *eq_name,
233  const char *var_name);
234 
235 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
251 
253 cs_gwf_add_tracer_user(const char *eq_name,
254  const char *var_name,
255  cs_gwf_tracer_setup_t *setup,
256  cs_gwf_tracer_add_terms_t *add_terms);
257 
258 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
270 cs_gwf_tracer_by_name(const char *eq_name);
271 
272 /*----------------------------------------------------------------------------*/
278 /*----------------------------------------------------------------------------*/
279 
280 void
281 cs_gwf_init_setup(void);
282 
283 /*----------------------------------------------------------------------------*/
288 /*----------------------------------------------------------------------------*/
289 
290 void
292 
293 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 void
304  const cs_cdo_quantities_t *quant);
305 
306 /*----------------------------------------------------------------------------*/
317 /*----------------------------------------------------------------------------*/
318 
319 void
321  const cs_cdo_connect_t *connect,
322  const cs_cdo_quantities_t *quant,
323  const cs_time_step_t *ts,
324  bool cur2prev);
325 
326 /*----------------------------------------------------------------------------*/
336 /*----------------------------------------------------------------------------*/
337 
338 void
340  const cs_time_step_t *time_step,
341  const cs_cdo_connect_t *connect,
342  const cs_cdo_quantities_t *cdoq);
343 
344 /*----------------------------------------------------------------------------*/
353 /*----------------------------------------------------------------------------*/
354 
355 void
357  const cs_time_step_t *time_step,
358  const cs_cdo_connect_t *connect,
359  const cs_cdo_quantities_t *cdoq);
360 
361 /*----------------------------------------------------------------------------*/
375 /*----------------------------------------------------------------------------*/
376 
377 cs_real_t
379  const cs_cdo_quantities_t *cdoq,
380  const cs_gwf_tracer_t *tracer,
381  const char *z_name);
382 
383 /*----------------------------------------------------------------------------*/
390 /*----------------------------------------------------------------------------*/
391 
392 void
393 cs_gwf_extra_op(const cs_cdo_connect_t *connect,
394  const cs_cdo_quantities_t *cdoq);
395 
396 /*----------------------------------------------------------------------------*/
418 /*----------------------------------------------------------------------------*/
419 
420 void
422  int mesh_id,
423  int cat_id,
424  int ent_flag[5],
425  cs_lnum_t n_cells,
426  cs_lnum_t n_i_faces,
427  cs_lnum_t n_b_faces,
428  const cs_lnum_t cell_ids[],
429  const cs_lnum_t i_face_ids[],
430  const cs_lnum_t b_face_ids[],
431  const cs_time_step_t *time_step);
432 
433 /*----------------------------------------------------------------------------*/
434 
436 
437 #endif /* __CS_GWF_H__ */
cs_gwf_activate
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:605
input
static int input(void)
cs_gwf_integrate_tracer
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....
Definition: cs_gwf.c:1547
cs_gwf_add_tracer
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:857
cs_real_3_t
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:315
cs_gwf_compute_steady_state
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:1400
cs_property_type_t
cs_property_type_t
Type of property to consider.
Definition: cs_property.h:93
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_gwf_tracer_add_terms_t
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_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
cs_gwf_finalize_setup
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:1154
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_gwf_soil.h
mesh
Definition: mesh.f90:26
cs_gwf_is_activated
bool cs_gwf_is_activated(void)
Check if the groundwater flow module has been activated.
Definition: cs_gwf.c:585
cs_gwf_set_darcian_flux_location
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:826
cs_gwf_set_post_options
void cs_gwf_set_post_options(cs_flag_t post_flag)
Set the flag dedicated to the post-processing of the GWF module.
Definition: cs_gwf.c:779
cs_time_step_t
time step descriptor
Definition: cs_time_step.h:51
ts
void cs_int_t cs_int_t cs_int_t cs_real_t * ts
Definition: cs_at_plugin.h:63
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:94
cs_gwf_extra_post
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:1788
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_cdo_connect_t
Definition: cs_cdo_connect.h:74
cs_gwf_compute
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:1471
cs_gwf_add_tracer_terms
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:1126
cs_gwf_update
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, bool cur2prev)
Update the groundwater system (pressure head, head in law, moisture content, darcian velocity,...
Definition: cs_gwf.c:1307
cs_gwf_add_tracer_user
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:903
cs_gwf_tracer_setup_t
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
cs_flag_t
unsigned short int cs_flag_t
Definition: cs_defs.h:304
cs_gwf_tracer_t
Definition: cs_gwf_tracer.h:116
cs_gwf_init_setup
void cs_gwf_init_setup(void)
Predefined settings for the Richards equation and the related equations defining the groundwater flow...
Definition: cs_gwf.c:974
cs_equation.h
cs_gwf_set_gravity_vector
void cs_gwf_set_gravity_vector(const cs_real_3_t gvec)
Activate the gravity and set the gravitaty vector.
Definition: cs_gwf.c:801
cs_gwf_tracer.h
cs_gwf_log_setup
void cs_gwf_log_setup(void)
Summary of the main cs_gwf_t structure.
Definition: cs_gwf.c:701
cs_gwf_tracer_by_name
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:946
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h
cs_gwf_destroy_all
cs_gwf_t * cs_gwf_destroy_all(void)
Free the main structure related to groundwater flows.
Definition: cs_gwf.c:662
cs_gwf_extra_op
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:1642