7.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-2021 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 
47 #define CS_GWF_ADV_FIELD_NAME "darcy_velocity"
48 
50 
89 typedef enum {
90 
91  /* Main physical modelling */
92  /* ----------------------- */
93 
94  CS_GWF_GRAVITATION = 1<< 0, /* = 1 */
95  CS_GWF_RICHARDS_UNSTEADY = 1<< 1, /* = 2 */
96  CS_GWF_SOIL_PROPERTY_UNSTEADY = 1<< 2, /* = 4 */
97  CS_GWF_SOIL_ALL_SATURATED = 1<< 3, /* = 8 */
98 
99 
100  /* Main numerical options */
101  /* ---------------------- */
102 
105  CS_GWF_ENFORCE_DIVERGENCE_FREE = 1<< 8 /* = 256 */
106 
108 
138 #define CS_GWF_POST_CAPACITY (1 << 0)
139 #define CS_GWF_POST_MOISTURE (1 << 1)
140 #define CS_GWF_POST_PERMEABILITY (1 << 2)
141 #define CS_GWF_POST_DARCY_FLUX_BALANCE (1 << 3)
142 #define CS_GWF_POST_DARCY_FLUX_DIVERGENCE (1 << 4)
143 #define CS_GWF_POST_DARCY_FLUX_AT_BOUNDARY (1 << 5)
144 
147 /*============================================================================
148  * Type definitions
149  *============================================================================*/
150 
151 typedef struct _gwf_t cs_gwf_t;
152 
153 /*============================================================================
154  * Public function prototypes
155  *============================================================================*/
156 
157 /*----------------------------------------------------------------------------*/
163 /*----------------------------------------------------------------------------*/
164 
165 bool
166 cs_gwf_is_activated(void);
167 
168 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 cs_gwf_t *
181  cs_flag_t flag);
182 
183 /*----------------------------------------------------------------------------*/
189 /*----------------------------------------------------------------------------*/
190 
191 cs_gwf_t *
192 cs_gwf_destroy_all(void);
193 
194 /*----------------------------------------------------------------------------*/
198 /*----------------------------------------------------------------------------*/
199 
200 void
201 cs_gwf_log_setup(void);
202 
203 /*----------------------------------------------------------------------------*/
209 /*----------------------------------------------------------------------------*/
210 
211 void
213 
214 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
229 cs_gwf_tracer_t *
231  const char *eq_name,
232  const char *var_name);
233 
234 /*----------------------------------------------------------------------------*/
249 /*----------------------------------------------------------------------------*/
250 
251 cs_gwf_tracer_t *
252 cs_gwf_add_user_tracer(const char *eq_name,
253  const char *var_name,
254  cs_gwf_tracer_setup_t *setup,
255  cs_gwf_tracer_add_terms_t *add_terms);
256 
257 /*----------------------------------------------------------------------------*/
266 /*----------------------------------------------------------------------------*/
267 
268 cs_gwf_tracer_t *
269 cs_gwf_tracer_by_name(const char *eq_name);
270 
271 /*----------------------------------------------------------------------------*/
277 /*----------------------------------------------------------------------------*/
278 
279 void
280 cs_gwf_init_setup(void);
281 
282 /*----------------------------------------------------------------------------*/
287 /*----------------------------------------------------------------------------*/
288 
289 void
291 
292 /*----------------------------------------------------------------------------*/
299 /*----------------------------------------------------------------------------*/
300 
301 void
303  const cs_cdo_quantities_t *quant);
304 
305 /*----------------------------------------------------------------------------*/
316 /*----------------------------------------------------------------------------*/
317 
318 void
320  const cs_cdo_connect_t *connect,
321  const cs_cdo_quantities_t *quant,
322  const cs_time_step_t *ts,
323  bool cur2prev);
324 
325 /*----------------------------------------------------------------------------*/
335 /*----------------------------------------------------------------------------*/
336 
337 void
339  const cs_time_step_t *time_step,
340  const cs_cdo_connect_t *connect,
341  const cs_cdo_quantities_t *cdoq);
342 
343 /*----------------------------------------------------------------------------*/
352 /*----------------------------------------------------------------------------*/
353 
354 void
356  const cs_time_step_t *time_step,
357  const cs_cdo_connect_t *connect,
358  const cs_cdo_quantities_t *cdoq);
359 
360 /*----------------------------------------------------------------------------*/
374 /*----------------------------------------------------------------------------*/
375 
376 cs_real_t
378  const cs_cdo_quantities_t *cdoq,
379  const cs_gwf_tracer_t *tracer,
380  const char *z_name);
381 
382 /*----------------------------------------------------------------------------*/
389 /*----------------------------------------------------------------------------*/
390 
391 void
392 cs_gwf_extra_op(const cs_cdo_connect_t *connect,
393  const cs_cdo_quantities_t *cdoq);
394 
395 /*----------------------------------------------------------------------------*/
417 /*----------------------------------------------------------------------------*/
418 
419 void
420 cs_gwf_extra_post(void *input,
421  int mesh_id,
422  int cat_id,
423  int ent_flag[5],
424  cs_lnum_t n_cells,
425  cs_lnum_t n_i_faces,
426  cs_lnum_t n_b_faces,
427  const cs_lnum_t cell_ids[],
428  const cs_lnum_t i_face_ids[],
429  const cs_lnum_t b_face_ids[],
430  const cs_time_step_t *time_step);
431 
432 /*----------------------------------------------------------------------------*/
433 
435 
436 #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:937
Definition: cs_gwf.h:95
time step descriptor
Definition: cs_time_step.h:64
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:1612
cs_gwf_tracer_t * cs_gwf_add_tracer(cs_gwf_tracer_model_t model, 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:814
void cs_gwf_log_setup(void)
Summary of the main cs_gwf_t structure.
Definition: cs_gwf.c:707
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:1353
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:606
cs_flag_t cs_gwf_tracer_model_t
Definition: cs_gwf_tracer.h:47
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
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:1514
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:238
Definition: cs_cdo_connect.h:76
Definition: cs_gwf.h:94
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
Definition: cs_cdo_quantities.h:124
Definition: cs_mesh.h:84
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:1104
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:786
bool cs_gwf_is_activated(void)
Check if the groundwater flow module has been activated.
Definition: cs_gwf.c:586
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:1429
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:1259
cs_gwf_tracer_t * cs_gwf_add_user_tracer(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:866
Definition: cs_gwf.h:105
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
Definition: cs_gwf.h:103
cs_gwf_model_bit_t
elemental modelling choice either from the physical viewpoint or the numerical viewpoint ...
Definition: cs_gwf.h:89
#define END_C_DECLS
Definition: cs_defs.h:496
unsigned short int cs_flag_t
Definition: cs_defs.h:309
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:1758
Definition: cs_gwf.h:96
cs_flag_t cs_property_type_t
Definition: cs_property.h:102
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:1076
cs_gwf_t * cs_gwf_destroy_all(void)
Free the main structure related to groundwater flows.
Definition: cs_gwf.c:668
cs_flag_t cs_gwf_model_t
Definition: cs_gwf.h:49
Definition: cs_gwf.h:97
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:252
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:909