BG_Flood  0.8
Documentation (Work-in-progress)
Param.h
Go to the documentation of this file.
1 #ifndef PARAM_H
2 #define PARAM_H
3 
4 #include "General.h"
5 #include "Input.h"
6 
10 class Param {
11 public:
12 
13  //*General parameters
14  int test = -1; //-1: no test, 99: run all independent tests, X: run test X
15  double g = 9.81; // Acceleration of gravity in m.s-2
16  double rho = 1025.0; // Fluid density in kg.m-3
17  double eps = 0.0001; // Drying height in m (if h<eps, the surface is concidered dry)
18  double dt = 0.0; // Model time step in s.
19  double CFL = 0.5; // Current Freidrich Limiter criterium (between 0 and 1. Higher values may make the model unstable)
20  double theta = 1.3; // Minmod limiter parameter, theta in [1,2]. <br>Can be used to tune the momentum dissipation (theta=1 gives minmod the most dissipative limiter and theta = 2 gives superbee, the least dissipative).
21  double VelThreshold = -1.0; // Using Velocity threshold if the the velocuity exceeds that threshold. Advice value of 16.0 to use or negative value (-1) to turn off
22  int frictionmodel = 0; // Bottom friction model flag (-1: Manning model, 0: quadratic, 1: Smart model)
23  double cf = 0.0001; // Bottom friction coefficient for the model (if constant)
24  double Cd = 0.002; // Wind drag coefficient
25  bool windforcing = false; //not working yet
26  bool atmpforcing = false;
27  bool rainforcing = false;
28  bool infiltration = false;
29 
30  bool conserveElevation = false; //Switch to force the conservation of zs instead of h at the interface between coarse and fine blocks
31  bool wetdryfix = true; // Switch to remove wet/dry instability (i.e. true reoves instability and false leaves the model as is)
32 
33  bool leftbnd = false; // bnd is forced (i.e. not a wall or neuman)
34  bool rightbnd = false; // bnd is forced (i.e. not a wall or neuman)
35  bool topbnd = false; // bnd is forced (i.e. not a wall or neuman)
36  bool botbnd = false; // bnd is forced (i.e. not a wall or neuman)
37 
38  double Pa2m = 0.00009916; // Conversion between atmospheric pressure changes to water level changes in Pa (if unit is hPa then user should use 0.009916)
39  double Paref = 101300.0; // Reference pressure in Pa (if unit is hPa then user should use 1013.0)
40  double lat = 0.0; // Model latitude. This is ignored in spherical case
41  int GPUDEVICE = 0; // 0: first available GPU, -1: CPU single core, 2+: other GPU
42 
43  int doubleprecision = 0; // 0: float precision, 1: double precision (for the solver and math)
44 
45  int engine = 1; // 1: Buttinger-Kreuzhuber et al. 2019, 2: Kurganov (Popinet 2011), 3: KurganovATMP same as Kurganov but with atmospheric forcing terms
46 
47  //*Grid parameters
48  double dx = nan(""); // Grid resolution, in m for a metric grid or in decimal degree for a sperical grid.
49  double delta; // Grid resolution for the model. in Spherical coordinates this is dx * Radius*pi / 180.0
50  int nx = 0; // Initial/input grid size (number of nodes) in x direction
51  int ny = 0; //Initial/input grid size (number of nodes) in y direction
52  int nblk = 0; // Number of compute blocks
53  int blkwidth = 16; //Block width in number of cells
54  int blkmemwidth = 0; // Calculated in sanity check as blkwidth+2*halowidth
55  int blksize = 0; // Calculated in sanity check as blkmemwidth*blkmemwidth
56  int halowidth = 1; // Use a halo around the blocks default is 1 cell: the memory for each blk is 18x18 when blkwidth is 16
57 
58  double xo = nan(""); // Grid x origin in m or decimal degree (if not alter by the user, will be defined based on the topography/bathymetry input map)
59  double yo = nan(""); // Grid y origin im m or decimal degree (if not alter by the user, will be defined based on the topography/bathymetry input map)
60  double ymax = nan(""); // Grid ymax (if not alter by the user, will be defined based on the topography/bathymetry input map)
61  double xmax = nan(""); // Grid xmax (if not alter by the user, will be defined based on the topography/bathymetry input map)
62  double grdalpha = nan(""); // Grid rotation on Y axis from the North input in degrees but later converted to rad
63  int posdown = 0; // Flag for bathy input. Model requirement is positive up so if posdown ==1 then zb=zb*-1.0f
64  int spherical = 0; // Flag to switch the model in sperical (geographical) coordinates. This implies that the computation will occur in double precision.
65  double Radius = 6371220.; //Earth radius used to calculate sherical grid corrections in m.
66  double mask = 9999.0; //Mask any zb above this value. If the entire Block is masked then it is not allocated in the memory
67 
68  //*Adaptation
69  int initlevel = 0; //Initial level of grid adaptation (based on dx if defined by the user or on the resolution of the topography/bathymetry input)
70  int maxlevel = 0; //Maximum level for grid adaptation (overwrite the adaptation map if use)
71  int minlevel = 0; //Minumim level for grid adaptation (overwrite the adaptation map if use)
72  int nblkmem = 0;
73  int navailblk = 0;
74  double membuffer = 1.05; //Needs to allocate more memory than initially needed so adaptation can happen without memory reallocation
75 
76 
77 
78  //*Timekeeping
79  double outputtimestep = 0.0; //Number of seconds between netCDF outputs, 0.0 for no outputs
80  double endtime = 0.0; // Total runtime in s. It sould be smaller than any time dependant forcing and will be reduce to accomodate the time dependent boundaries conditions.
81  double totaltime = 0.0; // Time at the start of the simulation in s.
82  double dtinit = -1; // Maximum initial time steps in s (should be positive, advice 0.1 if dry domain initialement)
83  double dtmin = 0.0005; //Minimum accepted time steps in s (a lower value will be concidered a crash of the code, and stop the run)
84 
85  //* Initialisation
86  double zsinit = nan(""); //Init zs for cold start in m. If not specified by user and no bnd file = 1 then sanity check will set it to 0.0
87 
88  double zsoffset = nan(""); //Add a water level offset in m to initial conditions and boundaries (0.0 by default)
89 
90  std::string hotstartfile;
91  /*Allow to hotstart (or restart) the computation providing a netcdf file containing at least zb, h or zs, u and v
92  Default: None
93  */
94  //std::string deformfile;
95  int hotstep = 0; //Step to read if hotstart file has multiple steps (step and not (computation) time)
96  //other
99 
100 
101  //*Outputs
102  //std::string Bathymetryfile;// bathymetry file name
103  //inputmap Bathymetry;
104 
105 
106  //Timeseries output (save as a vector containing information for each Time Serie output)
107  std::vector<TSoutnode> TSnodesout;
108  /*Time serie output, giving a file name and a (x,y) position
109  (which will be converted to nearest grid position).
110  This keyword can be used multiple times to extract time series at different locations.
111  The data is stocked for each timestep and written by flocs.
112  The resulting file contains (t,zs,h,u,v)
113  Example: "TSnodesout = Offshore.txt,3101.00,4982.57" (*filename,x,y*)
114  Default: None
115  */
116 
117  std::string outfile = "Output.nc"; // Netcdf output file name (if it exists, a number will be happened to the file name to not overwrite it)
118  std::vector<std::string> outvars;
119  /*List of names of the variables to output (for 2D maps)
120  Supported variables = "zb", "zs", "u", "v", "h", "hmean", "zsmean", "umean", "vmean", "hUmean", "Umean", "hmax", "zsmax", "umax", "vmax", "hUmax", "Umax", "twet", "dhdx","dhdy","dzsdx","dzsdy","dudx","dudy","dvdx","dvdy","Fhu","Fhv","Fqux","Fqvy","Fquy","Fqvx","Su","Sv","dh","dhu","dhv","cf","Patm", "datmpdx","datmpdy","il","cl","hgw";
121  Example: "outvars = zs,h,u,v,zb,hmax,Umax;"
122  Default: "zb", "zs", "u", "v", "h"
123  */
124  double wet_threshold = 0.1; //in m. Limit to consider a cell wet for the twet output (duration of inundation (s))
125 
126  std::vector<outzoneP> outzone;
127  /*Zoned output (netcdf file), giving a file name and the position of two corner points
128  (which will be converted to a rectagle containing full blocks).
129  This keyword can be used multiple times to output maps of different areas.
130  Example: "outzone=zoomed.nc,5.3,5.4,0.5,0.8;" (*filename,x1,x2,y1,y2*)
131  Default: Full domain
132  */
133 
134  int maxTSstorage = 16384; //maximum strorage (nTSnodes*4*nTSsteps) before time series output are flushed to disk [2^14]
135 
136 
137 
138 
139  // Output switch controls
140  bool resetmax = false; //Switch to reset the "max" outputs after each output (reset if 1, no reset if 0)
141  bool outmax = false;
142  bool outmean = false;
143  //bool outvort = false;
144  bool outtwet = false;
145  //bool outU = false;
146 
147  // WARNING FOR DEBUGGING PURPOSE ONLY
148 // For debugging one can shift the output by 1 or -1 in the i and j direction.
149 // this will save the value in the halo to the output file allowing debugging of values there.
150  int outishift = 0; //DEBUGGING ONLY: allow cell shift (1 or -1) in x direction to visualise the halo around blocks in the output
151  int outjshift = 0; //DEBUGGING ONLY: allow cell shift (1 or -1) in y direction to visualise the halo around blocks in the output
152 
153 
154  //Rivers
155  //std::vector<River> Rivers; // empty vector to hold river location and discharge time series
156  int nrivers = 0;
157  int nblkriver = 0;
158 
159  // length of bnd blk, redundant from XForcing but useful
160  int nbndblkleft = 0;
161  int nbndblkright = 0;
162  int nbndblktop = 0;
163  int nbndblkbot = 0;
164 
165  int nmaskblk = 0;
166 
167 
168 
169  //*Netcdf parameters
170  int smallnc = 1; //Short integer conversion for netcdf outputs. 1: save as short integer for the netcdf file, if 0 then save all variables as float
171  float scalefactor = 0.01f; //Scale factor used for the short integer conversion for netcdf outputs. This follow the COARDS convention.
172  float addoffset = 0.0f; //Offset add during the short integer conversion for netcdf outputs (follow the COARDS convention)
173 
174 #ifdef USE_CATALYST
175  //* ParaView Catalyst parameters (SPECIAL USE WITH PARAVIEW)
176  int use_catalyst = 0; // Switch to use ParaView Catalyst
177  int catalyst_python_pipeline = 0; //Pipeline to use ParaView Catalyst
178  int vtk_output_frequency = 0; // Output frequency for ParaView Catalyst
179  double vtk_output_time_interval = 1.0; // Output time step for ParaView Catalyst
180  std::string vtk_outputfile_root = "bg_out"; //output file name for ParaView Catalyst
181  std::string python_pipeline = "coproc.py"; //python pipeline for ParaView Catalyst
182 #endif
183 
184 
185 
186 
187  // info of the mapped cf
188  //inputmap roughnessmap;
189 
190  //forcingmap windU;
191  //forcingmap windV;
192  //forcingmap atmP;
193  //forcingmap Rainongrid;
194 
195  // deformation forcing for tsunami generation
196  //std::vector<deformmap> deform;
197  double deformmaxtime = 0.0; // time (s) after which no deformation occurs (internal parameter to cut some of the loops)
198  bool rainbnd = false; // when false it force the rain foring on the bnd cells to be null.
199 
200  // This here should be stored in a structure at a later stage
201  std::string AdaptCrit;
204  int adaptmaxiteration = 20; // Maximum number of iteration for adaptation. default 20
205 
206 };
207 
208 
209 
210 // End of global definition
211 #endif
Definition: Param.h:10
int outjshift
Definition: Param.h:151
int spherical
Definition: Param.h:64
bool outtwet
Definition: Param.h:144
double outputtimestep
Definition: Param.h:79
int adaptmaxiteration
Definition: Param.h:204
int nbndblkbot
Definition: Param.h:163
std::string Adapt_arg3
Definition: Param.h:203
bool resetmax
Definition: Param.h:140
double xmax
Definition: Param.h:61
double ymax
Definition: Param.h:60
std::vector< std::string > outvars
Definition: Param.h:118
std::vector< TSoutnode > TSnodesout
Definition: Param.h:107
double dtmin
Definition: Param.h:83
double Cd
Definition: Param.h:24
int outishift
Definition: Param.h:150
int GPUDEVICE
Definition: Param.h:41
int halowidth
Definition: Param.h:56
double eps
Definition: Param.h:17
int nbndblkright
Definition: Param.h:161
double endtime
Definition: Param.h:80
double zsoffset
Definition: Param.h:88
size_t GPU_totalmem_byte
Definition: Param.h:98
size_t GPU_initmem_byte
Definition: Param.h:98
double wet_threshold
Definition: Param.h:124
double lat
Definition: Param.h:40
int maxTSstorage
Definition: Param.h:134
std::string Adapt_arg4
Definition: Param.h:203
std::string outfile
Definition: Param.h:117
int engine
Definition: Param.h:45
double mask
Definition: Param.h:66
int nrivers
Definition: Param.h:156
clock_t endcputime
Definition: Param.h:97
bool outmax
Definition: Param.h:141
int nblkriver
Definition: Param.h:157
int posdown
Definition: Param.h:63
int maxlevel
Definition: Param.h:70
double VelThreshold
Definition: Param.h:21
double cf
Definition: Param.h:23
int smallnc
Definition: Param.h:170
bool windforcing
Definition: Param.h:25
int doubleprecision
Definition: Param.h:43
double zsinit
Definition: Param.h:86
double rho
Definition: Param.h:16
int hotstep
Definition: Param.h:95
int ny
Definition: Param.h:51
double yo
Definition: Param.h:59
int blkmemwidth
Definition: Param.h:54
double totaltime
Definition: Param.h:81
bool leftbnd
Definition: Param.h:33
int frictionmodel
Definition: Param.h:22
bool rainbnd
Definition: Param.h:198
double membuffer
Definition: Param.h:74
int navailblk
Definition: Param.h:73
double Radius
Definition: Param.h:65
double Paref
Definition: Param.h:39
int nmaskblk
Definition: Param.h:165
double dt
Definition: Param.h:18
int minlevel
Definition: Param.h:71
float addoffset
Definition: Param.h:172
std::string Adapt_arg1
Definition: Param.h:203
int blkwidth
Definition: Param.h:53
double g
Definition: Param.h:15
double deformmaxtime
Definition: Param.h:197
std::string AdaptCrit
Definition: Param.h:201
int initlevel
Definition: Param.h:69
clock_t setupcputime
Definition: Param.h:97
int nblk
Definition: Param.h:52
bool atmpforcing
Definition: Param.h:26
bool wetdryfix
Definition: Param.h:31
int blksize
Definition: Param.h:55
std::string Adapt_arg2
Definition: Param.h:203
double xo
Definition: Param.h:58
double theta
Definition: Param.h:20
double CFL
Definition: Param.h:19
int * AdaptCrit_funct_pointer
Definition: Param.h:202
int nblkmem
Definition: Param.h:72
clock_t startcputime
Definition: Param.h:97
bool rainforcing
Definition: Param.h:27
int nbndblktop
Definition: Param.h:162
int nx
Definition: Param.h:50
double Pa2m
Definition: Param.h:38
double dtinit
Definition: Param.h:82
bool conserveElevation
Definition: Param.h:30
double delta
Definition: Param.h:49
std::vector< outzoneP > outzone
Definition: Param.h:126
int test
Definition: Param.h:14
int nbndblkleft
Definition: Param.h:160
bool rightbnd
Definition: Param.h:34
bool outmean
Definition: Param.h:142
float scalefactor
Definition: Param.h:171
bool botbnd
Definition: Param.h:36
double dx
Definition: Param.h:48
double grdalpha
Definition: Param.h:62
std::string hotstartfile
Definition: Param.h:90
bool infiltration
Definition: Param.h:28
bool topbnd
Definition: Param.h:35
std::string Adapt_arg5
Definition: Param.h:203