My Project
programmer's documentation
cs_gwf_tracer.h
Go to the documentation of this file.
1 #ifndef __CS_GWF_TRACER_H__
2 #define __CS_GWF_TRACER_H__
3 
4 /*============================================================================
5  * Set of main functions to handle soils in the groundwater flow module
6  * when using CDO schemes
7  *============================================================================*/
8 
9 /*
10  This file is part of Code_Saturne, a general-purpose CFD tool.
11 
12  Copyright (C) 1998-2019 EDF S.A.
13 
14  This program is free software; you can redistribute it and/or modify it under
15  the terms of the GNU General Public License as published by the Free Software
16  Foundation; either version 2 of the License, or (at your option) any later
17  version.
18 
19  This program is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22  details.
23 
24  You should have received a copy of the GNU General Public License along with
25  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26  Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 */
28 
29 /*----------------------------------------------------------------------------*/
30 
31 /*----------------------------------------------------------------------------
32  * Local headers
33  *----------------------------------------------------------------------------*/
34 
35 #include "cs_advection_field.h"
36 #include "cs_base.h"
37 #include "cs_equation.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*============================================================================
44  * Macro definitions
45  *============================================================================*/
46 
47 /*============================================================================
48  * Public function pointer prototypes
49  *============================================================================*/
50 
51 /*----------------------------------------------------------------------------*/
62 /*----------------------------------------------------------------------------*/
63 
64 typedef void
66  const cs_mesh_t *mesh,
67  const cs_cdo_connect_t *connect,
68  const cs_cdo_quantities_t *quant,
69  cs_real_t t_eval);
70 
71 /*----------------------------------------------------------------------------*/
77 /*----------------------------------------------------------------------------*/
78 
79 typedef void
81 
82 /*============================================================================
83  * Structure definitions
84  *============================================================================*/
85 
86 /* Type of predefined modelling for the groundwater flows */
87 typedef enum {
88 
89  CS_GWF_TRACER_STANDARD, /* Default behavior of a tracer in groundwater flow
90  module */
91  CS_GWF_TRACER_USER, /* User-defined behavior */
93 
95 
96 /* Set of parameters related to a tracer equation attached to a standard
97  modelling */
98 
99 typedef struct {
100 
101  /* Parameters (array of size: n_soils) */
102  double *rho_kd; // Bulk density times the distribution coefficient
103  double *alpha_l; // Longitudinal dispersivity
104  double *alpha_t; // Transversal dispersivity
105  double *wmd; // Water molecular diffusivity
106  double *reaction_rate; /* First order decay coefficient (related to the
107  reaction term) */
108 
109  /* Variables used for the update of physical properties */
112 
114 
115 /* Set of parameters describing a tracer */
116 typedef struct {
117 
118  int id; /* tracer id */
119  cs_equation_t *eq; /* related equation */
120 
121  /* Physical modelling adopted for this tracer */
123 
124  cs_field_t *diffusivity; /* NULL if no diffusion term is
125  build in the tracer equation */
126  int reaction_id; /* id related to the reaction
127  term in the tracer equation */
128 
129  /* Pointer to an input structure according to the model */
130  void *input;
131 
132  /* Pointers to functions */
135 
137 
138 /*============================================================================
139  * Public function pointer prototypes
140  *============================================================================*/
141 
142 /*----------------------------------------------------------------------------*/
150 /*----------------------------------------------------------------------------*/
151 
152 typedef void
154  const cs_cdo_quantities_t *quant,
155  cs_gwf_tracer_t *tracer);
156 
157 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 typedef void
168 
169 /*============================================================================
170  * Public function prototypes
171  *============================================================================*/
172 
173 /*----------------------------------------------------------------------------*/
191 /*----------------------------------------------------------------------------*/
192 
194 cs_gwf_tracer_init(int tracer_id,
195  const char *eq_name,
196  const char *var_name,
197  cs_adv_field_t *adv_field,
198  cs_gwf_tracer_model_t model);
199 
200 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
212 
213 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
229 void
231  const char *soil_name,
232  double wmd,
233  double alpha_l,
234  double alpha_t,
235  double distrib_coef,
236  double reaction_rate);
237 
238 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 
249 void
251 
252 /*----------------------------------------------------------------------------*/
260 /*----------------------------------------------------------------------------*/
261 
262 void
264  const cs_cdo_quantities_t *quant,
265  cs_gwf_tracer_t *tracer);
266 
267 /*----------------------------------------------------------------------------*/
268 
270 
271 #endif /* __CS_GWF_TRACER_H__ */
cs_gwf_tracer_t::update_properties
cs_gwf_tracer_update_t * update_properties
Definition: cs_gwf_tracer.h:133
input
static int input(void)
cs_gwf_std_tracer_input_t::alpha_t
double * alpha_t
Definition: cs_gwf_tracer.h:104
cs_equation_t
Main structure to handle the discretization and the resolution of an equation.
cs_gwf_std_tracer_input_t::moisture_content
cs_field_t * moisture_content
Definition: cs_gwf_tracer.h:111
cs_gwf_tracer_free
cs_gwf_tracer_t * cs_gwf_tracer_free(cs_gwf_tracer_t *tracer)
Free a cs_gwf_tracer_t structure.
Definition: cs_gwf_tracer.c:512
cs_gwf_std_tracer_input_t::wmd
double * wmd
Definition: cs_gwf_tracer.h:105
cs_gwf_tracer_t::free_input
cs_gwf_tracer_free_input_t * free_input
Definition: cs_gwf_tracer.h:134
cs_gwf_std_tracer_input_t
Definition: cs_gwf_tracer.h:99
cs_gwf_tracer_t::id
int id
Definition: cs_gwf_tracer.h:118
cs_gwf_std_tracer_input_t::reaction_rate
double * reaction_rate
Definition: cs_gwf_tracer.h:106
cs_gwf_tracer_standard_add_terms
void cs_gwf_tracer_standard_add_terms(cs_gwf_tracer_t *tracer)
Add terms to the algebraic system related to a tracer equation according to the settings....
Definition: cs_gwf_tracer.c:612
cs_gwf_std_tracer_input_t::rho_kd
double * rho_kd
Definition: cs_gwf_tracer.h:102
cs_gwf_tracer_free_input_t
void() cs_gwf_tracer_free_input_t(void *input)
Generic function to free the input of a tracer model.
Definition: cs_gwf_tracer.h:80
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_gwf_std_tracer_input_t::darcy_velocity_field
cs_field_t * darcy_velocity_field
Definition: cs_gwf_tracer.h:110
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
cs_gwf_tracer_t::input
void * input
Definition: cs_gwf_tracer.h:130
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
CS_GWF_TRACER_STANDARD
Definition: cs_gwf_tracer.h:89
cs_gwf_tracer_t::model
cs_gwf_tracer_model_t model
Definition: cs_gwf_tracer.h:122
cs_gwf_tracer_model_t
cs_gwf_tracer_model_t
Definition: cs_gwf_tracer.h:87
mesh
Definition: mesh.f90:26
cs_gwf_tracer_standard_setup
void cs_gwf_tracer_standard_setup(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_gwf_tracer_t *tracer)
Set the parameters related to a standard tracer equation.
Definition: cs_gwf_tracer.c:706
cs_gwf_tracer_t::diffusivity
cs_field_t * diffusivity
Definition: cs_gwf_tracer.h:124
cs_gwf_tracer_t::eq
cs_equation_t * eq
Definition: cs_gwf_tracer.h:119
cs_gwf_tracer_update_t
void() cs_gwf_tracer_update_t(void *input, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, cs_real_t t_eval)
Generic function to update the phisical properties related to a tracer modelling.
Definition: cs_gwf_tracer.h:65
cs_gwf_tracer_init
cs_gwf_tracer_t * cs_gwf_tracer_init(int tracer_id, const char *eq_name, const char *var_name, cs_adv_field_t *adv_field, cs_gwf_tracer_model_t model)
Create a new cs_gwf_tracer_t structure and initialize its members by default. Add a new equation rela...
Definition: cs_gwf_tracer.c:419
CS_GWF_N_TRACER_MODELS
Definition: cs_gwf_tracer.h:92
cs_cdo_quantities_t
Definition: cs_cdo_quantities.h:94
cs_gwf_std_tracer_input_t::alpha_l
double * alpha_l
Definition: cs_gwf_tracer.h:103
cs_advection_field.h
cs_cdo_connect_t
Definition: cs_cdo_connect.h:74
cs_gwf_tracer_t::reaction_id
int reaction_id
Definition: cs_gwf_tracer.h:126
CS_GWF_TRACER_USER
Definition: cs_gwf_tracer.h:91
cs_gwf_set_standard_tracer
void cs_gwf_set_standard_tracer(cs_gwf_tracer_t *tracer, const char *soil_name, double wmd, double alpha_l, double alpha_t, double distrib_coef, double reaction_rate)
Set a tracer for a specified soil when the tracer is attached to the default model.
Definition: cs_gwf_tracer.c:544
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_gwf_tracer_t
Definition: cs_gwf_tracer.h:116
cs_equation.h
cs_adv_field_t
Definition: cs_advection_field.h:149
cs_field_t
Field descriptor.
Definition: cs_field.h:124
cs_mesh_t
Definition: cs_mesh.h:63
cs_base.h