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