9.2
general documentation
cs_gwf_tpf.h
Go to the documentation of this file.
1#ifndef CS_GWF_TPF_H
2#define CS_GWF_TPF_H
3
4/*============================================================================
5 * Main functions dedicated to the modelling of two-phase flows in a porous
6 * media. This media is always considered as unsaturated. Two sub-models are
7 * considered: miscible (MTPF) or immiscible (ITPF)
8 *============================================================================*/
9
10/*
11 This file is part of code_saturne, a general-purpose CFD tool.
12
13 Copyright (C) 1998-2026 EDF S.A.
14
15 This program is free software; you can redistribute it and/or modify it under
16 the terms of the GNU General Public License as published by the Free Software
17 Foundation; either version 2 of the License, or (at your option) any later
18 version.
19
20 This program is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23 details.
24
25 You should have received a copy of the GNU General Public License along with
26 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
27 Street, Fifth Floor, Boston, MA 02110-1301, USA.
28*/
29
30/*----------------------------------------------------------------------------*/
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
37
38/*============================================================================
39 * Macro definitions
40 *============================================================================*/
41
42/*============================================================================
43 * Type definitions
44 *============================================================================*/
45
46/*============================================================================
47 * Public function prototypes
48 *============================================================================*/
49
50/*----------------------------------------------------------------------------*/
51/*
52 * \brief Allocate and initialize the model context structure for two-phase
53 * flows in a porous media
54 *
55 * \param[in] model type of physical modelling
56 *
57 * \return a pointer to a new allocated structure
58 */
59/*----------------------------------------------------------------------------*/
60
63
64/*----------------------------------------------------------------------------*/
65/*
66 * \brief Free the context structure associated to the modelling of two-phase
67 * flows in a porous media
68 *
69 * \param[in, out] p_tpf pointer of pointer to the model context structure
70 */
71/*----------------------------------------------------------------------------*/
72
73void
75
76/*----------------------------------------------------------------------------*/
77/*
78 * \brief Define the relaxation property by value and set this value.
79 *
80 * \param[in] tpf pointer to the model context structure
81 * \param[in] val reference value used to set the relaxation property
82 */
83/*----------------------------------------------------------------------------*/
84
85void
87 double val);
88
89/*----------------------------------------------------------------------------*/
90/*
91 * \brief Define the relaxation property by value and set this value.
92 *
93 * \param[in] tpf pointer to the model context structure
94 * \param[in] func function pointer to a time function
95 * \param[in] func_context context related to this function
96 *
97 * \return a pointer to the created definition (\ref cs_xdef_t structure)
98 */
99/*----------------------------------------------------------------------------*/
100
101cs_xdef_t *
103 cs_time_func_t *func,
104 void *func_context);
105
106/*----------------------------------------------------------------------------*/
107/*
108 * \brief Log the setup related to the model context of two-phase flows.
109 * Common to the different sub-models relying on two-phase flows.
110 *
111 * \param[in] tpf pointer to the model context structure
112 */
113/*----------------------------------------------------------------------------*/
114
115void
117
118/*----------------------------------------------------------------------------*/
119/*
120 * \brief Initialize the model context according to the settings done inside
121 * the function cs_user_model()
122 * Case of a two-phase flows model in porous media
123 *
124 * \param[in, out] tpf pointer to the model context structure
125 * \param[in, out] perm_type type of permeability to handle
126 */
127/*----------------------------------------------------------------------------*/
128
129void
131 cs_property_type_t perm_type);
132
133/*----------------------------------------------------------------------------*/
134/*
135 * \brief Initial setup stage for two-phase flows in porous media. At this
136 * stage, all soils have been defined and equation parameters are set.
137 * Case of a miscible or immiscible model.
138 *
139 * \param[in] post_flag optional postprocessing request(s)
140 * \param[in, out] tpf pointer to the casted model context
141 */
142/*----------------------------------------------------------------------------*/
143
144void
146 cs_gwf_tpf_t *tpf);
147
148/*----------------------------------------------------------------------------*/
149/*
150 * \brief Last setup stage in the case of two-phase flows in a porous media
151 * (miscible or immiscible case)
152 *
153 * \param[in] connect pointer to a cs_cdo_connect_t structure
154 * \param[in] cdoq pointer to a cs_cdo_quantities_t structure
155 * \param[in] flag optional settings for the module
156 * \param[in, out] tpf pointer to the casted model context
157 */
158/*----------------------------------------------------------------------------*/
159
160void
162 const cs_cdo_quantities_t *cdoq,
163 cs_flag_t flag,
164 cs_gwf_tpf_t *tpf);
165
166/*----------------------------------------------------------------------------*/
167/*
168 * \brief Last setup stage in the case of two-phase flows in a porous media
169 * (miscible or immiscible case)
170 *
171 * \param[in] connect pointer to a cs_cdo_connect_t structure
172 * \param[in] cdoq pointer to a cs_cdo_quantities_t structure
173 * \param[in, out] tpf pointer to the casted model context
174 */
175/*----------------------------------------------------------------------------*/
176
177void
179 const cs_cdo_quantities_t *cdoq,
180 cs_gwf_tpf_t *tpf);
181
182/*----------------------------------------------------------------------------*/
183/*
184 * \brief Compute the new state for the groundwater flows module.
185 * Case of two-phase flows in porous media.
186 *
187 * \param[in] mesh pointer to a cs_mesh_t structure
188 * \param[in] connect pointer to a cs_cdo_connect_t structure
189 * \param[in] cdoq pointer to a cs_cdo_quantities_t structure
190 * \param[in] time_step pointer to a cs_time_step_t structure
191 * \param[in] option_flag calculation option related to the GWF module
192 * \param[in, out] tpf pointer to the model context structure
193 */
194/*----------------------------------------------------------------------------*/
195
196void
198 const cs_cdo_connect_t *connect,
199 const cs_cdo_quantities_t *cdoq,
200 const cs_time_step_t *time_step,
201 cs_flag_t option_flag,
202 cs_gwf_tpf_t *tpf);
203
204/*----------------------------------------------------------------------------*/
205/*
206 * \brief Operate a "current to previous" step on fields or arrays which have
207 * at least a storage of the previous step (time t^n when computing
208 * t^{n+1})
209 *
210 * \param[in] connect pointer to a cs_cdo_connect_t structure
211 * \param[in, out] tpf pointer to the casted model context
212 */
213/*----------------------------------------------------------------------------*/
214
215void
217 cs_gwf_tpf_t *tpf);
218
219/*----------------------------------------------------------------------------*/
220/*
221 * \brief Perform the update step in the case of a two-phase flow model in
222 * porous media (miscible or immiscible). To operate a "current to
223 * previous" step, one has to call the dedicated function \ref
224 * cs_gwf_tpf_current_to_previous()
225 *
226 * \param[in] mesh pointer to a cs_mesh_t structure
227 * \param[in] connect pointer to a cs_cdo_connect_t structure
228 * \param[in] cdoq pointer to a cs_cdo_quantities_t structure
229 * \param[in] time_eval time at which properties are evaluated if needed
230 * \param[in] option_flag calculation option related to the GWF module
231 * \param[in, out] tpf pointer to a TPF model context
232 */
233/*----------------------------------------------------------------------------*/
234
235void
237 const cs_cdo_connect_t *connect,
238 const cs_cdo_quantities_t *cdoq,
239 double time_eval,
240 cs_flag_t option_flag,
241 cs_gwf_tpf_t *tpf);
242
243/*----------------------------------------------------------------------------*/
244/*
245 * \brief Predefined extra-operations for the groundwater flow module in case
246 * of miscible or immiscible two-phase flows in porous media
247 *
248 * \param[in] connect pointer to a cs_cdo_connect_t structure
249 * \param[in] cdoq pointer to a cs_cdo_quantities_t structure
250 * \param[in] ts pointer to a cs_time_step_t struct.
251 * \param[in] post_flag requested quantities to be postprocessed
252 * \param[in, out] tpf pointer to the casted model context
253 */
254/*----------------------------------------------------------------------------*/
255
256void
258 const cs_cdo_quantities_t *cdoq,
259 const cs_time_step_t *ts,
260 cs_flag_t post_flag,
261 cs_gwf_tpf_t *tpf);
262
263/*----------------------------------------------------------------------------*/
264/*
265 * \brief Predefined post-processing output for the groundwater flow module
266 * in case of saturated two-phase flows (tpf) in porous media.
267 *
268 * \param[in] mesh_id id of the output mesh for the current call
269 * \param[in] n_cells local number of cells of post_mesh
270 * \param[in] cell_ids list of cells (0 to n-1)
271 * \param[in] post_flag flag gathering quantities to postprocess
272 * \param[in] abs_perm property for the absolute permeability
273 * \param[in] tpf pointer to the model context structure
274 * \param[in] connect pointer to additional connectivities for CDO
275 * \param[in] cdoq pointer to additional mesh quantities for CDO
276 * \param[in] time_step pointer to a cs_time_step_t struct.
277 */
278/*----------------------------------------------------------------------------*/
279
280void
281cs_gwf_tpf_extra_post(int mesh_id,
282 cs_lnum_t n_cells,
283 const cs_lnum_t cell_ids[],
284 cs_flag_t post_flag,
285 const cs_property_t *abs_perm,
286 const cs_gwf_tpf_t *tpf,
287 const cs_cdo_connect_t *connect,
288 const cs_cdo_quantities_t *cdoq,
289 const cs_time_step_t *time_step);
290
291/*----------------------------------------------------------------------------*/
292
293#endif /* CS_GWF_TPF_H */
time step descriptor
Definition: cs_time_step.h:60
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
unsigned short int cs_flag_t
Definition: cs_defs.h:334
cs_gwf_model_type_t
Type of system of equation(s) to consider for the physical modelling.
Definition: cs_gwf_param.h:123
void cs_gwf_tpf_update(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, double time_eval, cs_flag_t option_flag, cs_gwf_tpf_t *tpf)
Perform the update step in the case of a two-phase flow model in porous media (miscible or immiscible...
Definition: cs_gwf_tpf.cpp:3242
cs_xdef_t * cs_gwf_tpf_define_relax_pty_by_time_func(cs_gwf_tpf_t *tpf, cs_time_func_t *func, void *func_context)
Define the relaxation property by value and set this value.
Definition: cs_gwf_tpf.cpp:2530
void cs_gwf_tpf_finalize_setup(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_flag_t flag, cs_gwf_tpf_t *tpf)
Last setup stage in the case of two-phase flows in a porous media (miscible or immiscible case)
Definition: cs_gwf_tpf.cpp:2962
void cs_gwf_tpf_free(cs_gwf_tpf_t **p_tpf)
Free the context structure associated to the modelling of two-phase flows in a porous media.
Definition: cs_gwf_tpf.cpp:2463
void cs_gwf_tpf_define_relax_pty_by_value(cs_gwf_tpf_t *tpf, double val)
Define the relaxation property by value and set this value.
Definition: cs_gwf_tpf.cpp:2503
void cs_gwf_tpf_extra_post(int mesh_id, cs_lnum_t n_cells, const cs_lnum_t cell_ids[], cs_flag_t post_flag, const cs_property_t *abs_perm, const cs_gwf_tpf_t *tpf, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *time_step)
Predefined post-processing output for the groundwater flow module in case of saturated two-phase flow...
Definition: cs_gwf_tpf.cpp:3432
void cs_gwf_tpf_compute(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *time_step, cs_flag_t option_flag, cs_gwf_tpf_t *tpf)
Compute the new state for the groundwater flows module. Case of two-phase flows in porous media.
Definition: cs_gwf_tpf.cpp:3118
void cs_gwf_tpf_init_values(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_gwf_tpf_t *tpf)
Last setup stage in the case of two-phase flows in a porous media (miscible or immiscible case)
Definition: cs_gwf_tpf.cpp:3059
void cs_gwf_tpf_init_setup(cs_flag_t post_flag, cs_gwf_tpf_t *tpf)
Initial setup stage for two-phase flows in porous media. At this stage, all soils have been defined a...
Definition: cs_gwf_tpf.cpp:2768
void cs_gwf_tpf_current_to_previous(const cs_cdo_connect_t *connect, cs_gwf_tpf_t *tpf)
Operate a "current to previous" step on fields or arrays which have at least a storage of the previou...
Definition: cs_gwf_tpf.cpp:3201
void cs_gwf_tpf_extra_op(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_time_step_t *ts, cs_flag_t post_flag, cs_gwf_tpf_t *tpf)
Predefined extra-operations for the groundwater flow module in case of miscible or immiscible two-pha...
Definition: cs_gwf_tpf.cpp:3292
void cs_gwf_tpf_init(cs_gwf_tpf_t *tpf, cs_property_type_t perm_type)
Initialize the model context according to the settings done inside the function cs_user_model() Case ...
Definition: cs_gwf_tpf.cpp:2691
void cs_gwf_tpf_log_setup(cs_gwf_tpf_t *tpf)
Log the setup related to the model context of two-phase flows. Common to the different sub-models rel...
Definition: cs_gwf_tpf.cpp:2560
cs_gwf_tpf_t * cs_gwf_tpf_create(cs_gwf_model_type_t model)
Allocate and initialize the model context structure for two-phase flows in a porous media.
Definition: cs_gwf_tpf.cpp:2328
void() cs_time_func_t(double time, void *input, cs_real_t *retval)
Function which defines the evolution of a quantity according to the current time and any structure gi...
Definition: cs_param_types.h:172
cs_flag_t cs_property_type_t
Definition: cs_property.h:119
Definition: mesh.f90:26
Definition: cs_cdo_connect.h:57
Definition: cs_cdo_quantities.h:142
Structure to handle the modelling of miscible or immiscible two-phase flows in a porous media.
Definition: cs_gwf_hydraulic_model.h:328
Definition: cs_mesh.h:85
Structure associated to the definition of a property relying on the cs_xdef_t structure.
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:156