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 < NUMBER_OF_RNGS; 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 << " Usual spacing of coastline normals \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalSpacing << " m" << endl;
542 OutStream << "*Usual spacing of coastline normals on interventions \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalInterventionSpacing << " m" << endl;
543 OutStream << " Random factor for spacing of normals \t: " << resetiosflags(ios::floatfield) << fixed << m_dCoastNormalRandSpacingFactor << endl;
544 OutStream << " Length of coastline normals \t: " << m_dCoastNormalLength << " m" << endl;
545 OutStream << endl;
546 /*
547 OutStream << fixed << setprecision(8);
548 OutStream << " Erosion potential shape function:" << endl;
549 OutStream << "\tDepth over DB\tErosion potential\tFirst derivative of erosion potential" << endl;
550 for (int i = 0; i < m_VdDepthOverDB.size(); i++)
551 OutStream << "\t" << m_VdDepthOverDB[i] << "\t\t" << m_VdErosionPotential[i] << "\t\t" << m_VdErosionPotentialFirstDeriv[i] << endl;
552 OutStream << endl;
553 */
554 // ------------------------------------------------------ Testing only --------------------------------------------------------
555 OutStream << "Testing only" << endl;
556
557 OutStream << " Output profile data? \t: " << (m_bOutputProfileData ? "Y" : "N") << endl;
558 OutStream << " Profile numbers to be saved \t: ";
559 for (unsigned int i = 0; i < m_VnProfileToSave.size(); i++)
561 OutStream << endl;
562 OutStream << " Timesteps when profiles are saved \t: ";
563 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
565 OutStream << endl;
566 OutStream << " Output parallel profile data? \t: " << (m_bOutputParallelProfileData ? "Y" : "N") << endl;
567 OutStream << " Output erosion potential look-up data? \t: " << (m_bOutputErosionPotentialData ? "Y" : "N");
570 OutStream << endl;
571 OutStream << " Size of moving window for calculating coastline curvature \t: " << m_nCoastCurvatureMovingWindowSize << endl;
572
573 OutStream << endl
574 << endl;
575
576 // -------------------------------------------------- Per-iteration output ----------------------------------------------------
577 OutStream << fixed << setprecision(3);
578
579 // Write per-timestep headers to .out file
580 OutStream << PER_ITER_HEAD << endl;
581 OutStream << "Sea depth in metres. All erosion and deposition values in millimetres" << endl;
582 OutStream << "GISn = GIS files saved as <filename>n." << endl;
583 OutStream << endl;
584
585 OutStream << PER_ITER_HEAD1 << endl;
586 OutStream << PER_ITER_HEAD2 << endl;
587 OutStream << PER_ITER_HEAD3 << endl;
588 OutStream << PER_ITER_HEAD4 << endl;
589 OutStream << PER_ITER_HEAD5 << endl;
590}
591
592//===============================================================================================================================
594//===============================================================================================================================
596{
597 OutStream << resetiosflags(ios::floatfield);
598 OutStream << fixed << setprecision(0);
599
600 // Output timestep and simulated time info ===================================================================================
601 OutStream << setw(4) << m_ulIter;
602 OutStream << setw(7) << m_dSimElapsed; // In hours
603 OutStream << resetiosflags(ios::floatfield);
604 OutStream << fixed << setprecision(0);
605 OutStream << setw(7) << m_dSimElapsed / (24 * 365.25); // In years
606
607 // Output average sea depth (m) per sea cell =================================================================================
608 OutStream << resetiosflags(ios::floatfield);
609 OutStream << fixed << setprecision(2);
610 double dAvgSeaDepth = m_dThisIterTotSeaDepth / static_cast<double>(m_ulThisIterNumSeaCells);
611 OutStream << setw(6) << dAvgSeaDepth;
612 OutStream << " ";
613
614 // Output the this-timestep % of sea cells with potential shore platform erosion =============================================
615 OutStream << fixed << setprecision(0);
617
618 // Output per-timestep potential shore platform erosion in m (average for all sea cells)
619 OutStream << fixed << setprecision(1);
620 OutStream << setw(6) << 1000 * m_dThisIterPotentialPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells);
621
622 // Output per-timestep potential shore platform erosion in m (average for all cells with potential shore platform erosion)
623 OutStream << fixed << setprecision(1);
626 else
627 OutStream << setw(6) << SPACE;
628
629 // Output the this-timestep % of sea cells with actual shore platform erosion ================================================
630 OutStream << fixed << setprecision(0);
632
633 // Output per-timestep actual shore platform erosion in m (average for all sea cells)
634 OutStream << fixed << setprecision(1);
636 OutStream << setw(6) << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumSeaCells);
637
638 // Output per-timestep actual shore platform erosion in m (average for all cells with actual shore platform erosion)
639 OutStream << fixed << setprecision(1);
641 OutStream << setw(5) << 1000 * dThisIterActualPlatformErosion / static_cast<double>(m_ulThisIterNumActualPlatformErosionCells);
642 else
643 OutStream << setw(5) << SPACE;
644
645 // Output per-timestep actual shore platform erosion in m (average for all sea cells)
646 OutStream << fixed << setprecision(1);
647
649 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionFineCons / static_cast<double>(m_ulThisIterNumSeaCells);
650 else
651 OutStream << setw(4) << SPACE;
652
654 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionSandCons / static_cast<double>(m_ulThisIterNumSeaCells);
655 else
656 OutStream << setw(4) << SPACE;
657
659 OutStream << setw(4) << 1000 * m_dThisIterActualPlatformErosionCoarseCons / static_cast<double>(m_ulThisIterNumSeaCells);
660 else
661 OutStream << setw(4) << SPACE;
662
663 // Output the this-timestep % of sea cells with potential beach erosion ======================================================
665
666 // Output per-timestep potential beach erosion in m (average for all sea cells)
667 OutStream << fixed << setprecision(0);
668 // assert(m_ulThisIterNumSeaCells > 0);
669 double dTmp = 1000 * m_dThisIterPotentialBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
670 if (dTmp > 99999)
671 {
672 OutStream << setw(6) << scientific << setprecision(0) << dTmp;
673 OutStream << fixed;
674 }
675 else
676 OutStream << setw(6) << dTmp;
677
678 // Output per-timestep potential beach erosion in m (average for all cells with potential beach erosion)
679 OutStream << fixed << setprecision(1);
681 {
683 if (dTmp > 99999)
684 {
685 OutStream << setw(6) << scientific << setprecision(0) << dTmp;
686 OutStream << fixed;
687 }
688 else
689 OutStream << setw(6) << dTmp;
690 }
691 else
692 OutStream << setw(6) << SPACE;
693
694 // This-timestep % of sea cells with actual beach erosion ====================================================================
695 OutStream << fixed << setprecision(0);
697
698 // Output per-timestep actual beach erosion in m (average for all sea cells)
700 OutStream << setw(6) << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumSeaCells);
701
702 // Per-iteration actual beach erosion in m (average for all cells with actual beach erosion)
703 OutStream << fixed << setprecision(1);
705 OutStream << setw(7) << 1000 * dThisIterActualBeachErosion / static_cast<double>(m_ulThisIterNumActualBeachErosionCells);
706 else
707 OutStream << setw(7) << SPACE;
708
709 // Per-iteration actual beach erosion in m (average for all sea cells)
710 OutStream << fixed << setprecision(1);
711
713 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionFine / static_cast<double>(m_ulThisIterNumSeaCells);
714 else
715 OutStream << setw(4) << SPACE;
716
718 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionSand / static_cast<double>(m_ulThisIterNumSeaCells);
719 else
720 OutStream << setw(4) << SPACE;
721
723 OutStream << setw(4) << 1000 * m_dThisIterBeachErosionCoarse / static_cast<double>(m_ulThisIterNumSeaCells);
724 else
725 OutStream << setw(4) << SPACE;
726
727 // Output the this-timestep % of sea cells with beach deposition =============================================================
728 OutStream << fixed << setprecision(0);
730
731 // Per-iteration beach deposition in m (average for all sea cells)
732 double dThisIterBeachDeposition = m_dThisIterBeachDepositionSand + m_dThisIterBeachDepositionCoarse;
733 OutStream << setw(6) << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
734
735 // Per-iteration beach deposition in m (average for all cells with beach deposition)
736 OutStream << fixed << setprecision(1);
738 OutStream << setw(9) << 1000 * dThisIterBeachDeposition / static_cast<double>(m_ulThisIterNumBeachDepositionCells);
739 else
740 OutStream << setw(9) << SPACE;
741
742 // Per-iteration beach deposition in m (average for all sea cells)
743 OutStream << fixed << setprecision(1);
744
746 OutStream << setw(4) << 1000 * m_dThisIterBeachDepositionSand / static_cast<double>(m_ulThisIterNumSeaCells);
747 else
748 OutStream << setw(4) << SPACE;
749
751 OutStream << setw(4) << 1000 * m_dThisIterBeachDepositionCoarse / static_cast<double>(m_ulThisIterNumSeaCells);
752 else
753 OutStream << setw(4) << SPACE;
754
755 // Output the this-timestep sediment input in m ==============================================================================
756 OutStream << scientific << setprecision(0);
757
760 else
761 OutStream << setw(4) << SPACE;
762
765 else
766 OutStream << setw(4) << SPACE;
767
770 else
771 OutStream << setw(4) << SPACE;
772
773 // Per-iteration cliff collapse erosion (both cons and uncons) in m (average for all coast cells) ============================
774 OutStream << fixed << setprecision(1);
775
778 else
779 OutStream << setw(4) << SPACE;
780
783 else
784 OutStream << setw(4) << SPACE;
785
788 else
789 OutStream << setw(4) << SPACE;
790
791 // Per-iteration cliff collapse deposition in m (average for all sea cells) ==================================================
793 OutStream << setw(4) << 1000 * m_dThisIterUnconsSandCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
794 else
795 OutStream << setw(4) << SPACE;
796
798 OutStream << setw(4) << 1000 * m_dThisIterUnconsCoarseCliffDeposition / static_cast<double>(m_ulThisIterNumSeaCells);
799 else
800 OutStream << setw(4) << SPACE;
801
802 // Output per-timestep fine sediment going to suspension, in m (average for all sea cells) ==================================
804 OutStream << setw(6) << 1000 * m_dThisIterFineSedimentToSuspension / static_cast<double>(m_ulThisIterNumSeaCells);
805 else
806 OutStream << setw(6) << SPACE;
807
808 OutStream << " ";
809
810 // Finally, set 'markers' for events that have occurred this timestep
812 OutStream << " GIS" << m_nGISSave;
813
814 OutStream << endl;
815
816 // Did a text file write error occur?
817 if (OutStream.fail())
818 return false;
819
820 return true;
821}
822
823//===============================================================================================================================
825//===============================================================================================================================
827{
828 // Sea area
830 {
831 // Output in external CRS units
832 SeaAreaTSStream << m_dSimElapsed << "\t,\t" << m_dExtCRSGridArea * static_cast<double>(m_ulThisIterNumSeaCells) / static_cast<double>(m_ulNumCells) << endl;
833
834 // Did a time series file write error occur?
835 if (SeaAreaTSStream.fail())
836 return false;
837 }
838
839 // Still water level
841 {
842 // Output as is (m)
843 StillWaterLevelTSStream << m_dSimElapsed << "\t,\t" << m_dThisIterSWL << "\t,\t" << m_dThisIterMeanSWL << endl;
844
845 // Did a time series file write error occur?
846 if (StillWaterLevelTSStream.fail())
847 return false;
848 }
849
850 // Actual platform erosion (fine, sand, and coarse)
852 {
853 // Output as is (m depth equivalent)
855
856 // Did a time series file write error occur?
857 if (PlatformErosionTSStream.fail())
858 return false;
859 }
860
861 // Cliff collapse erosion (fine, sand, and coarse)
863 {
864 // Output as is (m depth equivalent)
866
867 // Did a time series file write error occur?
869 return false;
870 }
871
872 // Cliff collapse deposition (sand and coarse)
874 {
875 // Output as is (m depth equivalent)
877
878 // Did a time series file write error occur?
880 return false;
881 }
882
883 // Cliff collapse net
885 {
886 // Output as is (m depth equivalent)
888
889 // Did a time series file write error occur?
891 return false;
892 }
893
894 // Beach erosion (fine, sand, and coarse)
896 {
897 // Output as is (m depth equivalent)
899
900 // Did a time series file write error occur?
901 if (BeachErosionTSStream.fail())
902 return false;
903 }
904
905 // Beach deposition (sand and coarse)
907 {
908 // Output as is (m depth equivalent)
910
911 // Did a time series file write error occur?
912 if (BeachDepositionTSStream.fail())
913 return false;
914 }
915
916 // Net change in beach sediment
918 {
919 // Output as is (m depth equivalent)
921
922 // Did a time series file write error occur?
924 return false;
925 }
926
928 {
929 // Output as is (m depth equivalent)
931
932 // Did a time series file write error occur?
933 if (FineSedSuspensionTSStream.fail())
934 return false;
935 }
936
938 {
939 // Output as is (m depth equivalent)
941
942 // Did a time series file write error occur?
943 if (FloodSetupSurgeTSStream.fail())
944 return false;
945 }
946
948 {
949 // Output as is (m depth equivalent)
951
952 // Did a time series file write error occur?
954 return false;
955 }
956
957 return true;
958}
959
960//===============================================================================================================================
962//===============================================================================================================================
964{
965 // Open the output file
966 string strLookUpFile = m_strOutPath;
967 strLookUpFile.append(EROSION_POTENTIAL_LOOKUP_FILE);
968 ofstream LookUpOutStream;
969 LookUpOutStream.open(strLookUpFile.c_str(), ios::out | ios::trunc);
970
971 if (LookUpOutStream)
972 {
973 // File opened OK, so output the values
974 LookUpOutStream << "DepthOverDB, \tErosionPotential" << endl;
975 double dDepthOverDB = 0.0;
976 while (dDepthOverDB <= m_dDepthOverDBMax)
977 {
978 double dErosionPotential = dGetInterpolatedValue(&m_VdDepthOverDB, &m_VdErosionPotential, dDepthOverDB, false);
979 LookUpOutStream << dDepthOverDB << ",\t" << dErosionPotential << endl;
980 dDepthOverDB += DEPTH_OVER_DB_INCREMENT;
981 }
982 LookUpOutStream << endl;
983
984 // And close the file
985 LookUpOutStream.close();
986 }
987}
988
989//===============================================================================================================================
991//===============================================================================================================================
992int 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
993{
994 // TODO 052 Make this more efficient, also give warnings if no profiles will be output
995 int nProfile = pProfile->nGetCoastID();
996
997 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
998 {
999 for (unsigned int j = 0; j < m_VnProfileToSave.size(); j++)
1000 {
1001 if ((m_ulIter == m_VulProfileTimestep[i]) && (nProfile == m_VnProfileToSave[j]))
1002 {
1003 if (! bWriteProfileData(nCoast, pProfile, nProfSize, pdVDistXY, pdVZ, pdVDepthOverDB, pdVErosionPotentialFunc, pdVSlope, pdVRecessionXY, pdVChangeElevZ, pPtVGridProfile, pdVScapeXY))
1004 return RTN_ERR_PROFILEWRITE;
1005 }
1006 }
1007 }
1008
1009 return RTN_OK;
1010}
1011
1012//===============================================================================================================================
1014//===============================================================================================================================
1015bool 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
1016{
1017 int nProfile = pProfile->nGetCoastID();
1018
1019 string strFName = m_strOutPath;
1020 stringstream ststrTmp;
1021
1022 strFName.append("profile_");
1023 ststrTmp << FillToWidth('0', 3) << nProfile;
1024 strFName.append(ststrTmp.str());
1025
1026 strFName.append("_timestep_");
1027 ststrTmp.clear();
1028 ststrTmp.str(string());
1029 ststrTmp << FillToWidth('0', 4) << m_ulIter;
1030 strFName.append(ststrTmp.str());
1031
1032 strFName.append(".csv");
1033
1034 ofstream OutProfStream;
1035 OutProfStream.open(strFName.c_str(), ios::out | ios::trunc);
1036 if (!OutProfStream)
1037 {
1038 // Error, cannot open file
1039 cerr << ERR << "cannot open " << strFName << " for output" << endl;
1040 return false;
1041 }
1042
1043 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;
1044 for (int i = 0; i < nProfSize; i++)
1045 {
1046 double dX = dGridCentroidXToExtCRSX(pPtVGridProfile->at(i).nGetX());
1047 double dY = dGridCentroidYToExtCRSY(pPtVGridProfile->at(i).nGetY());
1048
1049 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;
1050 }
1051
1052 OutProfStream.close();
1053
1054 return true;
1055}
1056
1057//===============================================================================================================================
1059//===============================================================================================================================
1060int 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
1061{
1062 // TODO 052 Make this more efficient, also give warnings if no profiles will be output
1063 int nProfile = pProfile->nGetCoastID();
1064 for (unsigned int i = 0; i < m_VulProfileTimestep.size(); i++)
1065 {
1066 for (unsigned int j = 0; j < m_VnProfileToSave.size(); j++)
1067 {
1068 if ((m_ulIter == m_VulProfileTimestep[i]) && (nProfile == m_VnProfileToSave[j]))
1069 {
1070 if (! bWriteParProfileData(nCoast, nProfile, nParProfSize, nDirection, nDistFromProfile, pdVDistXY, pdVZ, pdVDepthOverDB, pdVErosionPotentialFunc, pdVSlope, pdVRecessionXY, pdVChangeElevZ, pPtVGridProfile, pdVScapeXY))
1071 return RTN_ERR_PROFILEWRITE;
1072 }
1073 }
1074 }
1075
1076 return RTN_OK;
1077}
1078
1079//===============================================================================================================================
1081//===============================================================================================================================
1082bool 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
1083{
1084 string strFName = m_strOutPath;
1085 stringstream ststrTmp;
1086
1087 strFName.append("profile_");
1088 ststrTmp << FillToWidth('0', 3) << nProfile;
1089 strFName.append(ststrTmp.str());
1090
1091 strFName.append("_parallel_");
1092 ststrTmp.clear();
1093 ststrTmp.str(string());
1094 ststrTmp << FillToWidth('0', 3) << nDistFromProfile;
1095 strFName.append(ststrTmp.str());
1096
1097 strFName.append((nDirection == 0 ? "_F" : "_B"));
1098
1099 strFName.append("_timestep_");
1100 ststrTmp.clear();
1101 ststrTmp.str(string());
1102 ststrTmp << FillToWidth('0', 4) << m_ulIter;
1103 strFName.append(ststrTmp.str());
1104
1105 strFName.append(".csv");
1106
1107 ofstream OutProfStream;
1108 OutProfStream.open(strFName.c_str(), ios::out | ios::trunc);
1109 if (!OutProfStream)
1110 {
1111 // Error, cannot open file
1112 cerr << ERR << "cannot open " << strFName << " for output" << endl;
1113 return false;
1114 }
1115
1116 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;
1117 for (int i = 0; i < nProfSize; i++)
1118 {
1119 double dX = dGridCentroidXToExtCRSX(pPtVGridProfile->at(i).nGetX());
1120 double dY = dGridCentroidYToExtCRSY(pPtVGridProfile->at(i).nGetY());
1121
1122 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;
1123 }
1124
1125 OutProfStream.close();
1126
1127 return true;
1128}
1129
1130//===============================================================================================================================
1132//===============================================================================================================================
1134{
1135 // Final write to time series CSV files
1136 if (! bWriteTSFiles())
1138
1139 // Save the values from the RasterGrid array into raster GIS files
1140 if (! bSaveAllRasterGISFiles())
1142
1143 // Save the vector GIS files
1144 if (! bSaveAllVectorGISFiles())
1146
1147 OutStream << " GIS" << m_nGISSave << endl;
1148
1149 // Print out run totals etc.
1150 OutStream << PER_ITER_HEAD1 << endl;
1151 OutStream << PER_ITER_HEAD2 << endl;
1152 OutStream << PER_ITER_HEAD3 << endl;
1153 OutStream << PER_ITER_HEAD4 << endl;
1154 OutStream << PER_ITER_HEAD5 << endl;
1155
1156 OutStream << fixed << setprecision(3);
1157 OutStream << endl
1158 << endl;
1159
1160 // Write out hydrology grand totals etc.
1161 OutStream << ENDHYDROLOGYHEAD << endl;
1162 OutStream << "Minimum still water level = " << m_dMinSWL << endl;
1163 OutStream << "Maximum still water level = " << m_dMaxSWL << endl;
1164 OutStream << endl;
1165
1166 // Now write out sediment movement grand totals etc.
1167 OutStream << ENDSEDIMENTHEAD << endl
1168 << endl;
1169
1170 OutStream << "TOTAL PLATFORM EROSION" << endl;
1171 OutStream << "Potential platform erosion, all size classes = " << m_ldGTotPotentialPlatformErosion * m_dCellArea << " m^3" << endl
1172 << endl;
1173 OutStream << "Actual platform erosion, fine = " << m_ldGTotFineActualPlatformErosion * m_dCellArea << " m^3" << endl;
1174 OutStream << "Actual platform erosion, sand = " << m_ldGTotSandActualPlatformErosion * m_dCellArea << " m^3" << endl;
1175 OutStream << "Actual platform erosion, coarse = " << m_ldGTotCoarseActualPlatformErosion * m_dCellArea << " m^3" << endl;
1176 OutStream << "Actual platform erosion, all size classes = " << (m_ldGTotFineActualPlatformErosion + m_ldGTotSandActualPlatformErosion + m_ldGTotCoarseActualPlatformErosion) * m_dCellArea << " m^3" << endl;
1177 OutStream << endl;
1178
1179 OutStream << "TOTAL CLIFF COLLAPSE EROSION" << endl;
1180 OutStream << "Cliff collapse, fine = " << m_ldGTotCliffCollapseFine * m_dCellArea << " m^3" << endl;
1181 OutStream << "Cliff collapse, sand = " << m_ldGTotCliffCollapseSand * m_dCellArea << " m^3" << endl;
1182 OutStream << "Cliff collapse, coarse = " << m_ldGTotCliffCollapseCoarse * m_dCellArea << " m^3" << endl;
1184 OutStream << endl;
1185
1186 OutStream << "TOTAL DEPOSITION AND SUSPENSION OF CLIFF COLLAPSE TALUS" << endl;
1187 OutStream << "Cliff collapse to suspension, fine = " << m_ldGTotCliffTalusFineToSuspension * m_dCellArea << " m^3" << endl;
1188 OutStream << "Cliff collapse deposition, sand = " << m_ldGTotCliffTalusSandDeposition * m_dCellArea << " m^3" << endl;
1189 OutStream << "Cliff collapse deposition, coarse = " << m_ldGTotCliffTalusCoarseDeposition * m_dCellArea << " m^3" << endl;
1190 OutStream << "Cliff collapse deposition, sand and coarse = " << (m_ldGTotCliffTalusSandDeposition + m_ldGTotCliffTalusCoarseDeposition) * m_dCellArea << " m^3" << endl;
1191 OutStream << endl;
1192
1193 OutStream << "TOTAL BEACH EROSION" << endl;
1194 OutStream << "Potential beach erosion, all size classes = " << m_ldGTotPotentialBeachErosion * m_dCellArea << " m^3" << endl
1195 << endl;
1196 OutStream << "Actual fine beach erosion, fine = " << m_ldGTotActualFineBeachErosion * m_dCellArea << " m^3" << endl;
1197 OutStream << "Actual sand beach erosion, sand = " << m_ldGTotActualSandBeachErosion * m_dCellArea << " m^3" << endl;
1198 OutStream << "Actual coarse beach erosion, coarse = " << m_ldGTotActualCoarseBeachErosion * m_dCellArea << " m^3" << endl;
1199 OutStream << "Actual beach erosion, all size classes = " << (m_ldGTotActualFineBeachErosion + m_ldGTotActualSandBeachErosion + m_ldGTotActualCoarseBeachErosion) * m_dCellArea << " m^3" << endl;
1200 OutStream << endl;
1201
1202 OutStream << "TOTAL BEACH DEPOSITION" << endl;
1203 OutStream << "Beach deposition, sand = " << m_ldGTotSandBeachDeposition * m_dCellArea << " m^3" << endl;
1204 OutStream << "Beach deposition, coarse = " << m_ldGTotCoarseBeachDeposition * m_dCellArea << " m^3" << endl;
1205 OutStream << "Beach deposition, sand and coarse = " << (m_ldGTotSandBeachDeposition + m_ldGTotCoarseBeachDeposition) * m_dCellArea << " m^3" << endl;
1206 OutStream << endl;
1207
1208 OutStream << "TOTAL SEDIMENT INPUT EVENTS" << endl;
1209 OutStream << "Sediment from sediment input events, fine = " << m_ldGTotFineSedimentInput * m_dCellArea << " m^3" << endl;
1210 OutStream << "Sediment from sediment input events, sand = " << m_ldGTotSandSedimentInput * m_dCellArea << " m^3" << endl;
1211 OutStream << "Sediment from sediment input events, coarse = " << m_ldGTotCoarseSedimentInput * m_dCellArea << " m^3" << endl;
1212 OutStream << "Sediment from sediment input events, all size classes = " << (m_ldGTotFineSedimentInput + m_ldGTotSandSedimentInput + m_ldGTotCoarseSedimentInput) * m_dCellArea << " m^3" << endl;
1213 OutStream << endl;
1214
1215 OutStream << "TOTAL SUSPENDED SEDIMENT" << endl;
1216 OutStream << "Suspended fine sediment = " << m_ldGTotSuspendedSediment * m_dCellArea << " m^3" << endl;
1217 OutStream << endl;
1218
1219 OutStream << "TOTAL LOST FROM GRID BY BEACH MOVEMENT" << endl;
1220 OutStream << "Potential sediment lost, all size classes = " << m_ldGTotPotentialSedLostBeachErosion * m_dCellArea << " m^3" << endl;
1221 OutStream << "Actual sediment lost, fine = " << m_ldGTotActualFineLostBeachErosion * m_dCellArea << " m^3" << endl;
1222 OutStream << "Actual sediment lost, sand = " << m_ldGTotActualSandLostBeachErosion * m_dCellArea << " m^3" << endl;
1223 OutStream << "Actual sediment lost, coarse = " << m_ldGTotActualCoarseLostBeachErosion * m_dCellArea << " m^3" << endl;
1224 OutStream << "Actual sediment lost, all size classes = " << (m_ldGTotActualFineLostBeachErosion + m_ldGTotActualSandLostBeachErosion + m_ldGTotActualCoarseLostBeachErosion) * m_dCellArea << " m^3" << endl;
1225 OutStream << endl;
1226
1227 OutStream << "TOTAL LOST FROM GRID BY CLIFF COLLAPSE" << endl;
1228 OutStream << "Sediment lost, sand = " << m_ldGTotSandSedLostCliffCollapse * m_dCellArea << " m^3" << endl;
1229 OutStream << "Sediment lost, coarse = " << m_ldGTotCoarseSedLostCliffCollapse * m_dCellArea << " m^3" << endl;
1230 OutStream << endl;
1231
1232 OutStream << "ALL-PROCESS TOTALS (all size classes)" << endl;
1234 OutStream << "Fine sediment eroded = " << ldFineEroded * m_dCellArea << " m^3" << endl;
1235 OutStream << "Fine sediment to suspension = " << m_ldGTotSuspendedSediment * m_dCellArea << " m^3" << endl;
1236 if (! bFPIsEqual(ldFineEroded, m_ldGTotSuspendedSediment, 1.0L))
1237 OutStream << MASS_BALANCE_ERROR << endl;
1238
1240 OutStream << "Sand sediment eroded = " << ldSandEroded * m_dCellArea << " m^3" << endl;
1241 long double ldSandDeposited = m_ldGTotCliffTalusSandDeposition + m_ldGTotSandBeachDeposition;
1242 OutStream << "Sand sediment deposited = " << ldSandDeposited * m_dCellArea << " m^3" << endl;
1244 OutStream << "Sand sediment lost from grid = " << ldSandLost * m_dCellArea << " m^3" << endl;
1245 if (! bFPIsEqual(ldSandEroded, (ldSandDeposited + ldSandLost), 1.0L))
1246 OutStream << MASS_BALANCE_ERROR << endl;
1247
1249 OutStream << "Coarse sediment eroded = " << ldCoarseEroded * m_dCellArea << " m^3" << endl;
1250 long double ldCoarseDeposited = m_ldGTotCliffTalusCoarseDeposition + m_ldGTotCoarseBeachDeposition;
1251 OutStream << "Coarse sediment deposited = " << ldCoarseDeposited * m_dCellArea << " m^3" << endl;
1253 OutStream << "Coarse sediment lost from grid = " << ldCoarseLost * m_dCellArea << " m^3" << endl;
1254 if (! bFPIsEqual(ldCoarseEroded, (ldCoarseDeposited + ldCoarseLost), 1.0L))
1255 OutStream << MASS_BALANCE_ERROR << endl;
1256
1257 OutStream << endl;
1258
1260 OutStream << "Total sediment eroded (all processes) = " << ldActualTotalEroded * m_dCellArea << " m^3" << endl;
1261
1263 OutStream << "Total sediment deposited/to suspension (all processes) = " << ldTotalDepositedAndSuspension * m_dCellArea << " m^3" << endl;
1264
1266 OutStream << "Total sediment lost from grid (all processes) = " << ldTotalLost * m_dCellArea << " m^3" << endl;
1267 OutStream << " = " << 24 * 365.25 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/year" << endl;
1268 OutStream << " = " << 24 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/day" << endl;
1269 OutStream << " = " << ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/hour" << endl;
1270 OutStream << fixed << setprecision(6);
1271 OutStream << " = " << ldTotalLost * m_dCellArea / (m_dSimDuration * 3600) << " m^3/sec" << endl
1272 << endl;
1273 OutStream << fixed << setprecision(3);
1274
1276 {
1277 OutStream << "Grid edge option is ";
1279 OutStream << "CLOSED.";
1281 OutStream << "OPEN.";
1283 OutStream << "RE-CIRCULATING.";
1284 OutStream << endl << endl;
1285 }
1286
1287 // Finally calculate performance details
1288 OutStream << PERFORMHEAD << endl;
1289
1290 // Get the time that the run ended
1291 m_tSysEndTime = time(nullptr);
1292
1293 OutStream << "Run ended at " << put_time(localtime(&m_tSysEndTime), "%T on %A %d %B %Y") << endl;
1294 OutStream << "Time simulated: " << strDispSimTime(m_dSimDuration) << endl
1295 << endl;
1296
1297 // Write to log file
1298 LogStream << "END OF RUN TOTALS =================================================================================================================================================" << endl
1299 << endl;
1300
1301 LogStream << "ALL-PROCESS TOTALS (all size classes)" << endl;
1303 LogStream << "Sediment eroded (all processes) = " << ldActualTotalEroded * m_dCellArea << " m^3" << endl;
1304
1305 LogStream << "Sediment deposited and in suspension (all processes) = " << ldTotalDepositedAndSuspension * m_dCellArea << " m^3" << endl;
1306
1307 LogStream << "Sediment lost from grid (all processes) = " << ldTotalLost * m_dCellArea << " m^3" << endl;
1308 LogStream << " = " << 24 * 365.25 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/year" << endl;
1309 LogStream << " = " << 24 * ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/day" << endl;
1310 LogStream << " = " << ldTotalLost * m_dCellArea / m_dSimDuration << " m^3/hour" << endl;
1311 LogStream << " = " << setprecision(6) << ldTotalLost * m_dCellArea / (m_dSimDuration * 3600) << " m^3/sec" << endl;
1312 LogStream << endl;
1313 LogStream << fixed << setprecision(3);
1314
1316 {
1317 LogStream << "Grid edge option is ";
1319 LogStream << "CLOSED.";
1321 LogStream << "OPEN.";
1323 LogStream << "RE-CIRCULATING.";
1324 LogStream << endl << endl;
1325
1326 // Output averages for on-profile and between-profile potential shore platform erosion, ideally these are roughly equal
1327 LogStream << fixed << setprecision(6);
1328 LogStream << "On-profile average potential shore platform erosion = " << (m_ulTotPotentialPlatformErosionOnProfiles > 0 ? m_dTotPotentialPlatformErosionOnProfiles / static_cast<double>(m_ulTotPotentialPlatformErosionOnProfiles) : 0) << " mm (n = " << m_ulTotPotentialPlatformErosionOnProfiles << ")" << endl;
1329 LogStream << "Between-profile average potential shore platform erosion = " << (m_ulTotPotentialPlatformErosionBetweenProfiles > 0 ? m_dTotPotentialPlatformErosionBetweenProfiles / static_cast<double>(m_ulTotPotentialPlatformErosionBetweenProfiles) : 0) << " mm (n = " << m_ulTotPotentialPlatformErosionBetweenProfiles << ")" << endl;
1330 LogStream << endl;
1331 }
1332
1333 // Calculate statistics re. memory usage etc.
1335 OutStream << endl
1336 << "END OF RUN" << endl;
1337 LogStream << endl
1338 << "END OF RUN" << endl;
1339
1340 // Need to flush these here (if we don't, the buffer may not get written)
1341 LogStream.flush();
1342 OutStream.flush();
1343
1344 return RTN_OK;
1345}
1346
1347//===============================================================================================================================
1349//===============================================================================================================================
1351{
1352 LogStream << endl << m_ulIter << ": Per-polygon profile info, seawater volume (m^3), and D50 values (mm: a blank D50 value means that there is no unconsolidated sediment on that polygon)." << endl;
1353
1354 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|--------------|" << endl;
1355 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("Up-coast", 11) << "|" << strCentre("Down-coast", 11) << "|" << strCentre("Seawater", 14) << "|" << strCentre("Uncons d50", 14) << "|" << endl;
1356 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Profile", 11) << "|" << strCentre("Profile", 11) << "|" << strCentre("Volume", 14) << "|" << strCentre("", 14) << "|" << endl;
1357 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|--------------|" << endl;
1358
1359 for (int n = 0; n < nGetCoastPolygonSize(); n++)
1360 {
1361 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1362
1363 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strIntRight(pPolygon->nGetUpCoastProfile(), 11) << "|" << strIntRight(pPolygon->nGetDownCoastProfile(), 11) << "|" << strDblRight(pPolygon->dGetSeawaterVolume(), 0, 14) << "|" << strDblRight(pPolygon->dGetAvgUnconsD50(), 0, 14) << "| " << endl;
1364 }
1365
1366 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|--------------|" << endl << endl;
1367}
1368
1369//===============================================================================================================================
1371//===============================================================================================================================
1373{
1374 double dTmpTot = 0;
1375 double dTmpFineTot = 0;
1376 double dTmpSandTot = 0;
1377 double dTmpCoarseTot = 0;
1378
1385
1386 // TODO 082 Also show m_dStartIterUnconsFineAllCells etc.
1387
1388 LogStream << m_ulIter << ": Per-polygon pre-existing unconsolidated sediment. Note that this does not include pre-existing unconsolidated sediment outside the polygons.";
1389 if (m_ulIter > 1)
1390 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.";
1391 LogStream << endl;
1392
1393 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1394 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1395 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1396 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1397
1398 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1399 {
1400 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1401
1402 // Add to this-iteration all-polygon totals of consolidated sediment within polygons
1406
1407 // Now consider unconsolidated sediment
1408 double dThisFine = pPolygon->dGetPreExistingUnconsFine() + pPolygon->dGetSedimentInputUnconsFine();
1409 double dThisSand = pPolygon->dGetPreExistingUnconsSand() + pPolygon->dGetSedimentInputUnconsSand();
1410 double dThisCoarse = pPolygon->dGetPreExistingUnconsCoarse() + pPolygon->dGetSedimentInputUnconsCoarse();
1411
1412 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;
1413
1414 dTmpFineTot += (dThisFine * m_dCellArea);
1415 dTmpSandTot += (dThisSand * m_dCellArea);
1416 dTmpCoarseTot += (dThisCoarse * m_dCellArea);
1417 dTmpTot += (dThisFine + dThisSand + dThisCoarse) * m_dCellArea;
1418
1419 // Add to this-iteration all-polygon totals of unconsolidated sediment within polygons
1420 m_dTotalFineUnconsInPolygons += dThisFine;
1421 m_dTotalSandUnconsInPolygons += dThisSand;
1422 m_dTotalCoarseUnconsInPolygons += dThisCoarse;
1423 }
1424
1425 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1426 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1427 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1428}
1429
1430//===============================================================================================================================
1432//===============================================================================================================================
1434{
1435 LogStream << m_ulIter << ": Per-polygon sediment input event totals." << endl;
1436
1437 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1438 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1439 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1440 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1441
1442 double dTmpFineTot = 0;
1443 double dTmpSandTot = 0;
1444 double dTmpCoarseTot = 0;
1445 double dTmpTot = 0;
1446
1447 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1448 {
1449 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1450
1451 double dThisFine = pPolygon->dGetSedimentInputUnconsFine();
1452 double dThisSand = pPolygon->dGetSedimentInputUnconsSand();
1453 double dThisCoarse = pPolygon->dGetSedimentInputUnconsCoarse();
1454
1455 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;
1456
1457 dTmpFineTot += (dThisFine * m_dCellArea);
1458 dTmpSandTot += (dThisSand * m_dCellArea);
1459 dTmpCoarseTot += (dThisCoarse * m_dCellArea);
1460 dTmpTot += (dThisFine + dThisSand + dThisCoarse) * m_dCellArea;
1461 }
1462
1463 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1464 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1465 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1466}
1467
1468//===============================================================================================================================
1470//===============================================================================================================================
1472{
1473 double dTmpTot = 0;
1474 double dTmpFineTot = 0;
1475 double dTmpSandTot = 0;
1476 double dTmpCoarseTot = 0;
1477
1478 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;
1479
1480 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1481 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1482 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1483 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1484
1485 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1486 {
1487 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1488
1489 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;
1490
1491 dTmpTot += (pPolygon->dGetPlatformErosionUnconsSand() + pPolygon->dGetPlatformErosionUnconsCoarse()) * m_dCellArea;
1492 dTmpSandTot += (pPolygon->dGetPlatformErosionUnconsSand() * m_dCellArea);
1493 dTmpCoarseTot += (pPolygon->dGetPlatformErosionUnconsCoarse() * m_dCellArea);
1494 }
1495
1496 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1497 LogStream << "TOTAL from shore platform |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1498 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1499}
1500
1501//===============================================================================================================================
1503//===============================================================================================================================
1505{
1506 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;
1507
1508 LogStream << "-----------|-----------|-----------|--------------------------------------------|-----------------------------|--------------------------------------------|--------------------------------------------|" << endl;
1509 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;
1510 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;
1511 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1512
1513 double dTmpErosionTot = 0;
1514 double dTmpErosionDDPDTot = 0;
1515 double dTmpDepositTot = 0;
1516
1517 double dTmpErosionFineTot = 0;
1518 double dTmpSuspensionFineTot = 0;
1519
1520 double dTmpErosionSandTot = 0;
1521 double dTmpErosionSandDDPDTot = 0;
1522 double dTmpDepositSandTot = 0;
1523
1524 double dTmpErosionCoarseTot = 0;
1525 double dTmpErosionCoarseDDPDTot = 0;
1526 double dTmpDepositCoarseTot = 0;
1527
1528 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1529 {
1530 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1531
1532 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11)
1533 // All
1535 // Fine
1536 << strDblRight(pPolygon->dGetCliffCollapseErosionFine(), 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseToSuspensionFine(), 0, 14) << "|"
1537 // Sand
1538 << strDblRight(pPolygon->dGetCliffCollapseErosionSand(), 0, 14) << " " << strDblRight(pPolygon->dGetCliffCollapseSandErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(pPolygon->dGetCliffCollapseUnconsSandDeposition() * m_dCellArea, 0, 14) << "|"
1539 // Coarse
1540 << strDblRight(pPolygon->dGetCliffCollapseErosionCoarse(), 0, 14) << " " << strDblRight(pPolygon->dGetCliffCollapseCoarseErodedDeanProfile() * m_dCellArea, 0, 14)<< "|" << strDblRight(pPolygon->dGetCliffCollapseUnconsCoarseDeposition() * m_dCellArea, 0, 14) << "|" << endl;
1541
1542 dTmpErosionTot += ((pPolygon->dGetCliffCollapseErosionFine() + pPolygon->dGetCliffCollapseErosionSand() + pPolygon->dGetCliffCollapseErosionCoarse()) * m_dCellArea);
1543
1544 dTmpErosionDDPDTot += ((pPolygon->dGetCliffCollapseSandErodedDeanProfile() + pPolygon->dGetCliffCollapseCoarseErodedDeanProfile()) * m_dCellArea);
1545
1547
1548 dTmpErosionFineTot += (pPolygon->dGetCliffCollapseErosionFine() * m_dCellArea);
1549 dTmpSuspensionFineTot += (pPolygon->dGetCliffCollapseToSuspensionFine() * m_dCellArea);
1550
1551 dTmpErosionSandTot += ((pPolygon->dGetCliffCollapseErosionSand()) * m_dCellArea);
1552 dTmpErosionSandDDPDTot += ((pPolygon->dGetCliffCollapseSandErodedDeanProfile()) * m_dCellArea);
1553 dTmpDepositSandTot += (pPolygon->dGetCliffCollapseUnconsSandDeposition() * m_dCellArea);
1554
1555 dTmpErosionCoarseTot += ((pPolygon->dGetCliffCollapseErosionCoarse()) * m_dCellArea);
1556 dTmpErosionCoarseDDPDTot += ((pPolygon->dGetCliffCollapseCoarseErodedDeanProfile()) * m_dCellArea);
1557 dTmpDepositCoarseTot += pPolygon->dGetCliffCollapseUnconsCoarseDeposition() * m_dCellArea;
1558 }
1559
1560 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1561 LogStream << "TOTAL from cliff collapse |" << strDblRight(dTmpErosionTot, 0, 14) << " " << strDblRight(dTmpErosionDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositTot, 0, 14) << "|"
1562 << strDblRight(dTmpErosionFineTot, 0, 14) << "|" << strDblRight(dTmpSuspensionFineTot, 0, 14) << "|"
1563 << strDblRight(dTmpErosionSandTot, 0, 14) << " " << strDblRight(dTmpErosionSandDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositSandTot, 0, 14) << "|"
1564 << strDblRight(dTmpErosionCoarseTot, 0, 14) << " " << strDblRight(dTmpErosionCoarseDDPDTot, 0, 14) << "|" << strDblRight(dTmpDepositCoarseTot, 0, 14) << "|" << endl;
1565 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl << endl;
1566}
1567
1568//===============================================================================================================================
1570//===============================================================================================================================
1572{
1573 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;
1574
1575 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1576 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) << "|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1577 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << strCentre("Sediment", 14) << "|" << endl;
1578 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1579
1580 double dTmpTot = 0;
1581 double dTmpFineTot = 0;
1582 double dTmpSandTot = 0;
1583 double dTmpCoarseTot = 0;
1584
1585 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1586 {
1587 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1588
1589 double dFine = pPolygon->dGetPreExistingUnconsFine();
1590 double dSand = pPolygon->dGetPreExistingUnconsSand();
1591 double dCoarse = pPolygon->dGetPreExistingUnconsCoarse();
1592
1593 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;
1594
1595 dTmpTot += (dFine + dSand + dCoarse) * m_dCellArea;
1596 dTmpFineTot += (dFine * m_dCellArea);
1597 dTmpSandTot += (dSand * m_dCellArea);
1598 dTmpCoarseTot += (dCoarse * m_dCellArea);
1599 }
1600
1601 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1602 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1603 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1604}
1605
1606//===============================================================================================================================
1608//===============================================================================================================================
1610{
1611 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 ";
1613 LogStream << "CERC";
1615 LogStream << "Kamphuis";
1616 LogStream << " equation." << endl;
1617
1618 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1619 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("Potential", 14) << "|" << endl;
1620 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Erosion", 14) << "|" << endl;
1621 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1622
1623 double dTmpTot = 0;
1624 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1625 {
1626 CGeomCoastPolygon const* pPolygon = pGetPolygon(n);
1627
1628 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pPolygon->nGetCoastID(), 11) << "|" << strDblRight(pPolygon->dGetPotentialErosion() * m_dCellArea, 0, 14) << "|" << endl;
1629
1630 dTmpTot += (pPolygon->dGetPotentialErosion() * m_dCellArea);
1631 }
1632 LogStream << "-----------|-----------|-----------|--------------|" << endl;
1633 LogStream << "TOTAL |" << strDblRight(dTmpTot, 0, 14) << "|" << endl;
1634 LogStream << "-----------|-----------|-----------|--------------|" << endl << endl;
1635}
1636
1637// //===============================================================================================================================
1638// //! Writes to the log file a table showing per-polygon supply-limited erosion of unconsolidated beach sediment
1639// //===============================================================================================================================
1640// void CSimulation::WritePolygonUnconsErosion(int const nCoast)
1641// {
1642// LogStream << m_ulIter << ": per-polygon supply-limited erosion of unconsolidated beach sediment (-ve, all m^3). All fine sediment eroded goes to suspension." << endl;
1643//
1644// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1645// LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 14) << "|" << strCentre("Fine", 14) <<"|" << strCentre("Sand", 14) << "|" << strCentre("Coarse", 14) << "|" << endl;
1646// LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("Estimated", 14) << "|" << strCentre("Estimated", 14) <<"|" << strCentre("Estimated", 14) << "|" << strCentre("Estimated", 14) << "|" << endl;
1647// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1648//
1649// double
1650// dTmpTot = 0,
1651// dTmpFineTot = 0,
1652// dTmpSandTot = 0,
1653// dTmpCoarseTot = 0;
1654//
1655// for (int nPoly = 0; nPoly < m_VCoast[nCoast].nGetNumPolygons(); nPoly++)
1656// {
1657// CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(nPoly);
1658//
1659// 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;
1660//
1661// dTmpTot += (pPolygon->dGetBeachErosionUnconsFine() + pPolygon->dGetBeachErosionUnconsSand() + pPolygon->dGetBeachErosionUnconsCoarse()) * m_dCellArea;
1662// dTmpFineTot += (pPolygon->dGetBeachErosionUnconsFine() * m_dCellArea);
1663// dTmpSandTot += (pPolygon->dGetBeachErosionUnconsSand() * m_dCellArea);
1664// dTmpCoarseTot += (pPolygon->dGetBeachErosionUnconsCoarse() * m_dCellArea);
1665// }
1666//
1667// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl;
1668// LogStream << "TOTAL estimated erosion |" << strDblRight(dTmpTot, 0, 14) << "|" << strDblRight(dTmpFineTot, 0, 14) << "|" << strDblRight(dTmpSandTot, 0, 14) << "|" << strDblRight(dTmpCoarseTot, 0, 14) << "|" << endl;
1669// LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|" << endl << endl;
1670// }
1671
1672//===============================================================================================================================
1674//===============================================================================================================================
1675void CSimulation::WritePolygonUnsortedSequence(int const nCoast, vector<vector<int> >& pnVVPolyAndAdjacent)
1676{
1677 LogStream << m_ulIter << ": Unsorted sequence of polygon processing (-9999 = leaves grid)" << endl;
1678 LogStream << "-----------|-----------|-----------|-----------|-----------|" << endl;
1679 LogStream << strCentre("From", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("From", 11) << "|" << strCentre("Direction", 11) << "|" << strCentre("To", 11) << "|" << endl;
1680 LogStream << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << endl;
1681 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << endl;
1682 LogStream << "-----------|-----------|-----------|-----------|-----------|" << endl;
1683
1684 for (int n = 0; n < static_cast<int>(pnVVPolyAndAdjacent.size()); n++)
1685 {
1686 CGeomCoastPolygon const* pPolygon = m_VCoast[nCoast].pGetPolygon(pnVVPolyAndAdjacent[n][1]);
1687
1688 for (int m = 0; m < static_cast<int>(pnVVPolyAndAdjacent[n].size()); m++)
1689 {
1690 if (m == 0)
1691 {
1692 LogStream << strIntRight(pPolygon->nGetGlobalID(), 11) << "|";
1693 LogStream << strIntRight(nCoast, 11) << "|";
1694 continue;
1695 }
1696
1697 if (m == 1)
1698 {
1699 LogStream << strIntRight(pPolygon->nGetCoastID(), 11) << "|";
1700 continue;
1701 }
1702
1703 if (m == 2)
1704 {
1705 if (pnVVPolyAndAdjacent[n][m] == true)
1706 LogStream << strCentre("DOWN ", 11) << "|";
1707 else
1708 LogStream << strCentre("UP ", 11) << "|";
1709
1710 continue;
1711 }
1712
1713 int nAdjDownCoast = pnVVPolyAndAdjacent[n][m];
1714 int nCoastID = INT_NODATA;
1715 if (nAdjDownCoast != INT_NODATA)
1716 {
1717 CGeomCoastPolygon const* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjDownCoast);
1718 nCoastID = pAdjPolygon->nGetCoastID();
1719 }
1720 LogStream << strIntRight(nCoastID, 11) << "|";
1721 }
1722 LogStream << endl;
1723 }
1724 LogStream << "-----------|-----------|-----------|-----------|-----------|" << endl << endl;
1725}
1726
1727//===============================================================================================================================
1729//===============================================================================================================================
1730void CSimulation::WritePolygonSortedSequence(int const nCoast, vector<vector<int> >& pnVVPolyAndAdjacent)
1731{
1732 // Show sorted order of polygon processing, and any circularities
1733 LogStream << m_ulIter << ": Sorted sequence of polygon processing (" << INT_NODATA << " = leaves grid), and any X -> Y -> X circularities" << endl;
1734
1735 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|" << endl;
1736 LogStream << strCentre("From", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("From", 11) << "|" << strCentre("Direction", 11) << "|" << strCentre("To", 11) << "|" << strCentre("Circular", 14) << "|" << endl;
1737 LogStream << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("-ity?", 14) << "|" << endl;
1738 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|" << strCentre("", 14) << "|" << endl;
1739 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|" << endl;
1740
1741 for (int nPoly = 0; nPoly < static_cast<int>(pnVVPolyAndAdjacent.size()); nPoly++)
1742 {
1743 const CGeomCoastPolygon* pPoly = m_VCoast[nCoast].pGetPolygon(pnVVPolyAndAdjacent[nPoly][1]);
1744 vector<int> VCirc = pPoly->VnGetCircularities();
1745
1746 LogStream << strIntRight(m_pVCoastPolygon[pnVVPolyAndAdjacent[nPoly][1]]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(pnVVPolyAndAdjacent[nPoly][1], 11) << "|";
1747
1748 // Up-coast or down-coast sediment movement?
1749 string strTmp = "";
1750 for (int m = 2; m < static_cast<int>(pnVVPolyAndAdjacent[nPoly].size()); m++)
1751 {
1752 if (m == 2)
1753 {
1754 if (pnVVPolyAndAdjacent[nPoly][m] == true)
1755 LogStream << strCentre("DOWN ", 11) << "|";
1756 else
1757 LogStream << strCentre("UP ", 11) << "|";
1758
1759 continue;
1760 }
1761
1762 // These are the "To" polygons
1763 int nAdjPolyDownCoastSeq = pnVVPolyAndAdjacent[nPoly][m];
1764 int nAdjacentPolyID = INT_NODATA;
1765 if (nAdjPolyDownCoastSeq != INT_NODATA)
1766 {
1767 CGeomCoastPolygon const* pAdjPolygon = m_VCoast[nCoast].pGetPolygon(nAdjPolyDownCoastSeq);
1768 nAdjacentPolyID = pAdjPolygon->nGetCoastID();
1769 }
1770 strTmp += to_string(nAdjacentPolyID);
1771
1772 if (m < (static_cast<int>(pnVVPolyAndAdjacent[nPoly].size()) - 1))
1773 strTmp += ", ";
1774 }
1775 LogStream << strRight(strTmp, 11) << "|";
1776
1777 strTmp = "";
1778
1779 // Now check for circularities
1780 if (! VCirc.empty())
1781 {
1782 // There is at least one circularity
1783 for (unsigned int i = 0; i < VCirc.size(); i++)
1784 {
1785 strTmp += to_string(VCirc[i]);
1786
1787 if (i < (VCirc.size()-1))
1788 strTmp += ", ";
1789 }
1790 }
1791 LogStream << strCentre(strTmp, 14) << "|" << endl;
1792 }
1793 LogStream << "-----------|-----------|-----------|-----------|-----------|--------------|" << endl << endl;
1794}
1795
1796//===============================================================================================================================
1798//===============================================================================================================================
1799void CSimulation::WritePolygonActualMovement(int const nCoast, vector<vector<int> > const& pnVVPolyAndAdjacent)
1800{
1801 // Show estimated polygon-to-polygon movement
1802 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;
1803
1804 LogStream << "-----------|-----------|-----------|--------------------------------------------|-----------------------------|--------------------------------------------|--------------------------------------------|" << endl;
1805 LogStream << strCentre("Polygon", 11) << "|" << strCentre("Coast", 11) << "|" << strCentre("Polygon", 11) << "|" << strCentre("All", 44) << "|" << strCentre("Fine", 29) << "|" << strCentre("Sand", 44) << "|" << strCentre("Coarse", 44) << "|" << endl;
1806 LogStream << strCentre("Global ID", 11) << "|" << strCentre("", 11) << "|" << strCentre("Coast ID", 11) << "|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1807 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;
1808 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1809
1810 double dTmpTotAllErosion = 0;
1811 double dTmpTotAllErosionDDPD = 0;
1812 double dTmpTotAllDeposition = 0;
1813
1814 double dTmpFineErosion = 0;
1815 // double dTmpFineDeposition = 0;
1816
1817 double dTmpSandErosion = 0;
1818 double dTmpSandErosionDDPD = 0;
1819 double dTmpSandDeposition = 0;
1820
1821 double dTmpCoarseErosion = 0;
1822 double dTmpCoarseErosionDDPD = 0;
1823 double dTmpCoarseDeposition = 0;
1824
1825 for (unsigned int n = 0; n < m_pVCoastPolygon.size(); n++)
1826 {
1827 int nPoly = pnVVPolyAndAdjacent[n][1];
1828
1829 double dAllErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGeBeachErosionAllUncons() - (m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile());
1830 double dSandErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsSand() - m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile();
1831 double dCoarseErosionNotDDPD = -m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsCoarse() - m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile();
1832
1833 LogStream << strIntRight(m_pVCoastPolygon[nPoly]->nGetGlobalID(), 11) << "|" << strIntRight(nCoast, 11) << "|" << strIntRight(m_pVCoastPolygon[nPoly]->nGetCoastID(), 11) << "|"
1834 // All
1835 << 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) << "|"
1836 // Fine
1837 << strDblRight(-m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|" << strDblRight(-m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea, 0, 14) << "|"
1838 // Sand
1839 << strDblRight(dSandErosionNotDDPD * m_dCellArea, 0, 14) << " " << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() * m_dCellArea, 0, 14) << "|" << strDblRight(m_pVCoastPolygon[nPoly]->dGetBeachDepositionUnconsSand() * m_dCellArea, 0, 14) << "|"
1840 // Coarse
1841 << 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;
1842
1843 dTmpTotAllErosion += (dAllErosionNotDDPD * m_dCellArea);
1844 dTmpTotAllErosionDDPD += ((m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() + m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile()) * m_dCellArea);
1845 dTmpTotAllDeposition += (m_pVCoastPolygon[nPoly]->dGetBeachDepositionAndSuspensionAllUncons() * m_dCellArea);
1846
1847 dTmpFineErosion += (m_pVCoastPolygon[nPoly]->dGetBeachErosionUnconsFine() * m_dCellArea);
1848 // dTmpFineDeposition +=
1849
1850 dTmpSandErosion += (dSandErosionNotDDPD * m_dCellArea);
1851 dTmpSandErosionDDPD += (m_pVCoastPolygon[nPoly]->dGetBeachSandErodedDeanProfile() * m_dCellArea);
1852 dTmpSandDeposition += (m_pVCoastPolygon[nPoly]->dGetBeachDepositionUnconsSand() * m_dCellArea);
1853
1854 dTmpCoarseErosion += (dCoarseErosionNotDDPD * m_dCellArea);
1855 dTmpCoarseErosionDDPD += (m_pVCoastPolygon[nPoly]->dGetBeachCoarseErodedDeanProfile() * m_dCellArea);
1856 dTmpCoarseDeposition += (m_pVCoastPolygon[nPoly]->dGetToDoBeachDepositionUnconsCoarse() * m_dCellArea);
1857 }
1858
1859 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1860 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;
1861
1863 dTmpSandDeposition += (m_dThisIterLeftGridUnconsSand * m_dCellArea);
1864 dTmpCoarseDeposition += (m_dThisIterLeftGridUnconsCoarse * m_dCellArea);
1865
1866 bool bShowZeroFine = false;
1867 bool bShowZeroSand = false;
1868 bool bShowZeroCoarse = false;
1869
1870 if (! bFPIsEqual(dTmpFineErosion, 0.0, MASS_BALANCE_TOLERANCE))
1871 bShowZeroFine = true;
1872
1873 if (! bFPIsEqual(dTmpSandErosion, 0.0, MASS_BALANCE_TOLERANCE))
1874 bShowZeroSand = true;
1875
1876 if (! bFPIsEqual(dTmpCoarseErosion, 0.0, MASS_BALANCE_TOLERANCE))
1877 bShowZeroCoarse = true;
1878
1879 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1880 LogStream << "TOTAL |"
1881 // All
1882 << strDblRight(-dTmpTotAllErosion, 0, 14) << "|" << strDblRight(dTmpTotAllErosionDDPD, 0, 14) << "|" << strDblRight(dTmpTotAllDeposition, 0, 14) << "|"
1883 // Fine
1884 << strDblRight(-dTmpFineErosion, 0, 14, bShowZeroFine) << "|" << strDblRight(dTmpFineErosion, 0, 14, bShowZeroFine) << "|"
1885 // Sand
1886 << strDblRight(-dTmpSandErosion, 0, 14, bShowZeroSand) << "|" << strDblRight(dTmpSandErosionDDPD, 0, 14, bShowZeroSand) << "|" << strDblRight(dTmpSandDeposition, 0, 14, bShowZeroSand) << "|"
1887 // Coarse
1888 << strDblRight(-dTmpCoarseErosion, 0, 14, bShowZeroCoarse) << "|" << strDblRight(dTmpCoarseErosionDDPD, 0, 14, bShowZeroCoarse) << "|" << strDblRight(dTmpCoarseDeposition, 0, 14, bShowZeroCoarse) << "|" << endl;
1889 LogStream << "-----------|-----------|-----------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------|" << endl;
1890}
1891
1892//===============================================================================================================================
1894//===============================================================================================================================
1896{
1898 {
1899 // TODO 062 show these results somewhere
1900 // 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)
1901 int nSuspFineCellsAllCells = 0;
1902 int nUnconsFineCellsAllCells = 0;
1903 int nUnconsSandCellsAllCells = 0;
1904 int nUnconsCoarseCellsAllCells = 0;
1905
1906 // TODO 062 show these results somewhere
1907 // Also get the numbers of cells with consolidated and unconsolidated sediment stored or in suspension, only for cells inside polygons
1908 int nSuspFineCellsInPolygons = 0;
1909 int nUnconsFineCellsInPolygons = 0;
1910 int nUnconsSandCellsInPolygons = 0;
1911 int nUnconsCoarseCellsInPolygons = 0;
1912
1913 // Get the depths of consolidated and unconsolidated sediment stored or in suspension, for all cells (both inside and outside polygons)
1914 double dEndIterSuspFineAllCells = 0;
1915 double dEndIterUnconsFineAllCells = 0;
1916 double dEndIterUnconsSandAllCells = 0;
1917 double dEndIterUnconsCoarseAllCells = 0;
1918 double dEndIterConsFineAllCells = 0;
1919 double dEndIterConsSandAllCells = 0;
1920 double dEndIterConsCoarseAllCells = 0;
1921
1922 // Also get the depths of consolidated and unconsolidated sediment stored or in suspension, only for cells inside polygons
1923 double dEndIterSuspFineInPolygons = 0;
1924 double dEndIterUnconsFineInPolygons = 0;
1925 double dEndIterUnconsSandInPolygons = 0;
1926 double dEndIterUnconsCoarseInPolygons = 0;
1927 double dEndIterConsFineInPolygons = 0;
1928 double dEndIterConsSandInPolygons = 0;
1929 double dEndIterConsCoarseInPolygons = 0;
1930
1931 // Get depth of consolidated and unconsolidated (and suspended) sediment from each cell (both within and outside polygons)
1932 for (int nX = 0; nX < m_nXGridSize; nX++)
1933 {
1934 for (int nY = 0; nY < m_nYGridSize; nY++)
1935 {
1936 dEndIterConsFineAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsFineThickConsiderNotch();
1937 dEndIterConsSandAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsSandThickConsiderNotch();
1938 dEndIterConsCoarseAllCells += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsCoarseThickConsiderNotch();
1939
1940 double dSuspFine = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1941 if (dSuspFine > 0)
1942 {
1943 dEndIterSuspFineAllCells += dSuspFine;
1944 nSuspFineCellsAllCells++;
1945 }
1946
1947 double dUnconsFine = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsFine();
1948 if (dUnconsFine > 0)
1949 {
1950 dEndIterUnconsFineAllCells += dUnconsFine;
1951 nUnconsFineCellsAllCells++;
1952 }
1953
1954 double dUnconsSand = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsSand();
1955 if (dUnconsSand > 0)
1956 {
1957 dEndIterUnconsSandAllCells += dUnconsSand;
1958 nUnconsSandCellsAllCells++;
1959 }
1960
1961 double dUnconsCoarse = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsCoarse();
1962 if (dUnconsCoarse > 0)
1963 {
1964 dEndIterUnconsCoarseAllCells += dUnconsCoarse;
1965 nUnconsCoarseCellsAllCells++;
1966 }
1967
1968 // Is this cell within a polygon?
1969 if (m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID() != INT_NODATA)
1970 {
1971 // It is within a polygon
1972 dEndIterConsFineInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsFineThickConsiderNotch();
1973 dEndIterConsSandInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsSandThickConsiderNotch();
1974 dEndIterConsCoarseInPolygons += m_pRasterGrid->m_Cell[nX][nY].dGetTotConsCoarseThickConsiderNotch();
1975
1976 dSuspFine = m_pRasterGrid->m_Cell[nX][nY].dGetSuspendedSediment();
1977 if (dSuspFine > 0)
1978 {
1979 dEndIterSuspFineInPolygons += dSuspFine;
1980 nSuspFineCellsInPolygons++;
1981 }
1982
1983 dUnconsFine = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsFine();
1984 if (dUnconsFine > 0)
1985 {
1986 dEndIterUnconsFineInPolygons += dUnconsFine;
1987 nUnconsFineCellsInPolygons++;
1988 }
1989
1990 dUnconsSand = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsSand();
1991 if (dUnconsSand > 0)
1992 {
1993 dEndIterUnconsSandInPolygons += dUnconsSand;
1994 nUnconsSandCellsInPolygons++;
1995 }
1996
1997 dUnconsCoarse = m_pRasterGrid->m_Cell[nX][nY].dGetTotUnconsCoarse();
1998 if (dUnconsCoarse > 0)
1999 {
2000 dEndIterUnconsCoarseInPolygons += dUnconsCoarse;
2001 nUnconsCoarseCellsInPolygons++;
2002 }
2003 }
2004 }
2005 }
2006
2007 double dFineTmp = 0;
2008 double dSandTmp = 0;
2009 double dCoarseTmp = 0;
2010
2011 LogStream << endl << m_ulIter << ": Consolidated sediment budget, all m^3. This includes sediment within and outside the polygons." << endl;
2012
2013 // Stored consolidated sediment at start of timestep: sediment within and outside the polygons
2014 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2015 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2016 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2017
2018 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2021
2022 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;
2023
2024 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2027
2028 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;
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("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dTmp5 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp6 * m_dCellArea, 0, 14) << "|" << strDblRight( m_dStartIterConsCoarseAllCells * m_dCellArea, 0, 14) << "|" << endl;
2035
2036 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;
2037
2038 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2039
2043
2044 // Shore platform erosion, consolidated sediment lost (becomes unconsolidated esediment and suspended sediment)
2045 LogStream << strLeft("Consolidated sediment lost via platform erosion (becomes suspended sediment)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2046 LogStream << strLeft("Consolidated sediment lost via platform erosion (becomes unconsolidated sediment)", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2047 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterActualPlatformErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2049 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2050
2054
2055 // Cliff collapse, consolidated sediment lost (becomes unconsolidated esediment and suspended sediment)
2056 LogStream << strLeft("Consolidated sediment lost via cliff collapse (becomes suspended sediment)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2057 LogStream << strLeft("Consolidated sediment lost via cliff collapse (becomes unconsolidated sediment)", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2058 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterCliffCollapseErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2060
2064
2065 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2066 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2067 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2068
2069 // Don't show inside/outside polygon values if not simulating beach erosion
2070 dTmp1 = (m_bDoBeachSedimentTransport ? dEndIterConsFineInPolygons : 0);
2071 dTmp2 = (m_bDoBeachSedimentTransport ? (dEndIterConsFineAllCells - dEndIterConsFineInPolygons) : 0);
2072
2073 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;
2074
2075 // Don't show inside/outside polygon values if not simulating beach erosion
2076 dTmp3 = (m_bDoBeachSedimentTransport ? dEndIterConsSandInPolygons : 0);
2077 dTmp4 = (m_bDoBeachSedimentTransport ? (dEndIterConsSandAllCells - dEndIterConsSandInPolygons) : 0);
2078 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;
2079
2080 // Don't show inside/outside polygon values if not simulating beach erosion
2081 dTmp5 = (m_bDoBeachSedimentTransport ? dEndIterConsCoarseInPolygons : 0);
2082 dTmp6 = (m_bDoBeachSedimentTransport ? (dEndIterConsCoarseAllCells - dEndIterConsCoarseInPolygons) : 0);
2083
2084 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;
2085
2086 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;
2087
2088 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2089
2090 double dFineError = (dEndIterConsFineAllCells * m_dCellArea) - dFineTmp;
2091 double dSandError = (dEndIterConsSandAllCells * m_dCellArea) - dSandTmp;
2092 double dCoarseError = (dEndIterConsCoarseAllCells * m_dCellArea) - dCoarseTmp;
2093
2094 // Mass balance check
2095 bool bError = false;
2096 string strFineErrMsg = "";
2097 string strSandErrMsg = "";
2098 string strCoarseErrMsg = "";
2099 string strAllErrMsg = "";
2100
2101 if (! bFPIsEqual(dFineError, 0.0, MASS_BALANCE_TOLERANCE))
2102 {
2103 strFineErrMsg = MASS_BALANCE_ERROR;
2104 bError = true;
2105 }
2106
2107 if (! bFPIsEqual(dSandError, 0.0, MASS_BALANCE_TOLERANCE))
2108 {
2109 strSandErrMsg = MASS_BALANCE_ERROR;
2110 bError = true;
2111 }
2112
2113 if (! bFPIsEqual(dCoarseError, 0.0, MASS_BALANCE_TOLERANCE))
2114 {
2115 strCoarseErrMsg = MASS_BALANCE_ERROR;
2116 bError = true;
2117 }
2118
2119 if (bError)
2120 strAllErrMsg = MASS_BALANCE_ERROR;
2121
2122 LogStream << strLeft("Consolidated sediment mass balance check (+ve means end total > start total)", 101) << "|" << strLeft("", 8) << "|" << strLeft("", 44) << "|" << endl;
2123 LogStream << strLeft(strFineErrMsg, 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dFineError, 3, 30, false) << strRightPerCent(dFineError, dEndIterConsFineAllCells, 14, 2) << "|" << endl;
2124 LogStream << strLeft(strSandErrMsg, 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dSandError, 3, 30, false) << strRightPerCent(dSandError, dEndIterConsSandAllCells, 14, 2) << "|" << endl;
2125 LogStream << strLeft(strCoarseErrMsg, 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dCoarseError, 3, 30, false) << strRightPerCent(dCoarseError, dEndIterConsCoarseAllCells, 14, 2) << "|" << endl;
2126 LogStream << strLeft(strAllErrMsg, 101) << "|" << strLeft("ALL", 8) << "|" << strDblRight(dFineError + dSandError + dCoarseError, 3, 30, false) << strRightPerCent(dFineError + dSandError + dCoarseError, dEndIterConsFineAllCells + dEndIterConsSandAllCells + dEndIterConsCoarseAllCells, 14, 2) << "|" << endl;
2127 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2128 LogStream << endl;
2129
2130 // Now look at unconsolidated sediment
2131 dFineTmp =
2132 dSandTmp =
2133 dCoarseTmp = 0;
2134
2135 LogStream << m_ulIter << ": Unconsolidated sediment budget, all m^3." << endl;
2136
2137 // Stored unconsolidated sediment, and in suspension, at start of timestep: sediment within and outside the polygons
2138 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2139 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2140 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2141
2142 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2145
2146 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;
2147
2148 // Don't show inside/outside polygon values if not simulating beach erosion (since polygons are not constructed if no beach erosion)
2151
2152 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;
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("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dTmp5 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp6 * m_dCellArea, 0, 14) << "|" << strDblRight(m_dStartIterUnconsSandAllCells * 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("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dTmp7 * m_dCellArea, 0, 14) << "|" << strDblRight(dTmp8 * m_dCellArea, 0, 14) << "|" << strDblRight( m_dStartIterUnconsCoarseAllCells * m_dCellArea, 0, 14) << "|" << endl;
2165
2166 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;
2167
2168 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2169
2173
2174 // Shore platform erosion, consolidated sediment becomes unconsolidated sediment and suspended sediment
2175 LogStream << strLeft("Suspended sediment derived from platform erosion of consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2176 LogStream << strLeft("Unconsolidated sediment derived from platform erosion of consolidated sediment", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionSandCons * m_dCellArea, 0, 44) << "|" << endl;
2177 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisIterActualPlatformErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2179 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2180
2184
2185 // Cliff collapse, consolidated sediment becomes unconsolidated sediment and suspended sediment
2186 LogStream << strLeft("Suspended sediment derived from cliff collapse erosion of consolidated sediment", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionFineCons * m_dCellArea, 0, 44) << "|" << endl;
2187 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;
2188 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisIterCliffCollapseErosionCoarseCons * m_dCellArea, 0, 44) << "|" << endl;
2190 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2191
2195
2196 // Beach (unconsolidated sediment) lost from grid due to beach erosion and deposition, and to cliff collapse with talus going outside the grid
2197 LogStream << strLeft("Unconsolidated sediment lost from grid", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsFine * m_dCellArea, 0, 44) << "|" << endl;
2198 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsSand * m_dCellArea, 0, 44) << "|" << endl;
2199 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(-m_dThisIterLeftGridUnconsCoarse * m_dCellArea, 0, 44) << "|" << endl;
2201 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2202
2206
2207 // Sediment added via input events
2208 LogStream << strLeft("Unconsolidated sediment added via input event(s)", 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(m_dThisiterUnconsFineInput * m_dCellArea, 0, 44) << "|" << endl;
2209 LogStream << strLeft("", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dThisiterUnconsSandInput * m_dCellArea, 0, 44) << "|" << endl;
2210 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dThisiterUnconsCoarseInput * m_dCellArea, 0, 44) << "|" << endl;
2211 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2212
2215 dCoarseTmp += (m_dThisiterUnconsCoarseInput * m_dCellArea);
2216
2217 // Any uncons sediment left over from last iter and deposited this iter?
2218
2219 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;
2220 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dUnconsCoarseNotDepositedLastIter * m_dCellArea, 0, 44) << "|" << endl;
2221
2224
2225 // Any insufficient deposition?
2226 LogStream << strLeft("Insufficient unconsolidated sediment deposited this iteration", 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(m_dDepositionSandDiff * m_dCellArea, 0, 44) << "|" << endl;
2227 LogStream << strLeft("", 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(m_dDepositionCoarseDiff * m_dCellArea, 0, 44) << "|" << endl;
2228
2229 dSandTmp -= (m_dDepositionSandDiff * m_dCellArea);
2230 dCoarseTmp -= (m_dDepositionCoarseDiff * m_dCellArea);
2231
2232 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2233 LogStream << strLeft("", 101) << "|" << strLeft("", 8) << "|" << strCentre("In Polygons", 14) << "|" << strCentre("Outside", 14) << "|" << strCentre("ALL", 14) << "|" << endl;
2234 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2235
2236 // Don't show inside/outside polygon values if not simulating beach erosion
2237 dTmp1 = (m_bDoBeachSedimentTransport ? dEndIterSuspFineInPolygons : 0);
2238 dTmp2 = (m_bDoBeachSedimentTransport ? (dEndIterSuspFineAllCells - dEndIterSuspFineInPolygons) : 0);
2239
2240 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;
2241
2242 // Don't show inside/outside polygon values if not simulating beach erosion
2243 dTmp3 = (m_bDoBeachSedimentTransport ? dEndIterUnconsFineInPolygons : 0);
2244 dTmp4 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsFineAllCells - dEndIterUnconsFineInPolygons) : 0);
2245
2246 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;
2247
2248 // Don't show inside/outside polygon values if not simulating beach erosion
2249 dTmp5 = (m_bDoBeachSedimentTransport ? dEndIterUnconsSandInPolygons : 0);
2250 dTmp6 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsSandAllCells - dEndIterUnconsSandInPolygons) : 0);
2251
2252 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;
2253
2254 // Don't show inside/outside polygon values if not simulating beach erosion
2255 dTmp7 = (m_bDoBeachSedimentTransport ? dEndIterUnconsCoarseInPolygons : 0);
2256 dTmp8 = (m_bDoBeachSedimentTransport ? (dEndIterUnconsCoarseAllCells - dEndIterUnconsCoarseInPolygons) : 0);
2257
2258 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;
2259
2260 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;
2261
2262 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << string(14, '-') << "|" << endl;
2263
2264 dFineError = ((dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells) * m_dCellArea) - dFineTmp,
2265 dSandError = (dEndIterUnconsSandAllCells * m_dCellArea) - dSandTmp,
2266 dCoarseError = (dEndIterUnconsCoarseAllCells * m_dCellArea) - dCoarseTmp;
2267
2268 // Mass balance check
2269 bError = false;
2270 strFineErrMsg = "";
2271 strSandErrMsg = "";
2272 strCoarseErrMsg = "";
2273 strAllErrMsg = "";
2274
2275 if (! bFPIsEqual(dFineError, 0.0, MASS_BALANCE_TOLERANCE))
2276 {
2277 strFineErrMsg = MASS_BALANCE_ERROR;
2278 bError = true;
2279 }
2280
2281 if (! bFPIsEqual(dSandError, 0.0, MASS_BALANCE_TOLERANCE))
2282 {
2283 strSandErrMsg = MASS_BALANCE_ERROR;
2284 bError = true;
2285 }
2286
2287 if (! bFPIsEqual(dCoarseError, 0.0, MASS_BALANCE_TOLERANCE))
2288 {
2289 strCoarseErrMsg = MASS_BALANCE_ERROR;
2290 bError = true;
2291 }
2292
2293 if (bError)
2294 strAllErrMsg = MASS_BALANCE_ERROR;
2295
2296 LogStream << strLeft("Unconsolidated sediment mass balance check (+ve means iteration-end total > iteration-start total)", 101) << "|" << strLeft("", 8) << "|" << strLeft("", 44) << "|" << endl;
2297 LogStream << strLeft(strFineErrMsg, 101) << "|" << strLeft("Fine", 8) << "|" << strDblRight(dFineError, 0, 30, false) << strRightPerCent(dFineError, (dEndIterSuspFineAllCells + dEndIterUnconsFineAllCells), 14, 2) << "|" << endl;
2298 LogStream << strLeft(strSandErrMsg, 101) << "|" << strLeft("Sand", 8) << "|" << strDblRight(dSandError, 0, 30, false) << strRightPerCent(dSandError, dEndIterUnconsSandAllCells, 14, 2) << "|" << endl;
2299 LogStream << strLeft(strCoarseErrMsg, 101) << "|" << strLeft("Coarse", 8) << "|" << strDblRight(dCoarseError, 0, 30, false) << strRightPerCent(dCoarseError, dEndIterUnconsCoarseAllCells, 14, 2) << "|" << endl;
2300 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;
2301 LogStream << string(101, '-') << "|" << string(8, '-') << "|" << string(44, '-') << "|" << endl;
2302 LogStream << endl;
2303 }
2304
2305 // Add to grand totals: first platform erosion
2307 // assert(isfinite(m_dThisIterPotentialPlatformErosion));
2308
2312
2313 // Erosion from cliff collapse, both consolidated and unconsolidated
2320
2321 // Deposition (with fine to suspension) of unconsolidated talus from cliff collapse
2325
2326 // Erosion of unconsolidated sediment during deposition of unconsolidated cliff collapse talus
2330
2331 // Beach erosion of unconsolidated sediment
2333
2337
2338 // Beach deposition of unconsolidated sediment
2341
2342 // Unconsolidated sediment lost due to beach erosion
2344
2348
2349 // Unconsolidated sediment input event(s)
2353
2354 // Suspended unconsolidated sediment
2356
2357 // Shortfall in unconsolidated sediment deposition
2360}
2361
Geometry class used for coast polygon objects.
double dGetCliffCollapseErosionCoarse(void) const
Get the this-iteration total of unconsolidated coarse sediment from cliff collapse on this polygon,...
double dGetSedimentInputUnconsSand(void) const
Get the value of sand sediment on the polygon derived from sediment input events(s)
double dGetPotentialErosion(void) const
Returns this timestep's total change in depth of unconsolidated sediment (all size classes) due to be...
double dGetCliffCollapseUnconsSandDeposition(void) const
Get the this-iteration total of unconsolidated sand sediment deposited from cliff collapse on this po...
double dGetCliffCollapseToSuspensionFine(void) const
Get the this-iteration total of unconsolidated fine sediment from cliff collapse which goes to suspen...
double dGetPreExistingUnconsSand(void) const
Get the value of pre-existing unconsolidated sand sediment stored on this polygon.
double dGetPreExistingConsSand(void) const
Get the value of pre-existing consolidated sand sediment stored on this polygon.
double dGetCliffCollapseErosionFine(void) const
Get the this-iteration total of unconsolidated fine sediment eroded from cliff collapse on this polyg...
double dGetPlatformErosionUnconsCoarse(void) const
Get the this-iteration total of unconsolidated coarse sediment derived from shore platform erosion on...
double dGetCliffCollapseCoarseErodedDeanProfile(void) const
Get the this-iteration total of unconsolidated coarse sediment eroded during deposition of cliff coll...
double dGetSedimentInputUnconsFine(void) const
Get the value of fine sediment on the polygon derived from sediment input events(s)
double dGetPreExistingConsFine(void) const
Get the value of pre-existing consolidated fine sediment stored on this polygon.
int nGetGlobalID(void) const
Get the global ID.
double dGetCliffCollapseUnconsCoarseDeposition(void) const
Get the this-iteration total of unconsolidated coarse sediment deposited from cliff collapse on this ...
double dGetSeawaterVolume(void) const
Get the volume of seawater in the coast polygon.
double dGetPreExistingUnconsFine(void) const
Get the value of pre-existing unconsolidated fine sediment stored on this polygon.
int nGetUpCoastProfile(void) const
Return the number of the up-coast profile.
double dGetCliffCollapseErosionSand(void) const
Get the this-iteration total of unconsolidated sand sediment from cliff collapse on this polygon,...
double dGetAvgUnconsD50(void) const
Get the average d50 for unconsolidated sediment on this polygon.
double dGetPlatformErosionUnconsSand(void) const
Get the this-iteration total of unconsolidated sand sediment derived from shore platform erosion on t...
double dGetPreExistingUnconsCoarse(void) const
Get the value of pre-existing unconsolidated coarse sediment stored on this polygon.
double dGetCliffCollapseSandErodedDeanProfile(void) const
Get the this-iteration total of unconsolidated sand sediment eroded during deposition of cliff collap...
double dGetPreExistingConsCoarse(void) const
Get the value of pre-existing consolidated coarse sediment stored on this polygon.
double dGetSedimentInputUnconsCoarse(void) const
Get the value of coarse sediment on the polygon derived from sediment input events(s)
int nGetDownCoastProfile(void) const
Return the number of the down-coast profile.
int nGetCoastID(void) const
Get the coast ID, this is the same as the down-coast sequence of polygons.
vector< int > VnGetCircularities(void) const
Get all circularities for this polygon.
Geometry class used to represent coast profile objects.
Definition profile.h:35
int nGetCoastID(void) const
Returns the profile's coast ID.
Definition profile.cpp:67
double m_dThisIterPotentialBeachErosion
Total potential beach erosion (all size classes of unconsolidated sediment) for this iteration (depth...
Definition simulation.h:800
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:875
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:531
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:710
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:459
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:866
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:414
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:965
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:369
double m_dMinSWL
Minimum still water level.
Definition simulation.h:677
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:767
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:668
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:489
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:297
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:429
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:917
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:722
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Does this work correctly?
Definition simulation.h:309
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:809
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
Definition simulation.h:947
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dCoastNormalLength
Length of the coastline-normal profiles, in m.
Definition simulation.h:782
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:312
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:980
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:360
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:605
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:833
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:689
double m_dThisIterActualPlatformErosionCoarseCons
Total actual platform erosion (coarse consolidated sediment) for this iteration (depth in m)
Definition simulation.h:797
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:432
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:279
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:749
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:878
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:486
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:746
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:516
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:303
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:291
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
Definition simulation.h:938
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:569
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:563
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:854
double m_dWaveDepthRatioForWaveCalcs
Start depth for wave calculations.
Definition simulation.h:704
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:408
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:890
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:845
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:740
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:510
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:519
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:575
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:282
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:997
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:884
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:336
bool m_bSliceSave
Save slices?
Definition simulation.h:87
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:602
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:246
int m_nLayers
The number of sediment layers.
Definition simulation.h:435
double m_dStartIterConsCoarseAllCells
Depth (m) of coarse consolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:956
double m_dStartIterConsSandAllCells
Depth (m) of sand consolidated sediment at the start of the simulation, all cells (both inside and ou...
Definition simulation.h:953
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:375
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:366
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:584
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:842
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:932
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:465
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:788
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:911
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitsky-Golay smoothing is used (usually ...
Definition simulation.h:444
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:869
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:357
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:848
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:743
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:926
time_t m_tSysStartTime
System start-simulation time.
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:776
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:656
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:725
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:794
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:330
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:372
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:863
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:815
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:731
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:761
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:507
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:713
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:635
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:905
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:785
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:851
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:324
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
Definition simulation.h:994
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
Definition simulation.h:988
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:902
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:306
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:599
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:734
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:821
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:608
string m_strFloodLocationShapefile
The name of the flood loction events shape file.
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
All-simulation total of fine sediment eroded during talus deposition following cliff collapse (m)
long double m_ldGTotCoarseDepositionDiff
All-simulation total of shortfall in unconsolidated coarse sediment deposition (m,...
double m_dStartIterConsFineAllCells
Depth (m) of fine consolidated sediment at the start of the simulation, all cells (both inside and ou...
Definition simulation.h:950
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:420
int m_nSimStartMonth
Start date of the simulation (month)
Definition simulation.h:522
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:881
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:806
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:818
double m_dThisIterBeachErosionFine
Total actual beach erosion (fine unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:803
double m_dThisIterCliffCollapseSandErodedDuringDeposition
Total sand sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:836
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:513
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:581
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:872
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:294
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:572
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:944
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:680
long double m_ldGTotActualSandLostBeachErosion
All-simulation total of sand sediment lost via beach (unconsolidated) sediment movement (m)
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:462
string m_strInterventionClassFile
Name of intervention class file.
long double m_ldGTotActualFineLostBeachErosion
All-simulation total of fine sediment lost via beach (unconsolidated) sediment movement (m)
string m_strGDALBasementDEMDataType
GDAL data type for the basement DEM raster file.
bool m_bFloodSWLSetupLine
Are we saving the flood still water level setup line? TODO 007.
Definition simulation.h:411
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:893
long double m_ldGTotCoarseSedLostCliffCollapse
All-simulation total of coarse sediment lost via cliff collapse (m)
double m_dCoastNormalInterventionSpacing
Average spacing of the coastline-normal profiles on interventions, in m.
Definition simulation.h:779
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
Definition simulation.h:991
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:525
string m_strDeepWaterWavesInputFile
The name of the deep water wave stations time series file.
void WritePolygonInfoTable(int const)
Writes to the log file a table showing polygon info.
long double m_ldGTotSandSedLostCliffCollapse
All-simulation total of sand sediment lost via cliff collapse (m)
double m_dUnconsSandNotDepositedLastIter
Depth of unconsolidated sand sediment that could not be deposited during the last iteration,...
Definition simulation.h:977
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:974
int m_nCoastCurvatureMovingWindowSize
Definition simulation.h:539
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:566
double m_dTotalSandUnconsInPolygons
Total sand unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:962
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:384
double m_dStartIterUnconsFineAllCells
Depth (m) of fine unconsolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:941
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:641
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:587
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:288
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:617
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:590
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:908
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:719
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:662
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:342
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:578
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:438
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:896
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:300
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:812
string m_strOGRFloodDriverDesc
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:276
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:354
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:830
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:887
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:728
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:560
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:327
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:971
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:554
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:737
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:629
double m_dTotalFineUnconsInPolygons
Total fine unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:959
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:968
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
Definition simulation.h:929
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:611
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:315
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:692
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:614
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:860
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:716
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:839
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:644
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:791
long double m_ldGTotPotentialBeachErosion
All-simulation total of potential beach erosion (m), all size classes.
double m_dProfileMaxSlope
Maximum slope on coastline-normal profiles.
Definition simulation.h:857
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:447
string m_strGDALIHDriverDesc
GDAL description for the initial intervention height raster file.
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:339
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:899
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:827
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:773
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:659
double m_dStartIterSuspFineAllCells
Depth (m) of fine suspended sediment at the start of the simulation, all cells (both inside and outsi...
Definition simulation.h:935
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:671
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:285
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
Definition simulation.h:985
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:417
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:318
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:764
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:321
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:405
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:333
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:441
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:824
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:365
char const SLASH
Definition cme.h:341
int const SMOOTH_NONE
Definition cme.h:658
int const WAVE_MODEL_COVE
Definition cme.h:668
double const TOLERANCE
Definition cme.h:699
string const PERFORMHEAD
Definition cme.h:802
int const NO_LOG_FILE
Definition cme.h:378
string const PER_ITER_HEAD
Definition cme.h:796
int const UNCONS_SEDIMENT_EQUATION_KAMPHUIS
Definition cme.h:673
string const ERR
Definition cme.h:777
int const LOG_FILE_LOW_DETAIL
Definition cme.h:379
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:600
string const PER_ITER_HEAD4
Definition cme.h:791
double const DEPTH_OVER_DB_INCREMENT
Definition cme.h:691
int const WAVE_MODEL_CSHORE
Definition cme.h:669
int const RTN_ERR_PROFILEWRITE
Definition cme.h:615
string const PER_ITER_HEAD2
Definition cme.h:786
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:380
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1178
string const ENDHYDROLOGYHEAD
Definition cme.h:798
int const GRID_EDGE_CLOSED
Definition cme.h:663
int const GRID_EDGE_RECIRCULATE
Definition cme.h:665
double const MASS_BALANCE_TOLERANCE
Definition cme.h:701
string const ENDSEDIMENTHEAD
Definition cme.h:800
int const LOG_FILE_HIGH_DETAIL
Definition cme.h:381
int const NUMBER_OF_RNGS
Definition cme.h:352
string const PROGRAM_NAME
Definition cme.h:711
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:660
string const PER_ITER_HEAD3
Definition cme.h:789
int const SMOOTH_RUNNING_MEAN
Definition cme.h:659
int const LOG_FILE_ALL
Definition cme.h:382
int const RTN_OK
Definition cme.h:580
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:601
string const PER_ITER_HEAD5
Definition cme.h:793
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:361
int const GRID_EDGE_OPEN
Definition cme.h:664
string const EROSION_POTENTIAL_LOOKUP_FILE
Definition cme.h:772
int const UNCONS_SEDIMENT_EQUATION_CERC
Definition cme.h:672
string const PER_ITER_HEAD1
Definition cme.h:783
char const COLON
Definition cme.h:335
string const MASS_BALANCE_ERROR
Definition cme.h:781
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:602
char const SPACE
Definition cme.h:342
Contains CRWCoast definitions.
double dGetInterpolatedValue(vector< double > const *pVdXdata, vector< double > const *pVdYdata, double dX, bool bExtrapolate)
Definitions of routines which return interpolated value at x from parallel arrays.
Contains CSimulation definitions.
string strLeft(const string &strIn, int const nWidth)
Left-aligns string within a field of given width, pads with blank spaces to enforce alignment....
string strDblRight(double const dX, int const nDigits, int const nWidth, bool const bShowDash)
Converts double to string with specified number of decimal places, within a field of given width,...
string strRightPerCent(double const d1, double const d2, int const nWidth, int const nDigits, bool const bShowDash)
Calculates a percentage from two numbers then, if the result is non-zero, right-aligns the result as ...
string strCentre(const char *pchIn, int const nWidth)
Centre-aligns char array within a field of given width, pads with blank spaces to enforce alignment....
string strRight(const string &strIn, int const nWidth)
Right-aligns string within a field of given width, pads with blank spaces to enforce alignment....
string strIntRight(int const nX, int const nWidth)
Converts int to string within a field of given width, pads with blank spaces to enforce alignment....