CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
configuration.cpp
Go to the documentation of this file.
1
12
13/* ==============================================================================================================================
14
15 This file is part of CoastalME, the Coastal Modelling Environment.
16
17 CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23==============================================================================================================================*/
24#include "cme.h"
25#include "configuration.h"
26// #include "simulation.h"
27#include <algorithm>
28#include <string>
29#include <cctype>
30
31//===============================================================================================================================
33//===============================================================================================================================
38
39//===============================================================================================================================
41//===============================================================================================================================
45
46//===============================================================================================================================
48//===============================================================================================================================
50{
51 // Run Information
52 m_strRunName = "cme";
55
56 // Simulation timing
57 m_strStartDateTime = "00-00-00 01/01/2000";
58 m_strDuration = "1 hour";
59 m_strTimestep = "1 hour";
60 m_vecSaveTimes.clear();
61 m_nRandomSeed = 0;
63
64 // GIS Output
66 m_strSaveDigitsMode = "sequential";
67 m_vecRasterFiles.clear();
68 m_vecRasterFiles.push_back("");
70 m_bWorldFile = false;
71 m_bScaleValues = false;
73 m_vecVectorFiles.clear();
74 m_vecVectorFiles.push_back("");
75 m_strVectorFormat = "ESRI Shapefile";
77 m_vecTimeSeriesFiles.push_back("");
78
79 // Grid and Coastline
85 m_dMaxLocalSlope = 1.0;
87
88 // Layers and Files
89 m_nNumLayers = 1;
94 m_vecConsFineFiles.clear();
95 m_vecConsSandFiles.clear();
101
102 // Hydrology
103 m_nWavePropagationModel = 1; // CShore
104 m_dSeawaterDensity = 1029.0;
106 // m_dFinalWaterLevel = 0.0;
107 m_bHasFinalWaterLevel = false;
108
113 m_dWavePeriod = 10.0;
114
117
118 // Sediment and Erosion
122 m_nBeachTransportAtEdges = 1; // open
123 m_nBeachErosionEquation = 0; // CERC
124 m_dFineMedianSize = 0.0;
125 m_dSandMedianSize = 0.0;
127 m_dSedimentDensity = 2650.0;
129 m_dFineErosivity = 1.0;
130 m_dSandErosivity = 0.7;
131 m_dCoarseErosivity = 0.3;
132 m_dTransportKLS = 0.4;
133 m_dKamphuis = 5.0;
134 m_dBermHeight = 0.25;
135
136 // Cliff parameters
137 m_bCliffCollapse = true;
139 m_dNotchOverhang = 0.5;
140 m_dNotchBase = 0.3;
142 m_dTalusWidth = 15.0;
143 m_dMinTalusLength = 10.0;
144 m_dMinTalusHeight = 0.5;
145
146 // Flood parameters
147 m_bFloodInput = false;
152
153 // Sediment input parameters
154 m_bSedimentInput = false;
158
159 // Physics and Geometry
161 m_dNormalSpacing = 0.0;
162 m_dRandomFactor = 0.25;
163 m_dNormalLength = 130.0;
164 m_dStartDepthRatio = 30.0;
165
166 // Profile and Output Options
167 m_bSaveProfileData = false;
168 m_vecProfileNumbers.clear();
169 m_vecProfileTimesteps.clear();
173
174 // Cliff Edge Processing
178 m_dCliffSlopeLimit = 0.3;
179}
180
181//===============================================================================================================================
183//===============================================================================================================================
184vector<string> CConfiguration::GetRasterFiles() const
185{
186 // Case 11: Raster GIS files to output - expand "all" and "usual" keywords
187 vector<string> expandedFiles;
188
189 for (string const &fileSpec : m_vecRasterFiles)
190 {
191 string fileSpecLower = fileSpec;
192 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
193 fileSpecLower.begin(), ::tolower);
194
195 if (fileSpecLower == "all")
196 {
197 // Add all possible raster outputs (Case 11 "all" mode)
198 expandedFiles.insert(expandedFiles.end(),
199 {"suspended_sediment",
200 "avg_suspended_sediment",
201 "fine_uncons",
202 "fine_cons",
203 "sand_uncons",
204 "sand_cons",
205 "coarse_uncons",
206 "coarse_cons",
207 "sediment_top_elevation",
208 "top_elevation",
209 "sea_depth",
210 "wave_height",
211 "wave_orientation",
212 "wave_period",
213 "potential_platform_erosion",
214 "actual_platform_erosion",
215 "total_potential_platform_erosion",
216 "total_actual_platform_erosion",
217 "potential_beach_erosion",
218 "actual_beach_erosion",
219 "total_potential_beach_erosion",
220 "total_actual_beach_erosion",
221 "beach_deposition",
222 "total_beach_deposition",
223 "landform",
224 "local_cons_sediment_slope",
225 "slope",
226 "cliff",
227 "avg_sea_depth",
228 "avg_wave_height",
229 "avg_wave_orientation",
230 "beach_protection",
231 "basement_elevation",
232 "coastline",
233 "coast_normal",
234 "active_zone",
235 "cliff_collapse",
236 "total_cliff_collapse",
237 "cliff_collapse_deposition",
238 "total_cliff_collapse_deposition",
239 "polygon",
240 "potential_platform_erosion_mask",
241 "sea_mask",
242 "beach_mask",
243 "shadow_zone_codes",
244 "deep_water_wave_angle",
245 "deep_water_wave_height",
246 "deep_water_wave_period",
247 "polygon_uncons_sediment_up_or_down_drift",
248 "polygon_uncons_sediment_gain_or_loss"});
249 }
250 else if (fileSpecLower == "usual")
251 {
252 // Add usual/standard raster outputs (Case 11 "usual" mode)
253 expandedFiles.insert(expandedFiles.end(),
254 {"suspended_sediment",
255 "avg_suspended_sediment",
256 "fine_uncons",
257 "fine_cons",
258 "sand_uncons",
259 "sand_cons",
260 "coarse_uncons",
261 "coarse_cons",
262 "sediment_top_elevation",
263 "top_elevation",
264 "sea_depth",
265 "wave_height",
266 "wave_orientation",
267 "potential_platform_erosion",
268 "actual_platform_erosion",
269 "total_potential_platform_erosion",
270 "total_actual_platform_erosion",
271 "potential_beach_erosion",
272 "actual_beach_erosion",
273 "total_potential_beach_erosion",
274 "total_actual_beach_erosion",
275 "beach_deposition",
276 "total_beach_deposition",
277 "landform",
278 "local_cons_sediment_slope",
279 "slope",
280 "avg_wave_height",
281 "avg_wave_orientation",
282 "beach_protection",
283 "basement_elevation",
284 "active_zone",
285 "cliff_collapse",
286 "total_cliff_collapse",
287 "cliff_collapse_deposition",
288 "total_cliff_collapse_deposition",
289 "polygon",
290 "shadow_zone_codes",
291 "polygon_uncons_sediment_up_or_down_drift",
292 "polygon_uncons_sediment_gain_or_loss",
293 "coast_normal",
294 "coastline",
295 "fine_uncons",
296 "fine_cons",
297 "sand_uncons",
298 "sand_cons",
299 "coarse_uncons",
300 "coarse_cons"});
301 }
302 else if (fileSpecLower == "cmetools")
303 {
304 // Add usual/standard raster outputs (Case 11 "usual" mode)
305 expandedFiles.insert(expandedFiles.end(),
306 {"fine_uncons",
307 "fine_cons",
308 "sand_uncons",
309 "sand_cons",
310 "coarse_uncons",
311 "coarse_cons",
312 "top_elevation",
313 "sea_depth",
314 "wave_height",
315 "total_actual_platform_erosion",
316 "total_actual_beach_erosion",
317 "total_beach_deposition",
318 "landform",
319 "basement_elevation",
320 "active_zone",
321 "cliff_collapse",
322 "total_cliff_collapse",
323 "cliff_collapse_deposition",
324 "total_cliff_collapse_deposition",
325 "polygon",
326 "coast_normal",
327 "coastline"});
328 }
329 else if (fileSpecLower == "" or fileSpecLower == "none")
330 {
331 return expandedFiles;
332 }
333 else
334 {
335 // Regular file specification - add as-is
336 expandedFiles.push_back(fileSpec);
337 }
338 }
339
340 return expandedFiles;
341}
342
343//===============================================================================================================================
345//===============================================================================================================================
346vector<string> CConfiguration::GetVectorFiles() const
347{
348 // Case 16: Vector GIS files to output - expand "all" and "usual" keywords
349 vector<string> expandedFiles;
350
351 for (string const &fileSpec : m_vecVectorFiles)
352 {
353 string fileSpecLower = fileSpec;
354 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
355 fileSpecLower.begin(), ::tolower);
356
357 if (fileSpecLower == "all")
358 {
359 // Add all possible vector outputs (Case 16 "all" mode)
360 expandedFiles.insert(expandedFiles.end(), {"coast", "cliff_edge", "wave_angle", "normals", "invalid_normals", "avg_wave_angle", "wave_energy", "mean_wave_energy", "breaking_wave_height", "coast_curvature", "polygon_node", "polygon", "cliff_notch", "shadow_boundary", "downdrift_boundary", "deep_water_wave_angle", "wave_setup", "storm_surge", "run_up", "flood_line"});
361 }
362 else if (fileSpecLower == "usual")
363 {
364 // Add usual/standard vector outputs (Case 16 "usual" mode)
365 expandedFiles.insert(
366 expandedFiles.end(),
367 {"coast", "cliff_edge", "wave_angle", "normals", "invalid_normals",
368 "avg_wave_angle", "wave_energy", "mean_wave_energy",
369 "breaking_wave_height", "polygon", "cliff_notch",
370 "shadow_boundary", "downdrift_boundary", "deep_water_wave_angle"});
371 }
372 else if (fileSpecLower == "" or fileSpecLower == "none")
373 {
374 return expandedFiles;
375 }
376 else
377 {
378 // Regular file specification - add as-is
379 expandedFiles.push_back(fileSpec);
380 }
381 }
382
383 return expandedFiles;
384}
385//===============================================================================================================================
386
388//===============================================================================================================================
390{
391 // Case 18: Timeseries files to output - expand "all" and "usual" keywords
392 vector<string> expandedFiles;
393
394 for (string const &fileSpec : m_vecVectorFiles)
395 {
396 string fileSpecLower = fileSpec;
397 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
398 fileSpecLower.begin(), ::tolower);
399
400 if (fileSpecLower == "all")
401 {
402 // Add all possible vector outputs (Case 16 "all" mode)
403 expandedFiles.insert(expandedFiles.end(), {"wave_setup", "wave_runup", "beach_change_net", "beach_deposition", "beach_erosion", "cliff_collapse_deposition", "cliff_collapse_erosion", "cliff_collapse_net", "platform_erosion", "sea_area", "suspended", "water_level"});
404 }
405 else if (fileSpecLower == "" or fileSpecLower == "none")
406 {
407 return expandedFiles;
408 }
409 else
410 {
411 // Regular file specification - add as-is
412 expandedFiles.push_back(fileSpec);
413 }
414 }
415
416 return expandedFiles;
417}
418
420//===============================================================================================================================
421vector<string> CConfiguration::GetFloodFiles() const
422{
423 // Case 18: Timeseries files to output - expand "all" and "usual" keywords
424 vector<string> expandedFiles;
425
426 for (string const &fileSpec : m_vecVectorFiles)
427 {
428 string fileSpecLower = fileSpec;
429 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
430 fileSpecLower.begin(), ::tolower);
431
432 if (fileSpecLower == "all")
433 {
434 // Add all possible vector outputs (Case 16 "all" mode)
435 expandedFiles.insert(expandedFiles.end(), {});
436 }
437 else if (fileSpecLower == "" or fileSpecLower == "none")
438 {
439 return expandedFiles;
440 }
441 else
442 {
443 // Regular file specification - add as-is
444 expandedFiles.push_back(fileSpec);
445 }
446 }
447
448 return expandedFiles;
449}
450
452{
453 // This needs to be lower case
454 std::string my_text{m_strOmitGridEdges};
455 std::transform(my_text.begin(), my_text.end(), my_text.begin(), ::tolower);
456 return my_text;
457}
double m_dCoarseMedianSize
string m_strSedimentInputLocation
string GetOmitGridEdges() const
double m_dMinTalusHeight
double m_dSedimentDensity
double m_dPlatformErosionResistance
bool m_bCoastPlatformErosion
double m_dSeawaterDensity
bool m_bCSVPerTimestepResults
double m_dNormalSpacing
double m_dCliffSlopeLimit
double m_dDeepWaterWaveHeight
string m_strVectorFormat
vector< string > GetTimeSeriesFiles() const
Get time series files with keyword expansion support.
vector< string > GetFloodFiles() const
Get time series files with keyword expansion support.
vector< string > m_vecConsCoarseFiles
string m_strSuspendedSedFile
CConfiguration()
Constructor.
string m_strStartDateTime
double m_dInitialWaterLevel
double m_dGravitationalAcceleration
bool m_bSaveParallelProfiles
double m_dSandErosivity
double m_dSandMedianSize
string m_strLandformFile
int m_nCoastlineSmoothingWindow
vector< string > m_vecUnconsSandFiles
int m_nWavePropagationModel
string m_strInterventionClassFile
vector< string > m_vecTimeSeriesFiles
double m_dDeepWaterWaveOrientation
string m_strOmitGridEdges
double m_dNotchOverhang
double m_dMinTalusLength
bool m_bBeachSedimentTransport
vector< string > m_vecRasterFiles
string m_strWaveStationDataFile
string m_strBasementDEMFile
~CConfiguration()
Destructor.
double m_dBeachSedimentPorosity
vector< string > m_vecConsSandFiles
string m_strSedimentInputType
vector< string > m_vecVectorFiles
string m_strFloodCoastline
int m_nCliffEdgePolynomialOrder
vector< string > m_vecUnconsFineFiles
bool m_bOutputErosionPotential
string m_strFloodInputLocation
vector< double > m_vecSliceElevations
int m_nProfileSmoothingWindow
vector< int > m_vecProfileNumbers
string m_strTideDataFile
vector< string > m_vecSaveTimes
double m_dFineErosivity
int m_nCliffEdgeSmoothingWindow
double m_dCoarseErosivity
double m_dBreakingWaveRatio
string m_strWaveHeightTimeSeries
double m_dCliffDepositionA
vector< unsigned long > m_vecProfileTimesteps
vector< string > GetRasterFiles() const
Get raster files with keyword expansion support.
double m_dFineMedianSize
double m_dStartDepthRatio
void InitializeDefaults()
Initialize all parameters with default values.
string m_strFloodLocations
string m_strSaveDigitsMode
double m_dCliffErosionResistance
double m_dMaxBeachElevation
vector< string > GetVectorFiles() const
Get vector files with keyword expansion support.
string m_strSedimentInputDetails
vector< string > m_vecConsFineFiles
bool m_bUseSystemTimeForSeed
double m_dMaxLocalSlope
vector< string > m_vecUnconsCoarseFiles
string m_strInterventionHeightFile
string m_strRasterFormat
This file contains global definitions for CoastalME.
Unified configuration class for CoastalME simulation parameters.