1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380 | /**
* @file scheme.hpp
* @author Olivier Delestre <olivierdelestre41@yahoo.fr> (2008)
* @author Christian Laguerre <christian.laguerre@math.cnrs.fr> (2012-2015)
* @version 1.07.01
* @date 2017-05-09
*
* @brief Numerical scheme
* @details
* Common part for all the numerical schemes.
*
* @copyright License Cecill-V2 \n
* <http://www.cecill.info/licences/Licence_CeCILL_V2-en.html>
*
* (c) CNRS - Universite d'Orleans - BRGM (France)
*/
/*
*
* This file is part of FullSWOF_2D software.
* <https://sourcesup.renater.fr/projects/fullswof-2d/>
*
* FullSWOF_2D = Full Shallow-Water equations for Overland Flow,
* in two dimensions of space.
* This software is a computer program whose purpose is to compute
* solutions for 2D Shallow-Water equations.
*
* LICENSE
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* <http://www.cecill.info>.
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*
******************************************************************************/
#ifndef PARAMETERS_HPP
#include "parameters.hpp"
#endif
#ifndef HYDROSTATIC_HPP
#include "hydrostatic.hpp"
#endif
#ifndef CHOICE_CONDITION_HPP
#include "choice_condition.hpp"
#endif
#ifndef CHOICE_FLUX_HPP
#include "choice_flux.hpp"
#endif
#ifndef CHOICE_FRICTION_HPP
#include "choice_friction.hpp"
#endif
#ifndef CHOICE_INFILTRATION_HPP
#include "choice_infiltration.hpp"
#endif
#ifndef CHOICE_INIT_TOPO_HPP
#include "choice_init_topo.hpp"
#endif
#ifndef CHOICE_INIT_HUV_HPP
#include "choice_init_huv.hpp"
#endif
#ifndef CHOICE_RAIN_HPP
#include "choice_rain.hpp"
#endif
#ifndef CHOICE_OUTPUT_HPP
#include "choice_output.hpp"
#endif
#ifndef CHOICE_RECONSTRUCTION
#include "choice_reconstruction.hpp"
#endif
#ifndef CHOICE_SAVE_SPECIFIC_POINTS_HPP
#include "choice_save_specific_points.hpp"
#endif
#ifndef SCHEME_HPP
#define SCHEME_HPP
/** @class Scheme
* @brief Numerical scheme
* @details
* Class that contains all the common declarations for the numerical schemes.
*/
class Scheme{
public:
/** @brief Constructor */
Scheme(Parameters &);
/** @brief Function to be specified in each numerical scheme */
virtual void calcul() = 0;
/** @brief Allocation of spatialized variables */
void allocation();
/** @brief Deallocation of variables */
void deallocation();
/** @brief Main calculation of the flux */
void maincalcflux(SCALAR,SCALAR, SCALAR, SCALAR , SCALAR, SCALAR &);
/** @brief Main calculation of the scheme */
void maincalcscheme(TAB &,TAB &,TAB &,TAB &,TAB &,TAB &,TAB &,TAB &,TAB &,TAB &,TAB &,SCALAR,SCALAR,int);
/** @brief Calls the boundary conditions and affects the boundary values */
void boundary(TAB &,TAB &,TAB &, SCALAR,const int , const int);
/** @brief Returns the Froude number */
SCALAR froude_number(TAB,TAB,TAB);
/** @brief Destructor*/
virtual ~Scheme();
protected :
/** Number of cells in space in the first (x) direction. */
const int NXCELL;
/** Number of cells in space in the second (y) direction. */
const int NYCELL;
/** Order of the numerical scheme. */
const int ORDER;
/** Final time.*/
const SCALAR T;
/** Number of times saved. */
const int NBTIMES;
/** Type of scheme (fixed cfl or time step). */
const int SCHEME_TYPE;
/** Space step in the first (x) direction.*/
const SCALAR DX;
/** Space step in the second (y) direction.*/
const SCALAR DY;
/** Value of the fixed cfl.*/
const SCALAR CFL_FIX;
/** Value of the fixed time step.*/
SCALAR DT_FIX;
/** Ratio dt/dx.*/
SCALAR tx;
/** Ratio dt/dy.*/
SCALAR ty;
/** Time to save the data (evolution file).*/
SCALAR T_output;
/** Time step to save the data (evolution file).*/
SCALAR dt_output;
/** Friction coefficient. */
const SCALAR FRICCOEF;
/** Imposed discharge on the left boundary.*/
map<int,SCALAR> & L_IMP_Q;
/** Imposed water height on the left boundary.*/
map<int,SCALAR> & L_IMP_H;
/** List of files and time values corresponding to the left boundary condition.*/
map<SCALAR,string> left_times_files;
/** Iterator pointing to a file and time value corresponding to the left boundary condition */
map<SCALAR,string>::const_iterator p_left_times_files;
/** Right boundary condition.*/
map<int,int> L_choice_bound;
/** Type (constant or file) of left boundary condition */
int Lbound_type;
/** This variable is true if the boundary has been updated */
bool is_Lbound_changed ;
/** Imposed discharge on the right boundary.*/
map<int,SCALAR> & R_IMP_Q;
/** Imposed water height on the right boundary.*/
map<int,SCALAR> & R_IMP_H;
/** List of files and time values corresponding to the right boundary condition.*/
map<SCALAR,string> right_times_files;
/** Iterator pointing to a file and time value corresponding to the right boundary condition */
map<SCALAR,string>::const_iterator p_right_times_files;
/** Right boundary condition.*/
map<int,int> R_choice_bound;
/** Type (constant or file) of right boundary condition */
int Rbound_type;
/** This variable is true if the boundary has been updated */
bool is_Rbound_changed ;
/** Imposed discharge on the bottom boundary.*/
map<int,SCALAR> & B_IMP_Q;
/** Imposed water height on the bottom boundary.*/
map<int,SCALAR> & B_IMP_H;
/** List of files and time values corresponding to the bottom boundary condition.*/
map<SCALAR,string> bottom_times_files;
/** Iterator pointing to a file and time value corresponding to the bottom boundary condition */
map<SCALAR,string>::const_iterator p_bottom_times_files;
/** Bottom boundary condition.*/
map<int,int> B_choice_bound;
/** Type (constant or file) of bottom boundary condition */
int Bbound_type;
/** This variable is true if the boundary has been updated */
bool is_Bbound_changed ;
/** Imposed discharge on the top boundary.*/
map<int,SCALAR> & T_IMP_Q;
/** Imposed water height on the top boundary.*/
map<int,SCALAR> & T_IMP_H;
/** List of files and time values corresponding to the top boundary condition.*/
map<SCALAR,string> top_times_files;
/** Iterator pointing to a file and time value corresponding to the top boundary condition */
map<SCALAR,string>::const_iterator p_top_times_files;
/** Top boundary condition.*/
map<int,int> T_choice_bound;
/** Type (constant or file) of top boundary condition */
int Tbound_type;
/** This variable is true if the boundary has been updated */
bool is_Tbound_changed ;
/** Parameters object to read the files of boundary conditions */
Parameters & fs2d_par;
/** Topography.*/
TAB z;
/** Water height.*/
TAB h;
/** First component of the velocity.*/
TAB u;
/** Second component of the velocity.*/
TAB v;
/** First component of the discharge.*/
TAB q1;
/** Second component of the discharge.*/
TAB q2;
/** Water height after one step of the scheme.*/
TAB hs;
/** First component of the velocity after one step of the scheme.*/
TAB us;
/** Second component of the velocity after one step of the scheme.*/
TAB vs;
/** First component of the discharge after one step of the scheme.*/
TAB qs1;
/** Second component of the discharge after one step of the scheme.*/
TAB qs2;
/** First component of the numerical flux along x. */
TAB f1;
/** Second component of the numerical flux along x. */
TAB f2;
/** Third component of the numerical flux along x. */
TAB f3;
/** First component of the numerical flux along y. */
TAB g1;
/** Second component of the numerical flux along y. */
TAB g2;
/** Third component of the numerical flux along y. */
TAB g3;
/** %Hydrostatic reconstruction on the left along x.*/
TAB h1left;
/** %Hydrostatic reconstruction on the right along x.*/
TAB h1right;
/** %Hydrostatic reconstruction on the left along y.*/
TAB h2left;
/** %Hydrostatic reconstruction on the right along y.*/
TAB h2right;
/** Variations of the topography along x.*/
TAB delz1;
/** Variations of the topography along y.*/
TAB delz2;
/** Difference between the reconstructed topographies on the left and on the right boundary of a cell along x.*/
TAB delzc1;
/** Difference between the reconstructed topographies on the left and on the right boundary of a cell along y.*/
TAB delzc2;
/** Water height on the cell located at the right of the boundary along x.*/
TAB h1r;
/** First component of the velocity on the cell located at the right of the boundary along x.*/
TAB u1r;
/** Second component of the velocity on the cell located at the right of the boundary along x.*/
TAB v1r;
/** Water height on the cell located at the left of the boundary along x.*/
TAB h1l;
/** First component of the velocity on the cell located at the left of the boundary along x.*/
TAB u1l;
/** Second component of the velocity on the cell located at the left of the boundary along x.*/
TAB v1l;
/** Water height on the cell located at the right of the boundary along y.*/
TAB h2r;
/** First component of the velocity on the cell located at the right of the boundary along y.*/
TAB u2r;
/** Second component of the velocity on the cell located at the right of the boundary along y.*/
TAB v2r;
/** Water height on the cell located at the left of the boundary along y.*/
TAB h2l;
/** First component of the velocity on the cell located at the left of the boundary along y.*/
TAB u2l;
/** Second component of the velocity on the cell located at the left of the boundary along y.*/
TAB v2l;
/** %Rain intensity.*/
TAB Rain;
/** Cumulative volume of infiltrated water (at each point).*/
TAB Vin_tot;
/** Beginning of timer.*/
time_t start;
/** End of timer.*/
time_t end;
/** Duration of the computation.*/
SCALAR timecomputation;
/** CPU time.*/
clock_t cpu_time;
/** Iterator for the loop in time.*/
int n;
/** Mean Froude number.*/
SCALAR Fr;
/** Time step in case of fixed cfl. */
SCALAR dt1;
/** Maximum time step in case of fixed cfl. */
SCALAR dt_max;
/** The current simulation time. */
SCALAR cur_time;
/** Space step in the first step in the method Heun.*/
SCALAR dt_first;
/** Cumulative volume of rain on the whole domain.*/
SCALAR Volrain_Tot;
/** Cumulative outflow volume at the boundary. */
SCALAR Total_volume_outflow;
/** Cumulative water height on the whole domain*/
SCALAR height_of_tot;
/** Cumulative height of infiltrated water on the whole domain*/
SCALAR height_Vinf_tot;
/** Cumulative volume of water infiltrated.*/
SCALAR Vol_inf_tot_cumul;
/** Cumulative streammed volume.*/
SCALAR Vol_of_tot;
/** The choice of the left boundary condition.*/
Choice_condition * Lbound;
/** The choice of the right boundary condition.*/
Choice_condition * Rbound;
/** The choice of the bottom boundary condition.*/
Choice_condition * Bbound;
/** The choice of the top boundary condition.*/
Choice_condition * Tbound;
/** The choice of output.*/
Choice_output * out;
/** Flag for the time step.*/
int verif;
/** The choice of output for the specific points.*/
Choice_save_specific_points *out_specific_points;
private:
/** The choice of the left boundary condition.*/
map<int,int> nchoice_Lbound;
/** The choice of the right boundary condition.*/
map<int,int> nchoice_Rbound;
/** The choice of the bottom boundary condition.*/
map<int,int> nchoice_Bbound;
/** The choice of the top boundary condition.*/
map<int,int> nchoice_Tbound;
/** The choice of rain.*/
Choice_rain * Prain;
Hydrostatic rec_hydro;
Choice_flux * flux_num;
Choice_friction * fric;
Choice_infiltration * I;
Choice_init_topo * topo;
Choice_init_huv * huv_init;
};
#endif
|