BG_Flood  0.1
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; // 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
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 (-1: Manning model, 0: quadratic, 1: Smart model)
23  double cf = 0.0001; // Bottom friction coefficient for flow model (if constant)
24  double Cd = 0.002; // Wind drag coefficient
25  double il = 0.0; //Initial Loss (if constant)
26  double cl = 0.0; //Continuous Loss (if constant)
27  bool windforcing = false; //not working yet
28  bool atmpforcing = false;
29  bool rainforcing = false;
30  bool infiltration = false;
31 
32  bool conserveElevation = false; //Switch to force the conservation of zs instead of h at the interface between coarse and fine blocks
33  bool wetdryfix = true; // Switch to remove wet/dry instability (i.e. true reoves instability and false leaves the model as is)
34 
35  bool leftbnd = false; // bnd is forced (i.e. not a wall or neuman)
36  bool rightbnd = false; // bnd is forced (i.e. not a wall or neuman)
37  bool topbnd = false; // bnd is forced (i.e. not a wall or neuman)
38  bool botbnd = false; // bnd is forced (i.e. not a wall or neuman)
39 
40  int aoibnd = 0; // Boundary type for AOI: 0=wall; 1 neumann; 3 absorbing
41 
42  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)
43  double Paref = 101300.0; // Reference pressure in Pa (if unit is hPa then user should use 1013.0)
44  double lat = 0.0; // Model latitude. This is ignored in spherical case
45  int GPUDEVICE = 0; // 0: first available GPU, -1: CPU single core, 2+: other GPU
46 
47  int doubleprecision = 0; // 0: float precision, 1: double precision
48 
49  int engine = 1; // 1: Buttinger-Kreuzhuber et al. 2019, 2: Kurganov (Popinet 2011), 3: KurganovATMP same as Kurganov but with atmospheric forcing terms
50 
51  //*Grid parameters
52  double dx = nan(""); // Grid resolution in the coordinate system unit in m.
53  double delta; // Grid resolution for the model. in Spherical coordinates this is dx * Radius*pi / 180.0
54  int nx = 0; // Initial grid size in x direction
55  int ny = 0; //Initial grid size in y direction
56  int nblk = 0; // Number of compute blocks
57  int blkwidth = 16; //Block width in number of cells
58  int blkmemwidth = 0; // Calculated in sanity check as blkwidth+2*halowidth
59  int blksize = 0; // Calculated in sanity check as blkmemwidth*blkmemwidth
60  int halowidth = 1; // Use a halo around the blocks default is 1 cell: the memory for each blk is 18x18 when blkwidth is 16
61 
62 
63  double xo = nan(""); // Grid x origin (if not alter by the user, will be defined based on the topography/bathymetry input map)
64  double yo = nan(""); // Grid y origin (if not alter by the user, will be defined based on the topography/bathymetry input map)
65  double ymax = nan(""); // Grid ymax (if not alter by the user, will be defined based on the topography/bathymetry input map)
66  double xmax = nan(""); // Grid xmax (if not alter by the user, will be defined based on the topography/bathymetry input map)
67  double grdalpha = nan(""); // Grid rotation Y axis from the North input in degrees but later converted to rad
68  int posdown = 0; // Flag for bathy input. Model requirement is positive up so if posdown ==1 then zb=zb*-1.0f
69  bool spherical = 0; // Flag for sperical coordinate (still in development)
70  double Radius = 6371220.; //Earth radius [m]
71  double mask = 9999.0; //Mask any zb above this value. If the entire Block is masked then it is not allocated in the memory
72 
73  //*Adaptation
74  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)
75  int maxlevel = -99999; //Maximum level for grid adaptation (overwrite the adaptation map if use)
76  int minlevel = -99999; //Minumim level for grid adaptation (overwrite the adaptation map if use)
77  int nblkmem = 0;
78  int navailblk = 0;
79  double membuffer = 1.05; //Needs to allocate more memory than initially needed so adaptation can happen without memory reallocation
80 
81 
82 
83  //*Timekeeping
84  double outputtimestep = 0.0; //Number of seconds between netCDF outputs, 0.0 for none
85  double endtime = std::numeric_limits<double>::max(); // Total runtime in s, will be calculated based on bnd input as min(length of the shortest time series, user defined) and should be shorter than any time-varying forcing
86  double totaltime = 0.0; // Total simulation time in s
87  double dtinit = -1; // Maximum initial time steps in s (should be positive, advice 0.1 if dry domain initialement)
88  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)
89  double bndrelaxtime = 3600.0; // Realxation time for absorbing boundary
90  double bndfiltertime = 60.0; // Filtering time for absorbing boundary
91 
92 
93  //* Initialisation
94  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
95 
96  double zsoffset = nan(""); //Add a water level offset in m to initial conditions and boundaries (0.0 by default)
97 
98  std::string hotstartfile;
99  /*Allow to hotstart (or restart) the computation providing a netcdf file containing at least zb, h or zs, u and v
100  Default: None
101  */
102  //std::string deformfile;
103  int hotstep = 0; //Step to read if hotstart file has multiple steps (step and not (computation) time)
104 
105 
106  double bndtaper = 0.0; // number of second to taper boundary values to smooth transition with initial conditions default is no tapering but 600s is good practice
107  //other
110 
111 
112  //*Outputs
113  //std::string Bathymetryfile;// bathymetry file name
114  //inputmap Bathymetry;
115 
116 
117  //Timeseries output (save as a vector containing information for each Time Serie output)
118  std::vector<TSoutnode> TSnodesout;
119  /*Time serie output, giving a file name and a (x,y) position
120  (which will be converted to nearest grid position).
121  This keyword can be used multiple times to extract time series at different locations.
122  The data is stocked for each timestep and written by flocs.
123  The resulting file contains (t,zs,h,u,v)
124  Example: "TSnodesout = Offshore.txt,3101.00,4982.57" (*filename,x,y*)
125  Default: None
126  */
127 
128  std::string outfile = "Output.nc"; // netcdf output file name
129  std::vector<std::string> outvars;
130  /*List of names of the variables to output (for 2D maps)
131  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";
132  Default: "zb", "zs", "u", "v", "h"
133  */
134  double wet_threshold = 0.1; //in m. Limit to consider a cell wet for the twet output (duration of inundation (s))
135 
136  std::vector<outzoneP> outzone;
137  /*Zoned output (netcdf file), giving a file name and the position of two corner points
138  (which will be converted to a rectagle containing full blocks).
139  This keyword can be used multiple times to output maps of different areas.
140  Example: "outzone=zoomed.nc,5.3,5.4,0.5,0.8;" (*filename,x1,x2,y1,y2*)
141  Default: Full domain
142  */
143 
144  int maxTSstorage = 16384; //maximum strorage (nTSnodes*4*nTSsteps) before time series output are flushed to disk [2^14]
145 
146 
147 
148 
149  // Output switch controls
150  bool resetmax = false; //Switch to reset the "max" outputs after each output
151  bool outmax = false;
152  bool outmean = false;
153  //bool outvort = false;
154  bool outtwet = false;
155  //bool outU = false;
156 
157  // WARNING FOR DEBUGGING PURPOSE ONLY
158 // For debugging one can shift the output by 1 or -1 in the i and j direction.
159 // this will save the value in the halo to the output file allowing debugging of values there.
160  int outishift = 0; //DEBUGGING ONLY: allow cell shift (1 or -1) in x direction to visualise the halo around blocks in the output
161  int outjshift = 0; //DEBUGGING ONLY: allow cell shift (1 or -1) in y direction to visualise the halo around blocks in the output
162 
163 
164  //Rivers
165  //std::vector<River> Rivers; // empty vector to hold river location and discharge time series
166  int nrivers = 0;
167  int nblkriver = 0;
168 
169  // length of bnd blk, redundant from XForcing but useful
170  int nbndblkleft = 0;
171  int nbndblkright = 0;
172  int nbndblktop = 0;
173  int nbndblkbot = 0;
174 
175  int nmaskblk = 0;
176 
177 
178 
179  //*Netcdf parameters
180  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
181  float scalefactor = 0.01f; //Scale factor used for the short integer conversion for netcdf outputs
182  float addoffset = 0.0f; //Offset add during the short integer conversion for netcdf outputs
183 
184 #ifdef USE_CATALYST
185  //* ParaView Catalyst parameters (SPECIAL USE WITH PARAVIEW)
186  int use_catalyst = 0; // Switch to use ParaView Catalyst
187  int catalyst_python_pipeline = 0; //Pipeline to use ParaView Catalyst
188  int vtk_output_frequency = 0; // Output frequency for ParaView Catalyst
189  double vtk_output_time_interval = 1.0; // Output time step for ParaView Catalyst
190  std::string vtk_outputfile_root = "bg_out"; //output file name for ParaView Catalyst
191  std::string python_pipeline = "coproc.py"; //python pipeline for ParaView Catalyst
192 #endif
193 
194 
195 
196 
197  // info of the mapped cf
198  //inputmap roughnessmap;
199 
200  //forcingmap windU;
201  //forcingmap windV;
202  //forcingmap atmP;
203  //forcingmap Rainongrid;
204 
205  // deformation forcing for tsunami generation
206  //std::vector<deformmap> deform;
207  double deformmaxtime = 0.0; // time (s) after which no deformation occurs (internal parameter to cut some of the loops)
208  bool rainbnd = false; // when false it force the rain foring on the bnd cells to be null.
209 
210  // This here should be stored in a structure at a later stage
211 
212  std::string AdaptCrit;
214 
216  int adaptmaxiteration = 20; // Maximum number of iteration for adaptation. default 20
217 
218  std::string reftime = ""; // Reference time string as yyyy-mm-ddTHH:MM:SS
219  std::string crs_ref = "no_crs"; //"PROJCS[\"NZGD2000 / New Zealand Transverse Mercator 2000\",GEOGCS[\"NZGD2000\",DATUM[\"New_Zealand_Geodetic_Datum_2000\",SPHEROID[\"GRS 1980\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4167\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",173],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",1600000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1],AXIS[\"Northing\",NORTH],AXIS[\"Easting\",EAST],AUTHORITY[\"EPSG\",\"2193\"]]";
220 
221 
222  bool savebyblk=true;
223 
224 };
225 
226 
227 
228 // End of global definition
229 #endif
const T & max(const T &a, const T &b)
Definition: Bas_Cart_CPU.cpp:127
Definition: Param.h:10
int outjshift
Definition: Param.h:161
bool outtwet
Definition: Param.h:154
double outputtimestep
Definition: Param.h:84
int adaptmaxiteration
Definition: Param.h:216
int nbndblkbot
Definition: Param.h:173
std::string Adapt_arg3
Definition: Param.h:215
std::string reftime
Definition: Param.h:218
bool resetmax
Definition: Param.h:150
double xmax
Definition: Param.h:66
double ymax
Definition: Param.h:65
bool spherical
Definition: Param.h:69
std::vector< std::string > outvars
Definition: Param.h:129
double bndfiltertime
Definition: Param.h:90
std::vector< TSoutnode > TSnodesout
Definition: Param.h:118
double dtmin
Definition: Param.h:88
double Cd
Definition: Param.h:24
int outishift
Definition: Param.h:160
int aoibnd
Definition: Param.h:40
int GPUDEVICE
Definition: Param.h:45
int halowidth
Definition: Param.h:60
double eps
Definition: Param.h:17
int nbndblkright
Definition: Param.h:171
double endtime
Definition: Param.h:85
double zsoffset
Definition: Param.h:96
size_t GPU_totalmem_byte
Definition: Param.h:109
size_t GPU_initmem_byte
Definition: Param.h:109
double wet_threshold
Definition: Param.h:134
double lat
Definition: Param.h:44
int maxTSstorage
Definition: Param.h:144
std::string Adapt_arg4
Definition: Param.h:215
std::string outfile
Definition: Param.h:128
double bndtaper
Definition: Param.h:106
int engine
Definition: Param.h:49
double mask
Definition: Param.h:71
int nrivers
Definition: Param.h:166
clock_t endcputime
Definition: Param.h:108
bool outmax
Definition: Param.h:151
int nblkriver
Definition: Param.h:167
double il
Definition: Param.h:25
int posdown
Definition: Param.h:68
int maxlevel
Definition: Param.h:75
double VelThreshold
Definition: Param.h:21
double cf
Definition: Param.h:23
int smallnc
Definition: Param.h:180
bool windforcing
Definition: Param.h:27
int doubleprecision
Definition: Param.h:47
double zsinit
Definition: Param.h:94
double rho
Definition: Param.h:16
int hotstep
Definition: Param.h:103
int ny
Definition: Param.h:55
double yo
Definition: Param.h:64
int blkmemwidth
Definition: Param.h:58
double totaltime
Definition: Param.h:86
bool leftbnd
Definition: Param.h:35
int frictionmodel
Definition: Param.h:22
bool rainbnd
Definition: Param.h:208
double membuffer
Definition: Param.h:79
int navailblk
Definition: Param.h:78
std::string crs_ref
Definition: Param.h:219
double Radius
Definition: Param.h:70
double Paref
Definition: Param.h:43
int nmaskblk
Definition: Param.h:175
double dt
Definition: Param.h:18
int minlevel
Definition: Param.h:76
float addoffset
Definition: Param.h:182
std::string Adapt_arg1
Definition: Param.h:215
int blkwidth
Definition: Param.h:57
double g
Definition: Param.h:15
double deformmaxtime
Definition: Param.h:207
std::string AdaptCrit
Definition: Param.h:212
int initlevel
Definition: Param.h:74
clock_t setupcputime
Definition: Param.h:108
bool savebyblk
Definition: Param.h:222
int nblk
Definition: Param.h:56
bool atmpforcing
Definition: Param.h:28
double cl
Definition: Param.h:26
bool wetdryfix
Definition: Param.h:33
int blksize
Definition: Param.h:59
std::string Adapt_arg2
Definition: Param.h:215
double xo
Definition: Param.h:63
double theta
Definition: Param.h:20
double CFL
Definition: Param.h:19
int * AdaptCrit_funct_pointer
Definition: Param.h:213
int nblkmem
Definition: Param.h:77
clock_t startcputime
Definition: Param.h:108
bool rainforcing
Definition: Param.h:29
int nbndblktop
Definition: Param.h:172
int nx
Definition: Param.h:54
double Pa2m
Definition: Param.h:42
double dtinit
Definition: Param.h:87
bool conserveElevation
Definition: Param.h:32
double bndrelaxtime
Definition: Param.h:89
double delta
Definition: Param.h:53
std::vector< outzoneP > outzone
Definition: Param.h:136
int test
Definition: Param.h:14
int nbndblkleft
Definition: Param.h:170
bool rightbnd
Definition: Param.h:36
bool outmean
Definition: Param.h:152
float scalefactor
Definition: Param.h:181
bool botbnd
Definition: Param.h:38
double dx
Definition: Param.h:52
double grdalpha
Definition: Param.h:67
std::string hotstartfile
Definition: Param.h:98
bool infiltration
Definition: Param.h:30
bool topbnd
Definition: Param.h:37
std::string Adapt_arg5
Definition: Param.h:215