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
15This file is part of CoastalME, the Coastal Modelling Environment.
16
17CoastalME 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
19This 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
21You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23==============================================================================================================================*/
24#include <assert.h>
25
26#include <ctime>
27using std::localtime;
28
29#include <ios>
30using std::fixed;
31using std::scientific;
32
33#include <iostream>
34using std::cerr;
35using std::cout;
36using std::endl;
37using std::ios;
38using std::noshowpos;
39using std::showpos;
40
41#include <iomanip>
42using std::put_time;
43using std::resetiosflags;
44using std::setfill;
45using std::setiosflags;
46using std::setprecision;
47using std::setw;
48
49#include <sstream>
50using std::stringstream;
51
52#include <string>
53using std::to_string;
54
55#include "cme.h"
56#include "simulation.h"
57#include "coast.h"
58#include "interpolate.h"
59
60//===============================================================================================================================
62//===============================================================================================================================
64{
65 // Set the Out file output format to fixed point
66 OutStream << fixed;
67
68 // Start outputting stuff
69 OutStream << PROGRAM_NAME << " for " << PLATFORM << " " << strGetBuild() << " on " << strGetComputerName() << endl
70 << endl;
71
72 LogStream << PROGRAM_NAME << " for " << PLATFORM << " " << strGetBuild() << " on " << strGetComputerName() << endl
73 << endl;
74
75 // ----------------------------------------------- Run Information ----------------------------------------------------------
76 OutStream << "RUN DETAILS" << endl;
77 OutStream << " Name \t: " << m_strRunName << endl;
78 OutStream << " Run started \t: " << put_time(localtime(&m_tSysStartTime), "%T %A %d %B %Y") << endl;
79
80 // Same info. for Log file
81 LogStream << m_strRunName << " run started at " << put_time(localtime(&m_tSysStartTime), "%T on %A %d %B %Y") << endl
82 << endl;
83
84 // Contine with Out file
85 OutStream << " Initialization file \t: "
86#ifdef _WIN32
88#else
89 << m_strCMEIni << endl;
90#endif
91
92 OutStream << " Input data read from \t: "
93#ifdef _WIN32
95#else
96 << m_strDataPathName << endl;
97#endif
98
99 OutStream << " Main output file (this file) \t: "
100#ifdef _WIN32
102#else
103 << m_strOutFile << endl;
104#endif
105
106 LogStream << "Main output file \t: "
107#ifdef _WIN32
109#else
110 << m_strOutFile << endl;
111#endif
112
113 OutStream << " Log file \t: "
114#ifdef _WIN32
116#else
117 << m_strOutFile << endl;
118#endif
119
120 LogStream << "Log file (this file) \t: "
121#ifdef _WIN32
123#else
124 << m_strOutFile << endl;
125#endif
126
127 OutStream << " Level of Log detail \t: ";
129 OutStream << "0 (least detail)";
131 OutStream << "1 (least detail)";
133 OutStream << "2 (medium detail)";
135 OutStream << "3 (high detail)";
136 else if (m_nLogFileDetail == LOG_FILE_ALL)
137 OutStream << "4 (everything)";
138 OutStream << endl;
139
140 LogStream << "Level of Log detail \t: ";
142 LogStream << "1 (least detail)";
144 LogStream << "2 (medium detail)";
146 LogStream << "3 (high detail)";
147 else if (m_nLogFileDetail == LOG_FILE_ALL)
148 LogStream << "4 (everything)";
149 LogStream << endl << endl;
150
151 OutStream << " Simulation start date/time \t: ";
152 // hh:mm:ss dd/mm/yyyy
153 char cPrev = OutStream.fill('0');
154 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;
155 OutStream.fill(cPrev);
156
157 OutStream << " Duration of simulation \t: ";
159 if (m_bSaveRegular)
160 {
161 // Saves at regular intervals
162 OutStream << " Time between saves \t: ";
164 }
165 else
166 {
167 // Saves at user-defined intervals
168 OutStream << " Saves at \t: ";
169 string strTmp;
170 for (int i = 0; i < m_nUSave; i++)
171 {
172 strTmp.append(strDispSimTime(m_dUSaveTime[i]));
173 strTmp.append(", ");
174 }
175
176 // Also at end of run
177 strTmp.append(strDispSimTime(m_dSimDuration));
178 OutStream << strTmp << endl;
179 }
180 OutStream << " Raster GIS output format \t: " << m_strGDALRasterOutputDriverLongname << endl;
181 OutStream << " Maximum number of GIS Save Number digits \t: " << m_nGISMaxSaveDigits << endl;
182 OutStream << " GIS Save Numbers sequential (S) or iteration number (I) \t: " << (m_bGISSaveDigitsSequential ? "S" : "I") << endl;
183 OutStream << " Random number seeds \t: ";
184 {
185 for (int i = 0; i < NRNG; i++)
186 OutStream << m_ulRandSeed[i] << '\t';
187 }
188 OutStream << endl;
189
190 OutStream << " Raster GIS output format \t: " << m_strGDALRasterOutputDriverLongname << endl;
191 OutStream << " Raster output values scaled (if needed) \t: " << (m_bScaleRasterOutput ? "Y" : "N") << endl;
192 OutStream << " Raster world files created (if needed) \t: " << (m_bWorldFile ? "Y" : "N") << endl;
193 OutStream << " Raster GIS files saved \t: " << strListRasterFiles() << endl;
194 if (m_bSliceSave)
195 {
196 OutStream << fixed << setprecision(3);
197 OutStream << " Elevations for 'slice' raster output files \t: ";
198 for (int i = 0; i < static_cast<int>(m_VdSliceElev.size()); i++)
199 OutStream << m_VdSliceElev[i] << " ";
200 OutStream << endl;
201 }
202
203 OutStream << " Vector GIS output format \t: " << m_strVectorGISOutFormat << endl;
204 OutStream << " Vector GIS files saved \t: " << strListVectorFiles() << endl;
205 OutStream << " Output file (this file) \t: "
206#ifdef _WIN32
208#else
209 << m_strOutFile << endl;
210#endif
211 OutStream << " Log file \t: "
212#ifdef _WIN32
214#else
215 << m_strLogFile << endl;
216#endif
217
218 OutStream << " Optional time series files saved \t: " << strListTSFiles() << endl;
219
220 OutStream << " Coastline vector smoothing algorithm \t: ";
221 switch (m_nCoastSmooth)
222 {
223 case SMOOTH_NONE:
224 {
225 OutStream << "none";
226 break;
227 }
228
230 {
231 OutStream << "running mean";
232 break;
233 }
234
236 {
237 OutStream << "Savitzky-Golay";
238 break;
239 }
240 }
241 OutStream << endl;
242
243 OutStream << " Grid edge(s) to omit when searching for coastline \t: " << (m_bOmitSearchNorthEdge ? "N" : "") << (m_bOmitSearchSouthEdge ? "S" : "") << (m_bOmitSearchWestEdge ? "W" : "") << (m_bOmitSearchEastEdge ? "E" : "") << endl;
244
246 {
247 OutStream << " Size of coastline vector smoothing window \t: " << m_nCoastSmoothWindow << endl;
248
250 OutStream << " Savitzky-Golay coastline smoothing polynomial order \t: " << m_nSavGolCoastPoly << endl;
251 }
252 OutStream << " Size of profile slope smoothing window \t: " << m_nProfileSmoothWindow << endl;
253 OutStream << resetiosflags(ios::floatfield);
254 OutStream << fixed << setprecision(2);
255 OutStream << " Max local slope on profile (m/m) \t: " << m_dProfileMaxSlope << endl;
256 OutStream << " Vertical tolerance for beach to be included in smoothing \t: " << m_dMaxBeachElevAboveSWL << " m" << endl;
257 OutStream << endl;
258
259 // --------------------------------------------------- Raster GIS stuff -------------------------------------------------------
260 OutStream << "Raster GIS Input Files" << endl;
261 OutStream << " Basement DEM file \t: "
262#ifdef _WIN32
264#else
266#endif
267 OutStream << " Basement DEM driver code \t: " << m_strGDALBasementDEMDriverCode << endl;
268 OutStream << " GDAL basement DEM driver description \t: " << m_strGDALBasementDEMDriverDesc << endl;
269 OutStream << " GDAL basement DEM projection \t: " << m_strGDALBasementDEMProjection << endl;
270 OutStream << " GDAL basement DEM data type \t: " << m_strGDALBasementDEMDataType << endl;
271 OutStream << " Grid size (X by Y) \t: " << m_nXGridSize << " by " << m_nYGridSize << endl;
272 OutStream << resetiosflags(ios::floatfield);
273 OutStream << fixed << setprecision(1);
274 OutStream << "*Coordinates of NW corner of grid (external CRS) \t: " << m_dNorthWestXExtCRS << ", " << m_dNorthWestYExtCRS << endl;
275 OutStream << "*Coordinates of SE corner of grid (external CRS) \t: " << m_dSouthEastXExtCRS << ", " << m_dSouthEastYExtCRS << endl;
276 OutStream << "*Cell size \t: " << m_dCellSide << " m" << endl;
277 OutStream << "*Grid area \t: " << m_dExtCRSGridArea << " m^2" << endl;
278 OutStream << fixed << setprecision(2);
279 OutStream << "*Grid area \t: " << m_dExtCRSGridArea * 1e-6 << " km^2" << endl;
280
281 if (! m_strInitialLandformFile.empty())
282 {
283 OutStream << " Initial Landform Class file \t: " << m_strInitialLandformFile << endl;
284 OutStream << " GDAL Initial Landform Class file driver code \t: " << m_strGDALLDriverCode << endl;
285 OutStream << " GDAL Initial Landform Class file driver description \t: " << m_strGDALLDriverDesc << endl;
286 OutStream << " GDAL Initial Landform Class file projection \t: " << m_strGDALLProjection << endl;
287 OutStream << " GDAL Initial Landform Class file data type \t: " << m_strGDALLDataType << endl;
288 OutStream << endl;
289 }
290
291 if (! m_strInterventionClassFile.empty())
292 {
293 OutStream << " Intervention Class file \t: " << m_strInterventionClassFile << endl;
294 OutStream << " GDAL Intervention Class file driver code \t: " << m_strGDALICDriverCode << endl;
295 OutStream << " GDAL Intervention Class file driver description \t: " << m_strGDALICDriverDesc << endl;
296 OutStream << " GDAL Intervention Class file projection \t: " << m_strGDALICProjection << endl;
297 OutStream << " GDAL Intervention Class file data type \t: " << m_strGDALICDataType << endl;
298 OutStream << endl;
299 }
300
301 if (! m_strInterventionHeightFile.empty())
302 {
303 OutStream << " Intervention Height file \t: " << m_strInterventionHeightFile << endl;
304 OutStream << " GDAL Intervention Height file driver code \t: " << m_strGDALIHDriverCode << endl;
305 OutStream << " GDAL Intervention Height file driver description \t: " << m_strGDALIHDriverDesc << endl;
306 OutStream << " GDAL Intervention Height file projection \t: " << m_strGDALIHProjection << endl;
307 OutStream << " GDAL Intervention Height file data type \t: " << m_strGDALIHDataType << endl;
308 OutStream << endl;
309 }
310
311 if (! m_strInitialSuspSedimentFile.empty())
312 {
313 OutStream << " Initial Susp Sediment file \t: " << m_strInitialSuspSedimentFile << endl;
314 OutStream << " GDAL Initial Susp Sediment file driver code \t: " << m_strGDALISSDriverCode << endl;
315 OutStream << " GDAL Initial Susp Sediment file driver description \t: " << m_strGDALISSDriverDesc << endl;
316 OutStream << " GDAL Initial Susp Sediment file projection \t: " << m_strGDALISSProjection << endl;
317 OutStream << " GDAL Initial Susp Sediment file data type \t: " << m_strGDALISSDataType << endl;
318 OutStream << endl;
319 }
320
321 for (int i = 0; i < m_nLayers; i++)
322 {
323 if (m_nLayers == 1)
324 OutStream << " Only one layer" << endl;
325 else
326 OutStream << " Layer " << i << (i == 0 ? "(Top)" : "") << (i == m_nLayers - 1 ? "(Bottom)" : "") << endl;
327
329 {
330 OutStream << " Initial Fine Uncons Sediment file \t: " << m_VstrInitialFineUnconsSedimentFile[i] << endl;
331 OutStream << " GDAL Initial Fine Uncons Sediment file driver code \t: " << m_VstrGDALIUFDriverCode[i] << endl;
332 OutStream << " GDAL Initial Fine Uncons Sediment file driver desc \t: " << m_VstrGDALIUFDriverDesc[i] << endl;
333 OutStream << " GDAL Initial Fine Uncons Sediment file projection \t: " << m_VstrGDALIUFProjection[i] << endl;
334 OutStream << " GDAL Initial Fine Uncons Sediment file data type \t: " << m_VstrGDALIUFDataType[i] << endl;
335 OutStream << endl;
336 }
337
339 {
340 OutStream << " Initial Sand Uncons Sediment file \t: " << m_VstrInitialSandUnconsSedimentFile[i] << endl;
341 OutStream << " GDAL Initial Sand Uncons Sediment file driver code \t: " << m_VstrGDALIUSDriverCode[i] << endl;
342 OutStream << " GDAL Initial Sand Uncons Sediment file driver desc \t: " << m_VstrGDALIUSDriverDesc[i] << endl;
343 OutStream << " GDAL Initial Sand Uncons Sediment file projection \t: " << m_VstrGDALIUSProjection[i] << endl;
344 OutStream << " GDAL Initial Sand Uncons Sediment file data type \t: " << m_VstrGDALIUSDataType[i] << endl;
345 OutStream << endl;
346 }
347
349 {
350 OutStream << " Initial Coarse Uncons Sediment file \t: " << m_VstrInitialCoarseUnconsSedimentFile[i] << endl;
351 OutStream << " GDAL Initial Coarse Uncons Sediment file driver code \t: " << m_VstrGDALIUCDriverCode[i] << endl;
352 OutStream << " GDAL Initial Coarse Uncons Sediment file driver desc \t: " << m_VstrGDALIUCDriverDesc[i] << endl;
353 OutStream << " GDAL Initial Coarse Uncons Sediment file projection \t: " << m_VstrGDALIUCProjection[i] << endl;
354 OutStream << " GDAL Initial Coarse Uncons Sediment file data type \t: " << m_VstrGDALIUCDataType[i] << endl;
355 OutStream << endl;
356 }
357
358 if (! m_VstrInitialFineConsSedimentFile[i].empty())
359 {
360 OutStream << " Initial Fine Cons Sediment file \t: " << m_VstrInitialFineConsSedimentFile[i] << endl;
361 OutStream << " GDAL Initial Fine Cons Sediment file driver code \t: " << m_VstrGDALICFDriverCode[i] << endl;
362 OutStream << " GDAL Initial Fine Cons Sediment file driver desc \t: " << m_VstrGDALICFDriverDesc[i] << endl;
363 OutStream << " GDAL Initial Fine Cons Sediment file projection \t: " << m_VstrGDALICFProjection[i] << endl;
364 OutStream << " GDAL Initial Fine Cons Sediment file data type \t: " << m_VstrGDALICFDataType[i] << endl;
365 OutStream << endl;
366 }
367
368 if (! m_VstrInitialSandConsSedimentFile[i].empty())
369 {
370 OutStream << " Initial Sand Cons Sediment file \t: " << m_VstrInitialSandConsSedimentFile[i] << endl;
371 OutStream << " GDAL Initial Sand Cons Sediment file driver code \t: " << m_VstrGDALICSDriverCode[i] << endl;
372 OutStream << " GDAL Initial Sand Cons Sediment file driver desc \t: " << m_VstrGDALICSDriverDesc[i] << endl;
373 OutStream << " GDAL Initial Sand Cons Sediment file projection \t: " << m_VstrGDALICSProjection[i] << endl;
374 OutStream << " GDAL Initial Sand Cons Sediment file data type \t: " << m_VstrGDALICSDataType[i] << endl;
375 OutStream << endl;
376 }
377
379 {
380 OutStream << " Initial Coarse Cons Sediment file \t: " << m_VstrInitialCoarseConsSedimentFile[i] << endl;
381 OutStream << " GDAL Initial Coarse Cons Sediment file driver code \t: " << m_VstrGDALICCDriverCode[i] << endl;
382 OutStream << " GDAL Initial Coarse Cons Sediment file driver desc \t: " << m_VstrGDALICCDriverDesc[i] << endl;
383 OutStream << " GDAL Initial Coarse Cons Sediment file projection \t: " << m_VstrGDALICCProjection[i] << endl;
384 OutStream << " GDAL Initial Coarse Cons Sediment file data type \t: " << m_VstrGDALICCDataType[i] << endl;
385 OutStream << endl;
386 }
387 }
388 // OutStream << endl;
389
390 // ---------------------------------------------------- Vector GIS stuff ------------------------------------------------------
391 OutStream << "Vector GIS Input Files" << endl;
392
394 OutStream << " None" << endl;
395 else
396 {
398 {
399 OutStream << " Deep water wave stations shapefile \t: " << m_strDeepWaterWaveStationsShapefile << endl;
400 OutStream << " Deep water wave values file \t: " << m_strDeepWaterWavesInputFile << endl;
401 if (m_dWaveDataWrapHours > 0)
402 OutStream << " Deep water wave values will wrap every " << m_dWaveDataWrapHours << " hours" << endl;
403 OutStream << " GDAL/OGR deep water wave stations shapefile driver code \t: " << m_strOGRDWWVDriverCode << endl;
404 OutStream << " GDAL/OGR deep water wave stations shapefile driver desc \t: " << m_strOGRDWWVDriverDesc << endl;
405 OutStream << " GDAL/OGR deep water wave stations shapefile data type \t: " << m_strOGRDWWVDataType << endl;
406 OutStream << " GDAL/OGR deep water wave stations shapefile geometry \t: " << m_strOGRDWWVGeometry << endl;
407 }
408
410 {
411 OutStream << " Sediment input event shapefile \t: " << m_strSedimentInputEventShapefile << endl;
412 OutStream << " Sediment input event values file \t: " << m_strSedimentInputEventFile << endl;
413 OutStream << " Sediment input event type \t: ";
415 OutStream << "point";
417 OutStream << "coast block";
419 OutStream << "line";
420 OutStream << endl;
421 OutStream << " GDAL/OGR sediment input event shapefile driver code \t: " << m_strOGRSedInputDriverCode << endl;
422 OutStream << " GDAL/OGR sediment input event shapefile driver desc \t: " << m_strOGRSedInputDriverCode << endl;
423 OutStream << " GDAL/OGR sediment input event shapefile data type \t: " << m_strOGRSedInputDataType << endl;
424 OutStream << " GDAL/OGR sediment input event shapefile geometry \t: " << m_strOGRSedInputGeometry << endl;
425 }
426
428 {
429 OutStream << " Riverine flooding shapefile \t: " << m_strFloodLocationShapefile << endl;
430 OutStream << " Riverine flood location? \t: " << (m_bFloodLocation ? "Y" : "N") << endl;
431 OutStream << " Riverine flood save? \t: " << (m_bVectorWaveFloodLineSave ? "Y" : "N") << endl;
432 OutStream << " GDAL/OGR riverine flooding event shapefile driver code \t: " << m_strOGRFloodDriverCode << endl;
433 OutStream << " GDAL/OGR riverine flooding shapefile driver desc \t: " << m_strOGRFloodDriverDesc << endl;
434 OutStream << " GDAL/OGR riverine flooding shapefile data type \t: " << m_strOGRFloodDataType << endl;
435 OutStream << " GDAL/OGR riverine flooding shapefile geometry \t: " << m_strOGRFloodGeometry << endl;
436 }
437 }
438
439 OutStream << endl;
440
441 // -------------------------------------------------------- Other data --------------------------------------------------------
442 OutStream << "Other Input Data" << endl;
443
444 OutStream << " Wave propagation model \t: ";
446 OutStream << "COVE";
448 OutStream << "CShore (output arrays have " << CSHOREARRAYOUTSIZE << " points)";
449 OutStream << endl;
450 OutStream << " Density of sea water \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(0) << m_dSeaWaterDensity << " kg/m^3" << endl;
451 OutStream << " Initial still water level \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dOrigSWL << " m" << endl;
452 OutStream << " Final still water level \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dFinalSWL << " m" << endl;
454 {
455 OutStream << " Deep water wave height \t: " << m_dAllCellsDeepWaterWaveHeight << " m" << endl;
456 OutStream << " Deep water wave orientation \t: " << m_dAllCellsDeepWaterWaveAngle << " degrees" << endl;
457 OutStream << " Wave period \t: " << m_dAllCellsDeepWaterWavePeriod << " s" << endl;
458 }
459 else
460 {
461 OutStream << " Maximum User input Deep water wave height \t: " << m_dMaxUserInputWaveHeight << " m" << endl;
462 OutStream << " Maximum User input Deep waterWave period \t: " << m_dMaxUserInputWavePeriod << " s" << endl;
463 }
464 OutStream << " Start depth for wave calcs (*deep water wave height) \t: " << m_dWaveDepthRatioForWaveCalcs << endl;
465 OutStream << "*Depth of closure \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(3) << m_dDepthOfClosure << " m" << endl;
466 OutStream << " Tide data file \t: " << m_strTideDataFile << endl;
467 OutStream << " Do coast platform erosion? \t: " << (m_bDoShorePlatformErosion ? "Y" : "N") << endl;
468 OutStream << resetiosflags(ios::floatfield);
469 OutStream << scientific << setprecision(2);
470 OutStream << " Coast platform resistance to erosion \t: " << m_dR << endl;
471 OutStream << resetiosflags(ios::floatfield);
472 OutStream << fixed << setprecision(1);
473 OutStream << " Do beach sediment transport? \t: " << (m_bDoBeachSedimentTransport ? "Y" : "N") << endl;
474 OutStream << " Handling of beach sediment at grid edges \t: ";
476 OutStream << "closed";
478 OutStream << "open";
480 OutStream << "recirculate";
481 OutStream << endl;
482 OutStream << " Beach potential erosion/deposition equation \t: ";
484 OutStream << "CERC";
486 OutStream << "Kamphuis";
487 OutStream << endl;
488 OutStream << " Median particle size of fine sediment \t: " << resetiosflags(ios::floatfield) << fixed << m_dD50Fine << " mm" << endl;
489 OutStream << " Median particle size of sand sediment \t: " << resetiosflags(ios::floatfield) << fixed << m_dD50Sand << " mm" << endl;
490 OutStream << " Median particle size of coarse sediment \t: " << resetiosflags(ios::floatfield) << fixed << m_dD50Coarse << " mm" << endl;
491 OutStream << " Beach sediment density \t: " << resetiosflags(ios::floatfield) << fixed << m_dBeachSedimentDensity << " kg/m^3" << endl;
492 OutStream << " Beach sediment porosity \t: " << resetiosflags(ios::floatfield) << fixed << m_dBeachSedimentPorosity << endl;
493 OutStream << " Fine-sized sediment relative erodibility \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dFineErodibility << endl;
494 OutStream << " Sand-sized sediment relative erodibility \t: " << resetiosflags(ios::floatfield) << m_dSandErodibility << endl;
495 OutStream << " Coarse-sized sediment relative erodibility \t: " << m_dCoarseErodibility << endl;
497 OutStream << " Transport parameter KLS for CERC equation \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(3) << m_dKLS << endl;
499 OutStream << " Transport parameter for Kamphuis equation \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(3) << m_dKamphuis << endl;
500 OutStream << " Height of Dean profile start above SWL \t: " << resetiosflags(ios::floatfield) << fixed << setprecision(1) << m_dDeanProfileStartAboveSWL << " m" << endl;
501 OutStream << " Sediment input at a point \t: " << (m_bSedimentInput ? "Y" : "N") << endl;
503 {
504 OutStream << " Sediment input shapefile \t: " << m_strSedimentInputEventShapefile << endl;
505 OutStream << " Sediment input type \t: ";
507 OutStream << "point";
509 OutStream << "block on coast";
511 OutStream << "line intersection with coast";
512 OutStream << endl;
513 OutStream << " Sediment input file \t: " << m_strSedimentInputEventFile << endl;
514 }
515 OutStream << " Do cliff collapse? \t: " << (m_bDoCliffCollapse ? "Y" : "N") << endl;
516 OutStream << resetiosflags(ios::floatfield);
517 OutStream << scientific << setprecision(2);
518 OutStream << " Cliff resistance to erosion \t: " << m_dCliffErosionResistance << endl;
519 OutStream << resetiosflags(ios::floatfield);
520 OutStream << fixed << setprecision(1);
521 OutStream << " Notch overhang to initiate collapse \t: " << m_dNotchDepthAtCollapse << " m" << endl;
522 OutStream << " Notch base below SWL \t: " << m_dNotchBaseBelowSWL << " m" << endl;
523 OutStream << " Scale parameter A for cliff deposition \t: ";
525 OutStream << "auto";
526 else
527 OutStream << m_dCliffDepositionA << " m^(1/3)";
528 OutStream << endl;
529 OutStream << " Planview width of cliff deposition talus \t: " << resetiosflags(ios::floatfield) << fixed << m_dCliffDepositionPlanviewWidth << " m" << endl;
530 OutStream << " Planview length of cliff deposition talus \t: " << m_dCliffTalusMinDepositionLength << " m" << endl;
531 OutStream << " Min height of land-end talus (fraction of cliff elevation)\t: " << m_dMinCliffTalusHeightFrac << endl;
532 OutStream << " Do riverine flooding? \t: " << (m_bRiverineFlooding ? "Y" : "N") << endl;
534 {
535 // TODO 007 Need more info on this
536 OutStream << " FloodSWLSetupLine \t: " << (m_bFloodSWLSetupLine ? "Y" : "N") << endl;
537 OutStream << " FloodSWLSetupSurgeLine \t: " << (m_bFloodSWLSetupSurgeLine ? "Y" : "N") << endl;
538 OutStream << " m_bFloodSWLSetupSurgeRunupLine \t: " << (m_bFloodSWLSetupSurgeRunupLine ? "Y" : "N") << endl;
539 }
540 OutStream << " Gravitational acceleration \t: " << resetiosflags(ios::floatfield) << fixed << m_dG << " m^2/s" << endl;
541 OutStream << " Minimum spacing of coastline normals \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalAvgSpacing << " m" << endl;
542 OutStream << " Random factor for spacing of normals \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalRandSpacingFactor << endl;
543 OutStream << " Length of coastline normals \t: " << m_dCoastNormalLength << " m" << endl;
544 OutStream << endl;
545 /*
546 OutStream << fixed << setprecision(8);
547 OutStream << " Erosion potential shape function:" << endl;
548 OutStream << "\tDepth over DB\tErosion potential\tFirst derivative of erosion potential" << endl;
549 for (int i = 0; i < m_VdDepthOverDB.size(); i++)
550 OutStream << "\t" << m_VdDepthOverDB[i] << "\t\t" << m_VdErosionPotential[i] << "\t\t" << m_VdErosionPotentialFirstDeriv[i] << endl;
551 OutStream << endl;
552 */
553 // ------------------------------------------------------ Testing only --------------------------------------------------------
554 OutStream << "Testing only" << endl;
555
556 OutStream << " Output profile data? \t: " << (m_bOutputProfileData ? "Y" : "N") << endl;
557 OutStream << " Profile numbers to be saved \t: ";
558 for (unsigned int i = 0; i < m_VnProfileToSave.size(); i++)
560 OutStream << endl;
561 OutStream << " Timesteps when profiles are saved \t: ";
562 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
564 OutStream << endl;
565 OutStream << " Output parallel profile data? \t: " << (m_bOutputParallelProfileData ? "Y" : "N") << endl;
566 OutStream << " Output erosion potential look-up data? \t: " << (m_bOutputErosionPotentialData ? "Y" : "N");
569 OutStream << endl;
570 OutStream << " Size of moving window for calculating coastline curvature \t: " << m_nCoastCurvatureMovingWindowSize << endl;
571
572 OutStream << endl
573 << endl;
574
575 // -------------------------------------------------- Per-iteration output ----------------------------------------------------
576 OutStream << fixed << setprecision(3);
577
578 // Write per-timestep headers to .out file
579 OutStream << PER_ITER_HEAD << endl;
580 OutStream << "Sea depth in metres. All erosion and deposition values in millimetres" << endl;
581 OutStream << "GISn = GIS files saved as <filename>n." << endl;
582 OutStream << endl;
583
584 OutStream << PER_ITER_HEAD1 << endl;
585 OutStream << PER_ITER_HEAD2 << endl;
586 OutStream << PER_ITER_HEAD3 << endl;
587 OutStream << PER_ITER_HEAD4 << endl;
588 OutStream << PER_ITER_HEAD5 << endl;
589}
590
591//===============================================================================================================================
593//===============================================================================================================================
595{
596 OutStream << resetiosflags(ios::floatfield);
597 OutStream << fixed << setprecision(0);
598
599 // Output timestep and simulated time info ===================================================================================
600 OutStream << setw(4) << m_ulIter;
601 OutStream << setw(7) << m_dSimElapsed; // In hours
602 OutStream << resetiosflags(ios::floatfield);
603 OutStream << fixed << setprecision(0);
604 OutStream << setw(7) << m_dSimElapsed / (24 * 365.25); // In years
605
606 // Output average sea depth (m) per sea cell =================================================================================
607 OutStream << resetiosflags(ios::floatfield);
608 OutStream << fixed << setprecision(2);
609 double dAvgSeaDepth = m_dThisIterTotSeaDepth / static_cast<double>(m_ulThisIterNumSeaCells);
610 OutStream << setw(6) << dAvgSeaDepth;
611 OutStream << " ";
612
613 // Output the this-timestep % of sea cells with potential shore platform erosion =============================================
614 OutStream << fixed << setprecision(0);
616
617 // Output per-timestep potential shore platform erosion in m (average for all sea cells)
618 OutStream << fixed << setprecision(1);
619 OutStream << setw(6) << 1000 * m_dThisIterPotentialPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells);
620
621 // Output per-timestep potential shore platform erosion in m (average for all cells with potential shore platform erosion)
622 OutStream << fixed << setprecision(1);
625 else
626 OutStream << setw(6) << SPACE;
627
628 // Output the this-timestep % of sea cells with actual shore platform erosion ================================================
629 OutStream << fixed << setprecision(0);
631
632 // Output per-timestep actual shore platform erosion in m (average for all sea cells)
633 OutStream << fixed << setprecision(1);
635 OutStream << setw(6) << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells);
636
637 // Output per-timestep actual shore platform erosion in m (average for all cells with actual shore platform erosion)
638 OutStream << fixed << setprecision(1);
640 OutStream << setw(5) << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumActualPlatformErosionCells);
641 else
642 OutStream << setw(5) << SPACE;
643
644 // Output per-timestep actual shore platform erosion in m (average for all sea cells)
645 OutStream << fixed << setprecision(1);
646
648 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionFineCons / static_cast<double>(m_ulThisIterNumSeaCells);
649 else
650 OutStream << setw(4) << SPACE;
651
653 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionSandCons / static_cast<double>(m_ulThisIterNumSeaCells);
654 else
655 OutStream << setw(4) << SPACE;
656
658 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionCoarseCons / static_cast<double>(m_ulThisIterNumSeaCells);
659 else
660 OutStream << setw(4) << SPACE;
661
662 // Output the this-timestep % of sea cells with potential beach erosion ======================================================
664
665 // Output per-timestep potential beach erosion in m (average for all sea cells)
666 OutStream << fixed << setprecision(0);
667 // assert(m_ulThisIterNumSeaCells > 0);
668 double dTmp = 1000 * m_dThisIterPotentialBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
669 if (dTmp > 99999)
670 {
671 OutStream << setw(6) << scientific << setprecision(0) << dTmp;
672 OutStream << fixed;
673 }
674 else
675 OutStream << setw(6) << dTmp;
676
677 // Output per-timestep potential beach erosion in m (average for all cells with potential beach erosion)
678 OutStream << fixed << setprecision(1);
680 {
682 if (dTmp > 99999)
683 {
684 OutStream << setw(6) << scientific << setprecision(0) << dTmp;
685 OutStream << fixed;
686 }
687 else
688 OutStream << setw(6) << dTmp;
689 }
690 else
691 OutStream << setw(6) << SPACE;
692
693 // This-timestep % of sea cells with actual beach erosion ====================================================================
694 OutStream << fixed << setprecision(0);
696
697 // Output per-timestep actual beach erosion in m (average for all sea cells)
699 OutStream << setw(6) << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
700
701 // Per-iteration actual beach erosion in m (average for all cells with actual beach erosion)
702 OutStream << fixed << setprecision(1);
704 OutStream << setw(7) << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumActualBeachErosionCells);
705 else
706 OutStream << setw(7) << SPACE;
707
708 // Per-iteration actual beach erosion in m (average for all sea cells)
709 OutStream << fixed << setprecision(1);
710
712 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionFine / static_cast<double>(m_ulThisIterNumSeaCells);
713 else
714 OutStream << setw(4) << SPACE;
715
717 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionSand / static_cast<double>(m_ulThisIterNumSeaCells);
718 else
719 OutStream << setw(4) << SPACE;
720
722 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionCoarse / static_cast<double>(m_ulThisIterNumSeaCells);
723 else
724 OutStream << setw(4) << SPACE;
725
726 // Output the this-timestep % of sea cells with beach deposition =============================================================
727 OutStream << fixed << setprecision(0);
729
730 // Per-iteration beach deposition in m (average for all sea cells)
731 double dThisIterBeachDeposition = m_dThisIterBeachDepositionSand + m_dThisIterBeachDepositionCoarse;
732 OutStream << setw(6) << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
733
734 // Per-iteration beach deposition in m (average for all cells with beach deposition)
735 OutStream << fixed << setprecision(1);
737 OutStream << setw(9) << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumBeachDepositionCells);
738 else
739 OutStream << setw(9) << SPACE;
740
741 // Per-iteration beach deposition in m (average for all sea cells)
742 OutStream << fixed << setprecision(1);
743
745 OutStream << setw(4) << 1000 * m_dThisIterBeachDepositionSand / static_cast<double>(m_ulThisIterNumSeaCells);
746 else
747 OutStream << setw(4) << SPACE;
748
750 OutStream << setw(4) << 1000 * m_dThisIterBeachDepositionCoarse / static_cast<double>(m_ulThisIterNumSeaCells);
751 else
752 OutStream << setw(4) << SPACE;
753
754 // Output the this-timestep sediment input in m ==============================================================================
755 OutStream << scientific << setprecision(0);
756
759 else
760 OutStream << setw(4) << SPACE;
761
764 else
765 OutStream << setw(4) << SPACE;
766
769 else
770 OutStream << setw(4) << SPACE;
771
772 // Per-iteration cliff collapse erosion (both cons and uncons) in m (average for all coast cells) ============================
773 OutStream << fixed << setprecision(1);
774
777 else
778 OutStream << setw(4) << SPACE;
779
782 else
783 OutStream << setw(4) << SPACE;
784
787 else
788 OutStream << setw(4) << SPACE;
789
790 // Per-iteration cliff collapse deposition in m (average for all sea cells) ==================================================
792 OutStream << setw(4) << 1000 * m_dThisIterUnconsSandCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
793 else
794 OutStream << setw(4) << SPACE;
795
797 OutStream << setw(4) << 1000 * m_dThisIterUnconsCoarseCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
798 else
799 OutStream << setw(4) << SPACE;
800
801 // Output per-timestep fine sediment going to suspension, in m (average for all sea cells) ==================================
803 OutStream << setw(6) << 1000 * m_dThisIterFineSedimentToSuspension / static_cast<double>(m_ulThisIterNumSeaCells);
804 else
805 OutStream << setw(6) << SPACE;
806
807 OutStream << " ";
808
809 // Finally, set 'markers' for events that have occurred this timestep
811 OutStream << " GIS" << m_nGISSave;
812
813 OutStream << endl;
814
815 // Did a text file write error occur?
816 if (OutStream.fail())
817 return false;
818
819 return true;
820}
821
822//===============================================================================================================================
824//===============================================================================================================================
826{
827 // Sea area
829 {
830 // Output in external CRS units
831 SeaAreaTSStream << m_dSimElapsed << "\t,\t" << m_dExtCRSGridArea * static_cast<double>(m_ulThisIterNumSeaCells) / static_cast<double>(m_ulNumCells) << endl;
832
833 // Did a time series file write error occur?
834 if (SeaAreaTSStream.fail())
835 return false;
836 }
837
838 // Still water level
840 {
841 // Output as is (m)
842 StillWaterLevelTSStream << m_dSimElapsed << "\t,\t" << m_dThisIterSWL << "\t,\t" << m_dThisIterMeanSWL << endl;
843
844 // Did a time series file write error occur?
845 if (StillWaterLevelTSStream.fail())
846 return false;
847 }
848
849 // Actual platform erosion (fine, sand, and coarse)
851 {
852 // Output as is (m depth equivalent)
854
855 // Did a time series file write error occur?
856 if (PlatformErosionTSStream.fail())
857 return false;
858 }
859
860 // Cliff collapse erosion (fine, sand, and coarse)
862 {
863 // Output as is (m depth equivalent)
865
866 // Did a time series file write error occur?
868 return false;
869 }
870
871 // Cliff collapse deposition (sand and coarse)
873 {
874 // Output as is (m depth equivalent)
876
877 // Did a time series file write error occur?
879 return false;
880 }
881
882 // Cliff collapse net
884 {
885 // Output as is (m depth equivalent)
887
888 // Did a time series file write error occur?
890 return false;
891 }
892
893 // Beach erosion (fine, sand, and coarse)
895 {
896 // Output as is (m depth equivalent)
898
899 // Did a time series file write error occur?
900 if (BeachErosionTSStream.fail())
901 return false;
902 }
903
904 // Beach deposition (sand and coarse)
906 {
907 // Output as is (m depth equivalent)
909
910 // Did a time series file write error occur?
911 if (BeachDepositionTSStream.fail())
912 return false;
913 }
914
915 // Net change in beach sediment
917 {
918 // Output as is (m depth equivalent)
920
921 // Did a time series file write error occur?
923 return false;
924 }
925
927 {
928 // Output as is (m depth equivalent)
930
931 // Did a time series file write error occur?
932 if (FineSedSuspensionTSStream.fail())
933 return false;
934 }
935
937 {
938 // Output as is (m depth equivalent)
940
941 // Did a time series file write error occur?
942 if (FloodSetupSurgeTSStream.fail())
943 return false;
944 }
945
947 {
948 // Output as is (m depth equivalent)
950
951 // Did a time series file write error occur?
953 return false;
954 }
955
956 return true;
957}
958
959//===============================================================================================================================
961//===============================================================================================================================
963{
964 // Open the output file
965 string strLookUpFile = m_strOutPath;
966 strLookUpFile.append(EROSION_POTENTIAL_LOOKUP_FILE);
967 ofstream LookUpOutStream;
968 LookUpOutStream.open(strLookUpFile.c_str(), ios::out | ios::trunc);
969
970 if (LookUpOutStream)
971 {
972 // File opened OK, so output the values
973 LookUpOutStream << "DepthOverDB, \tErosionPotential" << endl;
974 double dDepthOverDB = 0.0;
975 while (dDepthOverDB <= m_dDepthOverDBMax)
976 {
977 double dErosionPotential = dGetInterpolatedValue(&m_VdDepthOverDB, &m_VdErosionPotential, dDepthOverDB, false);
978 LookUpOutStream << dDepthOverDB << ",\t" << dErosionPotential << endl;
979 dDepthOverDB += DEPTH_OVER_DB_INCREMENT;
980 }
981 LookUpOutStream << endl;
982
983 // And close the file
984 LookUpOutStream.close();
985 }
986}
987
988//===============================================================================================================================
990//===============================================================================================================================
991int 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
992{
993 // TODO 052 Make this more efficient, also give warnings if no profiles will be output
994 int nProfile = pProfile->nGetCoastID();
995
996 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
997 {
998 for (unsigned int j = 0; j < m_VnProfileToSave.size(); j++)
999 {
1000 if ((m_ulIter == m_VulProfileTimestep[i]) && (nProfile == m_VnProfileToSave[j]))
1001 {
1002 if (! bWriteProfileData(nCoast, pProfile, nProfSize, pdVDistXY, pdVZ, pdVDepthOverDB, pdVErosionPotentialFunc, pdVSlope, pdVRecessionXY, pdVChangeElevZ, pPtVGridProfile, pdVScapeXY))
1003 return RTN_ERR_PROFILEWRITE;
1004 }
1005 }
1006 }
1007
1008 return RTN_OK;
1009}
1010
1011//===============================================================================================================================
1013//===============================================================================================================================
1014bool 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
1015{
1016 int nProfile = pProfile->nGetCoastID();
1017
1018 string strFName = m_strOutPath;
1019 stringstream ststrTmp;
1020
1021 strFName.append("profile_");
1022 ststrTmp << FillToWidth('0', 3) << nProfile;
1023 strFName.append(ststrTmp.str());
1024
1025 strFName.append("_timestep_");
1026 ststrTmp.clear();
1027 ststrTmp.str(string());
1028 ststrTmp << FillToWidth('0', 4) << m_ulIter;
1029 strFName.append(ststrTmp.str());
1030
1031 strFName.append(".csv");
1032
1033 ofstream OutProfStream;
1034 OutProfStream.open(strFName.c_str(), ios::out | ios::trunc);
1035 if (!OutProfStream)
1036 {
1037 // Error, cannot open file
1038 cerr << ERR << "cannot open " << strFName << " for output" << endl;
1039 return false;
1040 }
1041
1042 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;
1043 for (int i = 0; i < nProfSize; i++)
1044 {
1045 double dX = dGridCentroidXToExtCRSX(pPtVGridProfile->at(i).nGetX());
1046 double dY = dGridCentroidYToExtCRSY(pPtVGridProfile->at(i).nGetY());
1047
1048 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;
1049 }
1050
1051 OutProfStream.close();
1052
1053 return true;
1054}
1055
1056//===============================================================================================================================
1058//===============================================================================================================================
1059int 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
1060{
1061 // TODO 052 Make this more efficient, also give warnings if no profiles will be output
1062 int nProfile = pProfile->nGetCoastID();
1063 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
1064 {
1065 for (unsigned int j = 0; j < m_VnProfileToSave.size(); j++)
1066 {
1067 if ((m_ulIter == m_VulProfileTimestep[i]) && (nProfile == m_VnProfileToSave[j]))
1068 {
1069 if (! bWriteParProfileData(nCoast, nProfile, nParProfSize, nDirection, nDistFromProfile, pdVDistXY, pdVZ, pdVDepthOverDB, pdVErosionPotentialFunc, pdVSlope, pdVRecessionXY, pdVChangeElevZ, pPtVGridProfile, pdVScapeXY))
1070 return RTN_ERR_PROFILEWRITE;
1071 }
1072 }
1073 }
1074
1075 return RTN_OK;
1076}
1077
1078//===============================================================================================================================
1080//===============================================================================================================================
1081bool 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
1082{
1083 string strFName = m_strOutPath;
1084 stringstream ststrTmp;
1085
1086 strFName.append("profile_");
1087 ststrTmp << FillToWidth('0', 3) << nProfile;
1088 strFName.append(ststrTmp.str());
1089
1090 strFName.append("_parallel_");
1091 ststrTmp.clear();
1092 ststrTmp.str(string());
1093 ststrTmp << FillToWidth('0', 3) << nDistFromProfile;
1094 strFName.append(ststrTmp.str());
1095
1096 strFName.append((nDirection == 0 ? "_F" : "_B"));
1097
1098 strFName.append("_timestep_");
1099 ststrTmp.clear();
1100 ststrTmp.str(string());
1101 ststrTmp << FillToWidth('0', 4) << m_ulIter;
1102 strFName.append(ststrTmp.str());
1103
1104 strFName.append(".csv");
1105
1106 ofstream OutProfStream;
1107 OutProfStream.open(strFName.c_str(), ios::out | ios::trunc);
1108 if (!OutProfStream)
1109 {
1110 // Error, cannot open file
1111 cerr << ERR << "cannot open " << strFName << " for output" << endl;
1112 return false;
1113 }
1114
1115 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;
1116 for (int i = 0; i < nProfSize; i++)
1117 {
1118 double dX = dGridCentroidXToExtCRSX(pPtVGridProfile->at(i).nGetX());
1119 double dY = dGridCentroidYToExtCRSY(pPtVGridProfile->at(i).nGetY());
1120
1121 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;
1122 }
1123
1124 OutProfStream.close();
1125
1126 return true;
1127}
1128
1129//===============================================================================================================================
1131//===============================================================================================================================
1133{
1134 // Final write to time series CSV files
1135 if (! bWriteTSFiles())
1137
1138 // Save the values from the RasterGrid array into raster GIS files
1139 if (! bSaveAllRasterGISFiles())
1141
1142 // Save the vector GIS files
1143 if (! bSaveAllVectorGISFiles())
1145
1146 OutStream << " GIS" << m_nGISSave << endl;
1147
1148 // Print out run totals etc.
1149 OutStream << PER_ITER_HEAD1 << endl;
1150 OutStream << PER_ITER_HEAD2 << endl;
1151 OutStream << PER_ITER_HEAD3 << endl;
1152 OutStream << PER_ITER_HEAD4 << endl;
1153 OutStream << PER_ITER_HEAD5 << endl;
1154
1155 OutStream << fixed << setprecision(3);
1156 OutStream << endl
1157 << endl;
1158
1159 // Write out hydrology grand totals etc.
1160 OutStream << ENDHYDROLOGYHEAD << endl;
1161 OutStream << "Minimum still water level = " << m_dMinSWL << endl;
1162 OutStream << "Maximum still water level = " << m_dMaxSWL << endl;
1163 OutStream << endl;
1164
1165 // Now write out sediment movement grand totals etc.
1166 OutStream << ENDSEDIMENTHEAD << endl
1167 << endl;
1168
1169 OutStream << "TOTAL PLATFORM EROSION" << endl;
1170 OutStream << "Potential platform erosion, all size classes = " << m_ldGTotPotentialPlatformErosion * m_dCellArea << " m^3" << endl
1171 << endl;
1172 OutStream << "Actual platform erosion, fine = " << m_ldGTotFineActualPlatformErosion * m_dCellArea << " m^3" << endl;
1173 OutStream << "Actual platform erosion, sand = " << m_ldGTotSandActualPlatformErosion * m_dCellArea << " m^3" << endl;
1174 OutStream << "Actual platform erosion, coarse = " << m_ldGTotCoarseActualPlatformErosion * m_dCellArea << " m^3" << endl;
1175 OutStream << "Actual platform erosion, all size classes = " << (m_ldGTotFineActualPlatformErosion + m_ldGTotSandActualPlatformErosion + m_ldGTotCoarseActualPlatformErosion) * m_dCellArea << " m^3" << endl;
1176 OutStream << endl;
1177
1178 OutStream << "TOTAL CLIFF COLLAPSE EROSION" << endl;
1179 OutStream << "Cliff collapse, fine = " << m_ldGTotCliffCollapseFine * m_dCellArea << " m^3" << endl;
1180 OutStream << "Cliff collapse, sand = " << m_ldGTotCliffCollapseSand * m_dCellArea << " m^3" << endl;
1181 OutStream << "Cliff collapse, coarse = " << m_ldGTotCliffCollapseCoarse * m_dCellArea << " m^3" << endl;
1183 OutStream << endl;
1184
1185 OutStream << "TOTAL DEPOSITION AND SUSPENSION OF CLIFF COLLAPSE TALUS" << endl;
1186 OutStream << "Cliff collapse to suspension, fine = " << m_ldGTotCliffTalusFineToSuspension * m_dCellArea << " m^3" << endl;
1187 OutStream << "Cliff collapse deposition, sand = " << m_ldGTotCliffTalusSandDeposition * m_dCellArea << " m^3" << endl;
1188 OutStream << "Cliff collapse deposition, coarse = " << m_ldGTotCliffTalusCoarseDeposition * m_dCellArea << " m^3" << endl;
1189 OutStream << "Cliff collapse deposition, sand and coarse = " << (m_ldGTotCliffTalusSandDeposition + m_ldGTotCliffTalusCoarseDeposition) * m_dCellArea << " m^3" << endl;
1190 OutStream << endl;
1191
1192 OutStream << "TOTAL BEACH EROSION" << endl;
1193 OutStream << "Potential beach erosion, all size classes = " << m_ldGTotPotentialBeachErosion * m_dCellArea << " m^3" << endl
1194 << endl;
1195 OutStream << "Actual fine beach erosion, fine = " << m_ldGTotActualFineBeachErosion * m_dCellArea << " m^3" << endl;
1196 OutStream << "Actual sand beach erosion, sand = " << m_ldGTotActualSandBeachErosion * m_dCellArea << " m^3" << endl;
1197 OutStream << "Actual coarse beach erosion, coarse = " << m_ldGTotActualCoarseBeachErosion * m_dCellArea << " m^3" << endl;
1198 OutStream << "Actual beach erosion, all size classes = " << (m_ldGTotActualFineBeachErosion + m_ldGTotActualSandBeachErosion + m_ldGTotActualCoarseBeachErosion) * m_dCellArea << " m^3" << endl;
1199 OutStream << endl;
1200
1201 OutStream << "TOTAL BEACH DEPOSITION" << endl;
1202 OutStream << "Beach deposition, sand = " << m_ldGTotSandBeachDeposition * m_dCellArea << " m^3" << endl;
1203 OutStream << "Beach deposition, coarse = " << m_ldGTotCoarseBeachDeposition * m_dCellArea << " m^3" << endl;
1204 OutStream << "Beach deposition, sand and coarse = " << (m_ldGTotSandBeachDeposition + m_ldGTotCoarseBeachDeposition) * m_dCellArea << " m^3" << endl;
1205 OutStream << endl;
1206
1207 OutStream << "TOTAL SEDIMENT INPUT EVENTS" << endl;
1208 OutStream << "Sediment from sediment input events, fine = " << m_ldGTotFineSedimentInput * m_dCellArea << " m^3" << endl;
1209 OutStream << "Sediment from sediment input events, sand = " << m_ldGTotSandSedimentInput * m_dCellArea << " m^3" << endl;
1210 OutStream << "Sediment from sediment input events, coarse = " << m_ldGTotCoarseSedimentInput * m_dCellArea << " m^3" << endl;
1211 OutStream << "Sediment from sediment input events, all size classes = " << (m_ldGTotFineSedimentInput + m_ldGTotSandSedimentInput + m_ldGTotCoarseSedimentInput) * m_dCellArea << " m^3" << endl;
1212 OutStream << endl;
1213
1214 OutStream << "TOTAL SUSPENDED SEDIMENT" << endl;
1215 OutStream << "Suspended fine sediment = " << m_ldGTotSuspendedSediment * m_dCellArea << " m^3" << endl;
1216 OutStream << endl;
1217
1218 OutStream << "TOTAL LOST FROM GRID BY BEACH MOVEMENT" << endl;
1219 OutStream << "Potential sediment lost, all size classes = " << m_ldGTotPotentialSedLostBeachErosion * m_dCellArea << " m^3" << endl;
1220 OutStream << "Actual sediment lost, fine = " << m_ldGTotActualFineLostBeachErosion * m_dCellArea << " m^3" << endl;
1221 OutStream << "Actual sediment lost, sand = " << m_ldGTotActualSandLostBeachErosion * m_dCellArea << " m^3" << endl;
1222 OutStream << "Actual sediment lost, coarse = " << m_ldGTotActualCoarseLostBeachErosion * m_dCellArea << " m^3" << endl;
1223 OutStream << "Actual sediment lost, all size classes = " << (m_ldGTotActualFineLostBeachErosion + m_ldGTotActualSandLostBeachErosion + m_ldGTotActualCoarseLostBeachErosion) * m_dCellArea << " m^3" << endl;
1224 OutStream << endl;
1225
1226 OutStream << "TOTAL LOST FROM GRID BY CLIFF COLLAPSE" << endl;
1227 OutStream << "Sediment lost, sand = " << m_ldGTotSandSedLostCliffCollapse * m_dCellArea << " m^3" << endl;
1228 OutStream << "Sediment lost, coarse = " << m_ldGTotCoarseSedLostCliffCollapse * m_dCellArea << " m^3" << endl;
1229 OutStream << endl;
1230
1231 OutStream << "ALL-PROCESS TOTALS (all size classes)" << endl;
1233 OutStream << "Fine sediment eroded = " << ldFineEroded * m_dCellArea << " m^3" << endl;
1234 OutStream << "Fine sediment to suspension = " << m_ldGTotSuspendedSediment * m_dCellArea << " m^3" << endl;
1235 if (! bFPIsEqual(ldFineEroded, m_ldGTotSuspendedSediment, 1.0L))
1236 OutStream << MASS_BALANCE_ERROR << endl;
1237
1239 OutStream << "Sand sediment eroded = " << ldSandEroded * m_dCellArea << " m^3" << endl;
1240 long double ldSandDeposited = m_ldGTotCliffTalusSandDeposition + m_ldGTotSandBeachDeposition;
1241 OutStream << "Sand sediment deposited = " << ldSandDeposited * m_dCellArea << " m^3" << endl;
1243 OutStream << "Sand sediment lost from grid = " << ldSandLost * m_dCellArea << " m^3" << endl;
1244 if (! bFPIsEqual(ldSandEroded, (ldSandDeposited + ldSandLost), 1.0L))
1245 OutStream << MASS_BALANCE_ERROR << endl;
1246
1248 OutStream << "Coarse sediment eroded = " << ldCoarseEroded * m_dCellArea << " m^3" << endl;
1249 long double ldCoarseDeposited = m_ldGTotCliffTalusCoarseDeposition + m_ldGTotCoarseBeachDeposition;
1250 OutStream << "Coarse sediment deposited = " << ldCoarseDeposited * m_dCellArea << " m^3" << endl;
1252 OutStream << "Coarse sediment lost from grid = " << ldCoarseLost * m_dCellArea << " m^3" << endl;
1253 if (! bFPIsEqual(ldCoarseEroded, (ldCoarseDeposited + ldCoarseLost), 1.0L))
1254 OutStream << MASS_BALANCE_ERROR << endl;
1255
1256 OutStream << endl;
1257
1259 OutStream << "Total sediment eroded (all processes) = " << ldActualTotalEroded * m_dCellArea << " m^3" << endl;
1260
1262 OutStream << "Total sediment deposited/to suspension (all processes) = " << ldTotalDepositedAndSuspension * m_dCellArea << " m^3" << endl;
1263
1265 OutStream << "Total sediment lost from grid (all processes) = " << ldTotalLost * m_dCellArea << " m^3" << endl;
1266 OutStream << " = " << 24 * 365.25 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/year" << endl;
1267 OutStream << " = " << 24 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/day" << endl;
1268 OutStream << " = " << ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/hour" << endl;
1269 OutStream << fixed << setprecision(6);
1270 OutStream << " = " << ldTotalLost * m_dCellArea / (m_dSimDuration * 3600) << " m^3/sec" << endl
1271 << endl;
1272 OutStream << fixed << setprecision(3);
1273
1275 {
1276 OutStream << "Grid edge option is ";
1278 OutStream << "CLOSED.";
1280 OutStream << "OPEN.";
1282 OutStream << "RE-CIRCULATING.";
1283 OutStream << endl << endl;
1284 }
1285
1286 // Finally calculate performance details
1287 OutStream << PERFORMHEAD << endl;
1288
1289 // Get the time that the run ended
1290 m_tSysEndTime = time(nullptr);
1291
1292 OutStream << "Run ended at " << put_time(localtime(&m_tSysEndTime), "%T on %A %d %B %Y") << endl;
1293 OutStream << "Time simulated: " << strDispSimTime(m_dSimDuration) << endl
1294 << endl;
1295
1296 // Write to log file
1297 LogStream << "END OF RUN TOTALS =================================================================================================================================================" << endl
1298 << endl;
1299
1300 LogStream << "ALL-PROCESS TOTALS (all size classes)" << endl;
1302 LogStream << "Sediment eroded (all processes) = " << ldActualTotalEroded * m_dCellArea << " m^3" << endl;
1303
1304 LogStream << "Sediment deposited and in suspension (all processes) = " << ldTotalDepositedAndSuspension * m_dCellArea << " m^3" << endl;
1305
1306 LogStream << "Sediment lost from grid (all processes) = " << ldTotalLost * m_dCellArea << " m^3" << endl;
1307 LogStream << " = " << 24 * 365.25 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/year" << endl;
1308 LogStream << " = " << 24 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/day" << endl;
1309 LogStream << " = " << ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/hour" << endl;
1310 LogStream << " = " << setprecision(6) << ldTotalLost * m_dCellArea / (m_dSimDuration * 3600) << " m^3/sec" << endl;
1311 LogStream << endl;
1312 LogStream << fixed << setprecision(3);
1313
1315 {
1316 LogStream << "Grid edge option is ";
1318 LogStream << "CLOSED.";
1320 LogStream << "OPEN.";
1322 LogStream << "RE-CIRCULATING.";
1323 LogStream << endl << endl;
1324
1325 // Output averages for on-profile and between-profile potential shore platform erosion, ideally these are roughly equal
1326 LogStream << fixed << setprecision(6);
1327 LogStream << "On-profile average potential shore platform erosion = " << (m_ulTotPotentialPlatformErosionOnProfiles > 0 ? m_dTotPotentialPlatformErosionOnProfiles / static_cast<double>(m_ulTotPotentialPlatformErosionOnProfiles) : 0) << " mm (n = " << m_ulTotPotentialPlatformErosionOnProfiles << ")" << endl;
1328 LogStream << "Between-profile average potential shore platform erosion = " << (m_ulTotPotentialPlatformErosionBetweenProfiles > 0 ? m_dTotPotentialPlatformErosionBetweenProfiles / static_cast<double>(m_ulTotPotentialPlatformErosionBetweenProfiles) : 0) << " mm (n = " << m_ulTotPotentialPlatformErosionBetweenProfiles << ")" << endl;
1329 LogStream << endl;
1330 }
1331
1332 // Calculate statistics re. memory usage etc.
1334 OutStream << endl
1335 << "END OF RUN" << endl;
1336 LogStream << endl
1337 << "END OF RUN" << endl;
1338
1339 // Need to flush these here (if we don't, the buffer may not get written)
1340 LogStream.flush();
1341 OutStream.flush();
1342
1343 return RTN_OK;
1344}
1345
1346//===============================================================================================================================
1348//===============================================================================================================================
1350{
1351 LogStream << endl << m_ulIter << ": Polygon-to-adjacent polygon shares (non-dimensional), per-polygon seawater volume (m^3), per-polygon D50 values (mm: a blank D50 value means that there is no unconsolidated sediment on that polygon)." << endl;
1352
1353 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------------------------------------" << endl;
1354 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("Seawater", 14) << "|" << strCentre("Uncons d50", 14) << "| " << strCentre("(Dir'n Adj Share)...", 14) << endl;
1355 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Volume", 14) << "|" << strCentre("", 14) << "| " << strCentre("", 14) << endl;
1356 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------------------------------------" << endl;
1357
1358 for (int n = 0; n < nGetCoastPolygonSize(); n++)
1359 {
1360 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1361
1362 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight(pPolygon->dGetSeawaterVolume(), 0, 14) << "|" << strDblRight(pPolygon->dGetAvgUnconsD50(), 0, 14) << "| ";
1363
1364 for (int m = 0; m < pPolygon->nGetNumUpCoastAdjacentPolygons(); m++)
1365 {
1366 if (! pPolygon->bDownCoastThisIter())
1367 LogStream << "(UP \t" << pPolygon->nGetUpCoastAdjacentPolygon(m) << "\t" << pPolygon->dGetUpCoastAdjacentPolygonBoundaryShare(m) << ")\t";
1368 }
1369
1370 for (int m = 0; m < pPolygon->nGetNumDownCoastAdjacentPolygons(); m++)
1371 {
1372 if (pPolygon->bDownCoastThisIter())
1373 LogStream << "(DOWN\t" << pPolygon->nGetDownCoastAdjacentPolygon(m) << "\t" << pPolygon->dGetDownCoastAdjacentPolygonBoundaryShare(m) << ")\t";
1374 }
1375 LogStream << endl;
1376 }
1377
1378 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------------------------------------" << endl << endl;
1379}
1380
1381//===============================================================================================================================
1383//===============================================================================================================================
1385{
1386 double dTmpTot = 0;
1387 double dTmpFineTot = 0;
1388 double dTmpSandTot = 0;
1389 double dTmpCoarseTot = 0;
1390
1397
1398 // TODO 082 Also show m_dStartIterUnconsFineAllCells etc.
1399
1400 LogStream << m_ulIter << ": Per-polygon pre-existing unconsolidated sediment. Note that this does not include pre-existing unconsolidated sediment outside the polygons.";
1401 if (m_ulIter > 1)
1402 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.";
1403 LogStream << endl;
1404
1405 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1406 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1407 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1408 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1409
1410 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1411 {
1412 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1413
1414 // Add to this-iteration all-polygon totals of consolidated sediment within polygons
1418
1419 // Now consider unconsolidated sediment
1420 double dThisFine = pPolygon->dGetPreExistingUnconsFine() + pPolygon->dGetSedimentInputUnconsFine();
1421 double dThisSand = pPolygon->dGetPreExistingUnconsSand() + pPolygon->dGetSedimentInputUnconsSand();
1422 double dThisCoarse = pPolygon->dGetPreExistingUnconsCoarse() + pPolygon->dGetSedimentInputUnconsCoarse();
1423
1424 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((dThisFine + dThisSand + dThisCoarse) * m_dCellArea, 0, 14) << "|" << strDblRight(dThisFine * m_dCellArea, 0, 14) << "|" << strDblRight(dThisSand * m_dCellArea, 0, 14) << "|" << strDblRight(dThisCoarse * m_dCellArea, 0, 14) << "|" << endl;
1425
1426 dTmpFineTot += (dThisFine * m_dCellArea);
1427 dTmpSandTot += (dThisSand * m_dCellArea);
1428 dTmpCoarseTot += (dThisCoarse * m_dCellArea);
1429 dTmpTot += (dThisFine + dThisSand + dThisCoarse) * m_dCellArea;
1430
1431 // Add to this-iteration all-polygon totals of unconsolidated sediment within polygons
1432 m_dTotalFineUnconsInPolygons += dThisFine;
1433 m_dTotalSandUnconsInPolygons += dThisSand;
1434 m_dTotalCoarseUnconsInPolygons += dThisCoarse;
1435 }
1436
1437 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1438 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1439 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1440}
1441
1442//===============================================================================================================================
1444//===============================================================================================================================
1446{
1447 LogStream << m_ulIter << ": Per-polygon sediment input event totals." << endl;
1448
1449 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1450 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1451 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1452 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1453
1454 double dTmpFineTot = 0;
1455 double dTmpSandTot = 0;
1456 double dTmpCoarseTot = 0;
1457 double dTmpTot = 0;
1458
1459 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1460 {
1461 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1462
1463 double dThisFine = pPolygon->dGetSedimentInputUnconsFine();
1464 double dThisSand = pPolygon->dGetSedimentInputUnconsSand();
1465 double dThisCoarse = pPolygon->dGetSedimentInputUnconsCoarse();
1466
1467 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((dThisFine + dThisSand + dThisCoarse) * m_dCellArea, 0, 14) << "|" << strDblRight(dThisFine * m_dCellArea, 0, 14) << "|" << strDblRight(dThisSand * m_dCellArea, 0, 14) << "|" << strDblRight(dThisCoarse * m_dCellArea, 0, 14) << "|" << endl;
1468
1469 dTmpFineTot += (dThisFine * m_dCellArea);
1470 dTmpSandTot += (dThisSand * m_dCellArea);
1471 dTmpCoarseTot += (dThisCoarse * m_dCellArea);
1472 dTmpTot += (dThisFine + dThisSand + dThisCoarse) * m_dCellArea;
1473 }
1474
1475 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1476 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1477 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1478}
1479
1480//===============================================================================================================================
1482//===============================================================================================================================
1484{
1485 double dTmpTot = 0;
1486 double dTmpFineTot = 0;
1487 double dTmpSandTot = 0;
1488 double dTmpCoarseTot = 0;
1489
1490 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;
1491
1492 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1493 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1494 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1495 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1496
1497 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1498 {
1499 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1500
1501 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((pPolygon->dGetPlatformErosionUnconsSand() + pPolygon->dGetPlatformErosionUnconsCoarse()) * m_dCellArea, 0, 14) << "|" << strDblRight(0, 0, 14) << "|" << strDblRight(pPolygon->dGetPlatformErosionUnconsSand() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetPlatformErosionUnconsCoarse() * m_dCellArea, 0, 14) << "|" << endl;
1502
1503 dTmpTot += (pPolygon->dGetPlatformErosionUnconsSand() + pPolygon->dGetPlatformErosionUnconsCoarse()) * m_dCellArea;
1504 dTmpSandTot += (pPolygon->dGetPlatformErosionUnconsSand() * m_dCellArea);
1505 dTmpCoarseTot += (pPolygon->dGetPlatformErosionUnconsCoarse() * m_dCellArea);
1506 }
1507
1508 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1509 LogStream << "TOTAL from shore platform |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1510 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1511}
1512
1513//===============================================================================================================================
1515//===============================================================================================================================
1517{
1518 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;
1519
1520 LogStream << "-----------|-----------|-----------|--------------------------------------------|-----------------------------|--------------------------------------------|--------------------------------------------|" << endl;
1521 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All sediment", 44) << "|" << strCentre("Fine sediment", 29) << "|" << strCentre("Sand sediment", 44) << "|" << strCentre("Coarse sediment", 44) << "|" << endl;
1522 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Eroded Cliff", 15) << strCentre("Eroded DDPD", 15) << strCentre("Deposited", 14) << "|" << strCentre("Eroded", 14) << "|" << strCentre("Suspension", 14) << "|" << strCentre("Eroded Cliff", 15) << strCentre("Eroded DDPD", 15) << strCentre("Deposited", 14) << "|" << strCentre("Eroded Cliff", 15) << strCentre("Eroded DDPD", 15) << strCentre("Deposited", 14) << "|" << endl;
1523 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1524
1525 double dTmpErosionTot = 0;
1526 double dTmpErosionDDPDTot = 0;
1527 double dTmpDepositTot = 0;
1528
1529 double dTmpErosionFineTot = 0;
1530 double dTmpSuspensionFineTot = 0;
1531
1532 double dTmpErosionSandTot = 0;
1533 double dTmpErosionSandDDPDTot = 0;
1534 double dTmpDepositSandTot = 0;
1535
1536 double dTmpErosionCoarseTot = 0;
1537 double dTmpErosionCoarseDDPDTot = 0;
1538 double dTmpDepositCoarseTot = 0;
1539
1540 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1541 {
1542 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1543
1544 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11)
1545 // All
1547 // Fine
1548 << strDblRight(pPolygon->dGetCliffCollapseErosionFine(), 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseToSuspensionFine(), 0, 14) << "|"
1549 // Sand
1550 << strDblRight(pPolygon->dGetCliffCollapseErosionSand(), 0, 14) << " " << strDblRight(pPolygon->dGetCliffCollapseSandErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseUnconsSandDeposition() * m_dCellArea, 0, 14) << "|"
1551 // Coarse
1552 << strDblRight(pPolygon->dGetCliffCollapseErosionCoarse(), 0, 14) << " " << strDblRight(pPolygon->dGetCliffCollapseCoarseErodedDeanProfile() * m_dCellArea, 0, 14)<< "|" << strDblRight(pPolygon->dGetCliffCollapseUnconsCoarseDeposition() * m_dCellArea, 0, 14) << "|" << endl;
1553
1554 dTmpErosionTot += ((pPolygon->dGetCliffCollapseErosionFine() + pPolygon->dGetCliffCollapseErosionSand() + pPolygon->dGetCliffCollapseErosionCoarse()) * m_dCellArea);
1555
1556 dTmpErosionDDPDTot += ((pPolygon->dGetCliffCollapseSandErodedDeanProfile() + pPolygon->dGetCliffCollapseCoarseErodedDeanProfile()) * m_dCellArea);
1557
1559
1560 dTmpErosionFineTot += (pPolygon->dGetCliffCollapseErosionFine() * m_dCellArea);
1561 dTmpSuspensionFineTot += (pPolygon->dGetCliffCollapseToSuspensionFine() * m_dCellArea);
1562
1563 dTmpErosionSandTot += ((pPolygon->dGetCliffCollapseErosionSand()) * m_dCellArea);
1564 dTmpErosionSandDDPDTot += ((pPolygon->dGetCliffCollapseSandErodedDeanProfile()) * m_dCellArea);
1565 dTmpDepositSandTot += (pPolygon->dGetCliffCollapseUnconsSandDeposition() * m_dCellArea);
1566
1567 dTmpErosionCoarseTot += ((pPolygon->dGetCliffCollapseErosionCoarse()) * m_dCellArea);
1568 dTmpErosionCoarseDDPDTot += ((pPolygon->dGetCliffCollapseCoarseErodedDeanProfile()) * m_dCellArea);
1569 dTmpDepositCoarseTot += pPolygon->dGetCliffCollapseUnconsCoarseDeposition() * m_dCellArea;
1570 }
1571
1572 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1573 LogStream << "TOTAL from cliff collapse |" << strDblRight(dTmpErosionTot, 0, 14) << " " << strDblRight(dTmpErosionDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositTot, 0, 14) << "|"
1574 << strDblRight(dTmpErosionFineTot, 0, 14) << "|" << strDblRight(dTmpSuspensionFineTot, 0, 14) << "|"
1575 << strDblRight(dTmpErosionSandTot, 0, 14) << " " << strDblRight(dTmpErosionSandDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositSandTot, 0, 14) << "|"
1576 << strDblRight(dTmpErosionCoarseTot, 0, 14) << " " << strDblRight(dTmpErosionCoarseDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositCoarseTot, 0, 14) << "|" << endl;
1577 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl << endl;
1578}
1579
1580//===============================================================================================================================
1582//===============================================================================================================================
1584{
1585 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;
1586
1587 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1588 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1589 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1590 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1591
1592 double dTmpTot = 0;
1593 double dTmpFineTot = 0;
1594 double dTmpSandTot = 0;
1595 double dTmpCoarseTot = 0;
1596
1597 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1598 {
1599 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1600
1601 double dFine = pPolygon->dGetPreExistingUnconsFine();
1602 double dSand = pPolygon->dGetPreExistingUnconsSand();
1603 double dCoarse = pPolygon->dGetPreExistingUnconsCoarse();
1604
1605 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight((dFine + dSand + dCoarse) * m_dCellArea, 0, 14) << "|" << strDblRight(dFine * m_dCellArea, 0, 14) << "|" << strDblRight(dSand * m_dCellArea, 0, 14) << "|" << strDblRight(dCoarse * m_dCellArea, 0, 14) << "|" << endl;
1606
1607 dTmpTot += (dFine + dSand + dCoarse) * m_dCellArea;
1608 dTmpFineTot += (dFine * m_dCellArea);
1609 dTmpSandTot += (dSand * m_dCellArea);
1610 dTmpCoarseTot += (dCoarse * m_dCellArea);
1611 }
1612
1613 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1614 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1615 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1616}
1617
1618//===============================================================================================================================
1620//===============================================================================================================================
1622{
1623 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 ";
1625 LogStream << "CERC";
1627 LogStream << "Kamphuis";
1628 LogStream << " equation." << endl;
1629
1630 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1631 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("Potential", 14) << "|" << endl;
1632 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Erosion", 14) << "|" << endl;
1633 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1634
1635 double dTmpTot = 0;
1636 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1637 {
1638 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1639
1640 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight(pPolygon->dGetPotentialErosion() * m_dCellArea, 0, 14) << "|" << endl;
1641
1642 dTmpTot += (pPolygon->dGetPotentialErosion() * m_dCellArea);
1643 }
1644 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1645 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << endl;
1646 LogStream << "-----------|-----------|-----------|--------------|" << endl << endl;
1647}
1648
1649// //===============================================================================================================================
1650// //! Writes to the log file a table showing per-polygon supply-limited erosion of unconsolidated beach sediment
1651// //===============================================================================================================================
1652// void CSimulation::WritePolygonUnconsErosion(int const nCoast)
1653// {
1654// LogStream << m_ulIter << ": per-polygon supply-limited erosion of unconsolidated beach sediment (-ve, all m^3). All fine sediment eroded goes to suspension." << endl;
1655//
1656// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1657// LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) <<"|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1658// LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Estimated", 14) << "|" << strCentre("Estimated", 14) <<"|" << strCentre("Estimated", 14) << "|" << strCentre("Estimated", 14) << "|" << endl;
1659// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1660//
1661// double
1662// dTmpTot = 0,
1663// dTmpFineTot = 0,
1664// dTmpSandTot = 0,
1665// dTmpCoarseTot = 0;
1666//
1667// for (int nPoly = 0; nPoly < m_VCoast[nCoast].nGetNumPolygons(); nPoly++)
1668// {
1669// CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(nPoly);
1670//
1671// LogStream << strIntRight(m_pVCoastPolygon[nPoly]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(m_pVCoastPolygon[nPoly]->nGetCoastID(), 11) << "|" << strDblRight((pPolygon->dGetBeachErosionUnconsFine() + pPolygon->dGetBeachErosionUnconsSand() + pPolygon->dGetBeachErosionUnconsCoarse()) * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetBeachErosionUnconsSand() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetBeachErosionUnconsCoarse() * m_dCellArea, 0, 14) << "|" << endl;
1672//
1673// dTmpTot += (pPolygon->dGetBeachErosionUnconsFine() + pPolygon->dGetBeachErosionUnconsSand() + pPolygon->dGetBeachErosionUnconsCoarse()) * m_dCellArea;
1674// dTmpFineTot += (pPolygon->dGetBeachErosionUnconsFine() * m_dCellArea);
1675// dTmpSandTot += (pPolygon->dGetBeachErosionUnconsSand() * m_dCellArea);
1676// dTmpCoarseTot += (pPolygon->dGetBeachErosionUnconsCoarse() * m_dCellArea);
1677// }
1678//
1679// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1680// LogStream << "TOTAL estimated erosion |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1681// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1682// }
1683
1684//===============================================================================================================================
1686//===============================================================================================================================
1687void CSimulation::WritePolygonUnsortedSequence(int const nCoast, vector<vector<int> >& pnVVPolyAndAdjacent)
1688{
1689 LogStream << m_ulIter << ": Unsorted sequence of polygon processing" << endl;
1690 LogStream << "-----------|-----------|-----------|--------------|--------------|" << endl;
1691 LogStream << strCentre("From", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("From", 11) << "|" << strCentre("Direction", 14) << "|" << strCentre("To", 14) << "|" << endl;
1692 LogStream << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("", 14) << "|" << strCentre("Polygon", 14) << "|" << endl;
1693 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 14) << "|" << strCentre("Coast ID", 14) << "|" << endl;
1694 LogStream << "-----------|-----------|-----------|--------------|--------------|" << endl;
1695
1696 for (int n = 0; n < static_cast<int>(pnVVPolyAndAdjacent.size()); n++)
1697 {
1698 CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(pnVVPolyAndAdjacent[n][1]);
1699
1700 for (int m = 0; m < static_cast<int>(pnVVPolyAndAdjacent[n].size()); m++)
1701 {
1702 if (m == 0)
1703 {
1704 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|";
1705 LogStream << strIntRight(nCoast, 11) << "|";
1706 continue;
1707 }
1708
1709 if (m == 1)
1710 {
1711 LogStream << strIntRight(pPolygon->nGetCoastID(), 11) << "|";
1712 continue;
1713 }
1714
1715 if (m == 2)
1716 {
1717 if (pnVVPolyAndAdjacent[n][m] == true)
1718 LogStream << strCentre("DOWN ", 14) << "|";
1719 else
1720 LogStream << strCentre("UP ", 14) << "|";
1721
1722 continue;
1723 }
1724
1725 int nAdjDownCoast = pnVVPolyAndAdjacent[n][m];
1726 int nCoastID = INT_NODATA;
1727 if (nAdjDownCoast != INT_NODATA)
1728 {
1729 CGeomCoastPolygon const* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjDownCoast);
1730 nCoastID = pAdjPolygon->nGetCoastID();
1731 }
1732 LogStream << strIntRight(nCoastID, 14) << "|";
1733 }
1734 LogStream << endl;
1735 }
1736 LogStream << "-----------|-----------|-----------|--------------|--------------|" << endl << endl;
1737}
1738
1739//===============================================================================================================================
1741//===============================================================================================================================
1742void CSimulation::WritePolygonSortedSequence(int const nCoast, vector<vector<int> >& pnVVPolyAndAdjacent)
1743{
1744 // Show sorted order of polygon processing, and any circularities
1745 LogStream << m_ulIter << ": Sorted sequence of polygon processing (" << INT_NODATA << " = leaves grid), and any X -> Y -> X circularities" << endl;
1746
1747 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|" << endl;
1748 LogStream << strCentre("From", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("From", 11) << "|" << strCentre("Direction", 14) << "|" << strCentre("To", 14) << "|" << strCentre("Circular", 14) << "|" << endl;
1749 LogStream << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("", 14) << "|" << strCentre("Polygon", 14) << "|" << strCentre("-ity?", 14) << "|" << endl;
1750 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 14) << "|" << strCentre("Coast ID", 14) << "|" << strCentre("", 14) << "|" << endl;
1751 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|" << endl;
1752
1753 for (int nPoly = 0; nPoly < static_cast<int>(pnVVPolyAndAdjacent.size()); nPoly++)
1754 {
1755 const CGeomCoastPolygon* pPoly = m_VCoast[nCoast].pGetPolygon(pnVVPolyAndAdjacent[nPoly][1]);
1756 vector<int> VCirc = pPoly->VnGetCircularities();
1757
1758 LogStream << strIntRight(m_pVCoastPolygon[pnVVPolyAndAdjacent[nPoly][1]]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pnVVPolyAndAdjacent[nPoly][1], 11) << "|";
1759
1760 // Up-coast or down-coast sediment movement?
1761 string strTmp = "";
1762 for (int m = 2; m < static_cast<int>(pnVVPolyAndAdjacent[nPoly].size()); m++)
1763 {
1764 if (m == 2)
1765 {
1766 if (pnVVPolyAndAdjacent[nPoly][m] == true)
1767 LogStream << strCentre("DOWN ", 14) << "|";
1768 else
1769 LogStream << strCentre("UP ", 14) << "|";
1770
1771 continue;
1772 }
1773
1774 // These are the "To" polygons
1775 int nAdjPolyDownCoastSeq = pnVVPolyAndAdjacent[nPoly][m];
1776 int nAdjacentPolyID = INT_NODATA;
1777 if (nAdjPolyDownCoastSeq != INT_NODATA)
1778 {
1779 CGeomCoastPolygon const* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjPolyDownCoastSeq);
1780 nAdjacentPolyID = pAdjPolygon->nGetCoastID();
1781 }
1782 strTmp += to_string(nAdjacentPolyID);
1783
1784 if (m < (static_cast<int>(pnVVPolyAndAdjacent[nPoly].size()) - 1))
1785 strTmp += ", ";
1786 }
1787 LogStream << strRight(strTmp, 14) << "|";
1788
1789 strTmp = "";
1790
1791 // Now check for circularities
1792 if (! VCirc.empty())
1793 {
1794 // There is at least one circularity
1795 for (unsigned int i = 0; i < VCirc.size(); i++)
1796 {
1797 strTmp += to_string(VCirc[i]);
1798
1799 if (i < (VCirc.size()-1))
1800 strTmp += ", ";
1801 }
1802 }
1803 LogStream << strCentre(strTmp, 14) << "|" << endl;
1804 }
1805 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|" << endl << endl;
1806}
1807
1808//===============================================================================================================================
1810//===============================================================================================================================
1811void CSimulation::WritePolygonActualMovement(int const nCoast, vector<vector<int> > const& pnVVPolyAndAdjacent)
1812{
1813 // Show estimated polygon-to-polygon movement
1814 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;
1815
1816 LogStream << "-----------|-----------|-----------|--------------------------------------------|-----------------------------|--------------------------------------------|--------------------------------------------|" << endl;
1817 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 44) << "|" << strCentre("Fine", 29) << "|" << strCentre("Sand", 44) << "|" << strCentre("Coarse", 44) << "|" << endl;
1818 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1819 LogStream << strCentre("", 11) << "|" << strCentre("", 11) << "|" << strCentre("", 11) << "|" << strCentre("Erosion", 14) << " " << strCentre("Erosion DPDD", 14) << "|" << strCentre("Dep + Susp", 14) << "|" << strCentre("Erosion", 14) << "|" << strCentre("Suspension", 14) << "|" << strCentre("Erosion", 14) << " " << strCentre("Erosion DPDD", 14) << "|" << strCentre("Deposition", 14) << "|" << strCentre("Erosion", 14) << " " << strCentre("Erosion DPDD", 14) << "|" << strCentre("Deposition", 14) << "|" << endl;
1820 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1821
1822 double dTmpTotAllErosion = 0;
1823 double dTmpTotAllErosionDDPD = 0;
1824 double dTmpTotAllDeposition = 0;
1825
1826 double dTmpFineErosion = 0;
1827 // double dTmpFineDeposition = 0;
1828
1829 double dTmpSandErosion = 0;
1830 double dTmpSandErosionDDPD = 0;
1831 double dTmpSandDeposition = 0;
1832
1833 double dTmpCoarseErosion = 0;
1834 double dTmpCoarseErosionDDPD = 0;
1835 double dTmpCoarseDeposition = 0;
1836
1837 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1838 {
1839 int nPoly = pnVVPolyAndAdjacent[n][1];
1840
1841 double dAllErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGeBeachErosionAllUncons() - (m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile());
1842 double dSandErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsSand() - m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile();
1843 double dCoarseErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsCoarse() - m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile();
1844
1845 LogStream << strIntRight(m_pVCoastPolygon[nPoly]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(m_pVCoastPolygon[nPoly]->nGetCoastID(), 11) << "|"
1846 // All
1847 << 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) << "|"
1848 // Fine
1849 << strDblRight(-m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|" << strDblRight(-m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|"
1850 // Sand
1851 << strDblRight(dSandErosionNotDDPD * m_dCellArea, 0, 14) << " " << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachDepositionUnconsSand() * m_dCellArea, 0, 14) << "|"
1852 // Coarse
1853 << 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;
1854
1855 dTmpTotAllErosion += (dAllErosionNotDDPD * m_dCellArea);
1856 dTmpTotAllErosionDDPD += ((m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile()) * m_dCellArea);
1857 dTmpTotAllDeposition += (m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons() * m_dCellArea);
1858
1859 dTmpFineErosion += (m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea);
1860 // dTmpFineDeposition +=
1861
1862 dTmpSandErosion += (dSandErosionNotDDPD * m_dCellArea);
1863 dTmpSandErosionDDPD += (m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() * m_dCellArea);
1864 dTmpSandDeposition += (m_pVCoastPolygon[nPoly]->dGetBeachDepositionUnconsSand() * m_dCellArea);
1865
1866 dTmpCoarseErosion += (dCoarseErosionNotDDPD * m_dCellArea);
1867 dTmpCoarseErosionDDPD += (m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile() * m_dCellArea);
1868 dTmpCoarseDeposition += (m_pVCoastPolygon[nPoly]->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea);
1869 }
1870
1871 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1872 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;
1873
1875 dTmpSandDeposition += (m_dThisIterLeftGridUnconsSand * m_dCellArea);
1876 dTmpCoarseDeposition += (m_dThisIterLeftGridUnconsCoarse * m_dCellArea);
1877
1878 bool bShowZeroFine = false;
1879 bool bShowZeroSand = false;
1880 bool bShowZeroCoarse = false;
1881
1882 if (! bFPIsEqual(dTmpFineErosion, 0.0, MASS_BALANCE_TOLERANCE))
1883 bShowZeroFine = true;
1884
1885 if (! bFPIsEqual(dTmpSandErosion, 0.0, MASS_BALANCE_TOLERANCE))
1886 bShowZeroSand = true;
1887
1888 if (! bFPIsEqual(dTmpCoarseErosion, 0.0, MASS_BALANCE_TOLERANCE))
1889 bShowZeroCoarse = true;
1890
1891 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1892 LogStream << "TOTAL |"
1893 // All
1894 << strDblRight(-dTmpTotAllErosion, 0, 14) << "|" << strDblRight(dTmpTotAllErosionDDPD, 0, 14) << "|" << strDblRight(dTmpTotAllDeposition, 0, 14) << "|"
1895 // Fine
1896 << strDblRight(-dTmpFineErosion, 0, 14, bShowZeroFine) << "|" << strDblRight(dTmpFineErosion, 0, 14, bShowZeroFine) << "|"
1897 // Sand
1898 << strDblRight(-dTmpSandErosion, 0, 14, bShowZeroSand) << "|" << strDblRight(dTmpSandErosionDDPD, 0, 14, bShowZeroSand) << "|" << strDblRight(dTmpSandDeposition, 0, 14, bShowZeroSand) << "|"
1899 // Coarse
1900 << strDblRight(-dTmpCoarseErosion, 0, 14, bShowZeroCoarse) << "|" << strDblRight(dTmpCoarseErosionDDPD, 0, 14, bShowZeroCoarse) << "|" << strDblRight(dTmpCoarseDeposition, 0, 14, bShowZeroCoarse) << "|" << endl;
1901 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1902}
1903
1904//===============================================================================================================================
1906//===============================================================================================================================
1908{
1910 {
1911 // TODO 062 show these results somewhere
1912 // 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)
1913 int nSuspFineCellsAllCells = 0;
1914 int nUnconsFineCellsAllCells = 0;
1915 int nUnconsSandCellsAllCells = 0;
1916 int nUnconsCoarseCellsAllCells = 0;
1917
1918 // TODO 062 show these results somewhere
1919 // Also get the numbers of cells with consolidated and unconsolidated sediment stored or in suspension, only for cells inside polygons
1920 int nSuspFineCellsInPolygons = 0;
1921 int nUnconsFineCellsInPolygons = 0;
1922 int nUnconsSandCellsInPolygons = 0;
1923 int nUnconsCoarseCellsInPolygons = 0;
1924
1925 // Get the depths of consolidated and unconsolidated sediment stored or in suspension, for all cells (both inside and outside polygons)
1926 double dEndIterSuspFineAllCells = 0;
1927 double dEndIterUnconsFineAllCells = 0;
1928 double dEndIterUnconsSandAllCells = 0;
1929 double dEndIterUnconsCoarseAllCells = 0;
1930 double dEndIterConsFineAllCells = 0;
1931 double dEndIterConsSandAllCells = 0;
1932 double dEndIterConsCoarseAllCells = 0;
1933
1934 // Also get the depths of consolidated and unconsolidated sediment stored or in suspension, only for cells inside polygons
1935 double dEndIterSuspFineInPolygons = 0;
1936 double dEndIterUnconsFineInPolygons = 0;
1937 double dEndIterUnconsSandInPolygons = 0;
1938 double dEndIterUnconsCoarseInPolygons = 0;
1939 double dEndIterConsFineInPolygons = 0;
1940 double dEndIterConsSandInPolygons = 0;
1941 double dEndIterConsCoarseInPolygons = 0;
1942
1943 // Get depth of consolidated and unconsolidated (and suspended) sediment from each cell (both within and outside polygons)
1944 for (int nX = 0; nX < m_nXGridSize; nX++)
1945 {
1946 for (int nY = 0; nY < m_nYGridSize; nY++)
1947 {
1948 dEndIterConsFineAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsFineThickConsiderNotch();
1949 dEndIterConsSandAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsSandThickConsiderNotch();
1950 dEndIterConsCoarseAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsCoarseThickConsiderNotch();
1951
1952 double dSuspFine = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1953 if (dSuspFine > 0)
1954 {
1955 dEndIterSuspFineAllCells += dSuspFine;
1956 nSuspFineCellsAllCells++;
1957 }
1958
1959 double dUnconsFine = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsFine();
1960 if (dUnconsFine > 0)
1961 {
1962 dEndIterUnconsFineAllCells += dUnconsFine;
1963 nUnconsFineCellsAllCells++;
1964 }
1965
1966 double dUnconsSand = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsSand();
1967 if (dUnconsSand > 0)
1968 {
1969 dEndIterUnconsSandAllCells += dUnconsSand;
1970 nUnconsSandCellsAllCells++;
1971 }
1972
1973 double dUnconsCoarse = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsCoarse();
1974 if (dUnconsCoarse > 0)
1975 {
1976 dEndIterUnconsCoarseAllCells += dUnconsCoarse;
1977 nUnconsCoarseCellsAllCells++;
1978 }
1979
1980 // Is this cell within a polygon?
1981 if (m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID() != INT_NODATA)
1982 {
1983 // It is within a polygon
1984 dEndIterConsFineInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsFineThickConsiderNotch();
1985 dEndIterConsSandInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsSandThickConsiderNotch();
1986 dEndIterConsCoarseInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsCoarseThickConsiderNotch();
1987
1988 dSuspFine = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1989 if (dSuspFine > 0)
1990 {
1991 dEndIterSuspFineInPolygons += dSuspFine;
1992 nSuspFineCellsInPolygons++;
1993 }
1994
1995 dUnconsFine = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsFine();
1996 if (dUnconsFine > 0)
1997 {
1998 dEndIterUnconsFineInPolygons += dUnconsFine;
1999 nUnconsFineCellsInPolygons++;
2000 }
2001
2002 dUnconsSand = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsSand();
2003 if (dUnconsSand > 0)
2004 {
2005 dEndIterUnconsSandInPolygons += dUnconsSand;
2006 nUnconsSandCellsInPolygons++;
2007 }
2008
2009 dUnconsCoarse = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsCoarse();
2010 if (dUnconsCoarse > 0)
2011 {
2012 dEndIterUnconsCoarseInPolygons += dUnconsCoarse;
2013 nUnconsCoarseCellsInPolygons++;
2014 }
2015 }
2016 }
2017 }
2018
2019 double dFineTmp = 0;
2020 double dSandTmp = 0;
2021 double dCoarseTmp = 0;
2022
2023 LogStream << endl << m_ulIter << ": Consolidated sediment budget, all m^3. This includes sediment within and outside the polygons." << endl;
2024
2025 // Stored consolidated sediment at start of timestep: sediment within and outside the polygons
2026 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2027 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2028 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2029
2030 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2033
2034 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;
2035
2036 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2039
2040 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;
2041
2042 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2045
2046 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;
2047
2048 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;
2049
2050 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2051
2055
2056 // Shore platform erosion, consolidated sediment lost (becomes unconsolidated esediment and suspended sediment)
2057 LogStream << strLeft("Consolidated sediment lost via platform erosion (becomes suspended sediment)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2058 LogStream << strLeft("Consolidated sediment lost via platform erosion (becomes unconsolidated sediment)", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2059 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2061 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2062
2066
2067 // Cliff collapse, consolidated sediment lost (becomes unconsolidated esediment and suspended sediment)
2068 LogStream << strLeft("Consolidated sediment lost via cliff collapse (becomes suspended sediment)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2069 LogStream << strLeft("Consolidated sediment lost via cliff collapse (becomes unconsolidated sediment)", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2070 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2072
2076
2077 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2078 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2079 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2080
2081 // Don't show inside/outside polygon values if not simulating beach erosion
2082 dTmp1 = (m_bDoBeachSedimentTransport ? dEndIterConsFineInPolygons : 0);
2083 dTmp2 = (m_bDoBeachSedimentTransport ? (dEndIterConsFineAllCells - dEndIterConsFineInPolygons) : 0);
2084
2085 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;
2086
2087 // Don't show inside/outside polygon values if not simulating beach erosion
2088 dTmp3 = (m_bDoBeachSedimentTransport ? dEndIterConsSandInPolygons : 0);
2089 dTmp4 = (m_bDoBeachSedimentTransport ? (dEndIterConsSandAllCells - dEndIterConsSandInPolygons) : 0);
2090 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;
2091
2092 // Don't show inside/outside polygon values if not simulating beach erosion
2093 dTmp5 = (m_bDoBeachSedimentTransport ? dEndIterConsCoarseInPolygons : 0);
2094 dTmp6 = (m_bDoBeachSedimentTransport ? (dEndIterConsCoarseAllCells - dEndIterConsCoarseInPolygons) : 0);
2095
2096 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;
2097
2098 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;
2099
2100 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2101
2102 double dFineError = (dEndIterConsFineAllCells * m_dCellArea) - dFineTmp;
2103 double dSandError = (dEndIterConsSandAllCells * m_dCellArea) - dSandTmp;
2104 double dCoarseError = (dEndIterConsCoarseAllCells * m_dCellArea) - dCoarseTmp;
2105
2106 // Mass balance check
2107 bool bError = false;
2108 string strFineErrMsg = "";
2109 string strSandErrMsg = "";
2110 string strCoarseErrMsg = "";
2111 string strAllErrMsg = "";
2112
2113 if (! bFPIsEqual(dFineError, 0.0, MASS_BALANCE_TOLERANCE))
2114 {
2115 strFineErrMsg = MASS_BALANCE_ERROR;
2116 bError = true;
2117 }
2118
2119 if (! bFPIsEqual(dSandError, 0.0, MASS_BALANCE_TOLERANCE))
2120 {
2121 strSandErrMsg = MASS_BALANCE_ERROR;
2122 bError = true;
2123 }
2124
2125 if (! bFPIsEqual(dCoarseError, 0.0, MASS_BALANCE_TOLERANCE))
2126 {
2127 strCoarseErrMsg = MASS_BALANCE_ERROR;
2128 bError = true;
2129 }
2130
2131 if (bError)
2132 strAllErrMsg = MASS_BALANCE_ERROR;
2133
2134 LogStream << strLeft("Consolidated sediment mass balance check (+ve means end total > start total)", 101) << "|" << strLeft("", 8) << "|" << strLeft("", 44) << "|" << endl;
2135 LogStream << strLeft(strFineErrMsg, 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dFineError, 3, 30, false) << strRightPerCent(dFineError, dEndIterConsFineAllCells, 14, 2) << "|" << endl;
2136 LogStream << strLeft(strSandErrMsg, 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dSandError, 3, 30, false) << strRightPerCent(dSandError, dEndIterConsSandAllCells, 14, 2) << "|" << endl;
2137 LogStream << strLeft(strCoarseErrMsg, 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dCoarseError, 3, 30, false) << strRightPerCent(dCoarseError, dEndIterConsCoarseAllCells, 14, 2) << "|" << endl;
2138 LogStream << strLeft(strAllErrMsg, 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight(dFineError + dSandError + dCoarseError, 3, 30, false) << strRightPerCent(dFineError + dSandError + dCoarseError, dEndIterConsFineAllCells + dEndIterConsSandAllCells + dEndIterConsCoarseAllCells, 14, 2) << "|" << endl;
2139 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2140 LogStream << endl;
2141
2142 // Now look at unconsolidated sediment
2143 dFineTmp =
2144 dSandTmp =
2145 dCoarseTmp = 0;
2146
2147 LogStream << m_ulIter << ": Unconsolidated sediment budget, all m^3." << endl;
2148
2149 // Stored unconsolidated sediment, and in suspension, at start of timestep: sediment within and outside the polygons
2150 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2151 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2152 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2153
2154 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2157
2158 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;
2159
2160 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2163
2164 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;
2165
2166 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2169
2170 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;
2171
2172 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2175
2176 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;
2177
2178 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;
2179
2180 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2181
2185
2186 // Shore platform erosion, consolidated sediment becomes unconsolidated sediment and suspended sediment
2187 LogStream << strLeft("Suspended sediment derived from platform erosion of consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2188 LogStream << strLeft("Unconsolidated sediment derived from platform erosion of consolidated sediment", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2189 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2191 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2192
2196
2197 // Cliff collapse, consolidated sediment becomes unconsolidated sediment and suspended sediment
2198 LogStream << strLeft("Suspended sediment derived from cliff collapse erosion of consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2199 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;
2200 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2202 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2203
2207
2208 // Beach (unconsolidated sediment) lost from grid due to beach erosion and deposition, and to cliff collapse with talus going outside the grid
2209 LogStream << strLeft("Unconsolidated sediment lost from grid", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsFine * m_dCellArea, 0, 44) << "|" << endl;
2210 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsSand * m_dCellArea, 0, 44) << "|" << endl;
2211 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsCoarse * m_dCellArea, 0, 44) << "|" << endl;
2213 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2214
2218
2219 // Sediment added via input events
2220 LogStream << strLeft("Unconsolidated sediment added via input event(s)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisiterUnconsFineInput * m_dCellArea, 0, 44) << "|" << endl;
2221 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisiterUnconsSandInput * m_dCellArea, 0, 44) << "|" << endl;
2222 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisiterUnconsCoarseInput * m_dCellArea, 0, 44) << "|" << endl;
2223 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2224
2227 dCoarseTmp += (m_dThisiterUnconsCoarseInput * m_dCellArea);
2228
2229 // Any uncons sediment left over from last iter and deposited this iter?
2230
2231 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;
2232 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dUnconsCoarseNotDepositedLastIter * m_dCellArea, 0, 44) << "|" << endl;
2233
2236
2237 // Any insufficient deposition?
2238 LogStream << strLeft("Insufficient unconsolidated sediment deposited this iteration", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dDepositionSandDiff * m_dCellArea, 0, 44) << "|" << endl;
2239 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dDepositionCoarseDiff * m_dCellArea, 0, 44) << "|" << endl;
2240
2241 dSandTmp -= (m_dDepositionSandDiff * m_dCellArea);
2242 dCoarseTmp -= (m_dDepositionCoarseDiff * m_dCellArea);
2243
2244 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2245 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2246 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2247
2248 // Don't show inside/outside polygon values if not simulating beach erosion
2249 dTmp1 = (m_bDoBeachSedimentTransport ? dEndIterSuspFineInPolygons : 0);
2250 dTmp2 = (m_bDoBeachSedimentTransport ? (dEndIterSuspFineAllCells - dEndIterSuspFineInPolygons) : 0);
2251
2252 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;
2253
2254 // Don't show inside/outside polygon values if not simulating beach erosion
2255 dTmp3 = (m_bDoBeachSedimentTransport ? dEndIterUnconsFineInPolygons : 0);
2256 dTmp4 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsFineAllCells - dEndIterUnconsFineInPolygons) : 0);
2257
2258 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;
2259
2260 // Don't show inside/outside polygon values if not simulating beach erosion
2261 dTmp5 = (m_bDoBeachSedimentTransport ? dEndIterUnconsSandInPolygons : 0);
2262 dTmp6 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsSandAllCells - dEndIterUnconsSandInPolygons) : 0);
2263
2264 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;
2265
2266 // Don't show inside/outside polygon values if not simulating beach erosion
2267 dTmp7 = (m_bDoBeachSedimentTransport ? dEndIterUnconsCoarseInPolygons : 0);
2268 dTmp8 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsCoarseAllCells - dEndIterUnconsCoarseInPolygons) : 0);
2269
2270 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;
2271
2272 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;
2273
2274 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2275
2276 dFineError = ((dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells) * m_dCellArea) - dFineTmp,
2277 dSandError = (dEndIterUnconsSandAllCells * m_dCellArea) - dSandTmp,
2278 dCoarseError = (dEndIterUnconsCoarseAllCells * m_dCellArea) - dCoarseTmp;
2279
2280 // Mass balance check
2281 bError = false;
2282 strFineErrMsg = "";
2283 strSandErrMsg = "";
2284 strCoarseErrMsg = "";
2285 strAllErrMsg = "";
2286
2287 if (! bFPIsEqual(dFineError, 0.0, MASS_BALANCE_TOLERANCE))
2288 {
2289 strFineErrMsg = MASS_BALANCE_ERROR;
2290 bError = true;
2291 }
2292
2293 if (! bFPIsEqual(dSandError, 0.0, MASS_BALANCE_TOLERANCE))
2294 {
2295 strSandErrMsg = MASS_BALANCE_ERROR;
2296 bError = true;
2297 }
2298
2299 if (! bFPIsEqual(dCoarseError, 0.0, MASS_BALANCE_TOLERANCE))
2300 {
2301 strCoarseErrMsg = MASS_BALANCE_ERROR;
2302 bError = true;
2303 }
2304
2305 if (bError)
2306 strAllErrMsg = MASS_BALANCE_ERROR;
2307
2308 LogStream << strLeft("Unconsolidated sediment mass balance check (+ve means iteration-end total > iteration-start total)", 101) << "|" << strLeft("", 8) << "|" << strLeft("", 44) << "|" << endl;
2309 LogStream << strLeft(strFineErrMsg, 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dFineError, 0, 30, false) << strRightPerCent(dFineError, (dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells), 14, 2) << "|" << endl;
2310 LogStream << strLeft(strSandErrMsg, 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dSandError, 0, 30, false) << strRightPerCent(dSandError, dEndIterUnconsSandAllCells, 14, 2) << "|" << endl;
2311 LogStream << strLeft(strCoarseErrMsg, 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dCoarseError, 0, 30, false) << strRightPerCent(dCoarseError, dEndIterUnconsCoarseAllCells, 14, 2) << "|" << endl;
2312 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;
2313 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2314 LogStream << endl;
2315 }
2316
2317 // Add to grand totals: first platform erosion
2319 // assert(isfinite(m_dThisIterPotentialPlatformErosion));
2320
2324
2325 // Erosion from cliff collapse, both consolidated and unconsolidated
2332
2333 // Deposition (with fine to suspension) of unconsolidated talus from cliff collapse
2337
2338 // Erosion of unconsolidated sediment during deposition of unconsolidated cliff collapse talus
2342
2343 // Beach erosion of unconsolidated sediment
2345
2349
2350 // Beach deposition of unconsolidated sediment
2353
2354 // Unconsolidated sediment lost due to beach erosion
2356
2360
2361 // Unconsolidated sediment input event(s)
2365
2366 // Suspended unconsolidated sediment
2368
2369 // Shortfall in unconsolidated sediment deposition
2372}
2373
Geometry class used for coast polygon objects.
double dGetCliffCollapseErosionCoarse(void) const
Get the this-iteration total of unconsolidated coarse sediment from cliff collapse on this polygon,...
double dGetSedimentInputUnconsSand(void) const
Get the value of sand sediment on the polygon derived from sediment input events(s)
double dGetPotentialErosion(void) const
Returns this timestep's total change in depth of unconsolidated sediment (all size classes) due to be...
double dGetCliffCollapseUnconsSandDeposition(void) const
Get the this-iteration total of unconsolidated sand sediment deposited from cliff collapse on this po...
double dGetCliffCollapseToSuspensionFine(void) const
Get the this-iteration total of unconsolidated fine sediment from cliff collapse which goes to suspen...
double dGetPreExistingUnconsSand(void) const
Get the value of pre-existing unconsolidated sand sediment stored on this polygon.
double dGetPreExistingConsSand(void) const
Get the value of pre-existing consolidated sand sediment stored on this polygon.
double dGetUpCoastAdjacentPolygonBoundaryShare(int const) const
Gets the boundary shares for all up-coast adjacent polygons.
int nGetUpCoastAdjacentPolygon(int const) const
Gets a single up-coast adjacent 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)
int nGetNumUpCoastAdjacentPolygons(void) const
Gets all up-coast adjacent polygons.
double dGetPreExistingConsFine(void) const
Get the value of pre-existing consolidated fine sediment stored on this polygon.
int nGetGlobalID(void) const
Get the global ID.
double dGetCliffCollapseUnconsCoarseDeposition(void) const
Get the this-iteration total of unconsolidated coarse sediment deposited from cliff collapse on this ...
double dGetSeawaterVolume(void) const
Get the volume of seawater in the coast polygon.
double dGetDownCoastAdjacentPolygonBoundaryShare(int const) const
Gets the boundary shares for all down-coast adjacent polygons.
double dGetPreExistingUnconsFine(void) const
Get the value of pre-existing unconsolidated fine sediment stored on this polygon.
int nGetDownCoastAdjacentPolygon(int const) const
Gets a single down-coast adjacent polygon.
int nGetNumDownCoastAdjacentPolygons(void) const
Gets all down-coast adjacent polygons.
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)
bool bDownCoastThisIter(void) const
Is sediment movement on this polygon downcoast this iteration?
int nGetCoastID(void) const
Get the coast ID, this is the same as the down-coast sequence.
vector< int > VnGetCircularities(void) const
Get all circularities for this polygon.
Geometry class used to represent coast profile objects.
Definition profile.h:35
int nGetCoastID(void) const
Returns the profile's coast ID.
Definition profile.cpp:66
double m_dThisIterPotentialBeachErosion
Total potential beach erosion (all size classes of unconsolidated sediment) for this iteration (depth...
Definition simulation.h:796
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:871
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:530
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:709
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:458
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.
double m_dNotchDepthAtCollapse
Notch overhang (i.e. length of horizontal incision) to initiate collapse (m)
Definition simulation.h:862
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:416
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 ...
Definition simulation.h:961
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:371
double m_dMinSWL
Minimum still water level.
Definition simulation.h:676
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:766
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:667
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:488
ofstream CliffCollapseNetChangeTSStream
Cliff collapse net change (erosion - deposition) time series file output stream.
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:299
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:431
string strListRasterFiles(void) const
Return a space-separated string containing the names of the raster GIS output files.
Definition utils.cpp:635
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
Definition simulation.h:913
string strListVectorFiles(void) const
Return a space-separated string containing the names of the vector GIS output files.
Definition utils.cpp:888
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:721
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Does this work correctly?
Definition simulation.h:311
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:805
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
Definition simulation.h:943
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dCoastNormalLength
Length of the cost-normal profiles, in m.
Definition simulation.h:778
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:2153
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:314
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,...
Definition simulation.h:976
string m_strOGRSedInputDataType
GDAL data type for the sediment input event locations vector file.
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
bool m_bSingleDeepWaterWaveValues
Do we have just a point source for (i.e. only a single measurement of) deep water wave values.
Definition simulation.h:362
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:1320
static string strDispSimTime(double const)
strDispSimTime returns a string formatted as year Julian_day hour, given a parameter in hours
Definition utils.cpp:1473
double m_dSouthEastXExtCRS
The south-east x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:604
long double m_ldGTotActualCoarseBeachErosion
All-simulation total of coarse sediment eroded during beach (unconsolidated sediment) movement (m)
void WriteLookUpData(void) const
Output the erosion potential look-up values, for checking purposes.
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Total fine sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:829
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:688
double m_dThisIterActualPlatformErosionCoarseCons
Total actual platform erosion (coarse consolidated sediment) for this iteration (depth in m)
Definition simulation.h:793
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:434
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:281
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:748
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:874
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:485
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:745
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:515
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:305
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:293
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
Definition simulation.h:934
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:568
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:562
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:850
double m_dWaveDepthRatioForWaveCalcs
Start depth for wave calculations.
Definition simulation.h:703
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:410
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:886
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:841
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:739
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:509
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:518
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:574
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:284
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),...
Definition simulation.h:993
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:880
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:338
bool m_bSliceSave
Save slices?
Definition simulation.h:89
void WritePolygonShorePlatformErosion(int const)
Writes to the log file a table showing per-polygon unconsolidated sand/coarse sediment derived from e...
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:601
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:248
int m_nLayers
The number of sediment layers.
Definition simulation.h:437
double m_dStartIterConsCoarseAllCells
Depth (m) of coarse consolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:952
double m_dStartIterConsSandAllCells
Depth (m) of sand consolidated sediment at the start of the simulation, all cells (both inside and ou...
Definition simulation.h:949
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:377
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:368
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:583
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:838
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:928
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:464
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:784
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:907
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitsky-Golay smoothing is used (usually ...
Definition simulation.h:446
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:865
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:359
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:844
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:742
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:922
time_t m_tSysStartTime
System start-simulation time.
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:655
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:724
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:790
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:332
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:374
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:859
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:811
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:71
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:730
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:760
ofstream BeachSedimentNetChangeTSStream
Beach sediment net change (erosion - deposition) time series file output stream.
string m_strOGRDWWVDriverDesc
int m_nWavePropagationModel
The wave propagation model used. Possible values are WAVE_MODEL_CSHORE and WAVE_MODEL_COVE.
Definition simulation.h:506
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:712
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:634
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)
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:901
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:781
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:847
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:326
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
Definition simulation.h:990
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
Definition simulation.h:984
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:898
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:992
bool m_bFloodSetupSurgeTSSave
Save the flood setup surge time series file? TODO 007 Does this work correctly?
Definition simulation.h:308
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:598
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:733
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:817
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:607
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_dCoastNormalAvgSpacing
Average spacing of the cost-normal profiles, in m.
Definition simulation.h:775
double m_dStartIterConsFineAllCells
Depth (m) of fine consolidated sediment at the start of the simulation, all cells (both inside and ou...
Definition simulation.h:946
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:422
int m_nSimStartMonth
Start date of the simulation (month)
Definition simulation.h:521
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:877
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:802
vector< string > m_VstrGDALIUSDriverDesc
GDAL driver description for the initial unconsolidated sand sediment GIS data.
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:814
double m_dThisIterBeachErosionFine
Total actual beach erosion (fine unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:799
double m_dThisIterCliffCollapseSandErodedDuringDeposition
Total sand sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:832
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:512
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
string m_strOGRDWWVGeometry
GDAL geometry for the deep water wave stations vector file.
unsigned long m_ulThisIterNumActualBeachErosionCells
The number of grid cells on which actual beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:580
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:868
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:296
vector< string > m_VstrGDALICFDriverDesc
GDAL driver description for the initial consolidated fine sediment GIS data.
static string strGetBuild(void)
Returns the date and time on which the program was compiled.
Definition utils.cpp:1584
string m_strTideDataFile
Name of tide data file.
vector< string > m_VstrGDALIUFDriverDesc
GDAL driver description for the initial unconsolidated fine sediment GIS data.
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
The number of grid cells on which potential platform erosion occurs, for this iteration.
Definition simulation.h:571
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:940
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:679
long double m_ldGTotActualSandLostBeachErosion
All-simulation total of sand sediment lost via beach (unconsolidated) sediment movement (m)
Definition simulation.h:999
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:461
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)
Definition simulation.h:996
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:413
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:889
long double m_ldGTotCoarseSedLostCliffCollapse
All-simulation total of coarse sediment lost via cliff collapse (m)
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
Definition simulation.h:987
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:524
void WritePolygonShareTable(int const)
Writes to the log file a table showing polygon to polygon shares of unconsolidated sediment transport...
string m_strDeepWaterWavesInputFile
The name of the deep water wave stations time series file.
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,...
Definition simulation.h:973
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...
Definition simulation.h:970
int m_nCoastCurvatureMovingWindowSize
Definition simulation.h:538
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:565
double m_dTotalSandUnconsInPolygons
Total sand unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:958
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:386
double m_dStartIterUnconsFineAllCells
Depth (m) of fine unconsolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:937
CGeomCoastPolygon * pGetPolygon(int const) const
Returns a pointer to a coast polygon, in down-coast sequence.
Definition utils.cpp:2755
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:640
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:586
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:290
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:616
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:589
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:904
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:718
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.
double m_dFinalSWL
The end-of-simulation still water (m), is same as m_dOrigSWL unless SWL changes.
Definition simulation.h:661
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:344
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:577
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:440
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:892
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:302
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:808
string m_strOGRFloodDriverDesc
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:278
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:356
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:1636
int nGetCoastPolygonSize(void) const
Returns the size of the coast polygon vector.
Definition utils.cpp:2747
double m_dThisIterLeftGridUnconsCoarse
Total coarse unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:826
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:883
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:727
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:329
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...
Definition simulation.h:967
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:553
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:736
double dGridCentroidXToExtCRSX(int const) const
Given the integer X-axis ordinate of a cell in the raster grid CRS, returns the external CRS X-axis o...
Definition gis_utils.cpp:62
vector< string > m_VstrInitialCoarseConsSedimentFile
The name of the initial coarse-sized consolidated sediment GIS file.
string m_strOGRDWWVDataType
GDAL data type for the deep water wave stations vector file.
double m_dSimDuration
Duration of simulation, in hours.
Definition simulation.h:628
double m_dTotalFineUnconsInPolygons
Total fine unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:955
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)
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...
Definition simulation.h:964
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
Definition simulation.h:925
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:610
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:317
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:691
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:613
vector< string > m_VstrGDALIUCDriverDesc
GDAL driver description for the initial unconsolidated coarse sediment GIS data.
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:856
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:715
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:835
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:643
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:787
long double m_ldGTotPotentialBeachErosion
All-simulation total of potential beach erosion (m), all size classes.
double m_dProfileMaxSlope
Maximum slope on costline-normal profiles.
Definition simulation.h:853
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:449
string m_strGDALIHDriverDesc
GDAL description for the initial intervention height raster file.
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:341
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:895
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:823
unsigned long m_ulRandSeed[NRNG]
A seed for each of the NRNG random number generators.
Definition simulation.h:559
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:772
vector< string > m_VstrGDALICCDriverDesc
GDAL driver decription for the initial consolidated coarse sediment GIS data.
double m_dOrigSWL
The start-of-simulation still water level (m)
Definition simulation.h:658
double m_dStartIterSuspFineAllCells
Depth (m) of fine suspended sediment at the start of the simulation, all cells (both inside and outsi...
Definition simulation.h:931
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:670
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:287
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
Definition simulation.h:981
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:419
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:320
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:763
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:323
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:407
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:335
vector< CGeomCoastPolygon * > m_pVCoastPolygon
Pointers to coast polygon objects, in down-coast sequence TODO 044 Will need to use global polygon ID...
int m_nCoastSmoothWindow
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:443
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:820
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:362
char const SLASH
Definition cme.h:340
int const SMOOTH_NONE
Definition cme.h:655
int const WAVE_MODEL_COVE
Definition cme.h:665
double const TOLERANCE
Definition cme.h:698
string const PERFORMHEAD
Definition cme.h:800
int const NO_LOG_FILE
Definition cme.h:375
string const PER_ITER_HEAD
Definition cme.h:794
int const UNCONS_SEDIMENT_EQUATION_KAMPHUIS
Definition cme.h:670
string const ERR
Definition cme.h:775
int const LOG_FILE_LOW_DETAIL
Definition cme.h:376
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:597
string const PER_ITER_HEAD4
Definition cme.h:789
double const DEPTH_OVER_DB_INCREMENT
Definition cme.h:690
int const WAVE_MODEL_CSHORE
Definition cme.h:666
int const RTN_ERR_PROFILEWRITE
Definition cme.h:612
string const PER_ITER_HEAD2
Definition cme.h:784
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:377
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1176
string const ENDHYDROLOGYHEAD
Definition cme.h:796
int const GRID_EDGE_CLOSED
Definition cme.h:660
int const GRID_EDGE_RECIRCULATE
Definition cme.h:662
double const MASS_BALANCE_TOLERANCE
Definition cme.h:700
string const ENDSEDIMENTHEAD
Definition cme.h:798
int const LOG_FILE_HIGH_DETAIL
Definition cme.h:378
string const PROGRAM_NAME
Definition cme.h:709
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:657
string const PER_ITER_HEAD3
Definition cme.h:787
int const SMOOTH_RUNNING_MEAN
Definition cme.h:656
int const LOG_FILE_ALL
Definition cme.h:379
int const RTN_OK
Definition cme.h:577
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:598
string const PER_ITER_HEAD5
Definition cme.h:791
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:358
int const GRID_EDGE_OPEN
Definition cme.h:661
string const EROSION_POTENTIAL_LOOKUP_FILE
Definition cme.h:770
int const UNCONS_SEDIMENT_EQUATION_CERC
Definition cme.h:669
string const PER_ITER_HEAD1
Definition cme.h:781
char const COLON
Definition cme.h:334
string const MASS_BALANCE_ERROR
Definition cme.h:779
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:599
char const SPACE
Definition cme.h:341
Contains CRWCoast definitions.
double dGetInterpolatedValue(vector< double > const *pVdXdata, vector< double > const *pVdYdata, double dX, bool bExtrapolate)
Definitions of routines which return interpolated value at x from parallel arrays.
Contains CSimulation definitions.
int const NRNG
Definition simulation.h:56
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....