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
109 m_strWaveInputMode = "fixed";
114 m_dWavePeriod = 10.0;
115
118
119 // Sediment and Erosion
123 m_nBeachTransportAtEdges = 1; // open
124 m_nBeachErosionEquation = 0; // CERC
125 m_dFineMedianSize = 0.0;
126 m_dSandMedianSize = 0.0;
128 m_dSedimentDensity = 2650.0;
130 m_dFineErosivity = 1.0;
131 m_dSandErosivity = 0.7;
132 m_dCoarseErosivity = 0.3;
133 m_dTransportKLS = 0.4;
134 m_dKamphuis = 5.0;
135 m_dBermHeight = 0.25;
136
137 // Cliff parameters
138 m_bCliffCollapse = true;
140 m_dNotchOverhang = 0.5;
141 m_dNotchBase = 0.3;
143 m_dTalusWidth = 15.0;
144 m_dMinTalusLength = 10.0;
145 m_dMinTalusHeight = 0.5;
146
147 // Flood parameters
148 m_bFloodInput = false;
153
154 // Sediment input parameters
155 m_bSedimentInput = false;
159
160 // Physics and Geometry
162 m_dNormalSpacing = 0.0;
163 m_dRandomFactor = 0.25;
164 m_dNormalLength = 130.0;
165 m_dStartDepthRatio = 30.0;
167
168 // Profile and Output Options
169 m_bSaveProfileData = false;
170 m_vecProfileNumbers.clear();
171 m_vecProfileTimesteps.clear();
175
176 // Cliff Edge Processing
180 m_dCliffSlopeLimit = 0.3;
181}
182
183//===============================================================================================================================
185//===============================================================================================================================
186vector<string> CConfiguration::GetRasterFiles() const
187{
188 // Case 11: Raster GIS files to output - expand "all" and "usual" keywords
189 vector<string> expandedFiles;
190
191 for (string const &fileSpec : m_vecRasterFiles)
192 {
193 string fileSpecLower = fileSpec;
194 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
195 fileSpecLower.begin(), ::tolower);
196
197 if (fileSpecLower == "all")
198 {
199 // Add all possible raster outputs (Case 11 "all" mode)
200 expandedFiles.insert(expandedFiles.end(),
201 {"suspended_sediment",
202 "avg_suspended_sediment",
203 "fine_uncons",
204 "fine_cons",
205 "sand_uncons",
206 "sand_cons",
207 "coarse_uncons",
208 "coarse_cons",
209 "sediment_top_elevation",
210 "top_elevation",
211 "sea_depth",
212 "wave_height",
213 "wave_orientation",
214 "wave_period",
215 "potential_platform_erosion",
216 "actual_platform_erosion",
217 "total_potential_platform_erosion",
218 "total_actual_platform_erosion",
219 "potential_beach_erosion",
220 "actual_beach_erosion",
221 "total_potential_beach_erosion",
222 "total_actual_beach_erosion",
223 "beach_deposition",
224 "total_beach_deposition",
225 "landform",
226 "local_cons_sediment_slope",
227 "slope",
228 "cliff",
229 "avg_sea_depth",
230 "avg_wave_height",
231 "avg_wave_orientation",
232 "beach_protection",
233 "basement_elevation",
234 "coastline",
235 "coast_normal",
236 "active_zone",
237 "cliff_collapse",
238 "total_cliff_collapse",
239 "cliff_collapse_deposition",
240 "total_cliff_collapse_deposition",
241 "polygon",
242 "potential_platform_erosion_mask",
243 "sea_mask",
244 "beach_mask",
245 "shadow_zone_codes",
246 "deep_water_wave_angle",
247 "deep_water_wave_height",
248 "deep_water_wave_period",
249 "polygon_uncons_sediment_up_or_down_drift",
250 "polygon_uncons_sediment_gain_or_loss"});
251 }
252 else if (fileSpecLower == "usual")
253 {
254 // Add usual/standard raster outputs (Case 11 "usual" mode)
255 expandedFiles.insert(expandedFiles.end(),
256 {"suspended_sediment",
257 "avg_suspended_sediment",
258 "fine_uncons",
259 "fine_cons",
260 "sand_uncons",
261 "sand_cons",
262 "coarse_uncons",
263 "coarse_cons",
264 "sediment_top_elevation",
265 "top_elevation",
266 "sea_depth",
267 "wave_height",
268 "wave_orientation",
269 "potential_platform_erosion",
270 "actual_platform_erosion",
271 "total_potential_platform_erosion",
272 "total_actual_platform_erosion",
273 "potential_beach_erosion",
274 "actual_beach_erosion",
275 "total_potential_beach_erosion",
276 "total_actual_beach_erosion",
277 "beach_deposition",
278 "total_beach_deposition",
279 "landform",
280 "local_cons_sediment_slope",
281 "slope",
282 "avg_wave_height",
283 "avg_wave_orientation",
284 "beach_protection",
285 "basement_elevation",
286 "active_zone",
287 "cliff_collapse",
288 "total_cliff_collapse",
289 "cliff_collapse_deposition",
290 "total_cliff_collapse_deposition",
291 "polygon",
292 "shadow_zone_codes",
293 "polygon_uncons_sediment_up_or_down_drift",
294 "polygon_uncons_sediment_gain_or_loss",
295 "coast_normal",
296 "coastline",
297 "fine_uncons",
298 "fine_cons",
299 "sand_uncons",
300 "sand_cons",
301 "coarse_uncons",
302 "coarse_cons"});
303 }
304 else if (fileSpecLower == "cmetools")
305 {
306 // Add usual/standard raster outputs (Case 11 "usual" mode)
307 expandedFiles.insert(expandedFiles.end(),
308 {"fine_uncons",
309 "fine_cons",
310 "sand_uncons",
311 "sand_cons",
312 "coarse_uncons",
313 "coarse_cons",
314 "top_elevation",
315 "sea_depth",
316 "wave_height",
317 "total_actual_platform_erosion",
318 "total_actual_beach_erosion",
319 "total_beach_deposition",
320 "landform",
321 "basement_elevation",
322 "active_zone",
323 "cliff_collapse",
324 "total_cliff_collapse",
325 "cliff_collapse_deposition",
326 "total_cliff_collapse_deposition",
327 "polygon",
328 "coast_normal",
329 "coastline"});
330 }
331 else if (fileSpecLower == "" or fileSpecLower == "none")
332 {
333 return expandedFiles;
334 }
335 else
336 {
337 // Regular file specification - add as-is
338 expandedFiles.push_back(fileSpec);
339 }
340 }
341
342 return expandedFiles;
343}
344
345//===============================================================================================================================
347//===============================================================================================================================
348vector<string> CConfiguration::GetVectorFiles() const
349{
350 // Case 16: Vector GIS files to output - expand "all" and "usual" keywords
351 vector<string> expandedFiles;
352
353 for (string const &fileSpec : m_vecVectorFiles)
354 {
355 string fileSpecLower = fileSpec;
356 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
357 fileSpecLower.begin(), ::tolower);
358
359 if (fileSpecLower == "all")
360 {
361 // Add all possible vector outputs (Case 16 "all" mode)
362 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", "wave_transect_points", "shadow_boundary", "downdrift_boundary", "deep_water_wave_angle", "wave_setup", "storm_surge", "run_up", "flood_line"});
363 }
364 else if (fileSpecLower == "usual")
365 {
366 // Add usual/standard vector outputs (Case 16 "usual" mode)
367 expandedFiles.insert(
368 expandedFiles.end(),
369 {"coast", "cliff_edge", "wave_angle", "normals", "invalid_normals",
370 "avg_wave_angle", "wave_energy", "mean_wave_energy",
371 "breaking_wave_height", "polygon", "cliff_notch",
372 "shadow_boundary", "downdrift_boundary", "deep_water_wave_angle"});
373 }
374 else if (fileSpecLower == "" or fileSpecLower == "none")
375 {
376 return expandedFiles;
377 }
378 else
379 {
380 // Regular file specification - add as-is
381 expandedFiles.push_back(fileSpec);
382 }
383 }
384
385 return expandedFiles;
386}
387//===============================================================================================================================
388
390//===============================================================================================================================
392{
393 // Case 18: Timeseries files to output - expand "all" and "usual" keywords
394 vector<string> expandedFiles;
395
396 for (string const &fileSpec : m_vecVectorFiles)
397 {
398 string fileSpecLower = fileSpec;
399 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
400 fileSpecLower.begin(), ::tolower);
401
402 if (fileSpecLower == "all")
403 {
404 // Add all possible vector outputs (Case 16 "all" mode)
405 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"});
406 }
407 else if (fileSpecLower == "" or fileSpecLower == "none")
408 {
409 return expandedFiles;
410 }
411 else
412 {
413 // Regular file specification - add as-is
414 expandedFiles.push_back(fileSpec);
415 }
416 }
417
418 return expandedFiles;
419}
420
422//===============================================================================================================================
423vector<string> CConfiguration::GetFloodFiles() const
424{
425 // Case 18: Timeseries files to output - expand "all" and "usual" keywords
426 vector<string> expandedFiles;
427
428 for (string const &fileSpec : m_vecVectorFiles)
429 {
430 string fileSpecLower = fileSpec;
431 std::transform(fileSpecLower.begin(), fileSpecLower.end(),
432 fileSpecLower.begin(), ::tolower);
433
434 if (fileSpecLower == "all")
435 {
436 // Add all possible vector outputs (Case 16 "all" mode)
437 expandedFiles.insert(expandedFiles.end(), {});
438 }
439 else if (fileSpecLower == "" or fileSpecLower == "none")
440 {
441 return expandedFiles;
442 }
443 else
444 {
445 // Regular file specification - add as-is
446 expandedFiles.push_back(fileSpec);
447 }
448 }
449
450 return expandedFiles;
451}
452
454{
455 // This needs to be lower case
456 std::string my_text{m_strOmitGridEdges};
457 std::transform(my_text.begin(), my_text.end(), my_text.begin(), ::tolower);
458 return my_text;
459}
double m_dCoarseMedianSize
double m_dSyntheticTransectSpacing
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_strWaveInputMode
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.