CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
write_output.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 <assert.h>
25
26#include <ctime>
27using std::localtime;
28
29#include <ios>
30using std::fixed;
31using std::scientific;
32
33#include <iostream>
34using std::cerr;
35using std::cout;
36using std::endl;
37using std::ios;
38using std::noshowpos;
39using std::showpos;
40
41#include <iomanip>
42using std::put_time;
43using std::resetiosflags;
44using std::setfill;
45using std::setiosflags;
46using std::setprecision;
47using std::setw;
48
49#include <sstream>
50using std::stringstream;
51
52#include <string>
53using std::to_string;
54
55#include "cme.h"
56#include "simulation.h"
57#include "coast.h"
58#include "interpolate.h"
59
60//===============================================================================================================================
62//===============================================================================================================================
64{
65 // Set the Out file output format to fixed point
66 OutStream << fixed;
67
68 // Start outputting stuff
69 OutStream << PROGRAM_NAME << " for " << PLATFORM << " " << strGetBuild() << " on " << strGetComputerName() << endl << endl;
70
71 LogStream << PROGRAM_NAME << " for " << PLATFORM << " " << strGetBuild() << " on " << strGetComputerName() << endl << endl;
72
73 // ----------------------------------------------- Run Information ----------------------------------------------------------
74 OutStream << "RUN DETAILS" << endl;
75 OutStream << " Name \t: " << m_strRunName << endl;
76 OutStream << " Run started \t: " << put_time(localtime(&m_tSysStartTime), "%T %A %d %B %Y") << endl;
77
78 // Same info. for Log file
79 LogStream << m_strRunName << " run started at " << put_time(localtime(&m_tSysStartTime), "%T on %A %d %B %Y") << endl
80 << endl;
81
82 // Contine with Out file
83 OutStream << " Initialization file \t: "
84#ifdef _WIN32
86#else
87 << m_strCMEIni << endl;
88#endif
89
90 OutStream << " Input data read from \t: "
91#ifdef _WIN32
93#else
94 << m_strDataPathName << endl;
95#endif
96
97 OutStream << " Main output file (this file) \t: "
98#ifdef _WIN32
100#else
101 << m_strOutFile << endl;
102#endif
103
104 LogStream << "Main output file \t: "
105#ifdef _WIN32
107#else
108 << m_strOutFile << endl;
109#endif
110
111 OutStream << " Log file \t: "
112#ifdef _WIN32
114#else
115 << m_strOutFile << endl;
116#endif
117
118 LogStream << "Log file (this file) \t: "
119#ifdef _WIN32
121#else
122 << m_strOutFile << endl;
123#endif
124
125 OutStream << " Level of Log detail \t: ";
126
128 OutStream << "0 (least detail)";
129
131 OutStream << "1 (least detail)";
132
134 OutStream << "2 (medium detail)";
135
137 OutStream << "3 (high detail)";
138
139 else if (m_nLogFileDetail == LOG_FILE_ALL)
140 OutStream << "4 (everything)";
141
142 OutStream << endl;
143
144 LogStream << "Level of Log detail \t: ";
145
147 LogStream << "1 (least detail)";
148
150 LogStream << "2 (medium detail)";
151
153 LogStream << "3 (high detail)";
154
155 else if (m_nLogFileDetail == LOG_FILE_ALL)
156 LogStream << "4 (everything)";
157
158 LogStream << endl << endl;
159
160 OutStream << " Simulation start date/time \t: ";
161 // hh:mm:ss dd/mm/yyyy
162 char cPrev = OutStream.fill('0');
163 OutStream << setw(2) << m_nSimStartHour << COLON << setw(2) << m_nSimStartMin << COLON << setw(2) << m_nSimStartSec << SPACE << setw(2) << m_nSimStartDay << SLASH << setw(2) << m_nSimStartMonth << SLASH << setw(2) << m_nSimStartYear << endl;
164 OutStream.fill(cPrev);
165
166 OutStream << " Duration of simulation \t: ";
168
169 if (m_bSaveRegular)
170 {
171 // Saves at regular intervals
172 OutStream << " Time between saves \t: ";
174 }
175
176 else
177 {
178 // Saves at user-defined intervals
179 OutStream << " Saves at \t: ";
180 string strTmp;
181
182 for (int i = 0; i < m_nUSave; i++)
183 {
184 strTmp.append(strDispSimTime(m_dUSaveTime[i]));
185 strTmp.append(", ");
186 }
187
188 // Also at end of run
189 strTmp.append(strDispSimTime(m_dSimDuration));
190 OutStream << strTmp << endl;
191 }
192
193 OutStream << " Raster GIS output format \t: " << m_strGDALRasterOutputDriverLongname << endl;
194 OutStream << " Maximum number of GIS Save Number digits \t: " << m_nGISMaxSaveDigits << endl;
195 OutStream << " GIS Save Numbers sequential (S) or iteration number (I) \t: " << (m_bGISSaveDigitsSequential ? "S" : "I") << endl;
196 OutStream << " Random number seeds \t: ";
197 {
198 for (int i = 0; i < NUMBER_OF_RNGS; i++)
199 OutStream << m_ulRandSeed[i] << '\t';
200 }
201 OutStream << endl;
202
203 OutStream << " Raster GIS output format \t: " << m_strGDALRasterOutputDriverLongname << endl;
204 OutStream << " Raster output values scaled (if needed) \t: " << (m_bScaleRasterOutput ? "Y" : "N") << endl;
205 OutStream << " Raster world files created (if needed) \t: " << (m_bWorldFile ? "Y" : "N") << endl;
206 OutStream << " Raster GIS files saved \t: " << strListRasterFiles() << endl;
207
208 if (m_bSliceSave)
209 {
210 OutStream << fixed << setprecision(3);
211 OutStream << " Elevations for 'slice' raster output files \t: ";
212
213 for (int i = 0; i < static_cast<int>(m_VdSliceElev.size()); i++)
214 OutStream << m_VdSliceElev[i] << " ";
215
216 OutStream << endl;
217 }
218
219 OutStream << " Vector GIS output format \t: " << m_strVectorGISOutFormat << endl;
220 OutStream << " Vector GIS files saved \t: " << strListVectorFiles() << endl;
221 OutStream << " Output file (this file) \t: "
222#ifdef _WIN32
224#else
225 << m_strOutFile << endl;
226#endif
227 OutStream << " Log file \t: "
228#ifdef _WIN32
230#else
231 << m_strLogFile << endl;
232#endif
233
234 OutStream << " Optional time series files saved \t: " << strListTSFiles() << endl;
235
236 OutStream << " Coastline vector smoothing algorithm \t: ";
237
238 switch (m_nCoastSmooth)
239 {
240 case SMOOTH_NONE:
241 {
242 OutStream << "none";
243 break;
244 }
245
247 {
248 OutStream << "running mean";
249 break;
250 }
251
253 {
254 OutStream << "Savitzky-Golay";
255 break;
256 }
257 }
258
259 OutStream << endl;
260
261 OutStream << " Grid edge(s) to omit when searching for coastline \t: " << (m_bOmitSearchNorthEdge ? "N" : "") << (m_bOmitSearchSouthEdge ? "S" : "") << (m_bOmitSearchWestEdge ? "W" : "") << (m_bOmitSearchEastEdge ? "E" : "") << endl;
262
264 {
265 OutStream << " Size of coastline vector smoothing window \t: " << m_nCoastSmoothWindow << endl;
266
268 OutStream << " Savitzky-Golay coastline smoothing polynomial order \t: " << m_nSavGolCoastPoly << endl;
269 }
270
271 OutStream << " Size of profile slope smoothing window \t: " << m_nProfileSmoothWindow << endl;
272 OutStream << resetiosflags(ios::floatfield);
273 OutStream << fixed << setprecision(2);
274 OutStream << " Max local slope on profile (m/m) \t: " << m_dProfileMaxSlope << endl;
275 OutStream << " Vertical tolerance for beach to be included in smoothing \t: " << m_dMaxBeachElevAboveSWL << " m" << endl;
276 OutStream << endl;
277
278 // --------------------------------------------------- Raster GIS stuff -------------------------------------------------------
279 OutStream << "Raster GIS Input Files" << endl;
280 OutStream << " Basement DEM file \t: "
281#ifdef _WIN32
283#else
285#endif
286 OutStream << " Basement DEM driver code \t: " << m_strGDALBasementDEMDriverCode << endl;
287 OutStream << " GDAL basement DEM driver description \t: " << m_strGDALBasementDEMDriverDesc << endl;
288 OutStream << " GDAL basement DEM projection \t: " << m_strGDALBasementDEMProjection << endl;
289 OutStream << " GDAL basement DEM data type \t: " << m_strGDALBasementDEMDataType << endl;
290 OutStream << " Grid size (X by Y) \t: " << m_nXGridSize << " by " << m_nYGridSize << endl;
291 OutStream << resetiosflags(ios::floatfield);
292 OutStream << fixed << setprecision(1);
293 OutStream << "*Coordinates of NW corner of grid (external CRS) \t: " << m_dNorthWestXExtCRS << ", " << m_dNorthWestYExtCRS << endl;
294 OutStream << "*Coordinates of SE corner of grid (external CRS) \t: " << m_dSouthEastXExtCRS << ", " << m_dSouthEastYExtCRS << endl;
295 OutStream << "*Cell size \t: " << m_dCellSide << " m" << endl;
296 OutStream << "*Grid area \t: " << m_dExtCRSGridArea << " m^2" << endl;
297 OutStream << fixed << setprecision(2);
298 OutStream << "*Grid area \t: " << m_dExtCRSGridArea * 1e-6 << " km^2" << endl;
299
300 if (! m_strInitialLandformFile.empty())
301 {
302 OutStream << " Initial Landform Class file \t: " << m_strInitialLandformFile << endl;
303 OutStream << " GDAL Initial Landform Class file driver code \t: " << m_strGDALLDriverCode << endl;
304 OutStream << " GDAL Initial Landform Class file driver description \t: " << m_strGDALLDriverDesc << endl;
305 OutStream << " GDAL Initial Landform Class file projection \t: " << m_strGDALLProjection << endl;
306 OutStream << " GDAL Initial Landform Class file data type \t: " << m_strGDALLDataType << endl;
307 OutStream << endl;
308 }
309
310 if (! m_strInterventionClassFile.empty())
311 {
312 OutStream << " Intervention Class file \t: " << m_strInterventionClassFile << endl;
313 OutStream << " GDAL Intervention Class file driver code \t: " << m_strGDALICDriverCode << endl;
314 OutStream << " GDAL Intervention Class file driver description \t: " << m_strGDALICDriverDesc << endl;
315 OutStream << " GDAL Intervention Class file projection \t: " << m_strGDALICProjection << endl;
316 OutStream << " GDAL Intervention Class file data type \t: " << m_strGDALICDataType << endl;
317 OutStream << endl;
318 }
319
320 if (! m_strInterventionHeightFile.empty())
321 {
322 OutStream << " Intervention Height file \t: " << m_strInterventionHeightFile << endl;
323 OutStream << " GDAL Intervention Height file driver code \t: " << m_strGDALIHDriverCode << endl;
324 OutStream << " GDAL Intervention Height file driver description \t: " << m_strGDALIHDriverDesc << endl;
325 OutStream << " GDAL Intervention Height file projection \t: " << m_strGDALIHProjection << endl;
326 OutStream << " GDAL Intervention Height file data type \t: " << m_strGDALIHDataType << endl;
327 OutStream << endl;
328 }
329
330 if (! m_strInitialSuspSedimentFile.empty())
331 {
332 OutStream << " Initial Susp Sediment file \t: " << m_strInitialSuspSedimentFile << endl;
333 OutStream << " GDAL Initial Susp Sediment file driver code \t: " << m_strGDALISSDriverCode << endl;
334 OutStream << " GDAL Initial Susp Sediment file driver description \t: " << m_strGDALISSDriverDesc << endl;
335 OutStream << " GDAL Initial Susp Sediment file projection \t: " << m_strGDALISSProjection << endl;
336 OutStream << " GDAL Initial Susp Sediment file data type \t: " << m_strGDALISSDataType << endl;
337 OutStream << endl;
338 }
339
340 for (int i = 0; i < m_nLayers; i++)
341 {
342 if (m_nLayers == 1)
343 OutStream << " Only one layer" << endl;
344
345 else
346 OutStream << " Layer " << i << (i == 0 ? "(Top)" : "") << (i == m_nLayers - 1 ? "(Bottom)" : "") << endl;
347
349 {
350 OutStream << " Initial Fine Uncons Sediment file \t: " << m_VstrInitialFineUnconsSedimentFile[i] << endl;
351 OutStream << " GDAL Initial Fine Uncons Sediment file driver code \t: " << m_VstrGDALIUFDriverCode[i] << endl;
352 OutStream << " GDAL Initial Fine Uncons Sediment file driver desc \t: " << m_VstrGDALIUFDriverDesc[i] << endl;
353 OutStream << " GDAL Initial Fine Uncons Sediment file projection \t: " << m_VstrGDALIUFProjection[i] << endl;
354 OutStream << " GDAL Initial Fine Uncons Sediment file data type \t: " << m_VstrGDALIUFDataType[i] << endl;
355 OutStream << endl;
356 }
357
359 {
360 OutStream << " Initial Sand Uncons Sediment file \t: " << m_VstrInitialSandUnconsSedimentFile[i] << endl;
361 OutStream << " GDAL Initial Sand Uncons Sediment file driver code \t: " << m_VstrGDALIUSDriverCode[i] << endl;
362 OutStream << " GDAL Initial Sand Uncons Sediment file driver desc \t: " << m_VstrGDALIUSDriverDesc[i] << endl;
363 OutStream << " GDAL Initial Sand Uncons Sediment file projection \t: " << m_VstrGDALIUSProjection[i] << endl;
364 OutStream << " GDAL Initial Sand Uncons Sediment file data type \t: " << m_VstrGDALIUSDataType[i] << endl;
365 OutStream << endl;
366 }
367
369 {
370 OutStream << " Initial Coarse Uncons Sediment file \t: " << m_VstrInitialCoarseUnconsSedimentFile[i] << endl;
371 OutStream << " GDAL Initial Coarse Uncons Sediment file driver code \t: " << m_VstrGDALIUCDriverCode[i] << endl;
372 OutStream << " GDAL Initial Coarse Uncons Sediment file driver desc \t: " << m_VstrGDALIUCDriverDesc[i] << endl;
373 OutStream << " GDAL Initial Coarse Uncons Sediment file projection \t: " << m_VstrGDALIUCProjection[i] << endl;
374 OutStream << " GDAL Initial Coarse Uncons Sediment file data type \t: " << m_VstrGDALIUCDataType[i] << endl;
375 OutStream << endl;
376 }
377
378 if (! m_VstrInitialFineConsSedimentFile[i].empty())
379 {
380 OutStream << " Initial Fine Cons Sediment file \t: " << m_VstrInitialFineConsSedimentFile[i] << endl;
381 OutStream << " GDAL Initial Fine Cons Sediment file driver code \t: " << m_VstrGDALICFDriverCode[i] << endl;
382 OutStream << " GDAL Initial Fine Cons Sediment file driver desc \t: " << m_VstrGDALICFDriverDesc[i] << endl;
383 OutStream << " GDAL Initial Fine Cons Sediment file projection \t: " << m_VstrGDALICFProjection[i] << endl;
384 OutStream << " GDAL Initial Fine Cons Sediment file data type \t: " << m_VstrGDALICFDataType[i] << endl;
385 OutStream << endl;
386 }
387
388 if (! m_VstrInitialSandConsSedimentFile[i].empty())
389 {
390 OutStream << " Initial Sand Cons Sediment file \t: " << m_VstrInitialSandConsSedimentFile[i] << endl;
391 OutStream << " GDAL Initial Sand Cons Sediment file driver code \t: " << m_VstrGDALICSDriverCode[i] << endl;
392 OutStream << " GDAL Initial Sand Cons Sediment file driver desc \t: " << m_VstrGDALICSDriverDesc[i] << endl;
393 OutStream << " GDAL Initial Sand Cons Sediment file projection \t: " << m_VstrGDALICSProjection[i] << endl;
394 OutStream << " GDAL Initial Sand Cons Sediment file data type \t: " << m_VstrGDALICSDataType[i] << endl;
395 OutStream << endl;
396 }
397
399 {
400 OutStream << " Initial Coarse Cons Sediment file \t: " << m_VstrInitialCoarseConsSedimentFile[i] << endl;
401 OutStream << " GDAL Initial Coarse Cons Sediment file driver code \t: " << m_VstrGDALICCDriverCode[i] << endl;
402 OutStream << " GDAL Initial Coarse Cons Sediment file driver desc \t: " << m_VstrGDALICCDriverDesc[i] << endl;
403 OutStream << " GDAL Initial Coarse Cons Sediment file projection \t: " << m_VstrGDALICCProjection[i] << endl;
404 OutStream << " GDAL Initial Coarse Cons Sediment file data type \t: " << m_VstrGDALICCDataType[i] << endl;
405 OutStream << endl;
406 }
407 }
408
409 // OutStream << endl;
410
411 // ---------------------------------------------------- Vector GIS stuff ------------------------------------------------------
412 OutStream << "Vector GIS Input Files" << endl;
413
415 OutStream << " None" << endl;
416
417 else
418 {
420 {
421 OutStream << " Deep water wave stations shapefile \t: " << m_strDeepWaterWaveStationsShapefile << endl;
422 OutStream << " Deep water wave values file \t: " << m_strDeepWaterWavesInputFile << endl;
423
424 if (m_dWaveDataWrapHours > 0)
425 OutStream << " Deep water wave values will wrap every " << m_dWaveDataWrapHours << " hours" << endl;
426
427 OutStream << " GDAL/OGR deep water wave stations shapefile driver code \t: " << m_strOGRDWWVDriverCode << endl;
428 OutStream << " GDAL/OGR deep water wave stations shapefile driver desc \t: " << m_strOGRDWWVDriverDesc << endl;
429 OutStream << " GDAL/OGR deep water wave stations shapefile data type \t: " << m_strOGRDWWVDataType << endl;
430 OutStream << " GDAL/OGR deep water wave stations shapefile geometry \t: " << m_strOGRDWWVGeometry << endl;
431 }
432
434 {
435 OutStream << " Sediment input event shapefile \t: " << m_strSedimentInputEventShapefile << endl;
436 OutStream << " Sediment input event values file \t: " << m_strSedimentInputEventFile << endl;
437 OutStream << " Sediment input event type \t: ";
438
440 OutStream << "point";
441
443 OutStream << "coast block";
444
446 OutStream << "line";
447
448 OutStream << endl;
449 OutStream << " GDAL/OGR sediment input event shapefile driver code \t: " << m_strOGRSedInputDriverCode << endl;
450 OutStream << " GDAL/OGR sediment input event shapefile driver desc \t: " << m_strOGRSedInputDriverCode << endl;
451 OutStream << " GDAL/OGR sediment input event shapefile data type \t: " << m_strOGRSedInputDataType << endl;
452 OutStream << " GDAL/OGR sediment input event shapefile geometry \t: " << m_strOGRSedInputGeometry << endl;
453 }
454
456 {
457 OutStream << " Riverine flooding shapefile \t: " << m_strFloodLocationShapefile << endl;
458 OutStream << " Riverine flood location? \t: " << (m_bFloodLocation ? "Y" : "N") << endl;
459 OutStream << " Riverine flood save? \t: " << (m_bVectorWaveFloodLineSave ? "Y" : "N") << endl;
460 OutStream << " GDAL/OGR riverine flooding event shapefile driver code \t: " << m_strOGRFloodDriverCode << endl;
461 OutStream << " GDAL/OGR riverine flooding shapefile driver desc \t: " << m_strOGRFloodDriverDesc << endl;
462 OutStream << " GDAL/OGR riverine flooding shapefile data type \t: " << m_strOGRFloodDataType << endl;
463 OutStream << " GDAL/OGR riverine flooding shapefile geometry \t: " << m_strOGRFloodGeometry << endl;
464 }
465 }
466
467 OutStream << endl;
468
469 // -------------------------------------------------------- Other data --------------------------------------------------------
470 OutStream << "Other Input Data" << endl;
471
472 OutStream << " Wave propagation model \t: ";
473
475 OutStream << "COVE";
476
478 OutStream << "CShore (output arrays have " << CSHOREARRAYOUTSIZE << " points)";
479
480 OutStream << endl;
481 OutStream << " Density of sea water \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(0) << m_dSeaWaterDensity << " kg/m^3" << endl;
482 OutStream << " Initial still water level \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dInitialMeanSWL << " m" << endl;
483 OutStream << " Final still water level \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dFinalMeanSWL << " m" << endl;
484
486 {
487 OutStream << " Deep water wave height \t: " << m_dAllCellsDeepWaterWaveHeight << " m" << endl;
488 OutStream << " Deep water wave orientation \t: " << m_dAllCellsDeepWaterWaveAngle << " degrees" << endl;
489 OutStream << " Wave period \t: " << m_dAllCellsDeepWaterWavePeriod << " s" << endl;
490 }
491
492 else
493 {
494 OutStream << " Maximum User input Deep water wave height \t: " << m_dMaxUserInputWaveHeight << " m" << endl;
495 OutStream << " Maximum User input Deep waterWave period \t: " << m_dMaxUserInputWavePeriod << " s" << endl;
496 }
497
498 OutStream << " Start depth for wave calcs (*deep water wave height) \t: " << m_dWaveDepthRatioForWaveCalcs << endl;
499 OutStream << "*Depth of closure \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(3) << m_dDepthOfClosure << " m" << endl;
500 OutStream << " Tide data file \t: " << m_strTideDataFile << endl;
501 OutStream << " Do coast platform erosion? \t: " << (m_bDoShorePlatformErosion ? "Y" : "N") << endl;
502 OutStream << resetiosflags(ios::floatfield);
503 OutStream << scientific << setprecision(2);
504 OutStream << " Coast platform resistance to erosion \t: " << m_dR << endl;
505 OutStream << resetiosflags(ios::floatfield);
506 OutStream << fixed << setprecision(1);
507 OutStream << " Do beach sediment transport? \t: " << (m_bDoBeachSedimentTransport ? "Y" : "N") << endl;
508 OutStream << " Handling of beach sediment at grid edges \t: ";
509
511 OutStream << "closed";
512
514 OutStream << "open";
515
517 OutStream << "recirculate";
518
519 OutStream << endl;
520 OutStream << " Beach potential erosion/deposition equation \t: ";
521
523 OutStream << "CERC";
524
526 OutStream << "Kamphuis";
527
528 OutStream << endl;
529 OutStream << " Median particle size of fine sediment \t: " << resetiosflags(ios::floatfield) << fixed << m_dD50Fine << " mm" << endl;
530 OutStream << " Median particle size of sand sediment \t: " << resetiosflags(ios::floatfield) << fixed << m_dD50Sand << " mm" << endl;
531 OutStream << " Median particle size of coarse sediment \t: " << resetiosflags(ios::floatfield) << fixed << m_dD50Coarse << " mm" << endl;
532 OutStream << " Beach sediment density \t: " << resetiosflags(ios::floatfield) << fixed << m_dBeachSedimentDensity << " kg/m^3" << endl;
533 OutStream << " Beach sediment porosity \t: " << resetiosflags(ios::floatfield) << fixed << m_dBeachSedimentPorosity << endl;
534 OutStream << " Fine-sized sediment relative erodibility \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dFineErodibility << endl;
535 OutStream << " Sand-sized sediment relative erodibility \t: " << resetiosflags(ios::floatfield) << m_dSandErodibility << endl;
536 OutStream << " Coarse-sized sediment relative erodibility \t: " << m_dCoarseErodibility << endl;
537
539 OutStream << " Transport parameter KLS for CERC equation \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(3) << m_dKLS << endl;
540
542 OutStream << " Transport parameter for Kamphuis equation \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(3) << m_dKamphuis << endl;
543
544 OutStream << " Height of Dean profile start above SWL \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dDeanProfileStartAboveSWL << " m" << endl;
545 OutStream << " Sediment input at a point \t: " << (m_bSedimentInput ? "Y" : "N") << endl;
546
548 {
549 OutStream << " Sediment input shapefile \t: " << m_strSedimentInputEventShapefile << endl;
550 OutStream << " Sediment input type \t: ";
551
553 OutStream << "point";
554
556 OutStream << "block on coast";
557
559 OutStream << "line intersection with coast";
560
561 OutStream << endl;
562 OutStream << " Sediment input file \t: " << m_strSedimentInputEventFile << endl;
563 }
564
566 {
567 OutStream << " Do cliff collapse? \t: " << (m_bDoCliffCollapse ? "Y" : "N") << endl;
568 OutStream << resetiosflags(ios::floatfield);
569 OutStream << scientific << setprecision(2);
570 OutStream << " Cliff resistance to erosion \t: " << m_dCliffErosionResistance << endl;
571 OutStream << resetiosflags(ios::floatfield);
572 OutStream << fixed << setprecision(1);
573 OutStream << " Notch overhang to initiate collapse \t: " << m_dNotchDepthAtCollapse << " m" << endl;
574 OutStream << " Notch base below SWL \t: " << m_dNotchBaseBelowSWL << " m" << endl;
575 OutStream << " Scale parameter A for cliff deposition \t: ";
576
578 OutStream << "auto";
579
580 else
581 OutStream << m_dCliffDepositionA << " m^(1/3)";
582
583 OutStream << endl;
584 OutStream << " Planview width of cliff deposition talus \t: " << resetiosflags(ios::floatfield) << fixed << m_dCliffDepositionPlanviewWidth << " m" << endl;
585 OutStream << " Planview length of cliff deposition talus \t: " << m_dCliffTalusMinDepositionLength << " m" << endl;
586 OutStream << " Min height of land-end talus (fraction of cliff elevation)\t: " << m_dMinCliffTalusHeightFrac << endl;
587 }
588
589 OutStream << " Do riverine flooding? \t: " << (m_bRiverineFlooding ? "Y" : "N") << endl;
590
592 {
593 // TODO 007 Need more info on this
594 OutStream << " FloodSWLSetupLine \t: " << (m_bFloodSWLSetupLine ? "Y" : "N") << endl;
595 OutStream << " FloodSWLSetupSurgeLine \t: " << (m_bFloodSWLSetupSurgeLine ? "Y" : "N") << endl;
596 OutStream << " m_bFloodSWLSetupSurgeRunupLine \t: " << (m_bFloodSWLSetupSurgeRunupLine ? "Y" : "N") << endl;
597 }
598
599 OutStream << " Gravitational acceleration \t: " << resetiosflags(ios::floatfield) << fixed << m_dG << " m^2/s" << endl;
600 OutStream << " Usual spacing of coastline normals \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalSpacing << " m" << endl;
601 OutStream << "*Usual spacing of coastline normals on interventions \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalInterventionSpacing << " m" << endl;
602 OutStream << " Random factor for spacing of normals \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalRandSpacingFactor << endl;
603 OutStream << " Length of coastline normals \t: " << m_dCoastNormalLength << " m" << endl;
604 OutStream << endl;
605 /*
606 OutStream << fixed << setprecision(8);
607 OutStream << " Erosion potential shape function:" << endl;
608 OutStream << "\tDepth over DB\tErosion potential\tFirst derivative of erosion potential" << endl;
609 for (int i = 0; i < m_VdDepthOverDB.size(); i++)
610 OutStream << "\t" << m_VdDepthOverDB[i] << "\t\t" << m_VdErosionPotential[i] << "\t\t" << m_VdErosionPotentialFirstDeriv[i] << endl;
611 OutStream << endl;
612 */
613 // ------------------------------------------------------ Testing only --------------------------------------------------------
614 OutStream << "Testing only" << endl;
615
616 OutStream << " Output profile data? \t: " << (m_bOutputProfileData ? "Y" : "N") << endl;
617 OutStream << " Profile numbers to be saved \t: ";
618
619 for (unsigned int i = 0; i < m_VnProfileToSave.size(); i++)
621
622 OutStream << endl;
623 OutStream << " Timesteps when profiles are saved \t: ";
624
625 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
627
628 OutStream << endl;
629 OutStream << " Output parallel profile data? \t: " << (m_bOutputParallelProfileData ? "Y" : "N") << endl;
630 OutStream << " Output erosion potential look-up data? \t: " << (m_bOutputErosionPotentialData ? "Y" : "N");
631
634
635 OutStream << endl;
636 OutStream << " Size of moving window for calculating coastline curvature \t: " << m_nCoastCurvatureMovingWindowSize << endl;
637
638 OutStream << endl
639 << endl;
640
641 // -------------------------------------------------- Per-iteration output ----------------------------------------------------
642 OutStream << fixed << setprecision(3);
643
644 // Write per-timestep headers to .out file
646 {
647 // CSV format header
648 OutStream << "# CSV FORMAT PER-ITERATION RESULTS" << endl;
649 OutStream << "# Sea depth in metres. All erosion and deposition values in millimetres" << endl;
650 OutStream << "# GISn = GIS files saved as <filename>n." << endl;
651 OutStream << PER_ITER_CSV_HEAD << endl;
652 }
653
654 else
655 {
656 // Fixed-width format headers
657 OutStream << PER_ITER_HEAD << endl;
658 OutStream << "Sea depth in metres. All erosion and deposition values in millimetres" << endl;
659 OutStream << "GISn = GIS files saved as <filename>n." << endl;
660 OutStream << endl;
661
662 OutStream << PER_ITER_HEAD1 << endl;
663 OutStream << PER_ITER_HEAD2 << endl;
664 OutStream << PER_ITER_HEAD3 << endl;
665 OutStream << PER_ITER_HEAD4 << endl;
666 OutStream << PER_ITER_HEAD5 << endl;
667 }
668}
669
670//===============================================================================================================================
672//===============================================================================================================================
674{
676 {
678 }
679
680 else
681 {
683 }
684}
685
686//===============================================================================================================================
688//===============================================================================================================================
690{
691 OutStream << resetiosflags(ios::floatfield);
692 OutStream << fixed << setprecision(0);
693
694 // Output timestep and simulated time info ===================================================================================
695 OutStream << setw(4) << m_ulIter;
696 OutStream << setw(7) << m_dSimElapsed; // In hours
697 OutStream << resetiosflags(ios::floatfield);
698 OutStream << fixed << setprecision(0);
699 OutStream << setw(7) << m_dSimElapsed / (24 * 365.25); // In years
700
701 // Output average sea depth (m) per sea cell =================================================================================
702 OutStream << resetiosflags(ios::floatfield);
703 OutStream << fixed << setprecision(2);
704 double dAvgSeaDepth = m_dThisIterTotSeaDepth / static_cast<double>(m_ulThisIterNumSeaCells);
705 OutStream << setw(7) << dAvgSeaDepth;
706 OutStream << " ";
707
708 // Output the this-timestep % of sea cells with potential shore platform erosion ==============================================
709 OutStream << fixed << setprecision(0);
711
712 // Output per-timestep potential shore platform erosion in m (average for all sea cells)
713 OutStream << fixed << setprecision(1);
714 OutStream << setw(6) << 1000 * m_dThisIterPotentialPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells);
715
716 // Output per-timestep potential shore platform erosion in m (average for all cells with potential shore platform erosion)
717 OutStream << fixed << setprecision(1);
718
721
722 else
723 OutStream << setw(6) << SPACE;
724
725 // Output the this-timestep % of sea cells with actual shore platform erosion =================================================
726 OutStream << fixed << setprecision(0);
728
729 // Output per-timestep actual shore platform erosion in m (average for all sea cells)
730 OutStream << fixed << setprecision(1);
732 OutStream << setw(6) << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells);
733
734 // Output per-timestep actual shore platform erosion in m (average for all cells with actual shore platform erosion)
735 OutStream << fixed << setprecision(1);
736
738 OutStream << setw(6) << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumActualPlatformErosionCells);
739
740 else
741 OutStream << setw(6) << SPACE;
742
743 // Output per-timestep actual shore platform erosion in m (average for all sea cells)
744 OutStream << fixed << setprecision(1) << SPACE;
745
747 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionFineCons / static_cast<double>(m_ulThisIterNumSeaCells);
748
749 else
750 OutStream << setw(4) << SPACE;
751
753 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionSandCons / static_cast<double>(m_ulThisIterNumSeaCells);
754
755 else
756 OutStream << setw(4) << SPACE;
757
759 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionCoarseCons / static_cast<double>(m_ulThisIterNumSeaCells);
760
761 else
762 OutStream << setw(4) << SPACE;
763
764 // Output the this-timestep % of sea cells with potential beach erosion ======================================================
766
767 // Output per-timestep potential beach erosion in m (average for all sea cells)
768 OutStream << fixed << setprecision(0);
769 // assert(m_ulThisIterNumSeaCells > 0);
770 double dTmp = 1000 * m_dThisIterPotentialBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
771
772 if (dTmp > 99999)
773 {
774 OutStream << setw(6) << scientific << setprecision(0) << dTmp;
775 OutStream << fixed;
776 }
777
778 else
779 OutStream << setw(6) << dTmp;
780
781 // Output per-timestep potential beach erosion in m (average for all cells with potential beach erosion)
782 OutStream << fixed << setprecision(1);
783
785 {
787
788 if (dTmp > 99999)
789 {
790 OutStream << setw(6) << scientific << setprecision(0) << dTmp;
791 OutStream << fixed;
792 }
793
794 else
795 OutStream << setw(6) << dTmp;
796 }
797
798 else
799 OutStream << setw(6) << SPACE;
800
801 // This-timestep % of sea cells with actual beach erosion =====================================================================
802 OutStream << fixed << setprecision(0);
804
805 // Output per-timestep actual beach erosion in m (average for all sea cells)
807 OutStream << setw(7) << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
808
809 // Per-iteration actual beach erosion in m (average for all cells with actual beach erosion)
810 OutStream << fixed << setprecision(1);
811
813 OutStream << setw(7) << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumActualBeachErosionCells);
814
815 else
816 OutStream << setw(7) << SPACE;
817
818 // Per-iteration actual beach erosion in m (average for all sea cells)
819 OutStream << fixed << setprecision(1) << SPACE;
820
822 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionFine / static_cast<double>(m_ulThisIterNumSeaCells);
823
824 else
825 OutStream << setw(4) << SPACE;
826
828 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionSand / static_cast<double>(m_ulThisIterNumSeaCells);
829
830 else
831 OutStream << setw(4) << SPACE;
832
834 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionCoarse / static_cast<double>(m_ulThisIterNumSeaCells);
835
836 else
837 OutStream << setw(4) << SPACE;
838
839 // Output the this-timestep % of sea cells with beach deposition =============================================================
840 OutStream << fixed << setprecision(0);
842
843 // Per-iteration beach deposition in m (average for all sea cells)
844 double dThisIterBeachDeposition = m_dThisIterBeachDepositionSand + m_dThisIterBeachDepositionCoarse;
845 OutStream << setw(6) << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
846
847 // Per-iteration beach deposition in m (average for all cells with beach deposition)
848 OutStream << fixed << setprecision(1);
849
851 OutStream << setw(7) << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumBeachDepositionCells);
852
853 else
854 OutStream << setw(7) << SPACE;
855
856 // Per-iteration beach deposition in m (average for all sea cells)
857 OutStream << fixed << setprecision(1) << SPACE;
858
860 OutStream << setw(5) << 1000 * m_dThisIterBeachDepositionSand / static_cast<double>(m_ulThisIterNumSeaCells);
861
862 else
863 OutStream << setw(5) << SPACE;
864
866 OutStream << setw(4) << 1000 * m_dThisIterBeachDepositionCoarse / static_cast<double>(m_ulThisIterNumSeaCells);
867
868 else
869 OutStream << setw(4) << SPACE;
870
871 // Output the this-timestep sediment input in m ==============================================================================
872 OutStream << scientific << setprecision(0) << SPACE;
873
876
877 else
878 OutStream << setw(5) << SPACE;
879
882
883 else
884 OutStream << setw(4) << SPACE;
885
888
889 else
890 OutStream << setw(4) << SPACE;
891
892 // Per-iteration cliff collapse erosion (both cons and uncons) in m (average for all coast cells) ============================
893 OutStream << fixed << setprecision(1) << SPACE;
894
897
898 else
899 OutStream << setw(5) << SPACE;
900
903
904 else
905 OutStream << setw(4) << SPACE;
906
909
910 else
911 OutStream << setw(4) << SPACE;
912
913 // Per-iteration cliff collapse deposition in m (average for all sea cells) ==================================================
915 OutStream << setw(5) << 1000 * m_dThisIterUnconsSandCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
916
917 else
918 OutStream << setw(5) << SPACE;
919
921 OutStream << setw(4) << 1000 * m_dThisIterUnconsCoarseCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
922
923 else
924 OutStream << setw(4) << SPACE;
925
926 // Output per-timestep fine sediment going to suspension, in m (average for all sea cells) ==================================
928 OutStream << setw(7) << 1000 * m_dThisIterFineSedimentToSuspension / static_cast<double>(m_ulThisIterNumSeaCells);
929
930 else
931 OutStream << setw(7) << SPACE;
932
933 OutStream << " ";
934
935 // Finally, set 'markers' for events that have occurred this timestep
937 OutStream << " GIS" << m_nGISSave;
938
939 OutStream << endl;
940
941 // Did a text file write error occur?
942 if (OutStream.fail())
943 return false;
944
945 return true;
946}
947
948//===============================================================================================================================
950//===============================================================================================================================
952{
953 OutStream << setprecision(6);
954
955 // Output timestep and simulated time info
956 OutStream << m_ulIter << ",";
957 OutStream << m_dSimElapsed << ","; // In hours
958 OutStream << m_dSimElapsed / (24 * 365.25) << ","; // In years
959
960 // Output average sea depth (m) per sea cell
961 double dAvgSeaDepth = m_dThisIterTotSeaDepth / static_cast<double>(m_ulThisIterNumSeaCells);
962 OutStream << dAvgSeaDepth << ",";
963
964 // Platform erosion data
966 OutStream << 1000 * m_dThisIterPotentialPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
967
970
971 else
972 OutStream << ",";
973
975
977 OutStream << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
978
980 OutStream << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumActualPlatformErosionCells) << ",";
981
982 else
983 OutStream << ",";
984
985 // Platform erosion by sediment type
987 OutStream << 1000 * m_dThisIterActualPlatformErosionFineCons / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
988
989 else
990 OutStream << ",";
991
993 OutStream << 1000 * m_dThisIterActualPlatformErosionSandCons / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
994
995 else
996 OutStream << ",";
997
1000
1001 else
1002 OutStream << ",";
1003
1004 // Beach erosion data
1006
1007 double dTmp = 1000 * m_dThisIterPotentialBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
1008 OutStream << dTmp << ",";
1009
1011 {
1013 OutStream << dTmp << ",";
1014 }
1015
1016 else
1017 OutStream << ",";
1018
1020
1022 OutStream << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1023
1025 OutStream << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumActualBeachErosionCells) << ",";
1026
1027 else
1028 OutStream << ",";
1029
1030 // Beach erosion by sediment type
1032 OutStream << 1000 * m_dThisIterBeachErosionFine / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1033
1034 else
1035 OutStream << ",";
1036
1038 OutStream << 1000 * m_dThisIterBeachErosionSand / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1039
1040 else
1041 OutStream << ",";
1042
1044 OutStream << 1000 * m_dThisIterBeachErosionCoarse / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1045
1046 else
1047 OutStream << ",";
1048
1049 // Beach deposition data
1051
1052 double dThisIterBeachDeposition = m_dThisIterBeachDepositionSand + m_dThisIterBeachDepositionCoarse;
1053 OutStream << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1054
1056 OutStream << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumBeachDepositionCells) << ",";
1057
1058 else
1059 OutStream << ",";
1060
1061 // Beach deposition by sediment type
1063 OutStream << 1000 * m_dThisIterBeachDepositionSand / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1064
1065 else
1066 OutStream << ",";
1067
1069 OutStream << 1000 * m_dThisIterBeachDepositionCoarse / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1070
1071 else
1072 OutStream << ",";
1073
1074 // Sediment input data
1077
1078 else
1079 OutStream << ",";
1080
1083
1084 else
1085 OutStream << ",";
1086
1089
1090 else
1091 OutStream << ",";
1092
1093 // Cliff collapse erosion data
1096
1097 else
1098 OutStream << ",";
1099
1102
1103 else
1104 OutStream << ",";
1105
1108
1109 else
1110 OutStream << ",";
1111
1112 // Cliff collapse deposition data
1114 OutStream << 1000 * m_dThisIterUnconsSandCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1115
1116 else
1117 OutStream << ",";
1118
1120 OutStream << 1000 * m_dThisIterUnconsCoarseCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1121
1122 else
1123 OutStream << ",";
1124
1125 // Suspended sediment data
1127 OutStream << 1000 * m_dThisIterFineSedimentToSuspension / static_cast<double>(m_ulThisIterNumSeaCells) << ",";
1128
1129 else
1130 OutStream << ",";
1131
1132 // GIS events (no comma after last column)
1134 OutStream << "GIS" << m_nGISSave;
1135
1136 OutStream << endl;
1137
1138 // Did a text file write error occur?
1139 if (OutStream.fail())
1140 return false;
1141
1142 return true;
1143}
1144
1145//===============================================================================================================================
1147//===============================================================================================================================
1149{
1150 // Sea area
1151 if (m_bSeaAreaTSSave)
1152 {
1153 // Output in external CRS units
1154 SeaAreaTSStream << m_dSimElapsed << "\t,\t" << m_dExtCRSGridArea * static_cast<double>(m_ulThisIterNumSeaCells) / static_cast<double>(m_ulNumCells) << endl;
1155
1156 // Did a time series file write error occur?
1157 if (SeaAreaTSStream.fail())
1158 return false;
1159 }
1160
1161 // Still water level
1163 {
1164 // Output as is (m)
1165 StillWaterLevelTSStream << m_dSimElapsed << "\t,\t" << m_dThisIterSWL << "\t,\t" << m_dThisIterMeanSWL << endl;
1166
1167 // Did a time series file write error occur?
1168 if (StillWaterLevelTSStream.fail())
1169 return false;
1170 }
1171
1172 // Actual platform erosion (fine, sand, and coarse)
1174 {
1175 // Output as is (m depth equivalent)
1177
1178 // Did a time series file write error occur?
1179 if (PlatformErosionTSStream.fail())
1180 return false;
1181 }
1182
1183 // Cliff collapse erosion (fine, sand, and coarse)
1185 {
1186 // Output as is (m depth equivalent)
1188
1189 // Did a time series file write error occur?
1191 return false;
1192 }
1193
1194 // Cliff collapse deposition (sand and coarse)
1196 {
1197 // Output as is (m depth equivalent)
1199
1200 // Did a time series file write error occur?
1202 return false;
1203 }
1204
1205 // Cliff collapse net
1207 {
1208 // Output as is (m depth equivalent)
1210
1211 // Did a time series file write error occur?
1213 return false;
1214 }
1215
1216 // Beach erosion (fine, sand, and coarse)
1218 {
1219 // Output as is (m depth equivalent)
1221
1222 // Did a time series file write error occur?
1223 if (BeachErosionTSStream.fail())
1224 return false;
1225 }
1226
1227 // Beach deposition (sand and coarse)
1229 {
1230 // Output as is (m depth equivalent)
1232
1233 // Did a time series file write error occur?
1234 if (BeachDepositionTSStream.fail())
1235 return false;
1236 }
1237
1238 // Net change in beach sediment
1240 {
1241 // Output as is (m depth equivalent)
1243
1244 // Did a time series file write error occur?
1246 return false;
1247 }
1248
1249 if (m_bSuspSedTSSave)
1250 {
1251 // Output as is (m depth equivalent)
1253
1254 // Did a time series file write error occur?
1255 if (FineSedSuspensionTSStream.fail())
1256 return false;
1257 }
1258
1260 {
1261 // Output as is (m depth equivalent)
1263
1264 // Did a time series file write error occur?
1265 if (FloodSetupSurgeTSStream.fail())
1266 return false;
1267 }
1268
1270 {
1271 // Output as is (m depth equivalent)
1273
1274 // Did a time series file write error occur?
1276 return false;
1277 }
1278
1279 return true;
1280}
1281
1282//===============================================================================================================================
1284//===============================================================================================================================
1286{
1287 // Open the output file
1288 string strLookUpFile = m_strOutPath;
1289 strLookUpFile.append(EROSION_POTENTIAL_LOOKUP_FILE);
1290 ofstream LookUpOutStream;
1291 LookUpOutStream.open(strLookUpFile.c_str(), ios::out | ios::trunc);
1292
1293 if (LookUpOutStream)
1294 {
1295 // File opened OK, so output the values
1296 LookUpOutStream << "DepthOverDB, \tErosionPotential" << endl;
1297 double dDepthOverDB = 0.0;
1298
1299 while (dDepthOverDB <= m_dDepthOverDBMax)
1300 {
1301 double dErosionPotential = dGetInterpolatedValue(&m_VdDepthOverDB, &m_VdErosionPotential, dDepthOverDB, false);
1302 LookUpOutStream << dDepthOverDB << ",\t" << dErosionPotential << endl;
1303 dDepthOverDB += DEPTH_OVER_DB_INCREMENT;
1304 }
1305
1306 LookUpOutStream << endl;
1307
1308 // And close the file
1309 LookUpOutStream.close();
1310 }
1311}
1312
1313//===============================================================================================================================
1315//===============================================================================================================================
1316int CSimulation::nSaveProfile(int const nCoast, CGeomProfile const* pProfile, int const nProfSize, vector<double> const* pdVDistXY, vector<double> const* pdVZ, vector<double> const* pdVDepthOverDB, vector<double> const* pdVErosionPotentialFunc, vector<double> const* pdVSlope, vector<double> const* pdVRecessionXY, vector<double> const* pdVChangeElevZ, vector<CGeom2DIPoint> *const pPtVGridProfile, vector<double> const* pdVScapeXY) const
1317{
1318 // TODO 052 Make this more efficient, also give warnings if no profiles will be output
1319 int nProfile = pProfile->nGetCoastID();
1320
1321 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
1322 {
1323 for (unsigned int j = 0; j < m_VnProfileToSave.size(); j++)
1324 {
1325 if ((m_ulIter == m_VulProfileTimestep[i]) && (nProfile == m_VnProfileToSave[j]))
1326 {
1327 if (! bWriteProfileData(nCoast, pProfile, nProfSize, pdVDistXY, pdVZ, pdVDepthOverDB, pdVErosionPotentialFunc, pdVSlope, pdVRecessionXY, pdVChangeElevZ, pPtVGridProfile, pdVScapeXY))
1328 return RTN_ERR_PROFILEWRITE;
1329 }
1330 }
1331 }
1332
1333 return RTN_OK;
1334}
1335
1336//===============================================================================================================================
1338//===============================================================================================================================
1339bool CSimulation::bWriteProfileData(int const nCoast, CGeomProfile const* pProfile, int const nProfSize, vector<double> const* pdVDistXY, vector<double> const* pdVZ, vector<double> const* pdVDepthOverDB, vector<double> const* pdVErosionPotentialFunc, vector<double> const* pdVSlope, vector<double> const* pdVRecessionXY, vector<double> const* pdVChangeElevZ, vector<CGeom2DIPoint> *const pPtVGridProfile, vector<double> const* pdVScapeXY) const
1340{
1341 int nProfile = pProfile->nGetCoastID();
1342
1343 string strFName = m_strOutPath;
1344 stringstream ststrTmp;
1345
1346 strFName.append("profile_");
1347 ststrTmp << FillToWidth('0', 3) << nProfile;
1348 strFName.append(ststrTmp.str());
1349
1350 strFName.append("_timestep_");
1351 ststrTmp.clear();
1352 ststrTmp.str(string());
1353 ststrTmp << FillToWidth('0', 4) << m_ulIter;
1354 strFName.append(ststrTmp.str());
1355
1356 strFName.append(".csv");
1357
1358 ofstream OutProfStream;
1359 OutProfStream.open(strFName.c_str(), ios::out | ios::trunc);
1360
1361 if (! OutProfStream)
1362 {
1363 // Error, cannot open file
1364 cerr << ERR << "cannot open " << strFName << " for output" << endl;
1365 return false;
1366 }
1367
1368 OutProfStream << "\"Dist\", \"X\", \"Y\", \"Z (before erosion)\", \"Depth/DB\", \"Erosion Potential\", \"Slope\", \"Recession XY\", \"Change Elev Z\", \"Grid X\", \"Grid Y\", \"Weight\", \"For profile " << nProfile << " from coastline " << nCoast << " at timestep " << m_ulIter << "\"" << endl;
1369
1370 for (int i = 0; i < nProfSize; i++)
1371 {
1372 double dX = dGridCentroidXToExtCRSX(pPtVGridProfile->at(i).nGetX());
1373 double dY = dGridCentroidYToExtCRSY(pPtVGridProfile->at(i).nGetY());
1374
1375 OutProfStream << pdVDistXY->at(i) << ",\t" << dX << ",\t" << dY << ",\t" << pdVZ->at(i) << ",\t" << pdVDepthOverDB->at(i) << ",\t" << pdVErosionPotentialFunc->at(i) << ",\t" << pdVSlope->at(i) << ",\t" << pdVRecessionXY->at(i) << ",\t" << pdVChangeElevZ->at(i) << ",\t" << pPtVGridProfile->at(i).nGetX() << ",\t" << pPtVGridProfile->at(i).nGetY() << ", \t" << pdVScapeXY->at(i) << endl;
1376 }
1377
1378 OutProfStream.close();
1379
1380 return true;
1381}
1382
1383//===============================================================================================================================
1385//===============================================================================================================================
1386int CSimulation::nSaveParProfile(int const nCoast, CGeomProfile const* pProfile, int const nParProfSize, int const nDirection, int const nDistFromProfile, vector<double> const* pdVDistXY, vector<double> const* pdVZ, vector<double> const* pdVDepthOverDB, vector<double> const* pdVErosionPotentialFunc, vector<double> const* pdVSlope, vector<double> const* pdVRecessionXY, vector<double> const* pdVChangeElevZ, vector<CGeom2DIPoint> *const pPtVGridProfile, vector<double> const* pdVScapeXY) const
1387{
1388 // TODO 052 Make this more efficient, also give warnings if no profiles will be output
1389 int nProfile = pProfile->nGetCoastID();
1390
1391 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
1392 {
1393 for (unsigned int j = 0; j < m_VnProfileToSave.size(); j++)
1394 {
1395 if ((m_ulIter == m_VulProfileTimestep[i]) && (nProfile == m_VnProfileToSave[j]))
1396 {
1397 if (! bWriteParProfileData(nCoast, nProfile, nParProfSize, nDirection, nDistFromProfile, pdVDistXY, pdVZ, pdVDepthOverDB, pdVErosionPotentialFunc, pdVSlope, pdVRecessionXY, pdVChangeElevZ, pPtVGridProfile, pdVScapeXY))
1398 return RTN_ERR_PROFILEWRITE;
1399 }
1400 }
1401 }
1402
1403 return RTN_OK;
1404}
1405
1406//===============================================================================================================================
1408//===============================================================================================================================
1409bool CSimulation::bWriteParProfileData(int const nCoast, int const nProfile, int const nProfSize, int const nDirection, int const nDistFromProfile, vector<double> const* pdVDistXY, vector<double> const* pdVZ, vector<double> const* pdVDepthOverDB, vector<double> const* pdVErosionPotentialFunc, vector<double> const* pdVSlope, vector<double> const* pdVRecessionXY, vector<double> const* pdVChangeElevZ, vector<CGeom2DIPoint> *const pPtVGridProfile, vector<double> const* pdVScapeXY) const
1410{
1411 string strFName = m_strOutPath;
1412 stringstream ststrTmp;
1413
1414 strFName.append("profile_");
1415 ststrTmp << FillToWidth('0', 3) << nProfile;
1416 strFName.append(ststrTmp.str());
1417
1418 strFName.append("_parallel_");
1419 ststrTmp.clear();
1420 ststrTmp.str(string());
1421 ststrTmp << FillToWidth('0', 3) << nDistFromProfile;
1422 strFName.append(ststrTmp.str());
1423
1424 strFName.append((nDirection == 0 ? "_F" : "_B"));
1425
1426 strFName.append("_timestep_");
1427 ststrTmp.clear();
1428 ststrTmp.str(string());
1429 ststrTmp << FillToWidth('0', 4) << m_ulIter;
1430 strFName.append(ststrTmp.str());
1431
1432 strFName.append(".csv");
1433
1434 ofstream OutProfStream;
1435 OutProfStream.open(strFName.c_str(), ios::out | ios::trunc);
1436
1437 if (! OutProfStream)
1438 {
1439 // Error, cannot open file
1440 cerr << ERR << "cannot open " << strFName << " for output" << endl;
1441 return false;
1442 }
1443
1444 OutProfStream << "\"Dist\", \"X\", \"Y\", \"Z (before erosion)\", \"Depth/DB\", \"Erosion Potential\", \"Slope\", \"Recession XY\", \"Change Elev Z\", \"Grid X\", \"Grid Y\", \"Weight\", \"For profile " << nProfile << " from coastline " << nCoast << " at timestep " << m_ulIter << "\"" << endl;
1445
1446 for (int i = 0; i < nProfSize; i++)
1447 {
1448 double dX = dGridCentroidXToExtCRSX(pPtVGridProfile->at(i).nGetX());
1449 double dY = dGridCentroidYToExtCRSY(pPtVGridProfile->at(i).nGetY());
1450
1451 OutProfStream << pdVDistXY->at(i) << ",\t" << dX << ",\t" << dY << ",\t" << pdVZ->at(i) << ",\t" << pdVDepthOverDB->at(i) << ",\t" << pdVErosionPotentialFunc->at(i) << ",\t" << pdVSlope->at(i) << ",\t" << pdVRecessionXY->at(i) << ",\t" << pdVChangeElevZ->at(i) << ",\t" << pPtVGridProfile->at(i).nGetX() << ",\t" << pPtVGridProfile->at(i).nGetY() << ", \t" << pdVScapeXY->at(i) << endl;
1452 }
1453
1454 OutProfStream.close();
1455
1456 return true;
1457}
1458
1459//===============================================================================================================================
1461//===============================================================================================================================
1463{
1464 // Final write to time series CSV files
1465 if (! bWriteTSFiles())
1467
1468 // Save the values from the RasterGrid array into raster GIS files
1469 if (! bSaveAllRasterGISFiles())
1471
1472 // Save the vector GIS files
1473 if (! bSaveAllVectorGISFiles())
1475
1476 OutStream << " GIS" << m_nGISSave << endl;
1477
1478 // Print out run totals etc.
1479 OutStream << PER_ITER_HEAD1 << endl;
1480 OutStream << PER_ITER_HEAD2 << endl;
1481 OutStream << PER_ITER_HEAD3 << endl;
1482 OutStream << PER_ITER_HEAD4 << endl;
1483 OutStream << PER_ITER_HEAD5 << endl;
1484
1485 OutStream << fixed << setprecision(3);
1486 OutStream << endl
1487 << endl;
1488
1489 // Write out hydrology grand totals etc.
1490 OutStream << ENDHYDROLOGYHEAD << endl;
1491 OutStream << "Minimum still water level = " << m_dMinSWL << endl;
1492 OutStream << "Maximum still water level = " << m_dMaxSWL << endl;
1493 OutStream << endl;
1494
1495 // Now write out sediment movement grand totals etc.
1496 OutStream << ENDSEDIMENTHEAD << endl
1497 << endl;
1498
1499 OutStream << "TOTAL PLATFORM EROSION" << endl;
1500 OutStream << "Potential platform erosion, all size classes = " << m_ldGTotPotentialPlatformErosion * m_dCellArea << " m^3" << endl
1501 << endl;
1502 OutStream << "Actual platform erosion, fine = " << m_ldGTotFineActualPlatformErosion * m_dCellArea << " m^3" << endl;
1503 OutStream << "Actual platform erosion, sand = " << m_ldGTotSandActualPlatformErosion * m_dCellArea << " m^3" << endl;
1504 OutStream << "Actual platform erosion, coarse = " << m_ldGTotCoarseActualPlatformErosion * m_dCellArea << " m^3" << endl;
1505 OutStream << "Actual platform erosion, all size classes = " << (m_ldGTotFineActualPlatformErosion + m_ldGTotSandActualPlatformErosion + m_ldGTotCoarseActualPlatformErosion) * m_dCellArea << " m^3" << endl;
1506 OutStream << endl;
1507
1508 OutStream << "TOTAL CLIFF COLLAPSE EROSION" << endl;
1509 OutStream << "Cliff collapse, fine = " << m_ldGTotCliffCollapseFine * m_dCellArea << " m^3" << endl;
1510 OutStream << "Cliff collapse, sand = " << m_ldGTotCliffCollapseSand * m_dCellArea << " m^3" << endl;
1511 OutStream << "Cliff collapse, coarse = " << m_ldGTotCliffCollapseCoarse * m_dCellArea << " m^3" << endl;
1513 OutStream << endl;
1514
1515 OutStream << "TOTAL DEPOSITION AND SUSPENSION OF CLIFF COLLAPSE TALUS" << endl;
1516 OutStream << "Cliff collapse to suspension, fine = " << m_ldGTotCliffTalusFineToSuspension * m_dCellArea << " m^3" << endl;
1517 OutStream << "Cliff collapse deposition, sand = " << m_ldGTotCliffTalusSandDeposition * m_dCellArea << " m^3" << endl;
1518 OutStream << "Cliff collapse deposition, coarse = " << m_ldGTotCliffTalusCoarseDeposition * m_dCellArea << " m^3" << endl;
1519 OutStream << "Cliff collapse deposition, sand and coarse = " << (m_ldGTotCliffTalusSandDeposition + m_ldGTotCliffTalusCoarseDeposition) * m_dCellArea << " m^3" << endl;
1520 OutStream << endl;
1521
1522 OutStream << "TOTAL BEACH EROSION" << endl;
1523 OutStream << "Potential beach erosion, all size classes = " << m_ldGTotPotentialBeachErosion * m_dCellArea << " m^3" << endl
1524 << endl;
1525 OutStream << "Actual fine beach erosion, fine = " << m_ldGTotActualFineBeachErosion * m_dCellArea << " m^3" << endl;
1526 OutStream << "Actual sand beach erosion, sand = " << m_ldGTotActualSandBeachErosion * m_dCellArea << " m^3" << endl;
1527 OutStream << "Actual coarse beach erosion, coarse = " << m_ldGTotActualCoarseBeachErosion * m_dCellArea << " m^3" << endl;
1528 OutStream << "Actual beach erosion, all size classes = " << (m_ldGTotActualFineBeachErosion + m_ldGTotActualSandBeachErosion + m_ldGTotActualCoarseBeachErosion) * m_dCellArea << " m^3" << endl;
1529 OutStream << endl;
1530
1531 OutStream << "TOTAL BEACH DEPOSITION" << endl;
1532 OutStream << "Beach deposition, sand = " << m_ldGTotSandBeachDeposition * m_dCellArea << " m^3" << endl;
1533 OutStream << "Beach deposition, coarse = " << m_ldGTotCoarseBeachDeposition * m_dCellArea << " m^3" << endl;
1534 OutStream << "Beach deposition, sand and coarse = " << (m_ldGTotSandBeachDeposition + m_ldGTotCoarseBeachDeposition) * m_dCellArea << " m^3" << endl;
1535 OutStream << endl;
1536
1537 OutStream << "TOTAL SEDIMENT INPUT EVENTS" << endl;
1538 OutStream << "Sediment from sediment input events, fine = " << m_ldGTotFineSedimentInput * m_dCellArea << " m^3" << endl;
1539 OutStream << "Sediment from sediment input events, sand = " << m_ldGTotSandSedimentInput * m_dCellArea << " m^3" << endl;
1540 OutStream << "Sediment from sediment input events, coarse = " << m_ldGTotCoarseSedimentInput * m_dCellArea << " m^3" << endl;
1541 OutStream << "Sediment from sediment input events, all size classes = " << (m_ldGTotFineSedimentInput + m_ldGTotSandSedimentInput + m_ldGTotCoarseSedimentInput) * m_dCellArea << " m^3" << endl;
1542 OutStream << endl;
1543
1544 OutStream << "TOTAL SUSPENDED SEDIMENT" << endl;
1545 OutStream << "Suspended fine sediment = " << m_ldGTotSuspendedSediment * m_dCellArea << " m^3" << endl;
1546 OutStream << endl;
1547
1548 OutStream << "TOTAL LOST FROM GRID BY BEACH MOVEMENT" << endl;
1549 OutStream << "Potential sediment lost, all size classes = " << m_ldGTotPotentialSedLostBeachErosion * m_dCellArea << " m^3" << endl;
1550 OutStream << "Actual sediment lost, fine = " << m_ldGTotActualFineLostBeachErosion * m_dCellArea << " m^3" << endl;
1551 OutStream << "Actual sediment lost, sand = " << m_ldGTotActualSandLostBeachErosion * m_dCellArea << " m^3" << endl;
1552 OutStream << "Actual sediment lost, coarse = " << m_ldGTotActualCoarseLostBeachErosion * m_dCellArea << " m^3" << endl;
1553 OutStream << "Actual sediment lost, all size classes = " << (m_ldGTotActualFineLostBeachErosion + m_ldGTotActualSandLostBeachErosion + m_ldGTotActualCoarseLostBeachErosion) * m_dCellArea << " m^3" << endl;
1554 OutStream << endl;
1555
1556 OutStream << "TOTAL LOST FROM GRID BY CLIFF COLLAPSE" << endl;
1557 OutStream << "Sediment lost, sand = " << m_ldGTotSandSedLostCliffCollapse * m_dCellArea << " m^3" << endl;
1558 OutStream << "Sediment lost, coarse = " << m_ldGTotCoarseSedLostCliffCollapse * m_dCellArea << " m^3" << endl;
1559 OutStream << endl;
1560
1561 OutStream << "ALL-PROCESS TOTALS (all size classes)" << endl;
1563 OutStream << "Fine sediment eroded = " << ldFineEroded * m_dCellArea << " m^3" << endl;
1564 OutStream << "Fine sediment to suspension = " << m_ldGTotSuspendedSediment * m_dCellArea << " m^3" << endl;
1565
1566 if (! bFPIsEqual(ldFineEroded, m_ldGTotSuspendedSediment, 1.0L))
1567 OutStream << MASS_BALANCE_ERROR << endl;
1568
1570 OutStream << "Sand sediment eroded = " << ldSandEroded * m_dCellArea << " m^3" << endl;
1571 long double ldSandDeposited = m_ldGTotCliffTalusSandDeposition + m_ldGTotSandBeachDeposition;
1572 OutStream << "Sand sediment deposited = " << ldSandDeposited * m_dCellArea << " m^3" << endl;
1574 OutStream << "Sand sediment lost from grid = " << ldSandLost * m_dCellArea << " m^3" << endl;
1575
1576 if (! bFPIsEqual(ldSandEroded, (ldSandDeposited + ldSandLost), 1.0L))
1577 OutStream << MASS_BALANCE_ERROR << endl;
1578
1580 OutStream << "Coarse sediment eroded = " << ldCoarseEroded * m_dCellArea << " m^3" << endl;
1581 long double ldCoarseDeposited = m_ldGTotCliffTalusCoarseDeposition + m_ldGTotCoarseBeachDeposition;
1582 OutStream << "Coarse sediment deposited = " << ldCoarseDeposited * m_dCellArea << " m^3" << endl;
1584 OutStream << "Coarse sediment lost from grid = " << ldCoarseLost * m_dCellArea << " m^3" << endl;
1585
1586 if (! bFPIsEqual(ldCoarseEroded, (ldCoarseDeposited + ldCoarseLost), 1.0L))
1587 OutStream << MASS_BALANCE_ERROR << endl;
1588
1589 OutStream << endl;
1590
1592 OutStream << "Total sediment eroded (all processes) = " << ldActualTotalEroded * m_dCellArea << " m^3" << endl;
1593
1595 OutStream << "Total sediment deposited/to suspension (all processes) = " << ldTotalDepositedAndSuspension * m_dCellArea << " m^3" << endl;
1596
1598 OutStream << "Total sediment lost from grid (all processes) = " << ldTotalLost * m_dCellArea << " m^3" << endl;
1599 OutStream << " = " << 24 * 365.25 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/year" << endl;
1600 OutStream << " = " << 24 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/day" << endl;
1601 OutStream << " = " << ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/hour" << endl;
1602 OutStream << fixed << setprecision(6);
1603 OutStream << " = " << ldTotalLost * m_dCellArea / (m_dSimDuration * 3600) << " m^3/sec" << endl
1604 << endl;
1605 OutStream << fixed << setprecision(3);
1606
1608 {
1609 OutStream << "Grid edge option is ";
1610
1612 OutStream << "CLOSED.";
1613
1615 OutStream << "OPEN.";
1616
1618 OutStream << "RE-CIRCULATING.";
1619
1620 OutStream << endl << endl;
1621 }
1622
1623 // Finally calculate performance details
1624 OutStream << PERFORMHEAD << endl;
1625
1626 // Get the time that the run ended
1627 m_tSysEndTime = time(nullptr);
1628
1629 OutStream << "Run ended at " << put_time(localtime(&m_tSysEndTime), "%T on %A %d %B %Y") << endl;
1630 OutStream << "Time simulated: " << strDispSimTime(m_dSimDuration) << endl << endl;
1631
1632 // Write to log file
1633 LogStream << "END OF RUN TOTALS =================================================================================================================================================" << endl
1634 << endl;
1635
1636 LogStream << "ALL-PROCESS TOTALS (all size classes)" << endl;
1638 LogStream << "Sediment eroded (all processes) = " << ldActualTotalEroded * m_dCellArea << " m^3" << endl;
1639
1640 LogStream << "Sediment deposited and in suspension (all processes) = " << ldTotalDepositedAndSuspension * m_dCellArea << " m^3" << endl;
1641
1642 LogStream << "Sediment lost from grid (all processes) = " << ldTotalLost * m_dCellArea << " m^3" << endl;
1643 LogStream << " = " << 24 * 365.25 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/year" << endl;
1644 LogStream << " = " << 24 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/day" << endl;
1645 LogStream << " = " << ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/hour" << endl;
1646 LogStream << " = " << setprecision(6) << ldTotalLost * m_dCellArea / (m_dSimDuration * 3600) << " m^3/sec" << endl;
1647 LogStream << endl;
1648 LogStream << fixed << setprecision(3);
1649
1651 {
1652 LogStream << "Grid edge option is ";
1653
1655 LogStream << "CLOSED.";
1656
1658 LogStream << "OPEN.";
1659
1661 LogStream << "RE-CIRCULATING.";
1662
1663 LogStream << endl << endl;
1664
1665 // Output averages for on-profile and between-profile potential shore platform erosion, ideally these are roughly equal
1666 LogStream << fixed << setprecision(6);
1667 LogStream << "On-profile average potential shore platform erosion = " << (m_ulTotPotentialPlatformErosionOnProfiles > 0 ? m_dTotPotentialPlatformErosionOnProfiles / static_cast<double>(m_ulTotPotentialPlatformErosionOnProfiles) : 0) << " mm (n = " << m_ulTotPotentialPlatformErosionOnProfiles << ")" << endl;
1668 LogStream << "Between-profile average potential shore platform erosion = " << (m_ulTotPotentialPlatformErosionBetweenProfiles > 0 ? m_dTotPotentialPlatformErosionBetweenProfiles / static_cast<double>(m_ulTotPotentialPlatformErosionBetweenProfiles) : 0) << " mm (n = " << m_ulTotPotentialPlatformErosionBetweenProfiles << ")" << endl;
1669 LogStream << endl;
1670 }
1671
1672 // Calculate statistics re. memory usage etc.
1674 OutStream << endl
1675 << "END OF RUN" << endl;
1676 LogStream << endl
1677 << "END OF RUN" << endl;
1678
1679 // Need to flush these here (if we don't, the buffer may not get written)
1680 LogStream.flush();
1681 OutStream.flush();
1682
1683 return RTN_OK;
1684}
1685
1686//===============================================================================================================================
1688//===============================================================================================================================
1690{
1691 LogStream << endl << m_ulIter << ": Per-polygon profile info, seawater volume (m^3), and D50 values (mm: a blank D50 value means that there is no unconsolidated sediment on that polygon)." << endl;
1692
1693 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|--------------|" << endl;
1694 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("Up-coast", 11) << "|" << strCentre("Down-coast", 11) << "|" << strCentre("Seawater", 14) << "|" << strCentre("Uncons d50", 14) << "|" << endl;
1695 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Profile", 11) << "|" << strCentre("Profile", 11) << "|" << strCentre("Volume", 14) << "|" << strCentre("", 14) << "|" << endl;
1696 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|--------------|" << endl;
1697
1698 for (int n = 0; n < nGetCoastPolygonSize(); n++)
1699 {
1700 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1701
1702 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strIntRight(pPolygon->nGetUpCoastProfile(), 11) << "|" << strIntRight(pPolygon->nGetDownCoastProfile(), 11) << "|" << strDblRight(pPolygon->dGetSeawaterVolume(), 0, 14) << "|" << strDblRight(pPolygon->dGetAvgUnconsD50(), 0, 14) << "| " << endl;
1703 }
1704
1705 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|--------------|" << endl << endl;
1706}
1707
1708//===============================================================================================================================
1710//===============================================================================================================================
1712{
1713 double dTmpTot = 0;
1714 double dTmpFineTot = 0;
1715 double dTmpSandTot = 0;
1716 double dTmpCoarseTot = 0;
1717
1724
1725 // TODO 082 Also show m_dStartIterUnconsFineAllCells etc.
1726
1727 LogStream << m_ulIter << ": Per-polygon pre-existing unconsolidated sediment. Note that this does not include pre-existing unconsolidated sediment outside the polygons.";
1728
1729 if (m_ulIter > 1)
1730 LogStream << " Also the all-polygon total will be slightly different from the all-polygon total at the end of the last timestep, since the coastline and polygons have been re-drawn.";
1731
1732 LogStream << endl;
1733
1734 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1735 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1736 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1737 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1738
1739 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1740 {
1741 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1742
1743 // Add to this-iteration all-polygon totals of consolidated sediment within polygons
1747
1748 // Now consider unconsolidated sediment
1749 double dThisFine = pPolygon->dGetPreExistingUnconsFine() + pPolygon->dGetSedimentInputUnconsFine();
1750 double dThisSand = pPolygon->dGetPreExistingUnconsSand() + pPolygon->dGetSedimentInputUnconsSand();
1751 double dThisCoarse = pPolygon->dGetPreExistingUnconsCoarse() + pPolygon->dGetSedimentInputUnconsCoarse();
1752
1753 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((dThisFine + dThisSand + dThisCoarse) * m_dCellArea, 0, 14) << "|" << strDblRight(dThisFine * m_dCellArea, 0, 14) << "|" << strDblRight(dThisSand * m_dCellArea, 0, 14) << "|" << strDblRight(dThisCoarse * m_dCellArea, 0, 14) << "|" << endl;
1754
1755 dTmpFineTot += (dThisFine * m_dCellArea);
1756 dTmpSandTot += (dThisSand * m_dCellArea);
1757 dTmpCoarseTot += (dThisCoarse * m_dCellArea);
1758 dTmpTot += (dThisFine + dThisSand + dThisCoarse) * m_dCellArea;
1759
1760 // Add to this-iteration all-polygon totals of unconsolidated sediment within polygons
1761 m_dTotalFineUnconsInPolygons += dThisFine;
1762 m_dTotalSandUnconsInPolygons += dThisSand;
1763 m_dTotalCoarseUnconsInPolygons += dThisCoarse;
1764 }
1765
1766 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1767 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1768 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1769}
1770
1771//===============================================================================================================================
1773//===============================================================================================================================
1775{
1776 LogStream << m_ulIter << ": Per-polygon sediment input event totals." << endl;
1777
1778 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1779 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1780 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1781 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1782
1783 double dTmpFineTot = 0;
1784 double dTmpSandTot = 0;
1785 double dTmpCoarseTot = 0;
1786 double dTmpTot = 0;
1787
1788 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1789 {
1790 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1791
1792 double dThisFine = pPolygon->dGetSedimentInputUnconsFine();
1793 double dThisSand = pPolygon->dGetSedimentInputUnconsSand();
1794 double dThisCoarse = pPolygon->dGetSedimentInputUnconsCoarse();
1795
1796 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((dThisFine + dThisSand + dThisCoarse) * m_dCellArea, 0, 14) << "|" << strDblRight(dThisFine * m_dCellArea, 0, 14) << "|" << strDblRight(dThisSand * m_dCellArea, 0, 14) << "|" << strDblRight(dThisCoarse * m_dCellArea, 0, 14) << "|" << endl;
1797
1798 dTmpFineTot += (dThisFine * m_dCellArea);
1799 dTmpSandTot += (dThisSand * m_dCellArea);
1800 dTmpCoarseTot += (dThisCoarse * m_dCellArea);
1801 dTmpTot += (dThisFine + dThisSand + dThisCoarse) * m_dCellArea;
1802 }
1803
1804 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1805 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1806 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1807}
1808
1809//===============================================================================================================================
1811//===============================================================================================================================
1813{
1814 double dTmpTot = 0;
1815 double dTmpFineTot = 0;
1816 double dTmpSandTot = 0;
1817 double dTmpCoarseTot = 0;
1818
1819 LogStream << endl << m_ulIter << ": Per-polygon unconsolidated sand/coarse sediment derived from erosion of the consolidated shore platform (all m^3). All fine sediment eroded from the shore platform goes to suspension." << endl;
1820
1821 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1822 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1823 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1824 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1825
1826 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1827 {
1828 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1829
1830 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((pPolygon->dGetPlatformErosionUnconsSand() + pPolygon->dGetPlatformErosionUnconsCoarse()) * m_dCellArea, 0, 14) << "|" << strDblRight(0, 0, 14) << "|" << strDblRight(pPolygon->dGetPlatformErosionUnconsSand() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetPlatformErosionUnconsCoarse() * m_dCellArea, 0, 14) << "|" << endl;
1831
1832 dTmpTot += (pPolygon->dGetPlatformErosionUnconsSand() + pPolygon->dGetPlatformErosionUnconsCoarse()) * m_dCellArea;
1833 dTmpSandTot += (pPolygon->dGetPlatformErosionUnconsSand() * m_dCellArea);
1834 dTmpCoarseTot += (pPolygon->dGetPlatformErosionUnconsCoarse() * m_dCellArea);
1835 }
1836
1837 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1838 LogStream << "TOTAL from shore platform |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1839 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1840}
1841
1842//===============================================================================================================================
1844//===============================================================================================================================
1846{
1847 LogStream << m_ulIter << ": Per-polygon cliff collapse (all m^3). Fine sediment derived from cliff collapse goes to suspension, sand/coarse sediment derived from cliff collapse becomes unconsolidated talus (DDPD = During Dean Profile Deposition)." << endl;
1848
1849 LogStream << "-----------|-----------|-----------|--------------------------------------------|-----------------------------|--------------------------------------------|--------------------------------------------|" << endl;
1850 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All sediment", 44) << "|" << strCentre("Fine sediment", 29) << "|" << strCentre("Sand sediment", 44) << "|" << strCentre("Coarse sediment", 44) << "|" << endl;
1851 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Eroded Cliff", 15) << strCentre("Eroded DDPD", 15) << strCentre("Deposited", 14) << "|" << strCentre("Eroded", 14) << "|" << strCentre("Suspension", 14) << "|" << strCentre("Eroded Cliff", 15) << strCentre("Eroded DDPD", 15) << strCentre("Deposited", 14) << "|" << strCentre("Eroded Cliff", 15) << strCentre("Eroded DDPD", 15) << strCentre("Deposited", 14) << "|" << endl;
1852 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1853
1854 double dTmpErosionTot = 0;
1855 double dTmpErosionDDPDTot = 0;
1856 double dTmpDepositTot = 0;
1857
1858 double dTmpErosionFineTot = 0;
1859 double dTmpSuspensionFineTot = 0;
1860
1861 double dTmpErosionSandTot = 0;
1862 double dTmpErosionSandDDPDTot = 0;
1863 double dTmpDepositSandTot = 0;
1864
1865 double dTmpErosionCoarseTot = 0;
1866 double dTmpErosionCoarseDDPDTot = 0;
1867 double dTmpDepositCoarseTot = 0;
1868
1869 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1870 {
1871 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1872
1873 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11)
1874 // All
1876 // Fine
1877 << strDblRight(pPolygon->dGetCliffCollapseErosionFine(), 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseToSuspensionFine(), 0, 14) << "|"
1878 // Sand
1879 << strDblRight(pPolygon->dGetCliffCollapseErosionSand(), 0, 14) << " " << strDblRight(pPolygon->dGetCliffCollapseSandErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseUnconsSandDeposition() * m_dCellArea, 0, 14) << "|"
1880 // Coarse
1881 << strDblRight(pPolygon->dGetCliffCollapseErosionCoarse(), 0, 14) << " " << strDblRight(pPolygon->dGetCliffCollapseCoarseErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseUnconsCoarseDeposition() * m_dCellArea, 0, 14) << "|" << endl;
1882
1883 dTmpErosionTot += ((pPolygon->dGetCliffCollapseErosionFine() + pPolygon->dGetCliffCollapseErosionSand() + pPolygon->dGetCliffCollapseErosionCoarse()) * m_dCellArea);
1884
1885 dTmpErosionDDPDTot += ((pPolygon->dGetCliffCollapseSandErodedDeanProfile() + pPolygon->dGetCliffCollapseCoarseErodedDeanProfile()) * m_dCellArea);
1886
1888
1889 dTmpErosionFineTot += (pPolygon->dGetCliffCollapseErosionFine() * m_dCellArea);
1890 dTmpSuspensionFineTot += (pPolygon->dGetCliffCollapseToSuspensionFine() * m_dCellArea);
1891
1892 dTmpErosionSandTot += ((pPolygon->dGetCliffCollapseErosionSand()) * m_dCellArea);
1893 dTmpErosionSandDDPDTot += ((pPolygon->dGetCliffCollapseSandErodedDeanProfile()) * m_dCellArea);
1894 dTmpDepositSandTot += (pPolygon->dGetCliffCollapseUnconsSandDeposition() * m_dCellArea);
1895
1896 dTmpErosionCoarseTot += ((pPolygon->dGetCliffCollapseErosionCoarse()) * m_dCellArea);
1897 dTmpErosionCoarseDDPDTot += ((pPolygon->dGetCliffCollapseCoarseErodedDeanProfile()) * m_dCellArea);
1898 dTmpDepositCoarseTot += pPolygon->dGetCliffCollapseUnconsCoarseDeposition() * m_dCellArea;
1899 }
1900
1901 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1902 LogStream << "TOTAL from cliff collapse |" << strDblRight(dTmpErosionTot, 0, 14) << " " << strDblRight(dTmpErosionDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositTot, 0, 14) << "|"
1903 << strDblRight(dTmpErosionFineTot, 0, 14) << "|" << strDblRight(dTmpSuspensionFineTot, 0, 14) << "|"
1904 << strDblRight(dTmpErosionSandTot, 0, 14) << " " << strDblRight(dTmpErosionSandDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositSandTot, 0, 14) << "|"
1905 << strDblRight(dTmpErosionCoarseTot, 0, 14) << " " << strDblRight(dTmpErosionCoarseDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositCoarseTot, 0, 14) << "|" << endl;
1906 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl << endl;
1907}
1908
1909//===============================================================================================================================
1911//===============================================================================================================================
1913{
1914 LogStream << m_ulIter << ": Per-polygon totals of stored unconsolidated beach sediment prior to polygon-to-polygon movement (all m^3). Note that this does not include unconsolidated sediment stored outside the polygons." << endl;
1915
1916 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1917 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1918 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1919 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1920
1921 double dTmpTot = 0;
1922 double dTmpFineTot = 0;
1923 double dTmpSandTot = 0;
1924 double dTmpCoarseTot = 0;
1925
1926 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1927 {
1928 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1929
1930 double dFine = pPolygon->dGetPreExistingUnconsFine();
1931 double dSand = pPolygon->dGetPreExistingUnconsSand();
1932 double dCoarse = pPolygon->dGetPreExistingUnconsCoarse();
1933
1934 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((dFine + dSand + dCoarse) * m_dCellArea, 0, 14) << "|" << strDblRight(dFine * m_dCellArea, 0, 14) << "|" << strDblRight(dSand * m_dCellArea, 0, 14) << "|" << strDblRight(dCoarse * m_dCellArea, 0, 14) << "|" << endl;
1935
1936 dTmpTot += (dFine + dSand + dCoarse) * m_dCellArea;
1937 dTmpFineTot += (dFine * m_dCellArea);
1938 dTmpSandTot += (dSand * m_dCellArea);
1939 dTmpCoarseTot += (dCoarse * m_dCellArea);
1940 }
1941
1942 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1943 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1944 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1945}
1946
1947//===============================================================================================================================
1949//===============================================================================================================================
1951{
1952 LogStream << m_ulIter << ": Per-polygon potential (i.e. not considering sediment availability) erosion of all size classes of unconsolidated beach sediment (-ve, all m^3), calculated with the ";
1953
1955 LogStream << "CERC";
1956
1958 LogStream << "Kamphuis";
1959
1960 LogStream << " equation." << endl;
1961
1962 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1963 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("Potential", 14) << "|" << endl;
1964 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Erosion", 14) << "|" << endl;
1965 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1966
1967 double dTmpTot = 0;
1968
1969 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1970 {
1971 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1972
1973 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight(pPolygon->dGetPotentialErosion() * m_dCellArea, 0, 14) << "|" << endl;
1974
1975 dTmpTot += (pPolygon->dGetPotentialErosion() * m_dCellArea);
1976 }
1977
1978 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1979 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << endl;
1980 LogStream << "-----------|-----------|-----------|--------------|" << endl << endl;
1981}
1982
1983// //===============================================================================================================================
1984// //! Writes to the log file a table showing per-polygon supply-limited erosion of unconsolidated beach sediment
1985// //===============================================================================================================================
1986// void CSimulation::WritePolygonUnconsErosion(int const nCoast)
1987// {
1988// LogStream << m_ulIter << ": per-polygon supply-limited erosion of unconsolidated beach sediment (-ve, all m^3). All fine sediment eroded goes to suspension." << endl;
1989//
1990// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1991// LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) <<"|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1992// LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Estimated", 14) << "|" << strCentre("Estimated", 14) <<"|" << strCentre("Estimated", 14) << "|" << strCentre("Estimated", 14) << "|" << endl;
1993// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1994//
1995// double
1996// dTmpTot = 0,
1997// dTmpFineTot = 0,
1998// dTmpSandTot = 0,
1999// dTmpCoarseTot = 0;
2000//
2001// for (int nPoly = 0; nPoly < m_VCoast[nCoast].nGetNumPolygons(); nPoly++)
2002// {
2003// CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(nPoly);
2004//
2005// LogStream << strIntRight(m_pVCoastPolygon[nPoly]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(m_pVCoastPolygon[nPoly]->nGetCoastID(), 11) << "|" << strDblRight((pPolygon->dGetBeachErosionUnconsFine() + pPolygon->dGetBeachErosionUnconsSand() + pPolygon->dGetBeachErosionUnconsCoarse()) * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetBeachErosionUnconsSand() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetBeachErosionUnconsCoarse() * m_dCellArea, 0, 14) << "|" << endl;
2006//
2007// dTmpTot += (pPolygon->dGetBeachErosionUnconsFine() + pPolygon->dGetBeachErosionUnconsSand() + pPolygon->dGetBeachErosionUnconsCoarse()) * m_dCellArea;
2008// dTmpFineTot += (pPolygon->dGetBeachErosionUnconsFine() * m_dCellArea);
2009// dTmpSandTot += (pPolygon->dGetBeachErosionUnconsSand() * m_dCellArea);
2010// dTmpCoarseTot += (pPolygon->dGetBeachErosionUnconsCoarse() * m_dCellArea);
2011// }
2012//
2013// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
2014// LogStream << "TOTAL estimated erosion |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
2015// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
2016// }
2017
2018//===============================================================================================================================
2020//===============================================================================================================================
2021void CSimulation::WritePolygonUnsortedSequence(int const nCoast, vector<vector<int> > &pnVVPolyAndAdjacent)
2022{
2023 LogStream << m_ulIter << ": Unsorted sequence of polygon processing (-9999 = leaves grid)" << endl;
2024 LogStream << "-----------|-----------|-----------|-----------|-----------|" << endl;
2025 LogStream << strCentre("From", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("From", 11) << "|" << strCentre("Direction", 11) << "|" << strCentre("To", 11) << "|" << endl;
2026 LogStream << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << endl;
2027 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << endl;
2028 LogStream << "-----------|-----------|-----------|-----------|-----------|" << endl;
2029
2030 for (int n = 0; n < static_cast<int>(pnVVPolyAndAdjacent.size()); n++)
2031 {
2032 CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(pnVVPolyAndAdjacent[n][1]);
2033
2034 for (int m = 0; m < static_cast<int>(pnVVPolyAndAdjacent[n].size()); m++)
2035 {
2036 if (m == 0)
2037 {
2038 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|";
2039 LogStream << strIntRight(nCoast, 11) << "|";
2040 continue;
2041 }
2042
2043 if (m == 1)
2044 {
2045 LogStream << strIntRight(pPolygon->nGetCoastID(), 11) << "|";
2046 continue;
2047 }
2048
2049 if (m == 2)
2050 {
2051 if (pnVVPolyAndAdjacent[n][m] == true)
2052 LogStream << strCentre("DOWN ", 11) << "|";
2053
2054 else
2055 LogStream << strCentre("UP ", 11) << "|";
2056
2057 continue;
2058 }
2059
2060 int nAdjDownCoast = pnVVPolyAndAdjacent[n][m];
2061 int nCoastID = INT_NODATA;
2062
2063 if (nAdjDownCoast != INT_NODATA)
2064 {
2065 CGeomCoastPolygon const* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjDownCoast);
2066 nCoastID = pAdjPolygon->nGetCoastID();
2067 }
2068
2069 LogStream << strIntRight(nCoastID, 11) << "|";
2070 }
2071
2072 LogStream << endl;
2073 }
2074
2075 LogStream << "-----------|-----------|-----------|-----------|-----------|" << endl << endl;
2076}
2077
2078//===============================================================================================================================
2080//===============================================================================================================================
2081void CSimulation::WritePolygonSortedSequence(int const nCoast, vector<vector<int>>& pnVVPolyAndAdjacent)
2082{
2083 // Show sorted order of polygon processing, and any circularities
2084 LogStream << m_ulIter << ": Sorted sequence of polygon processing (" << INT_NODATA << " = leaves grid), and any X -> Y -> X circularities" << endl;
2085
2086 LogStream << "-----------|-----------|-----------|-----------|----------------------|----------------------|" << endl;
2087 LogStream << strCentre("From", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("From", 11) << "|" << strCentre("Direction", 11) << "|" << strCentre("To", 22) << "|" << strCentre("Circularity", 22) << "|" << endl;
2088 LogStream << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 22) << "|" << strCentre("", 22) << "|" << endl;
2089 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 22) << "|" << strCentre("", 22) << "|" << endl;
2090 LogStream << "-----------|-----------|-----------|-----------|----------------------|----------------------|" << endl;
2091
2092 for (int nPoly = 0; nPoly < static_cast<int>(pnVVPolyAndAdjacent.size()); nPoly++)
2093 {
2094 const CGeomCoastPolygon* pPoly = m_VCoast[nCoast].pGetPolygon(pnVVPolyAndAdjacent[nPoly][1]);
2095 vector<int> VCirc = pPoly->VnGetCircularities();
2096
2097 LogStream << strIntRight(pPoly->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPoly->nGetCoastID(), 11) << "|";
2098
2099 // Up-coast or down-coast sediment movement?
2100 if (pnVVPolyAndAdjacent[nPoly][2] == true)
2101 LogStream << strCentre("DOWN ", 11) << "|";
2102
2103 else
2104 LogStream << strCentre("UP ", 11) << "|";
2105
2106 // Now the 'To' polygons: first copy the list of adjacent polygons
2107 vector<int> nVTmp;
2108
2109 for (int m = 3; m < static_cast<int>(pnVVPolyAndAdjacent[nPoly].size()); m++)
2110 nVTmp.push_back(pnVVPolyAndAdjacent[nPoly][m]);
2111
2112 // Now sort the copy
2113 sort(nVTmp.begin(), nVTmp.end());
2114
2115 // And write it out
2116 string strTmp;
2117
2118 for (int m = 0; m < static_cast<int>(nVTmp.size()); m++)
2119 {
2120 strTmp += to_string(nVTmp[m]);
2121
2122 if (m < static_cast<int>(nVTmp.size()) - 1)
2123 strTmp += " ";
2124 }
2125
2126 LogStream << strRight(strTmp, 22) << "|";
2127
2128 // Now show any circularities
2129 strTmp = "";
2130
2131 if (! VCirc.empty())
2132 {
2133 // There is at least one circularity
2134 for (unsigned int i = 0; i < VCirc.size(); i++)
2135 {
2136
2137 strTmp += to_string(VCirc[i]);
2138
2139 if (i < (VCirc.size() - 1))
2140 strTmp += " ";
2141 }
2142 }
2143
2144 LogStream << strCentre(strTmp, 22) << "|" << endl;
2145 }
2146
2147 LogStream << "-----------|-----------|-----------|-----------|----------------------|----------------------|" << endl << endl;
2148}
2149
2150//===============================================================================================================================
2152//===============================================================================================================================
2153void CSimulation::WritePolygonActualMovement(int const nCoast, vector<vector<int>> const& pnVVPolyAndAdjacent)
2154{
2155 // Show estimated polygon-to-polygon movement
2156 LogStream << m_ulIter << ": per-polygon erosion and deposition of unconsolidated beach sediment, all m^3. Fine sediment is moved to suspension, not deposited (DDPD = During Dean Profile Deposition)." << endl;
2157
2158 LogStream << "-----------|-----------|-----------|--------------------------------------------|-----------------------------|--------------------------------------------|--------------------------------------------|" << endl;
2159 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 44) << "|" << strCentre("Fine", 29) << "|" << strCentre("Sand", 44) << "|" << strCentre("Coarse", 44) << "|" << endl;
2160 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
2161 LogStream << strCentre("", 11) << "|" << strCentre("", 11) << "|" << strCentre("", 11) << "|" << strCentre("Erosion", 14) << " " << strCentre("Erosion DPDD", 14) << "|" << strCentre("Dep + Susp", 14) << "|" << strCentre("Erosion", 14) << "|" << strCentre("Suspension", 14) << "|" << strCentre("Erosion", 14) << " " << strCentre("Erosion DPDD", 14) << "|" << strCentre("Deposition", 14) << "|" << strCentre("Erosion", 14) << " " << strCentre("Erosion DPDD", 14) << "|" << strCentre("Deposition", 14) << "|" << endl;
2162 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
2163
2164 double dTmpTotAllErosion = 0;
2165 double dTmpTotAllErosionDDPD = 0;
2166 double dTmpTotAllDeposition = 0;
2167
2168 double dTmpFineErosion = 0;
2169 // double dTmpFineDeposition = 0;
2170
2171 double dTmpSandErosion = 0;
2172 double dTmpSandErosionDDPD = 0;
2173 double dTmpSandDeposition = 0;
2174
2175 double dTmpCoarseErosion = 0;
2176 double dTmpCoarseErosionDDPD = 0;
2177 double dTmpCoarseDeposition = 0;
2178
2179 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
2180 {
2181 int nPoly = pnVVPolyAndAdjacent[n][1];
2182
2183 double dAllErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGeBeachErosionAllUncons() - (m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile());
2184 double dSandErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsSand() - m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile();
2185 double dCoarseErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsCoarse() - m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile();
2186
2187 LogStream << strIntRight(m_pVCoastPolygon[nPoly]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(m_pVCoastPolygon[nPoly]->nGetCoastID(), 11) << "|"
2188 // All
2189 << strDblRight(dAllErosionNotDDPD * m_dCellArea, 0, 14) << " " << strDblRight((m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile()) * m_dCellArea, 0, 14) << "|" << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons() * m_dCellArea, 0, 14) << "|"
2190 // Fine
2191 << strDblRight(-m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|" << strDblRight(-m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|"
2192 // Sand
2193 << strDblRight(dSandErosionNotDDPD * m_dCellArea, 0, 14) << " " << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachDepositionUnconsSand() * m_dCellArea, 0, 14) << "|"
2194 // Coarse
2195 << strDblRight(dCoarseErosionNotDDPD * m_dCellArea, 0, 14) << " " << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(m_pVCoastPolygon[nPoly]->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea, 0, 14) << "|" << endl;
2196
2197 dTmpTotAllErosion += (dAllErosionNotDDPD * m_dCellArea);
2198 dTmpTotAllErosionDDPD += ((m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile()) * m_dCellArea);
2199 dTmpTotAllDeposition += (m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons() * m_dCellArea);
2200
2201 dTmpFineErosion += (m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea);
2202 // dTmpFineDeposition +=
2203
2204 dTmpSandErosion += (dSandErosionNotDDPD * m_dCellArea);
2205 dTmpSandErosionDDPD += (m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() * m_dCellArea);
2206 dTmpSandDeposition += (m_pVCoastPolygon[nPoly]->dGetBeachDepositionUnconsSand() * m_dCellArea);
2207
2208 dTmpCoarseErosion += (dCoarseErosionNotDDPD * m_dCellArea);
2209 dTmpCoarseErosionDDPD += (m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile() * m_dCellArea);
2210 dTmpCoarseDeposition += (m_pVCoastPolygon[nPoly]->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea);
2211 }
2212
2213 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
2214 LogStream << "Lost from grid |" << strLeft("", 14) << "|" << strLeft("", 14) << "|" << strDblRight((m_dThisIterLeftGridUnconsSand + m_dThisIterLeftGridUnconsCoarse) * m_dCellArea, 0, 14) << "|" << strLeft("", 14) << "|" << strLeft("", 14) << "|" << strLeft("", 14) << "|" << strLeft("", 14) << "|" << strDblRight(m_dThisIterLeftGridUnconsSand * m_dCellArea, 0, 14) << "|" << strLeft("", 14) << "|" << strLeft("", 14) << "|" << strDblRight(m_dThisIterLeftGridUnconsCoarse * m_dCellArea, 0, 14) << "|" << endl;
2215
2217 dTmpSandDeposition += (m_dThisIterLeftGridUnconsSand * m_dCellArea);
2218 dTmpCoarseDeposition += (m_dThisIterLeftGridUnconsCoarse * m_dCellArea);
2219
2220 bool bShowZeroFine = false;
2221 bool bShowZeroSand = false;
2222 bool bShowZeroCoarse = false;
2223
2224 if (! bFPIsEqual(dTmpFineErosion, 0.0, MASS_BALANCE_TOLERANCE))
2225 bShowZeroFine = true;
2226
2227 if (! bFPIsEqual(dTmpSandErosion, 0.0, MASS_BALANCE_TOLERANCE))
2228 bShowZeroSand = true;
2229
2230 if (! bFPIsEqual(dTmpCoarseErosion, 0.0, MASS_BALANCE_TOLERANCE))
2231 bShowZeroCoarse = true;
2232
2233 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
2234 LogStream << "TOTAL |"
2235 // All
2236 << strDblRight(-dTmpTotAllErosion, 0, 14) << "|" << strDblRight(dTmpTotAllErosionDDPD, 0, 14) << "|" << strDblRight(dTmpTotAllDeposition, 0, 14) << "|"
2237 // Fine
2238 << strDblRight(-dTmpFineErosion, 0, 14, bShowZeroFine) << "|" << strDblRight(dTmpFineErosion, 0, 14, bShowZeroFine) << "|"
2239 // Sand
2240 << strDblRight(-dTmpSandErosion, 0, 14, bShowZeroSand) << "|" << strDblRight(dTmpSandErosionDDPD, 0, 14, bShowZeroSand) << "|" << strDblRight(dTmpSandDeposition, 0, 14, bShowZeroSand) << "|"
2241 // Coarse
2242 << strDblRight(-dTmpCoarseErosion, 0, 14, bShowZeroCoarse) << "|" << strDblRight(dTmpCoarseErosionDDPD, 0, 14, bShowZeroCoarse) << "|" << strDblRight(dTmpCoarseDeposition, 0, 14, bShowZeroCoarse) << "|" << endl;
2243 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
2244}
2245
2246//===============================================================================================================================
2248//===============================================================================================================================
2250{
2252 {
2253 // TODO 062 show these results somewhere
2254 // At end of timestep, get the numbers of cells with consolidated and unconsolidated sediment stored or in suspension, for all cells (both inside and outside polygons)
2255 int nSuspFineCellsAllCells = 0;
2256 int nUnconsFineCellsAllCells = 0;
2257 int nUnconsSandCellsAllCells = 0;
2258 int nUnconsCoarseCellsAllCells = 0;
2259
2260 // TODO 062 show these results somewhere
2261 // Also get the numbers of cells with consolidated and unconsolidated sediment stored or in suspension, only for cells inside polygons
2262 int nSuspFineCellsInPolygons = 0;
2263 int nUnconsFineCellsInPolygons = 0;
2264 int nUnconsSandCellsInPolygons = 0;
2265 int nUnconsCoarseCellsInPolygons = 0;
2266
2267 // Get the depths of consolidated and unconsolidated sediment stored or in suspension, for all cells (both inside and outside polygons)
2268 double dEndIterSuspFineAllCells = 0;
2269 double dEndIterUnconsFineAllCells = 0;
2270 double dEndIterUnconsSandAllCells = 0;
2271 double dEndIterUnconsCoarseAllCells = 0;
2272 double dEndIterConsFineAllCells = 0;
2273 double dEndIterConsSandAllCells = 0;
2274 double dEndIterConsCoarseAllCells = 0;
2275
2276 // Also get the depths of consolidated and unconsolidated sediment stored or in suspension, only for cells inside polygons
2277 double dEndIterSuspFineInPolygons = 0;
2278 double dEndIterUnconsFineInPolygons = 0;
2279 double dEndIterUnconsSandInPolygons = 0;
2280 double dEndIterUnconsCoarseInPolygons = 0;
2281 double dEndIterConsFineInPolygons = 0;
2282 double dEndIterConsSandInPolygons = 0;
2283 double dEndIterConsCoarseInPolygons = 0;
2284
2285 // Get depth of consolidated and unconsolidated (and suspended) sediment from each cell (both within and outside polygons)
2286 for (int nX = 0; nX < m_nXGridSize; nX++)
2287 {
2288 for (int nY = 0; nY < m_nYGridSize; nY++)
2289 {
2290 dEndIterConsFineAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsFineThickConsiderNotch();
2291 dEndIterConsSandAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsSandThickConsiderNotch();
2292 dEndIterConsCoarseAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsCoarseThickConsiderNotch();
2293
2294 double dSuspFine = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
2295
2296 if (dSuspFine > 0)
2297 {
2298 dEndIterSuspFineAllCells += dSuspFine;
2299 nSuspFineCellsAllCells++;
2300 }
2301
2302 double dUnconsFine = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsFine();
2303
2304 if (dUnconsFine > 0)
2305 {
2306 dEndIterUnconsFineAllCells += dUnconsFine;
2307 nUnconsFineCellsAllCells++;
2308 }
2309
2310 double dUnconsSand = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsSand();
2311
2312 if (dUnconsSand > 0)
2313 {
2314 dEndIterUnconsSandAllCells += dUnconsSand;
2315 nUnconsSandCellsAllCells++;
2316 }
2317
2318 double dUnconsCoarse = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsCoarse();
2319
2320 if (dUnconsCoarse > 0)
2321 {
2322 dEndIterUnconsCoarseAllCells += dUnconsCoarse;
2323 nUnconsCoarseCellsAllCells++;
2324 }
2325
2326 // Is this cell within a polygon?
2327 if (m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID() != INT_NODATA)
2328 {
2329 // It is within a polygon
2330 dEndIterConsFineInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsFineThickConsiderNotch();
2331 dEndIterConsSandInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsSandThickConsiderNotch();
2332 dEndIterConsCoarseInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsCoarseThickConsiderNotch();
2333
2334 dSuspFine = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
2335
2336 if (dSuspFine > 0)
2337 {
2338 dEndIterSuspFineInPolygons += dSuspFine;
2339 nSuspFineCellsInPolygons++;
2340 }
2341
2342 dUnconsFine = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsFine();
2343
2344 if (dUnconsFine > 0)
2345 {
2346 dEndIterUnconsFineInPolygons += dUnconsFine;
2347 nUnconsFineCellsInPolygons++;
2348 }
2349
2350 dUnconsSand = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsSand();
2351
2352 if (dUnconsSand > 0)
2353 {
2354 dEndIterUnconsSandInPolygons += dUnconsSand;
2355 nUnconsSandCellsInPolygons++;
2356 }
2357
2358 dUnconsCoarse = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsCoarse();
2359
2360 if (dUnconsCoarse > 0)
2361 {
2362 dEndIterUnconsCoarseInPolygons += dUnconsCoarse;
2363 nUnconsCoarseCellsInPolygons++;
2364 }
2365 }
2366 }
2367 }
2368
2369 double dFineTmp = 0;
2370 double dSandTmp = 0;
2371 double dCoarseTmp = 0;
2372
2373 LogStream << endl << m_ulIter << ": Consolidated sediment budget, all m^3. This includes sediment within and outside the polygons." << endl;
2374
2375 // Stored consolidated sediment at start of timestep: sediment within and outside the polygons
2376 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2377 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2378 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2379
2380 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2383
2384 LogStream << strLeft("At start of timestep " + to_string(m_ulIter) + ", stored consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dTmp1 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp2 * m_dCellArea, 0, 14) << "|" << strDblRight(m_dStartIterConsFineAllCells * m_dCellArea, 0, 14) << "|" << endl;
2385
2386 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2389
2390 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dTmp3 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp4 * m_dCellArea, 0, 14) << "|" << strDblRight(m_dStartIterConsSandAllCells * m_dCellArea, 0, 14) << "|" << endl;
2391
2392 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2395
2396 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dTmp5 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp6 * m_dCellArea, 0, 14) << "|" << strDblRight( m_dStartIterConsCoarseAllCells * m_dCellArea, 0, 14) << "|" << endl;
2397
2398 LogStream << strLeft("", 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight((dTmp1 + dTmp3 + dTmp5) * m_dCellArea, 0, 14) << "|" << strDblRight((dTmp2 + dTmp4 + dTmp6) * m_dCellArea, 0, 14) << "|" << strDblRight((m_dStartIterConsFineAllCells + m_dStartIterConsSandAllCells + m_dStartIterConsCoarseAllCells) * m_dCellArea, 0, 14) << "|" << endl;
2399
2400 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2401
2405
2406 // Shore platform erosion, consolidated sediment lost (becomes unconsolidated esediment and suspended sediment)
2407 LogStream << strLeft("Consolidated sediment lost via platform erosion (becomes suspended sediment)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2408 LogStream << strLeft("Consolidated sediment lost via platform erosion (becomes unconsolidated sediment)", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2409 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2411 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2412
2416
2417 // Cliff collapse, consolidated sediment lost (becomes unconsolidated esediment and suspended sediment)
2418 LogStream << strLeft("Consolidated sediment lost via cliff collapse (becomes suspended sediment)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2419 LogStream << strLeft("Consolidated sediment lost via cliff collapse (becomes unconsolidated sediment)", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2420 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2422
2426
2427 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2428 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2429 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2430
2431 // Don't show inside/outside polygon values if not simulating beach erosion
2432 dTmp1 = (m_bDoBeachSedimentTransport ? dEndIterConsFineInPolygons : 0);
2433 dTmp2 = (m_bDoBeachSedimentTransport ? (dEndIterConsFineAllCells - dEndIterConsFineInPolygons) : 0);
2434
2435 LogStream << strLeft("At end of timestep " + to_string(m_ulIter) + ", stored consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dTmp1 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp2 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterConsFineAllCells * m_dCellArea, 0, 14) << "|" << endl;
2436
2437 // Don't show inside/outside polygon values if not simulating beach erosion
2438 dTmp3 = (m_bDoBeachSedimentTransport ? dEndIterConsSandInPolygons : 0);
2439 dTmp4 = (m_bDoBeachSedimentTransport ? (dEndIterConsSandAllCells - dEndIterConsSandInPolygons) : 0);
2440 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dTmp3 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp4 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterConsSandAllCells * m_dCellArea, 0, 14) << "|" << endl;
2441
2442 // Don't show inside/outside polygon values if not simulating beach erosion
2443 dTmp5 = (m_bDoBeachSedimentTransport ? dEndIterConsCoarseInPolygons : 0);
2444 dTmp6 = (m_bDoBeachSedimentTransport ? (dEndIterConsCoarseAllCells - dEndIterConsCoarseInPolygons) : 0);
2445
2446 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dTmp5 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp6 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterConsCoarseAllCells * m_dCellArea, 0, 14) << "|" << endl;
2447
2448 LogStream << strLeft("", 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight((dTmp1 + dTmp3 + dTmp5) * m_dCellArea, 0, 14) << "|" << strDblRight((dTmp2 + dTmp4 + dTmp6) * m_dCellArea, 0, 14) << "|" << strDblRight((dEndIterConsFineAllCells + dEndIterConsSandAllCells + dEndIterConsCoarseAllCells) * m_dCellArea, 0, 14) << "|" << endl;
2449
2450 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2451
2452 double dFineError = (dEndIterConsFineAllCells * m_dCellArea) - dFineTmp;
2453 double dSandError = (dEndIterConsSandAllCells * m_dCellArea) - dSandTmp;
2454 double dCoarseError = (dEndIterConsCoarseAllCells * m_dCellArea) - dCoarseTmp;
2455
2456 // Mass balance check
2457 bool bError = false;
2458 string strFineErrMsg = "";
2459 string strSandErrMsg = "";
2460 string strCoarseErrMsg = "";
2461 string strAllErrMsg = "";
2462
2463 if (! bFPIsEqual(dFineError, 0.0, MASS_BALANCE_TOLERANCE))
2464 {
2465 strFineErrMsg = MASS_BALANCE_ERROR;
2466 bError = true;
2467 }
2468
2469 if (! bFPIsEqual(dSandError, 0.0, MASS_BALANCE_TOLERANCE))
2470 {
2471 strSandErrMsg = MASS_BALANCE_ERROR;
2472 bError = true;
2473 }
2474
2475 if (! bFPIsEqual(dCoarseError, 0.0, MASS_BALANCE_TOLERANCE))
2476 {
2477 strCoarseErrMsg = MASS_BALANCE_ERROR;
2478 bError = true;
2479 }
2480
2481 if (bError)
2482 strAllErrMsg = MASS_BALANCE_ERROR;
2483
2484 LogStream << strLeft("Consolidated sediment mass balance check (+ve means end total > start total)", 101) << "|" << strLeft("", 8) << "|" << strLeft("", 44) << "|" << endl;
2485 LogStream << strLeft(strFineErrMsg, 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dFineError, 3, 30, false) << strRightPerCent(dFineError, dEndIterConsFineAllCells, 14, 2) << "|" << endl;
2486 LogStream << strLeft(strSandErrMsg, 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dSandError, 3, 30, false) << strRightPerCent(dSandError, dEndIterConsSandAllCells, 14, 2) << "|" << endl;
2487 LogStream << strLeft(strCoarseErrMsg, 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dCoarseError, 3, 30, false) << strRightPerCent(dCoarseError, dEndIterConsCoarseAllCells, 14, 2) << "|" << endl;
2488 LogStream << strLeft(strAllErrMsg, 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight(dFineError + dSandError + dCoarseError, 3, 30, false) << strRightPerCent(dFineError + dSandError + dCoarseError, dEndIterConsFineAllCells + dEndIterConsSandAllCells + dEndIterConsCoarseAllCells, 14, 2) << "|" << endl;
2489 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2490 LogStream << endl;
2491
2492 // Now look at unconsolidated sediment
2493 dFineTmp =
2494 dSandTmp =
2495 dCoarseTmp = 0;
2496
2497 LogStream << m_ulIter << ": Unconsolidated sediment budget, all m^3." << endl;
2498
2499 // Stored unconsolidated sediment, and in suspension, at start of timestep: sediment within and outside the polygons
2500 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2501 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2502 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2503
2504 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2507
2508 LogStream << strLeft("At start of timestep " + to_string(m_ulIter) + ", sediment in suspension", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dTmp1 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp2 * m_dCellArea, 0, 14) << "|" << strDblRight(m_dStartIterSuspFineAllCells * m_dCellArea, 0, 14) << "|" << endl;
2509
2510 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2513
2514 LogStream << strLeft("At start of timestep " + to_string(m_ulIter) + ", stored unconsolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dTmp3 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp4 * m_dCellArea, 0, 14) << "|" << strDblRight(m_dStartIterUnconsFineAllCells * m_dCellArea, 0, 14) << "|" << endl;
2515
2516 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2519
2520 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dTmp5 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp6 * m_dCellArea, 0, 14) << "|" << strDblRight(m_dStartIterUnconsSandAllCells * m_dCellArea, 0, 14) << "|" << endl;
2521
2522 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2525
2526 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dTmp7 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp8 * m_dCellArea, 0, 14) << "|" << strDblRight( m_dStartIterUnconsCoarseAllCells * m_dCellArea, 0, 14) << "|" << endl;
2527
2528 LogStream << strLeft("", 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight((dTmp1 + dTmp3 + dTmp5 + dTmp7) * m_dCellArea, 0, 14) << "|" << strDblRight((dTmp2 + dTmp4 + dTmp6 + dTmp8) * m_dCellArea, 0, 14) << "|" << strDblRight((m_dStartIterSuspFineAllCells + m_dStartIterUnconsFineAllCells + m_dStartIterUnconsSandAllCells + m_dStartIterUnconsCoarseAllCells) * m_dCellArea, 0, 14) << "|" << endl;
2529
2530 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2531
2535
2536 // Shore platform erosion, consolidated sediment becomes unconsolidated sediment and suspended sediment
2537 LogStream << strLeft("Suspended sediment derived from platform erosion of consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2538 LogStream << strLeft("Unconsolidated sediment derived from platform erosion of consolidated sediment", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2539 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2541 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2542
2546
2547 // Cliff collapse, consolidated sediment becomes unconsolidated sediment and suspended sediment
2548 LogStream << strLeft("Suspended sediment derived from cliff collapse erosion of consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2549 LogStream << strLeft("Unconsolidated sediment derived from cliff collapse erosion of consolidated sediment only", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2550 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2552 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2553
2557
2558 // Beach (unconsolidated sediment) lost from grid due to beach erosion and deposition, and to cliff collapse with talus going outside the grid
2559 LogStream << strLeft("Unconsolidated sediment lost from grid", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsFine * m_dCellArea, 0, 44) << "|" << endl;
2560 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsSand * m_dCellArea, 0, 44) << "|" << endl;
2561 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsCoarse * m_dCellArea, 0, 44) << "|" << endl;
2563 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2564
2568
2569 // Sediment added via input events
2570 LogStream << strLeft("Unconsolidated sediment added via input event(s)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisiterUnconsFineInput * m_dCellArea, 0, 44) << "|" << endl;
2571 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisiterUnconsSandInput * m_dCellArea, 0, 44) << "|" << endl;
2572 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisiterUnconsCoarseInput * m_dCellArea, 0, 44) << "|" << endl;
2573 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2574
2577 dCoarseTmp += (m_dThisiterUnconsCoarseInput * m_dCellArea);
2578
2579 // Any uncons sediment left over from last iter and deposited this iter?
2580
2581 LogStream << strLeft("Insufficient unconsolidated sediment deposited last iteration, carried forward to this iteration", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dUnconsSandNotDepositedLastIter * m_dCellArea, 0, 44) << "|" << endl;
2582 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dUnconsCoarseNotDepositedLastIter * m_dCellArea, 0, 44) << "|" << endl;
2583
2586
2587 // Any insufficient deposition?
2588 LogStream << strLeft("Insufficient unconsolidated sediment deposited this iteration", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dDepositionSandDiff * m_dCellArea, 0, 44) << "|" << endl;
2589 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dDepositionCoarseDiff * m_dCellArea, 0, 44) << "|" << endl;
2590
2591 dSandTmp -= (m_dDepositionSandDiff * m_dCellArea);
2592 dCoarseTmp -= (m_dDepositionCoarseDiff * m_dCellArea);
2593
2594 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2595 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2596 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2597
2598 // Don't show inside/outside polygon values if not simulating beach erosion
2599 dTmp1 = (m_bDoBeachSedimentTransport ? dEndIterSuspFineInPolygons : 0);
2600 dTmp2 = (m_bDoBeachSedimentTransport ? (dEndIterSuspFineAllCells - dEndIterSuspFineInPolygons) : 0);
2601
2602 LogStream << strLeft("At end of timestep " + to_string(m_ulIter) + ", sediment in suspension", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dTmp1 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp2 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterSuspFineAllCells * m_dCellArea, 0, 14) << "|" << endl;
2603
2604 // Don't show inside/outside polygon values if not simulating beach erosion
2605 dTmp3 = (m_bDoBeachSedimentTransport ? dEndIterUnconsFineInPolygons : 0);
2606 dTmp4 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsFineAllCells - dEndIterUnconsFineInPolygons) : 0);
2607
2608 LogStream << strLeft("At end of timestep " + to_string(m_ulIter) + ", stored unconsolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dTmp3 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp4 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterUnconsFineAllCells * m_dCellArea, 0, 14) << "|" << endl;
2609
2610 // Don't show inside/outside polygon values if not simulating beach erosion
2611 dTmp5 = (m_bDoBeachSedimentTransport ? dEndIterUnconsSandInPolygons : 0);
2612 dTmp6 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsSandAllCells - dEndIterUnconsSandInPolygons) : 0);
2613
2614 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dTmp5 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp6 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterUnconsSandAllCells * m_dCellArea, 0, 14) << "|" << endl;
2615
2616 // Don't show inside/outside polygon values if not simulating beach erosion
2617 dTmp7 = (m_bDoBeachSedimentTransport ? dEndIterUnconsCoarseInPolygons : 0);
2618 dTmp8 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsCoarseAllCells - dEndIterUnconsCoarseInPolygons) : 0);
2619
2620 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dTmp7 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp8 * m_dCellArea, 0, 14) << "|" << strDblRight(dEndIterUnconsCoarseAllCells * m_dCellArea, 0, 14) << "|" << endl;
2621
2622 LogStream << strLeft("", 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight((dTmp1 + dTmp3 + dTmp5 + dTmp7) * m_dCellArea, 0, 14) << "|" << strDblRight((dTmp2 + dTmp4 + dTmp6 + dTmp8) * m_dCellArea, 0, 14) << "|" << strDblRight((dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells + dEndIterUnconsSandAllCells + dEndIterUnconsCoarseAllCells) * m_dCellArea, 0, 14) << "|" << endl;
2623
2624 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2625
2626 dFineError = ((dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells) * m_dCellArea) - dFineTmp,
2627 dSandError = (dEndIterUnconsSandAllCells * m_dCellArea) - dSandTmp,
2628 dCoarseError = (dEndIterUnconsCoarseAllCells * m_dCellArea) - dCoarseTmp;
2629
2630 // Mass balance check
2631 bError = false;
2632 strFineErrMsg = "";
2633 strSandErrMsg = "";
2634 strCoarseErrMsg = "";
2635 strAllErrMsg = "";
2636
2637 if (! bFPIsEqual(dFineError, 0.0, MASS_BALANCE_TOLERANCE))
2638 {
2639 strFineErrMsg = MASS_BALANCE_ERROR;
2640 bError = true;
2641 }
2642
2643 if (! bFPIsEqual(dSandError, 0.0, MASS_BALANCE_TOLERANCE))
2644 {
2645 strSandErrMsg = MASS_BALANCE_ERROR;
2646 bError = true;
2647 }
2648
2649 if (! bFPIsEqual(dCoarseError, 0.0, MASS_BALANCE_TOLERANCE))
2650 {
2651 strCoarseErrMsg = MASS_BALANCE_ERROR;
2652 bError = true;
2653 }
2654
2655 if (bError)
2656 strAllErrMsg = MASS_BALANCE_ERROR;
2657
2658 LogStream << strLeft("Unconsolidated sediment mass balance check (+ve means iteration-end total > iteration-start total)", 101) << "|" << strLeft("", 8) << "|" << strLeft("", 44) << "|" << endl;
2659 LogStream << strLeft(strFineErrMsg, 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dFineError, 0, 30, false) << strRightPerCent(dFineError, (dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells), 14, 2) << "|" << endl;
2660 LogStream << strLeft(strSandErrMsg, 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dSandError, 0, 30, false) << strRightPerCent(dSandError, dEndIterUnconsSandAllCells, 14, 2) << "|" << endl;
2661 LogStream << strLeft(strCoarseErrMsg, 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dCoarseError, 0, 30, false) << strRightPerCent(dCoarseError, dEndIterUnconsCoarseAllCells, 14, 2) << "|" << endl;
2662 LogStream << strLeft(strAllErrMsg, 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight(dFineError + dSandError + dCoarseError, 0, 30, false) << strRightPerCent(dFineError + dSandError + dCoarseError, dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells + dEndIterUnconsSandAllCells + dEndIterUnconsCoarseAllCells, 14, 2) << "|" << endl;
2663 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2664 LogStream << endl;
2665 }
2666
2667 // Add to grand totals: first platform erosion
2669 // assert(isfinite(m_dThisIterPotentialPlatformErosion));
2670
2674
2675 // Erosion from cliff collapse, both consolidated and unconsolidated
2682
2683 // Deposition (with fine to suspension) of unconsolidated talus from cliff collapse
2687
2688 // Erosion of unconsolidated sediment during deposition of unconsolidated cliff collapse talus
2692
2693 // Beach erosion of unconsolidated sediment
2695
2699
2700 // Beach deposition of unconsolidated sediment
2703
2704 // Unconsolidated sediment lost due to beach erosion
2706
2710
2711 // Unconsolidated sediment input event(s)
2715
2716 // Suspended unconsolidated sediment
2718
2719 // Shortfall in unconsolidated sediment deposition
2722}
Geometry class used for coast polygon objects.
double dGetCliffCollapseErosionCoarse(void) const
Get the this-iteration total of unconsolidated coarse sediment from cliff collapse on this polygon,...
double dGetSedimentInputUnconsSand(void) const
Get the value of sand sediment on the polygon derived from sediment input events(s)
double dGetPotentialErosion(void) const
Returns this timestep's total change in depth of unconsolidated sediment (all size classes) due to be...
double dGetCliffCollapseUnconsSandDeposition(void) const
Get the this-iteration total of unconsolidated sand sediment deposited from cliff collapse on this po...
double dGetCliffCollapseToSuspensionFine(void) const
Get the this-iteration total of unconsolidated fine sediment from cliff collapse which goes to suspen...
double dGetPreExistingUnconsSand(void) const
Get the value of pre-existing unconsolidated sand sediment stored on this polygon.
double dGetPreExistingConsSand(void) const
Get the value of pre-existing consolidated sand sediment stored on this polygon.
double dGetCliffCollapseErosionFine(void) const
Get the this-iteration total of unconsolidated fine sediment eroded from cliff collapse on this polyg...
double dGetPlatformErosionUnconsCoarse(void) const
Get the this-iteration total of unconsolidated coarse sediment derived from shore platform erosion on...
double dGetCliffCollapseCoarseErodedDeanProfile(void) const
Get the this-iteration total of unconsolidated coarse sediment eroded during deposition of cliff coll...
double dGetSedimentInputUnconsFine(void) const
Get the value of fine sediment on the polygon derived from sediment input events(s)
double dGetPreExistingConsFine(void) const
Get the value of pre-existing consolidated fine sediment stored on this polygon.
int nGetGlobalID(void) const
Get the global ID.
double dGetCliffCollapseUnconsCoarseDeposition(void) const
Get the this-iteration total of unconsolidated coarse sediment deposited from cliff collapse on this ...
double dGetSeawaterVolume(void) const
Get the volume of seawater in the coast polygon.
double dGetPreExistingUnconsFine(void) const
Get the value of pre-existing unconsolidated fine sediment stored on this polygon.
int nGetUpCoastProfile(void) const
Return the number of the up-coast profile.
double dGetCliffCollapseErosionSand(void) const
Get the this-iteration total of unconsolidated sand sediment from cliff collapse on this polygon,...
double dGetAvgUnconsD50(void) const
Get the average d50 for unconsolidated sediment on this polygon.
double dGetPlatformErosionUnconsSand(void) const
Get the this-iteration total of unconsolidated sand sediment derived from shore platform erosion on t...
double dGetPreExistingUnconsCoarse(void) const
Get the value of pre-existing unconsolidated coarse sediment stored on this polygon.
double dGetCliffCollapseSandErodedDeanProfile(void) const
Get the this-iteration total of unconsolidated sand sediment eroded during deposition of cliff collap...
double dGetPreExistingConsCoarse(void) const
Get the value of pre-existing consolidated coarse sediment stored on this polygon.
double dGetSedimentInputUnconsCoarse(void) const
Get the value of coarse sediment on the polygon derived from sediment input events(s)
int nGetDownCoastProfile(void) const
Return the number of the down-coast profile.
int nGetCoastID(void) const
Get the coast ID, this is the same as the down-coast sequence of polygons.
vector< int > VnGetCircularities(void) const
Get all circularities for this polygon.
Geometry class used to represent coast profile objects.
Definition profile.h:35
int nGetCoastID(void) const
Returns the profile's coast ID.
Definition profile.cpp:67
double m_dThisIterPotentialBeachErosion
Definition simulation.h:890
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:983
int m_nLogFileDetail
Definition simulation.h:591
void WritePolygonSedimentInputEventTable(int const)
Writes to the log file a table showing per-polygon sediment input event totals.
string m_strGDALISSDriverCode
GDAL code for the initial suspended sediment raster file.
vector< string > m_VstrInitialSandConsSedimentFile
The name of the initial sand-sized consolidated sediment GIS file.
double m_dAllCellsDeepWaterWaveHeight
Deep water wave height (m) for all sea cells.
Definition simulation.h:792
int m_nGISMaxSaveDigits
Definition simulation.h:509
string m_strGDALISSProjection
GDAL projection string for the initial suspended sediment raster file.
string m_strInitialSuspSedimentFile
Name of initial suspended sediment file.
string m_strSedimentInputEventFile
The name of the sediment input events time series file.
bool m_bHaveConsolidatedSediment
Definition simulation.h:453
double m_dNotchDepthAtCollapse
Definition simulation.h:973
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:442
time_t m_tSysEndTime
System finish-simulation time.
string m_strCMEIni
Folder for the CME .ini file.
double m_dTotalCoarseUnconsInPolygons
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:397
double m_dMinSWL
Minimum still water level.
Definition simulation.h:759
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:849
vector< string > m_VstrInitialCoarseUnconsSedimentFile
The name of the initial coarse-sized unconsolidated sediment GIS file.
double m_dThisIterSWL
Definition simulation.h:748
string m_strGDALICDataType
GDAL data type of the initial intervention class raster file.
int m_nBeachErosionDepositionEquation
Definition simulation.h:543
ofstream CliffCollapseNetChangeTSStream
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:317
bool bWritePerTimestepResults(void)
Write the results for this timestep to the .out file.
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
vector< string > m_VstrGDALICCDataType
GDAL data type for the initial consolidated coarse sediment GIS data.
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:462
string strListRasterFiles(void) const
Return a space-separated string containing the names of the raster GIS output files.
Definition utils.cpp:661
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
string strListVectorFiles(void) const
Return a space-separated string containing the names of the vector GIS output files.
Definition utils.cpp:915
vector< string > m_VstrGDALICFDataType
GDAL data type for the initial consolidated fine sediment GIS data.
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:804
bool m_bFloodSetupSurgeRunupTSSave
Definition simulation.h:331
ofstream LogStream
int nWriteEndRunDetails(void)
Writes end-of-run information to Out, Log and time-series files.
vector< string > m_VstrGDALICCDriverCode
GDAL driver code for the initial consolidated coarse sediment GIS data.
double m_dThisIterBeachErosionCoarse
Definition simulation.h:902
double m_dStartIterUnconsCoarseAllCells
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dCoastNormalLength
Length of the coastline-normal profiles, in m.
Definition simulation.h:867
void WritePolygonCliffCollapseErosion(int const)
Writes to the log file a table showing per-polygon per-polygon cliff collapse.
static string pstrChangeToForwardSlash(string const *)
Swaps all backslashes in the input string to forward slashes, leaving the original unchanged.
Definition utils.cpp:2318
vector< string > m_VstrGDALIUFDataType
GDAL data type for the initial unconsolidated fine sediment GIS data.
bool m_bSaveGISThisIter
Save GIS files this iteration?
Definition simulation.h:334
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
double m_dUnconsCoarseNotDepositedLastIter
string m_strOGRSedInputDataType
GDAL data type for the sediment input event locations vector file.
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
bool m_bSingleDeepWaterWaveValues
Definition simulation.h:388
string m_strRunName
The name of this simulation.
static string strGetComputerName(void)
Returns a string, hopefully giving the name of the computer on which the simulation is running.
Definition utils.cpp:1359
static string strDispSimTime(double const)
strDispSimTime returns a string formatted as year Julian_day hour, given a parameter in hours
Definition utils.cpp:1518
double m_dSouthEastXExtCRS
Definition simulation.h:679
long double m_ldGTotActualCoarseBeachErosion
void WriteLookUpData(void) const
Output the erosion potential look-up values, for checking purposes.
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Definition simulation.h:934
void WritePolygonSedimentBeforeMovement(int const)
Writes to the log file a table showing per-polygon totals of stored unconsolidated beach sediment pri...
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
Definition simulation.h:771
double m_dThisIterActualPlatformErosionCoarseCons
Definition simulation.h:886
vector< CGeomCoastPolygon * > m_pVCoastPolygon
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:465
vector< double > m_VdErosionPotential
For erosion potential lookup.
vector< string > m_VstrGDALIUFProjection
GDAL projection for the initial unconsolidated fine sediment GIS data.
bool m_bStillWaterLevelTSSave
Save the still water level time series file?
Definition simulation.h:299
long double m_ldGTotCliffTalusFineToSuspension
int nSaveParProfile(int const, CGeomProfile const *, int const, int const, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Save a coastline-normal parallel profile.
string m_strSedimentInputEventShapefile
The name of the sediment input events shape file.
double m_dCoarseErodibility
The relative erodibility (0- 1) of coarse unconsolidated beach sediment.
Definition simulation.h:831
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:986
void WritePolygonSortedSequence(int const, vector< vector< int > > &)
Writes to the log file a table showing the sorted sequence of polygon processing, and any circulariti...
string m_strVectorGISOutFormat
Base name for CME vector GIS output files.
vector< string > m_VstrGDALICFDriverCode
GDAL driver code for the initial consolidated fine sediment GIS data.
vector< string > m_VstrInitialFineConsSedimentFile
The name of the initial fine-sized consolidated sediment GIS file.
int m_nUnconsSedimentHandlingAtGridEdges
Definition simulation.h:539
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:828
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:574
string m_strGDALLDriverCode
GDAL code for the for the initial landform class raster file.
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:323
string m_strDeepWaterWaveStationsShapefile
The name of the deep water wave stations shape file.
vector< double > m_VdDepthOverDB
For erosion potential lookup.
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:311
double m_dStartIterSuspFineInPolygons
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:633
vector< string > m_VstrGDALICSDriverCode
GDAL driver code for the initial consolidated sand sediment GIS data.
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:627
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:960
double m_dWaveDepthRatioForWaveCalcs
Start depth for wave calculations.
Definition simulation.h:786
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:436
string m_strGDALISSDataType
GDAL data type for the initial suspended sediment raster file.
void WriteStartRunDetails(void)
Writes beginning-of-run information to Out and Log files.
double m_dThisIterCliffCollapseErosionCoarseUncons
vector< string > m_VstrGDALIUCProjection
GDAL projection for the initial unconsolidated coarse sediment GIS data.
ofstream CliffCollapseDepositionTSStream
Cliff collapse deposition time series file output stream.
string m_strGDALLDataType
GDAL data type for the initial landform class raster file.
long double m_ldGTotCoarseBeachDeposition
double m_dDepositionCoarseDiff
Definition simulation.h:950
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:822
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:568
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:577
unsigned long m_ulThisIterNumActualPlatformErosionCells
Definition simulation.h:641
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:302
string m_strOGRFloodGeometry
GDAL geometry for the flood input locations point or vector file.
long double m_ldGTotPotentialSedLostBeachErosion
double m_dThisIterCliffCollapseErosionFineUncons
Definition simulation.h:994
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:361
bool m_bSliceSave
Save slices?
Definition simulation.h:100
void WritePolygonShorePlatformErosion(int const)
Writes to the log file a table showing per-polygon unconsolidated sand/coarse sediment derived from e...
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:737
string m_strOGRDWWVDriverCode
GDAL code for the deep water wave stations vector file.
double m_dNorthWestYExtCRS
Definition simulation.h:675
vector< string > m_VstrGDALICSDriverDesc
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:263
int m_nLayers
The number of sediment layers.
Definition simulation.h:468
double m_dStartIterConsCoarseAllCells
double m_dStartIterConsSandAllCells
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:403
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:394
unsigned long m_ulThisIterNumBeachDepositionCells
Definition simulation.h:653
double m_dDepositionSandDiff
Definition simulation.h:946
string m_strGDALBasementDEMDriverCode
GDAL code for the basement DEM raster file type.
vector< string > m_VstrGDALIUFDriverCode
GDAL driver code for the initial unconsolidated fine sediment GIS data.
int nSaveProfile(int const, CGeomProfile const *, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Save a coastline-normal profile.
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:515
double m_dThisIterPotentialPlatformErosion
Definition simulation.h:874
bool bWriteTSFiles(void)
Write the results for this timestep to the time series CSV files.
double m_dDeanProfileStartAboveSWL
Berm height i.e. height above SWL of start of depositional Dean profile.
int m_nSavGolCoastPoly
Definition simulation.h:478
void WritePolygonPotentialErosion(int const)
Writes to the log file a table showing per-polygon potential erosion of all size classes of unconsoli...
ofstream BeachDepositionTSStream
Beach sediment deposition time series file output stream.
double m_dNotchBaseBelowSWL
Notch base below SWL (m)
Definition simulation.h:976
string m_strInitialBasementDEMFile
Name of initial basement DEM file.
long double m_ldGTotCliffCollapseFine
All-simulation total of fine sediment from cliff collapse (m)
void WritePolygonActualMovement(int const, vector< vector< int > > const &)
Writes to the log file a table showing per-polygon actual movement of unconsolidated beach sediment.
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:384
long double m_ldGTotCliffTalusCoarseDeposition
string m_strLogFile
Name of output log file.
double m_dDepthOverDBMax
Definition simulation.h:954
long double m_ldGTotCliffCollapseCoarse
All-simulation total of coarse sediment from cliff collapse (m)
double m_dFineErodibility
The relative erodibility (0- 1) of fine unconsolidated beach sediment.
Definition simulation.h:825
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
time_t m_tSysStartTime
System start-simulation time.
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:861
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:734
long double m_ldGTotSuspendedSediment
All-simulation total of suspended sediment (m)
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:807
string m_strGDALLProjection
GDAL projection string for the initial landform class raster file.
ofstream StillWaterLevelTSStream
SWL time series file output stream.
vector< string > m_VstrInitialSandUnconsSedimentFile
The name of the initial sand-sized unconsolidated sediment GIS file.
double m_dThisIterActualPlatformErosionSandCons
Definition simulation.h:882
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:355
string m_strGDALIHProjection
GDAL projection string for the initial intervention height raster file.
string m_strGDALICDriverDesc
GDAL description of the initial intervention class raster file.
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:400
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:969
vector< string > m_VstrGDALIUSProjection
GDAL projection for the initial unconsolidated sand sediment GIS data.
double m_dThisIterBeachDepositionCoarse
Definition simulation.h:910
double dGridCentroidYToExtCRSY(int const) const
Given the integer Y-axis ordinate of a cell in the raster grid CRS, returns the external CRS Y-axis o...
Definition gis_utils.cpp:70
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:813
long double m_ldGTotCliffTalusSandDeposition
vector< int > m_VnProfileToSave
The numbers of the profiles which are to be saved.
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:843
ofstream BeachSedimentNetChangeTSStream
string m_strOGRDWWVDriverDesc
int m_nWavePropagationModel
Definition simulation.h:565
long double m_ldGTotCliffCollapseSandErodedDuringDeposition
double m_dAllCellsDeepWaterWaveAngle
Deep water wave angle for all sea cells.
Definition simulation.h:795
vector< string > m_VstrGDALICFProjection
GDAL projection for the initial consolidated fine sediment GIS data.
string m_strOGRFloodDriverCode
GDAL code for the flood input locations point or vector file.
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:710
vector< string > m_VstrGDALICCProjection
GDAL projection for the initial consolidated coarse sediment GIS data.
bool bWriteProfileData(int const, CGeomProfile const *, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Writes values for a single profile, for checking purposes.
long double m_ldGTotCoarseSedimentInput
All-simulation total of coarse sediment input (m)
double m_dFinalMeanSWL
Definition simulation.h:741
bool bWriteParProfileData(int const, int const, int const, int const, int const, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< double > const *, vector< CGeom2DIPoint > *const, vector< double > const *) const
Writes values for a single parallel profile, for checking purposes.
double m_dThisIterUnconsCoarseCliffDeposition
bool bWritePerTimestepResultsCSV(void)
Write the results for this timestep to the .out file in CSV format.
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:870
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:957
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:349
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
double m_dThisIterUnconsSandCliffDeposition
long double m_ldGTotSandSedimentInput
All-simulation total of sand sediment input (m)
string strListTSFiles(void) const
Return a space-separated string containing the names of the time series output files.
Definition utils.cpp:1019
bool m_bFloodSetupSurgeTSSave
Definition simulation.h:327
string m_strGDALLDriverDesc
GDAL description of the initial landform class raster file.
double m_dNorthWestXExtCRS
Definition simulation.h:671
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:816
vector< unsigned long > m_VulProfileTimestep
Timesteps at which to save profiles.
ofstream CliffCollapseErosionTSStream
Cliff collapse erosion time series file output stream.
double m_dThisIterPotentialSedLostBeachErosion
Definition simulation.h:918
double m_dSouthEastYExtCRS
Definition simulation.h:683
string m_strFloodLocationShapefile
The name of the flood loction events shape file.
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
long double m_ldGTotCoarseDepositionDiff
double m_dStartIterConsFineAllCells
long double m_ldGTotActualCoarseLostBeachErosion
bool m_bGISSaveDigitsSequential
Definition simulation.h:449
int m_nSimStartMonth
Start date of the simulation (month)
Definition simulation.h:580
double m_dMinCliffTalusHeightFrac
Definition simulation.h:990
double m_dThisIterBeachErosionSand
Definition simulation.h:898
vector< string > m_VstrGDALIUSDriverDesc
void WritePolygonPreExistingSedimentTable(int const)
Writes to the log file a table showing per-polygon pre-existing unconsolidated sediment.
vector< string > m_VstrInitialFineUnconsSedimentFile
The name of the initial fine-sized unconsolidated sediment GIS file.
double m_dThisIterFineSedimentToSuspension
Definition simulation.h:914
bool bWritePerTimestepResultsFixedWidth(void)
Write the results for this timestep to the .out file in fixed-width format.
double m_dThisIterBeachErosionFine
Definition simulation.h:894
double m_dThisIterCliffCollapseSandErodedDuringDeposition
Definition simulation.h:938
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:571
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
string m_strOGRDWWVGeometry
GDAL geometry for the deep water wave stations vector file.
unsigned long m_ulThisIterNumActualBeachErosionCells
Definition simulation.h:649
double m_dCliffDepositionA
Definition simulation.h:980
string m_strDataPathName
Folder in which the CME data file is found.
string m_strOutPath
Path for all output files.
bool m_bBeachErosionTSSave
Save the beach (unconsolidated sediment) erosion time series file?
Definition simulation.h:314
vector< string > m_VstrGDALICFDriverDesc
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
Definition utils.cpp:1633
string m_strTideDataFile
Name of tide data file.
vector< string > m_VstrGDALIUFDriverDesc
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
Definition simulation.h:637
vector< string > m_VstrGDALIUSDataType
GDAL data type for the initial unconsolidated sand sediment GIS data.
double m_dStartIterUnconsSandAllCells
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:762
long double m_ldGTotActualSandLostBeachErosion
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:512
string m_strInterventionClassFile
Name of intervention class file.
long double m_ldGTotActualFineLostBeachErosion
string m_strGDALBasementDEMDataType
GDAL data type for the basement DEM raster file.
bool m_bFloodSWLSetupLine
Are we saving the flood still water level setup line? TODO 007.
Definition simulation.h:439
double m_dThisIterCliffCollapseErosionFineCons
long double m_ldGTotCoarseSedLostCliffCollapse
All-simulation total of coarse sediment lost via cliff collapse (m)
double m_dCoastNormalInterventionSpacing
Average spacing of the coastline-normal profiles on interventions, in m.
Definition simulation.h:864
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:583
string m_strDeepWaterWavesInputFile
The name of the deep water wave stations time series file.
void WritePolygonInfoTable(int const)
Writes to the log file a table showing polygon info.
long double m_ldGTotSandSedLostCliffCollapse
All-simulation total of sand sediment lost via cliff collapse (m)
double m_dUnconsSandNotDepositedLastIter
string m_strGDALICProjection
GDAL projection string for the initial intervention class raster file.
double m_dTotalCoarseConsInPolygons
int m_nCoastCurvatureMovingWindowSize
Definition simulation.h:599
ofstream SeaAreaTSStream
Sea area time series file output stream.
unsigned long m_ulThisIterNumSeaCells
The number of grid cells which are marked as sea, for this iteration.
Definition simulation.h:630
double m_dTotalSandUnconsInPolygons
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:412
double m_dStartIterUnconsFineAllCells
CGeomCoastPolygon * pGetPolygon(int const) const
Returns a pointer to a coast polygon, in down-coast sequence.
Definition utils.cpp:2937
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:717
long double m_ldGTotActualFineBeachErosion
string m_strGDALISSDriverDesc
GDAL description for the initial suspended sediment raster file.
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
Definition simulation.h:657
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:308
string m_strGDALRasterOutputDriverLongname
GDAL raster output driver long name.
vector< string > m_VstrGDALIUCDriverCode
GDAL driver code for the initial unconsolidated coarse sediment GIS data.
ofstream PlatformErosionTSStream
Shore platform erosion time series file output stream.
void DoEndOfTimestepTotals(void)
Update and print totals at the end of each timestep.
double m_dCellArea
Area of a cell (in external CRS units)
Definition simulation.h:692
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
Definition simulation.h:661
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:801
vector< double > m_VdSliceElev
Elevations for raster slice output.
string m_strOGRSedInputGeometry
GDAL geometry for the sediment input event locations vector file.
string m_strOGRSedInputDriverCode
GDAL code for the sediment input event locations vector file.
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:367
unsigned long m_ulThisIterNumPotentialBeachErosionCells
Definition simulation.h:645
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:471
string m_strGDALBasementDEMDriverDesc
GDAL description of the basement DEM raster file type.
string m_strInitialLandformFile
Name of initial landform file.
string m_strInterventionHeightFile
Name of intervention height file.
double m_dThisIterCliffCollapseErosionSandCons
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:320
vector< string > m_VstrGDALICSDataType
GDAL data type for the initial consolidated sand sediment GIS data.
double m_dThisIterBeachDepositionSand
Definition simulation.h:906
string m_strOGRFloodDriverDesc
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:296
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:381
vector< string > m_VstrGDALICSProjection
GDAL dprojection for the initial consolidated sand sediment GIS data.
void CalcProcessStats(void)
This calculates and displays process statistics.
Definition utils.cpp:1687
int nGetCoastPolygonSize(void) const
Returns the size of the coast polygon vector.
Definition utils.cpp:2929
double m_dThisIterLeftGridUnconsCoarse
Definition simulation.h:930
double m_dThisIterCliffCollapseErosionSandUncons
Definition simulation.h:998
string m_strOGRFloodDataType
GDAL data type for the flood input locations point or vector file.
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:810
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:624
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:352
string m_strGDALBasementDEMProjection
GDAL projection string for the basement DEM raster file.
double m_dTotalSandConsInPolygons
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:618
void WritePolygonUnsortedSequence(int const, vector< vector< int > > &)
Writes to the log file a table showing the unsorted sequence of polygon processing.
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:819
double dGridCentroidXToExtCRSX(int const) const
Given the integer X-axis ordinate of a cell in the raster grid CRS, returns the external CRS X-axis o...
Definition gis_utils.cpp:62
vector< string > m_VstrInitialCoarseConsSedimentFile
The name of the initial coarse-sized consolidated sediment GIS file.
string m_strOGRDWWVDataType
GDAL data type for the deep water wave stations vector file.
double m_dSimDuration
Duration of simulation, in hours.
Definition simulation.h:704
double m_dTotalFineUnconsInPolygons
string m_strGDALIHDriverCode
GDAL code for the initial intervention height raster file.
long double m_ldGTotSandDepositionDiff
bool m_bCSVPerTimestepResults
Output per-timestep results in CSV format instead of fixed-width?
Definition simulation.h:346
string m_strGDALICDriverCode
GDAL code for the initial intervention class raster file.
ofstream FloodSetupSurgeTSStream
Flood setup surge time series file output stream.
double m_dTotalFineConsInPolygons
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:686
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:337
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:774
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:689
vector< string > m_VstrGDALIUCDriverDesc
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:966
long double m_ldGTotActualSandBeachErosion
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:798
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Definition simulation.h:942
long double m_ldGTotSandBeachDeposition
double m_dUSaveTime[SAVEMAX]
Definition simulation.h:721
double m_dThisIterActualPlatformErosionFineCons
Definition simulation.h:878
long double m_ldGTotPotentialBeachErosion
All-simulation total of potential beach erosion (m), all size classes.
double m_dProfileMaxSlope
Maximum slope on coastline-normal profiles.
Definition simulation.h:963
int m_nProfileSmoothWindow
Definition simulation.h:495
string m_strGDALIHDriverDesc
GDAL description for the initial intervention height raster file.
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:364
double m_dThisIterCliffCollapseErosionCoarseCons
double m_dThisIterLeftGridUnconsSand
Definition simulation.h:926
double m_dDepthOfClosure
Definition simulation.h:858
vector< string > m_VstrGDALICCDriverDesc
double m_dStartIterSuspFineAllCells
string m_strOutFile
Name of main output file.
string m_strGDALIHDataType
GDAL data type for the initial intervention height raster file.
ofstream FineSedSuspensionTSStream
Fine sediment in suspension time series file output stream.
ofstream FloodSetupSurgeRunupTSStream
Flood setup surge runup time series file output stream.
long double m_ldGTotFineSedimentInput
All-simulation total of fine sediment input (m)
double m_dThisIterMeanSWL
Definition simulation.h:752
vector< string > m_VstrGDALIUCDataType
GDAL data type for the initial unconsolidated coarse sediment GIS data.
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
Definition simulation.h:305
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
ofstream BeachErosionTSStream
Beach sediment erosion time series file output stream.
long double m_ldGTotCliffCollapseSand
All-simulation total of sand sediment from cliff collapse (m)
ofstream OutStream
The main output file stream.
bool m_bFloodSWLSetupSurgeRunupLine
Are we saving the flood still water level setup surge runup line? TODO 007.
Definition simulation.h:445
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:340
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:846
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:343
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:433
vector< string > m_VstrGDALIUSDriverCode
GDAL driver code for the initial unconsolidated sand sediment GIS data.
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:358
int m_nCoastSmoothWindow
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:474
double m_dThisIterLeftGridUnconsFine
Definition simulation.h:922
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:474
char const SLASH
Definition cme.h:450
int const SMOOTH_NONE
Definition cme.h:770
int const WAVE_MODEL_COVE
Definition cme.h:780
double const TOLERANCE
Definition cme.h:811
string const PERFORMHEAD
Definition cme.h:912
int const NO_LOG_FILE
Definition cme.h:487
string const PER_ITER_HEAD
Definition cme.h:906
int const UNCONS_SEDIMENT_EQUATION_KAMPHUIS
Definition cme.h:785
string const ERR
Definition cme.h:890
int const LOG_FILE_LOW_DETAIL
Definition cme.h:488
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:712
string const PER_ITER_CSV_HEAD
Definition cme.h:908
string const PER_ITER_HEAD4
Definition cme.h:902
double const DEPTH_OVER_DB_INCREMENT
Definition cme.h:803
int const WAVE_MODEL_CSHORE
Definition cme.h:781
int const RTN_ERR_PROFILEWRITE
Definition cme.h:727
string const PER_ITER_HEAD2
Definition cme.h:898
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:489
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1284
string const ENDHYDROLOGYHEAD
Definition cme.h:910
int const GRID_EDGE_CLOSED
Definition cme.h:775
int const GRID_EDGE_RECIRCULATE
Definition cme.h:777
double const MASS_BALANCE_TOLERANCE
Definition cme.h:814
string const ENDSEDIMENTHEAD
Definition cme.h:911
int const LOG_FILE_HIGH_DETAIL
Definition cme.h:490
int const NUMBER_OF_RNGS
Definition cme.h:461
string const PROGRAM_NAME
Definition cme.h:824
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:772
string const PER_ITER_HEAD3
Definition cme.h:900
int const SMOOTH_RUNNING_MEAN
Definition cme.h:771
int const LOG_FILE_ALL
Definition cme.h:491
int const RTN_OK
Definition cme.h:692
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:713
string const PER_ITER_HEAD5
Definition cme.h:904
int const CSHOREARRAYOUTSIZE
The size of the arrays output by CShore. If you change this, then you must also set the same value on...
Definition cme.h:470
int const GRID_EDGE_OPEN
Definition cme.h:776
string const EROSION_POTENTIAL_LOOKUP_FILE
Definition cme.h:885
int const UNCONS_SEDIMENT_EQUATION_CERC
Definition cme.h:784
string const PER_ITER_HEAD1
Definition cme.h:896
char const COLON
Definition cme.h:444
string const MASS_BALANCE_ERROR
Definition cme.h:894
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:714
char const SPACE
Definition cme.h:451
Contains CRWCoast definitions.
double dGetInterpolatedValue(vector< double > const *pVdXdata, vector< double > const *pVdYdata, double dX, bool bExtrapolate)
Definitions of routines which return interpolated value at x from parallel arrays.
Contains CSimulation definitions.
string strLeft(const string &strIn, int const nWidth)
Left-aligns string within a field of given width, pads with blank spaces to enforce alignment....
string strDblRight(double const dX, int const nDigits, int const nWidth, bool const bShowDash)
Converts double to string with specified number of decimal places, within a field of given width,...
string strRightPerCent(double const d1, double const d2, int const nWidth, int const nDigits, bool const bShowDash)
Calculates a percentage from two numbers then, if the result is non-zero, right-aligns the result as ...
string strCentre(const char *pchIn, int const nWidth)
Centre-aligns char array within a field of given width, pads with blank spaces to enforce alignment....
string strRight(const string &strIn, int const nWidth)
Right-aligns string within a field of given width, pads with blank spaces to enforce alignment....
string strIntRight(int const nX, int const nWidth)
Converts int to string within a field of given width, pads with blank spaces to enforce alignment....