CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
simulation.cpp
Go to the documentation of this file.
1
10
11/* ==============================================================================================================================
12 This file is part of CoastalME, the Coastal Modelling Environment.
13
14 CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19==============================================================================================================================*/
20#include <assert.h>
21
22#include <cstdio>
23#include <unistd.h>
24#include <stdio.h>
25
26#include <climits>
27
28#include <ios>
29using std::fixed;
30
31#include <iostream>
32using std::cerr;
33using std::cin;
34using std::endl;
35using std::ios;
36
37#include <iomanip>
38using std::setprecision;
39
40#include <cfloat>
41
42#include <string>
43using std::to_string;
44
45#include <filesystem> // C++17 and later, needed for missing output directory creation
46using std::filesystem::is_directory;
47using std::filesystem::exists;
48using std::filesystem::create_directories;
49
50#include <gdal.h>
51
52#include "cme.h"
53#include "simulation.h"
54#include "raster_grid.h"
55#include "coast.h"
56
57//===============================================================================================================================
59//===============================================================================================================================
61{
62 // Initialization
63 m_bHaveFineSediment = false;
64 m_bHaveSandSediment = false;
66 m_bBasementElevSave = false;
69 m_bTalusSave = false;
70 m_bSliceSave = false;
71 m_bSeaDepthSave = false;
72 m_bAvgSeaDepthSave = false;
73 m_bWaveHeightSave = false;
75 m_bWaveAngleSave = false;
76 m_bAvgWaveAngleSave = false;
94 m_bLandformSave = false;
95 m_bSlopeConsSedSave = false;
99 m_bSuspSedSave = false;
100 m_bAvgSuspSedSave = false;
101 m_bFineUnconsSedSave = false;
102 m_bSandUnconsSedSave = false;
104 m_bFineConsSedSave = false;
105 m_bSandConsSedSave = false;
106 m_bCoarseConsSedSave = false;
109 m_bActiveZoneSave = false;
110 m_bCliffCollapseSave = false;
114 m_bCliffNotchAllSave = false;
116 m_bRasterPolygonSave = false;
118 m_bSeaMaskSave = false;
119 m_bBeachMaskSave = false;
121 m_bSaveRegular = false;
122 m_bCoastSave = false;
123 m_bCliffEdgeSave = false;
124 m_bNormalsSave = false;
125 m_bInvalidNormalsSave = false;
126 m_bCoastCurvatureSave = false;
127 m_bPolygonNodeSave = false;
129 m_bCliffNotchSave = false;
130 m_bShadowBoundarySave = false;
137 m_bCliffToeSave = false;
138 m_bSeaAreaTSSave = false;
139 m_bSWLTSSave = false;
141 m_bSuspSedTSSave = false;
147 m_bBeachErosionTSSave = false;
151 m_bSaveGISThisIter = false;
157 m_bOmitSearchWestEdge = false;
158 m_bOmitSearchEastEdge = false;
160 m_bDoCliffCollapse = false;
162 m_bGDALCanWriteFloat = false;
163 m_bGDALCanWriteInt32 = false;
164 m_bScaleRasterOutput = false;
165 m_bWorldFile = false;
168 m_bSedimentInput = false;
174 m_bWaveSetupSave = false;
175 m_bStormSurgeSave = false;
176 m_bRiverineFlooding = false;
177 m_bRunUpSave = false;
182 m_bFloodLocationSave = false;
188 m_bGDALOptimisations = false;
189 m_bCliffToeLocate = false;
190 m_bHighestSWLSoFar = false;
191 m_bLowestSWLSoFar = false;
192
193 m_bGDALCanCreate = true;
194 m_bCSVPerTimestepResults = true; // Default to CSV output format
195 m_bYamlInputFormat = false; // Default to .dat format
196
199
200 m_nLayers = 0;
201 m_nCoastSmooth = 0;
212 m_nGISSave = 0;
213 m_nUSave = 0;
214 m_nThisSave = 0;
215 m_nXGridSize = 0;
216 m_nYGridSize = 0;
217 m_nCoastMax = 0;
218 m_nCoastMin = 0;
224 m_nSimStartSec = 0;
225 m_nSimStartMin = 0;
226 m_nSimStartHour = 0;
227 m_nSimStartDay = 0;
229 m_nSimStartYear = 0;
233 m_nLevel = 0;
234
235 // TODO 011 May wish to make this a user-supplied value
238
239 m_nXMinBoundingBox = INT_MAX;
240 m_nXMaxBoundingBox = INT_MIN;
241 m_nYMinBoundingBox = INT_MAX;
242 m_nYMaxBoundingBox = INT_MIN;
243
244 // cppcheck-suppress useInitializationList
245 m_GDALWriteIntDataType = GDT_Unknown;
246 // cppcheck-suppress useInitializationList
247 m_GDALWriteFloatDataType = GDT_Unknown;
248
251
252 m_ulIter = 0;
253 m_ulTotTimestep = 0;
260 m_ulNumCells = 0;
265
267
268 for (int i = 0; i < NUMBER_OF_RNGS; i++)
269 m_ulRandSeed[i] = 0;
270
271 for (int i = 0; i < SAVEMAX; i++)
272 m_dUSaveTime[i] = 0;
273
280 m_dCellSide = 0;
281 m_dCellDiagonal = 0;
282 m_dInvCellSide = 0;
284 m_dCellArea = 0;
285 m_dSimDuration = 0;
286 m_dTimeStep = 0;
287 m_dSimElapsed = 0;
290 m_dClkLast = 0;
291 m_dCPUClock = 0;
293 m_dThisIterSWL = 0;
296 m_dFinalMeanSWL = 0;
299 m_dC_0 = 0;
300 m_dL_0 = 0;
307 m_dR = 0;
308 m_dD50Fine = 0;
309 m_dD50Sand = 0;
310 m_dD50Coarse = 0;
319 m_dKLS = 0;
320 m_dKamphuis = 0;
321 m_dG = 0;
329 m_dThisIterLeftGridUnconsFine = 0; // TODO067
387 m_dThisIterDiffTotWaterLevel = 0; // Used in surge stuff TODO 007 Finish surge and runup stuff
401
402 m_dMinSWLSoFar = DBL_MAX;
403 m_dMaxSWLSoFar = DBL_MIN;
404
405 for (int i = 0; i < 6; i++)
406 m_dGeoTransform[i] = 0;
407
408 // TODO 011 May wish to make this a user-supplied value
411
443
444 m_tSysStartTime = 0;
445 m_tSysEndTime = 0;
446
447 m_pRasterGrid = NULL;
448}
449
450//===============================================================================================================================
452//===============================================================================================================================
454{
455 // Close output files if open
456 if (LogStream && LogStream.is_open())
457 {
458 LogStream.flush();
459 LogStream.close();
460 }
461
462 if (OutStream && OutStream.is_open())
463 {
464 OutStream.flush();
465 OutStream.close();
466 }
467
468 if (SeaAreaTSStream && SeaAreaTSStream.is_open())
469 {
470 SeaAreaTSStream.flush();
471 SeaAreaTSStream.close();
472 }
473
474 if (SWLTSStream && SWLTSStream.is_open())
475 {
476 SWLTSStream.flush();
477 SWLTSStream.close();
478 }
479
481 {
484 }
485
487 {
490 }
491
493 {
496 }
497
499 {
502 }
503
505 {
508 }
509
511 {
514 }
515
517 {
520 }
521
523 {
526 }
527
528 if (m_pRasterGrid)
529 delete m_pRasterGrid;
530}
531
532//===============================================================================================================================
534//===============================================================================================================================
535int CSimulation::nDoSimulation(int nArg, char const* pcArgv[])
536{
537 // ================================================== initialisation section ================================================
538 // Hello, World!
540
541 // Start the clock ticking
542 StartClock();
543
544 // Deal with command-line parameters
545 int nRet = nHandleCommandLineParams(nArg, pcArgv);
546
547 if (nRet != RTN_OK)
548 return (nRet);
549
550 // Find out the folder in which the CoastalME executable sits, in order to open the .ini file (they are assumed to be in the same folder)
551 if (! bFindExeDir(pcArgv[0]))
552 return (RTN_ERR_CMEDIR);
553
554 // OK, we are off, tell the user about the licence and the start time
556
557 // Read the .ini file and get the name of the run-data file, and path for output etc.
558 if (! bReadIniFile())
559 return (RTN_ERR_INI);
560
561 // Check if output dir exists
562 if ((! is_directory(m_strOutPath.c_str())) || (! exists(m_strOutPath.c_str())))
563 {
564 // Output dir does not exist
565 bool bCreateDir = false;
566
567 if ((isatty(fileno(stdout))) && (isatty(fileno(stderr))))
568 {
569 // Running with stdout and stderr as a tty, so ask the user if they wish to create it
570 char ch;
571 cerr << endl
572 << "Output folder '" << m_strOutPath << "' does not exist. Create it? (Y/N) ";
573 cerr.flush();
574 cin.get(ch);
575
576 if ((ch == 'y') || (ch == 'Y'))
577 bCreateDir = true;
578 }
579 else
580 {
581 // Running with stdout or stderr not a tty, so create output dir rather than abort
582 bCreateDir = true;
583 }
584
585 if (bCreateDir)
586 {
587 // Yes, so create the directory
588 create_directories(m_strOutPath.c_str());
589 cerr << m_strOutPath << " created" << endl << endl;
590 }
591 else
592 // Nope, just end the run
593 return RTN_USER_ABORT;
594 }
595
596 // We have the name of the run-data input file, so read it
597 if (! bReadRunDataFile())
598 return RTN_ERR_RUNDATA;
599
600 // Check raster GIS output format
603
604 // Check vector GIS output format
607
608 // Open log file
609 if (! bOpenLogFile())
610 return (RTN_ERR_LOGFILE);
611
612 // Set up the time series output files
613 if (! bSetUpTSFiles())
614 return (RTN_ERR_TSFILE);
615
616 // Initialize the random number generators
617 for (int n = 0; n < NUMBER_OF_RNGS; n++)
618 m_Rand[n].seed(m_ulRandSeed[n]);
619
620 // If we are doing Savitzky-Golay smoothing of the vector coastline(s), calculate the filter coefficients
623
624 // Create the raster grid object
625 m_pRasterGrid = new CGeomRasterGrid(this);
626
627 // Read in the basement layer (must have this file), create the raster grid, then read in the basement DEM data to the array
629 nRet = nReadRasterBasementDEM();
630
631 if (nRet != RTN_OK)
632 return nRet;
633
634 // Are we simulating cliff collapse?
636 {
637 // We are: now that we have a value for m_dCellSide, we can check some more input parameters. Talus must be more than one cell wide, and since the number of cells must be odd, three cells is the minimum width
639 if (nTmp < 3)
640 {
641 string const strErr = ERR + "cliff deposition must have a planview width of at least three cells. The current setting of " + to_string(m_dCliffDepositionPlanviewWidth) + " m gives a planview width of " + to_string(nTmp) + " cells. Please edit " + m_strDataPathName;
642 cerr << strErr << endl;
643 LogStream << strErr << endl;
644 OutStream << strErr << endl;
645 return RTN_ERR_RUNDATA;
646 }
647 }
648
649 // Do some more initialisation
650 // cppcheck-suppress truncLongCastAssignment
652
653 // Mark edge cells, as defined by the basement layer
655 if (nRet != RTN_OK)
656 return nRet;
657
658 // // DEBUG CODE =================================================================================================================
659 // for (int n = 0; n < m_VEdgeCell.size(); n++)
660 // {
661 // LogStream << "[" << m_VEdgeCell[n].nGetX() << "][" << m_VEdgeCell[n].nGetY() << "] = {" << dGridCentroidXToExtCRSX(m_VEdgeCell[n].nGetX()) << ", " << dGridCentroidYToExtCRSY(m_VEdgeCell[n].nGetY()) << "} " << m_VEdgeCellEdge[n] << endl;
662 // }
663 // // DEBUG CODE =================================================================================================================
664
665 // If we are using the default cell spacing, then now that we know the size of the raster cells, we can set the size of profile spacing in m
668 else
669 {
670 // The user specified a profile spacing, is this too small?
672
674 {
675 cerr << ERR << "profile spacing was specified as " << m_dCoastNormalSpacing << " m, which is " << m_nCoastNormalSpacing << " cells. Polygon creation works poorly if profile spacing is less than " << DEFAULT_PROFILE_SPACING << " cells, i.e. " << DEFAULT_PROFILE_SPACING * m_dCellSide << " m" << endl;
676
677 LogStream << ERR << "profile spacing was specified as " << m_dCoastNormalSpacing << " m, which is " << m_nCoastNormalSpacing << " cells. Polygon creation works poorly if profile spacing is less than " << DEFAULT_PROFILE_SPACING << " cells, i.e. " << DEFAULT_PROFILE_SPACING * m_dCellSide << " m" << endl;
678
680 }
681 }
682
683 // Set the profile spacing on interventions
686
687 // We have at least one filename for the first layer, so add the correct number of layers. Note the the number of layers does not change during the simulation: however layers can decrease in thickness until they have zero thickness
689
690 for (int nX = 0; nX < m_nXGridSize; nX++)
691 for (int nY = 0; nY < m_nYGridSize; nY++)
692 m_pRasterGrid->m_Cell[nX][nY].AppendLayers(m_nLayers);
693
694 // Tell the user what is happening then read in the layer files
696
697 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
698 {
699 if (! m_VstrInitialFineUnconsSedimentFile[nLayer].empty())
700 {
701 // Read in the initial fine unconsolidated sediment depth file(s)
704 if (nRet != RTN_OK)
705 return (nRet);
706 }
707
708 if (! m_VstrInitialSandUnconsSedimentFile[nLayer].empty())
709 {
710 // Read in the initial sand unconsolidated sediment depth file
713 if (nRet != RTN_OK)
714 return (nRet);
715 }
716
717 if (! m_VstrInitialCoarseUnconsSedimentFile[nLayer].empty())
718 {
719 // Read in the initial coarse unconsolidated sediment depth file
722 if (nRet != RTN_OK)
723 return (nRet);
724 }
725
726 if (! m_VstrInitialFineConsSedimentFile[nLayer].empty())
727 {
728 // Read in the initial fine consolidated sediment depth file
730 nRet = nReadRasterGISFile(FINE_CONS_RASTER, nLayer);
731 if (nRet != RTN_OK)
732 return (nRet);
733 }
734
735 if (! m_VstrInitialSandConsSedimentFile[nLayer].empty())
736 {
737 // Read in the initial sand consolidated sediment depth file
739 nRet = nReadRasterGISFile(SAND_CONS_RASTER, nLayer);
740 if (nRet != RTN_OK)
741 return (nRet);
742 }
743
744 if (! m_VstrInitialCoarseConsSedimentFile[nLayer].empty())
745 {
746 // Read in the initial coarse consolidated sediment depth file
749 if (nRet != RTN_OK)
750 return (nRet);
751 }
752 }
753
754 if (! m_strInitialSuspSedimentFile.empty())
755 {
756 // Read in the initial suspended sediment depth file
759 if (nRet != RTN_OK)
760 return (nRet);
761 }
762
763
764 // Maybe read in the landform class data, otherwise calculate this during the first timestep using identification rules
765 if (! m_strInitialLandformFile.empty())
766 {
769 if (nRet != RTN_OK)
770 return (nRet);
771 }
772
773 // Maybe read in intervention data
774 if (! m_strInterventionClassFile.empty())
775 {
778 if (nRet != RTN_OK)
779 return (nRet);
780
783 if (nRet != RTN_OK)
784 return (nRet);
785 }
786
787 // Maybe read in the tide data
788 if (! m_strTideDataFile.empty())
789 {
791 nRet = nReadTideDataFile();
792 if (nRet != RTN_OK)
793 return (nRet);
794 }
795
796 // Read in the erosion potential shape function data
798 nRet = nReadShapeFunctionFile();
799 if (nRet != RTN_OK)
800 return (nRet);
801
802 // Do we want to output the erosion potential look-up values, for checking purposes?
805
806 // OK, now read in the vector files (if any)
809
810 // Maybe read in deep water wave station data
812 {
813 // We are reading deep water wave height, orientation and period from a file of vector points and file time series
815
816 // Read in vector points
818 if (nRet != RTN_OK)
819 return (nRet);
820
821 int const nWaveStations = static_cast<int>(m_VnDeepWaterWaveStationID.size());
822
823 if (nWaveStations == 1)
825
826 // Read in time series values, and initialise the vector which stores each timestep's deep water wave height, orientation and period
827 nRet = nReadWaveStationInputFile(nWaveStations);
828 if (nRet != RTN_OK)
829 return (nRet);
830 }
831
832 // Maybe read in sediment input event data
834 {
835 // We are reading sediment input event data
837
838 // Read in vector points for sediment input events
840 if (nRet != RTN_OK)
841 return (nRet);
842
843 // Read in the time series values for sediment input events
845 if (nRet != RTN_OK)
846 return (nRet);
847 }
848
849 // Maybe read in flood input location
851 {
852 // We are reading sediment input event data
854
855 // Read in vector points for sediment input events
857 if (nRet != RTN_OK)
858 return (nRet);
859 }
860
861 // Open the main output
862 OutStream.open(m_strOutFile.c_str(), ios::out | ios::trunc);
863
864 if (!OutStream)
865 {
866 // Error, cannot open Out file
867 cerr << ERR << "cannot open " << m_strOutFile << " for output" << endl;
868 return (RTN_ERR_OUTFILE);
869 }
870
871 // Write beginning-of-run information to Out and Log files
873
874 // Final stage of initialization
876
877 // Misc initialisation calcs
878 m_nCoastMax = COAST_LENGTH_MAX * tMax(m_nXGridSize, m_nYGridSize); // Arbitrary but probably OK
879 // m_nCoastMin = tMin(m_nXGridSize, m_nYGridSize);
881 m_nCoastCurvatureInterval = tMax(nRound(m_dCoastNormalSpacing / (m_dCellSide * 2)), 2); // Arbitrary but probably OK
882
883 // For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) transport rate (Leo Van Rijn) TODO 007 need full reference
885
886 m_bConsChangedThisIter.resize(m_nLayers, false);
887 m_bUnconsChangedThisIter.resize(m_nLayers, false);
888
889 // Normalize sediment erodibility values, so that none are > 1
894
895 // Intialise SWL
897
898 // If SWL changes during the simulation, calculate the per-timestep increment (could be -ve)
900 {
903 }
904
905 // ===================================================== The main loop ======================================================
906 // Tell the user what is happening
908
909 while (true)
910 {
911 // Check that we haven't gone on too long: if not then update timestep number etc.
912 if (bTimeToQuit())
913 break;
914
915 // Tell the user how the simulation is progressing
917
919 LogStream << "TIMESTEP " << m_ulIter << " " << string(154, '=') << endl;
920
921 LogStream << fixed << setprecision(3);
922
923 // Check to see if there is a new intervention in place: if so, update it on the RasterGrid array
924 nRet = nUpdateIntervention();
925 if (nRet != RTN_OK)
926 return nRet;
927
928 // Calculate changes due to external forcing (change in still water level, tide level and deep water waves height, orientation and period)
929 nRet = nCalcExternalForcing();
930 if (nRet != RTN_OK)
931 return nRet;
932
933 // Do per-timestep initialisation: set up the grid cells ready for this timestep, also initialise per-timestep totals. Note that in the first timestep, all cells (including hinterland cells) are given the deep water wave values
935 if (nRet != RTN_OK)
936 return nRet;
937
938 // Next find out which cells are inundated and locate the coastline(s). This also gives to all sea cells, wave values which are the same as the deep water values. For shallow water sea cells, these wave values will be changed later, in nDoAllPropagateWaves()
939 nRet = nLocateSeaAndCoasts();
940 if (nRet != RTN_OK)
941 return nRet;
942
943 // Tell the user how the simulation is progressing
945
946 // Locate estuaries TODO someday...
947
949 {
950 // Locate and trace cliff toe
951 nRet = nLocateCliffToe();
952 if (nRet != RTN_OK)
953 return nRet;
954 }
955
956 // For all cells, use classification rules to assign sea and hinterland landform categories
958 if (nRet != RTN_OK)
959 return nRet;
960
961 // For every coastline, use classification rules to assign landform categories
963 if (nRet != RTN_OK)
964 return nRet;
965
966 // Create all coastline-normal profiles, in coastline-concave-curvature sequence
967 nRet = nCreateAllProfiles();
968 if (nRet != RTN_OK)
969 return nRet;
970
971 // Check the coastline-normal profiles for intersection, modify the profiles if they intersect, then mark valid profiles on the raster grid
973 if (nRet != RTN_OK)
974 return nRet;
975
976 if (m_VCoast.size() > 1)
977 {
978 // We have multiple coastlines
979 nRet = nDoMultipleCoastlines();
980 if (nRet != RTN_OK)
981 return nRet;
982 }
983
984 // Tell the user how the simulation is progressing
986
987 // Create the coast polygons
988 nRet = nCreateAllPolygons();
989 if (nRet != RTN_OK)
990 return nRet;
991
992 // Mark cells of the raster grid that are within each polygon, and do some polygon initialisation
994
995 // // DEBUG CODE ================
996 // m_nGISSave++;
997 // if (! bWriteVectorGISFile(VECTOR_PLOT_COAST, &VECTOR_PLOT_COAST_TITLE))
998 // return false;
999 // if (! bWriteVectorGISFile(VECTOR_PLOT_NORMALS, &VECTOR_PLOT_NORMALS_TITLE))
1000 // return false;
1001 // if (! bWriteVectorGISFile(VECTOR_PLOT_INVALID_NORMALS, &VECTOR_PLOT_INVALID_NORMALS_TITLE))
1002 // return false;
1003 // if (! bWriteRasterGISFile(RASTER_PLOT_NORMAL_PROFILE, &RASTER_PLOT_NORMAL_PROFILE_TITLE))
1004 // return false;
1005 // if (! bWriteRasterGISFile(RASTER_PLOT_COAST, &RASTER_PLOT_COAST_TITLE))
1006 // return false;
1007 // if (! bWriteRasterGISFile(RASTER_PLOT_POLYGON, &RASTER_PLOT_POLYGON_TITLE))
1008 // return false;
1009 // if (! bWriteVectorGISFile(VECTOR_PLOT_POLYGON_BOUNDARY, &VECTOR_PLOT_POLYGON_BOUNDARY_TITLE))
1010 // return false;
1011 // // DEBUG CODE ================
1012
1013 // Calculate the length of the shared normal between each polygon and the adjacent polygon(s)
1015 if (nRet != RTN_OK)
1016 return nRet;
1017
1018 // Tell the user how the simulation is progressing
1020
1021 // // DEBUG CODE =========================================================================================================
1022 // nNODATA = 0;
1023 // nPoly0 = 0;
1024 // nPoly24 = 0;
1025 // for (int nX = 0; nX < m_nXGridSize; nX++)
1026 // {
1027 // for (int nY = 0; nY < m_nYGridSize; nY++)
1028 // {
1029 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1030 // if (nTmp == INT_NODATA)
1031 // nNODATA++;
1032 //
1033 // if (nTmp == 0)
1034 // nPoly0++;
1035 //
1036 // if (nTmp == 24)
1037 // nPoly24++;
1038 // }
1039 // }
1040 // LogStream << "After marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1041 // // LogStream << "After marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1042 // LogStream << "After marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1043 // // DEBUG CODE =========================================================================================================
1044 // PropagateWind();
1045
1046 // Give every coast point a value for deep water wave height and direction
1048 if (nRet != RTN_OK)
1049 return nRet;
1050
1051 // // DEBUG CODE ===============
1052 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1053 // {
1054 // LogStream << "====================" << endl;
1055 //
1056 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1057 // {
1058 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfile(nProfile);
1059 // int nCell = pProfile->nGetNumCellsInProfile();
1060 // LogStream << "Profile " << pProfile->nGetProfileID() << " nGetNumCellsInProfile() = " << nCell << endl;
1061 // }
1062 //
1063 // LogStream << endl;
1064 //
1065 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1066 // {
1067 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfileWithDownCoastSeq(nProfile);
1068 // int nCell = pProfile->nGetNumCellsInProfile();
1069 // LogStream << "Profile " << pProfile->nGetProfileID() << " nGetNumCellsInProfile() = " << nCell << endl;
1070 // }
1071 //
1072 // LogStream << "====================" << endl;
1073 // }
1074 // // DEBUG CODE =====================
1075
1076 // Change the wave properties in all shallow water sea cells: propagate waves and define the active zone, also locate wave shadow zones
1077 nRet = nDoAllPropagateWaves();
1078 if (nRet != RTN_OK)
1079 return nRet;
1080
1081 // Output polygon share table and pre-existing sediment table to log file
1083 {
1086 }
1087
1088 // Tell the user how the simulation is progressing
1090
1091 // // DEBUG CODE ===========================================================================================================
1092 // string strOutFile = m_strOutPath;
1093 // strOutFile += "sea_wave_height_CHECKPOINT_";
1094 // strOutFile += to_string(m_ulIter);
1095 // strOutFile += ".tif";
1096 //
1097 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1098 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1099 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1100 // pDataSet->SetGeoTransform(m_dGeoTransform);
1101 //
1102 // int nn = 0;
1103 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1104 // for (int nY = 0; nY < m_nYGridSize; nY++)
1105 // {
1106 // for (int nX = 0; nX < m_nXGridSize; nX++)
1107 // {
1108 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1109 // }
1110 // }
1111 //
1112 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1113 // pBand->SetNoDataValue(m_dMissingValue);
1114 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1115 //
1116 // if (nRet == CE_Failure)
1117 // return RTN_ERR_GRIDCREATE;
1118 //
1119 // GDALClose(pDataSet);
1120 // delete[] pdRaster;
1121 // // DEBUG CODE ===========================================================================================================
1122 //
1123 // // DEBUG CODE ===========================================================================================================
1124 // strOutFile = m_strOutPath;
1125 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1126 // strOutFile += to_string(m_ulIter);
1127 // strOutFile += ".tif";
1128 //
1129 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1130 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1131 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1132 // pDataSet->SetGeoTransform(m_dGeoTransform);
1133 //
1134 // nn = 0;
1135 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1136 // for (int nY = 0; nY < m_nYGridSize; nY++)
1137 // {
1138 // for (int nX = 0; nX < m_nXGridSize; nX++)
1139 // {
1140 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1141 // }
1142 // }
1143 //
1144 // pBand = pDataSet->GetRasterBand(1);
1145 // pBand->SetNoDataValue(m_dMissingValue);
1146 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1147 //
1148 // if (nRet == CE_Failure)
1149 // return RTN_ERR_GRIDCREATE;
1150 //
1151 // GDALClose(pDataSet);
1152 // delete[] pdRaster;
1153 // // DEBUG CODE ===========================================================================================================
1154
1155 // Save the not-deposited values, to be shown in the logfile after we've finished beach sediment movement
1158
1161 {
1162 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << " m_dUnconsSandNotDepositedLastIter = " << m_dUnconsSandNotDepositedLastIter << endl;
1163 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea << " m_dUnconsCoarseNotDepositedLastIter = " << m_dUnconsCoarseNotDepositedLastIter << endl;
1164 }
1165
1167 {
1168 // Calculate elevation change on the consolidated sediment which comprises the coastal platform
1170 if (nRet != RTN_OK)
1171 return nRet;
1172 }
1173
1174 // Output shore platform erosion table to log file
1177
1178 // Are we considering cliff collapse?
1180 {
1181 // Distribute wave energy to coast landforms (currently, this is only relevant to cliffs), maybe incise cliff notches, maybe do cliff collapses
1183 if (nRet != RTN_OK)
1184 return nRet;
1185
1186 // Output cliff collapse table to log file
1189
1190 // Move some cliff collapse talus to unconsolidated sediment
1192 if (nRet != RTN_OK)
1193 return nRet;
1194 }
1195
1196 // Tell the user how the simulation is progressing
1198
1200 {
1201 // Next simulate beach erosion and deposition i.e. simulate alongshore transport of unconsolidated sediment (longshore drift) between polygons. First calculate potential sediment movement between polygons
1203
1204 // Do within-sediment redistribution of unconsolidated sediment, constraining potential sediment movement to give actual (i.e. supply-limited) sediment movement to/from each polygon in three size classes
1206 if (nRet != RTN_OK)
1207 return nRet;
1208 }
1209
1210 // If we have sediment input events, then check to see whether this is time for an event to occur. If it is, then do it
1211 if (m_bSedimentInput)
1212 {
1214 if (nRet != RTN_OK)
1215 return nRet;
1216
1217 // If we have had at least one sediment input event this iteration, then output the sediment event per polygon table to the log file
1220 }
1221
1222 // // Add the fine sediment that was eroded this timestep (from the shore platform, from cliff collapse, from erosion of existing fine sediment during cliff collapse talus deposition, and from beach erosion; minus the fine sediment from beach erosion that went off-grid) to the suspended sediment load
1223 // double dFineThisIter = m_dThisIterActualPlatformErosionFineCons + m_dThisIterCliffCollapseErosionFineUncons + m_dThisIterCliffCollapseErosionFineCons + m_dThisIterCliffCollapseFineErodedDuringDeposition + m_dThisIterBeachErosionFine - m_dThisIterLeftGridUnconsFine;
1224 //
1225 // m_dThisIterFineSedimentToSuspension += dFineThisIter;
1226
1227 // Tell the user how the simulation is progressing
1229
1230 // // DEBUG CODE ===========================================================================================================
1231 // string strOutFile = m_strOutPath;
1232 // strOutFile += "sea_wave_height_CHECKPOINT_";
1233 // strOutFile += to_string(m_ulIter);
1234 // strOutFile += ".tif";
1235 //
1236 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1237 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1238 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1239 // pDataSet->SetGeoTransform(m_dGeoTransform);
1240 //
1241 // int nn = 0;
1242 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1243 // for (int nY = 0; nY < m_nYGridSize; nY++)
1244 // {
1245 // for (int nX = 0; nX < m_nXGridSize; nX++)
1246 // {
1247 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1248 // }
1249 // }
1250 //
1251 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1252 // pBand->SetNoDataValue(m_dMissingValue);
1253 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1254 //
1255 // if (nRet == CE_Failure)
1256 // return RTN_ERR_GRIDCREATE;
1257 //
1258 // GDALClose(pDataSet);
1259 // delete[] pdRaster;
1260 // // DEBUG CODE ===========================================================================================================
1261 //
1262 // // DEBUG CODE ===========================================================================================================
1263 // strOutFile = m_strOutPath;
1264 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1265 // strOutFile += to_string(m_ulIter);
1266 // strOutFile += ".tif";
1267 //
1268 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1269 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1270 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1271 // pDataSet->SetGeoTransform(m_dGeoTransform);
1272 //
1273 // nn = 0;
1274 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1275 // for (int nY = 0; nY < m_nYGridSize; nY++)
1276 // {
1277 // for (int nX = 0; nX < m_nXGridSize; nX++)
1278 // {
1279 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1280 // }
1281 // }
1282 //
1283 // pBand = pDataSet->GetRasterBand(1);
1284 // pBand->SetNoDataValue(m_dMissingValue);
1285 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1286 //
1287 // if (nRet == CE_Failure)
1288 // return RTN_ERR_GRIDCREATE;
1289 //
1290 // GDALClose(pDataSet);
1291 // delete[] pdRaster;
1292 // // DEBUG CODE ===========================================================================================================
1293
1294 // Do some end-of-timestep updates to the raster grid, also update per-timestep and running totals
1295 nRet = nUpdateGrid();
1296 if (nRet != RTN_OK)
1297 return nRet;
1298
1299 // Make water level inundation on grid
1301 {
1302 m_nLevel = 0;
1303
1304 nRet = nLocateFloodAndCoasts();
1305 if (nRet != RTN_OK)
1306 return nRet;
1307 }
1308
1310 {
1311 // TODO 007 Finish surge and runup stuff
1312 m_nLevel = 1;
1313
1314 nRet = nLocateFloodAndCoasts();
1315 if (nRet != RTN_OK)
1316 return nRet;
1317 }
1318
1319 // Now save results, first the raster and vector GIS files if required
1320 m_bSaveGISThisIter = false;
1321
1323 {
1324 m_bSaveGISThisIter = true;
1325
1326 // Save the values from the RasterGrid array into raster GIS files
1327 if (! bSaveAllRasterGISFiles())
1329
1330 // Tell the user how the simulation is progressing
1332
1333 // Save the vector GIS files
1334 if (! bSaveAllVectorGISFiles())
1336
1337 // Tell the user how the simulation is progressing
1339 }
1340
1341 // Output per-timestep results to the .out file
1343 return (RTN_ERR_TEXT_FILE_WRITE);
1344
1345 // Now output time series CSV stuff
1346 if (! bWriteTSFiles())
1348
1349 // Tell the user how the simulation is progressing
1351
1352 // Update grand totals
1354
1355 } // ================================================ End of main loop ======================================================
1356
1357 // =================================================== post-loop tidying =====================================================
1358 // Tell the user what is happening
1360
1361 // Write end-of-run information to Out, Log and time-series files
1362 nRet = nWriteEndRunDetails();
1363 if (nRet != RTN_OK)
1364 return (nRet);
1365
1366 // Do end-of-run memory clearance
1368 return RTN_OK;
1369}
Geometry cass used to represent the raster grid of cell objects.
Definition raster_grid.h:29
double m_dThisIterPotentialBeachErosion
Total potential beach erosion (all size classes of unconsolidated sediment) for this iteration (depth...
Definition simulation.h:861
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:939
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:216
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:588
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:105
bool m_bCliffToeLocate
Cliff to location?
Definition simulation.h:462
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:768
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:243
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:516
int m_nYMinBoundingBox
The minimum y value of the bounding box.
Definition simulation.h:558
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
Definition utils.cpp:734
void CalcSavitzkyGolayCoeffs(void)
Calculates the Savitzky-Golay smoothing coefficients for a given size of smoothing window....
string m_strInitialSuspSedimentFile
Name of initial suspended sediment file.
bool m_bSlopeConsSedSave
Save slope of consolidated sediment raster GIS files?
Definition simulation.h:174
void WritePolygonShorePlatformErosion(void)
Writes to the log file a table showing per-polygon unconsolidated sand/coarse sediment derived from e...
int m_nNumTotCliffCollapse
The total number of cells with cliff collapse since the start of the simulation.
Definition simulation.h:537
bool bCheckRasterGISOutputFormat(void)
Checks whether the selected raster GDAL driver supports file creation, 32-bit doubles,...
static void AnnounceIsRunning(void)
Tell the user that the simulation is now running.
Definition utils.cpp:751
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:189
bool m_bHaveConsolidatedSediment
Does this simulation consider consolidated sediment, or is it an unconsolidated sediment only simulat...
Definition simulation.h:456
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:441
time_t m_tSysEndTime
System finish-simulation time.
double m_dTotalCoarseUnconsInPolygons
Total coarse unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells ...
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:396
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:825
vector< string > m_VstrInitialCoarseUnconsSedimentFile
The name of the initial coarse-sized unconsolidated sediment GIS file.
void AnnounceReadDeepWaterWaveValuesGIS(void) const
Tells the user that we are now reading the deep water wave values GIS file.
Definition utils.cpp:586
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:726
int m_nBeachErosionDepositionEquation
Which beach erosion-deposition equation is used. Possible values are UNCONS_SEDIMENT_EQUATION_CERC an...
Definition simulation.h:543
ofstream CliffCollapseNetChangeTSStream
Cliff collapse net change (erosion - deposition) time series file output stream.
bool m_bCoastSave
Save coastline as vector GIS file?
Definition simulation.h:261
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:315
bool bWritePerTimestepResults(void)
Write the results for this timestep to the .out file.
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
int nMoveCliffTalusToUnconsolidated(void)
Move talus from previous cliff collapse to unconsolidated sediment.
void AnnounceReadInitialSandConsSedGIS(int const) const
Tells the user that we are now reading the initial sand consolidated sediment depth GIS file.
Definition utils.cpp:696
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:477
int nAssignLandformsForAllCoasts(void)
Each timestep, classify coastal landforms and assign a coastal landform object to every point on ever...
void AnnounceReadInitialSandUnconsSedGIS(int const) const
Tells the user that we are now reading the initial sand unconsolidated sediment depth GIS file.
Definition utils.cpp:657
double m_dL_0
Deep water wave length (m)
Definition simulation.h:759
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
Definition simulation.h:984
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:780
void WritePolygonInfoTable(void)
Writes to the log file a table showing polygon info for all coasts.
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Finish surge and runup stuff.
Definition simulation.h:327
bool m_bTopSurfIncSeaSave
Save top surface (sediment, talus, and sea) raster DEMs?
Definition simulation.h:87
bool bSetUpTSFiles(void)
This member function intialises the time series files.
Definition utils.cpp:1215
ofstream LogStream
int nWriteEndRunDetails(void)
Writes end-of-run information to Out, Log and time-series files.
void AnnounceReadInitialFineUnconsSedGIS(int const) const
Tells the user that we are now reading the initial fine unconsolidated sediment depth GIS file.
Definition utils.cpp:644
double m_dThisIterBeachErosionCoarse
Total actual beach erosion (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:870
int m_nGISMissingValue
The value for integer missing values, as read from GIS input files.
Definition simulation.h:546
char ** m_papszGDALVectorOptions
Options for GDAL when handling vector files.
Definition simulation.h:474
bool m_bSedIncTalusTopSurfSave
Save sediment (inc talus) top surface raster DEMs?
Definition simulation.h:84
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
int nReadRasterGISFile(int const, int const)
Reads raster GIS datafiles into the RasterGrid array.
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dCoastNormalLength
Length of the coastline-normal profiles, in m.
Definition simulation.h:840
int nLocateFloodAndCoasts(void)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
bool m_bSaveGISThisIter
Save GIS files this iteration?
Definition simulation.h:333
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
All-simulation total of coarse sediment eroded during talus deposition following cliff collapse (m)
double m_dGISMissingValue
The value for floating-point missing values, as read from GIS input files.
Definition simulation.h:978
double m_dUnconsCoarseNotDepositedLastIter
Depth of unconsolidated coarse sediment that could not be deposited during the last iteration,...
double m_dCPUClock
Total elapsed CPU time.
Definition simulation.h:708
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:387
int nDoMultipleCoastlines(void)
Checks all profiles on all coasts for intersections between profiles belonging to different coasts.
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:525
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:603
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:123
double m_dSouthEastXExtCRS
The south-east x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:663
int m_nMissingValue
Used by CoastalME for integer missing values.
Definition simulation.h:549
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:117
long double m_ldGTotActualCoarseBeachErosion
All-simulation total of coarse sediment eroded during beach (unconsolidated sediment) movement (m)
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
int nReadWaveStationInputFile(int const)
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:264
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:810
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Total fine sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:894
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:270
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:288
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:747
int nReadSedimentInputEventFile(void)
Reads the sediment input event file.
double m_dThisIterActualPlatformErosionCoarseCons
Total actual platform erosion (coarse consolidated sediment) for this iteration (depth in m)
Definition simulation.h:858
int m_nNumThisIterCliffCollapse
The number of cells with cliff collapse this iteration.
Definition simulation.h:534
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:156
int nDoAllShorePlatFormErosion(void)
Does platform erosion on all coastlines by first calculating platform erosion on coastline-normal pro...
int m_nYGridSize
The size of the grid in the y direction.
Definition simulation.h:480
int nLocateCliffToe(void)
double m_dThisIterTopElevMin
This-iteration lowest elevation of DEM.
Definition simulation.h:990
bool m_bRunUpSave
Are we saving runup? TODO 007 Finish surge and runup stuff.
Definition simulation.h:420
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:597
long double m_ldGTotCliffTalusFineToSuspension
All-simulation total of fine sediment moved to suspension, due to cliff collapse (m)
bool m_bYamlInputFormat
Use YAML format for input datafile instead of .dat format?
Definition simulation.h:348
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:222
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:150
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:252
double m_dCoarseErodibility
The relative erodibility (0-1) of coarse unconsolidated beach sediment.
Definition simulation.h:807
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:711
double m_dMaxSWLSoFar
Maximum still water level (m)
Definition simulation.h:738
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:942
vector< string > m_VstrInitialFineConsSedimentFile
The name of the initial fine-sized consolidated sediment GIS file.
double m_dMissingValue
Used by CoastalME for floating-point missing values.
Definition simulation.h:981
double m_dNotchIncisionAtCollapse
Notch overhang (i.e. length of horizontal incision at the apex elevation) to initiate collapse (m)
Definition simulation.h:927
int m_nUnconsSedimentHandlingAtGridEdges
How sediment which moves off an edge of the grid is handled. Possible values are GRID_EDGE_CLOSED,...
Definition simulation.h:540
double m_dSandErodibility
The relative erodibility (0-1) of sand unconsolidated beach sediment.
Definition simulation.h:804
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:81
double m_dInvCellDiagonal
Inverse of m_dCellDiagonal.
Definition simulation.h:684
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:573
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:816
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:195
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:321
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:309
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:231
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:624
static void AnnounceSimEnd(void)
Announce the end of the simulation.
Definition utils.cpp:1549
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:618
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:915
void AnnounceReadICGIS(void) const
Tells the user that we are now reading the Intervention class GIS file.
Definition utils.cpp:556
bool m_bFloodLocationSave
Are we saving the flood location? TODO 007 Finish surge and runup stuff.
Definition simulation.h:435
int nCheckForSedimentInputEvent(void)
Check to see if we have any sediment input events this timestep, if so then do the event(s)
double m_dWaveDepthRatioForWaveCalcs
Start depth for wave calculations.
Definition simulation.h:762
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:108
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:954
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:372
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:171
ofstream CliffCollapseDepositionTSStream
Cliff collapse deposition time series file output stream.
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:906
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:168
int m_nCoastMax
Maximum valid coast length when searching for coasts.
Definition simulation.h:528
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0-1)
Definition simulation.h:798
static void AnnounceFinalInitialization(void)
Tells the user that we are now initializing.
Definition utils.cpp:742
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:567
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:576
bool m_bGDALOptimisations
GDAL optimisations enabled?
Definition simulation.h:459
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:630
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:192
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:300
int m_nCoastNormalSpacing
Average spacing between coastline normals, measured in cells.
Definition simulation.h:507
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
Definition simulation.h:555
long double m_ldGTotPotentialSedLostBeachErosion
All-simulation total of potential sediment lost via beach (unconsolidated) sediment movement (m),...
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:948
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:219
int nReadShapeFunctionFile(void)
static void AnnounceAddLayers(void)
Tells the user that we are now adding layers.
Definition utils.cpp:516
unsigned long m_ulMissingValue
Used by CoastalME for unsigned long integer missing values.
Definition simulation.h:651
int nDoAllActualBeachErosionAndDeposition(void)
Does between-polygon and within-polygon actual (supply-limited) redistribution of transported beach s...
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:363
bool m_bLowestSWLSoFar
Do we have the lowest SWL so far?
Definition simulation.h:468
bool m_bSliceSave
Save slices?
Definition simulation.h:99
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:228
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:717
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:165
double m_dThisIterNewNotchApexElev
Elevation (m) of the apex of any cliff notches created during this iteration.
Definition simulation.h:930
double m_dNorthWestYExtCRS
The north-west y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:660
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:258
int m_nLayers
The number of sediment layers.
Definition simulation.h:483
bool bFindExeDir(char const *)
Finds the folder (directory) in which the CoastalME executable is located.
Definition utils.cpp:316
double m_dStartIterConsCoarseAllCells
Depth (m) of coarse consolidated sediment at the start of the simulation, all cells (both inside and ...
double m_dStartIterConsSandAllCells
Depth (m) of sand consolidated sediment at the start of the simulation, all cells (both inside and ou...
int m_nCoastSmoothingWindowSize
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:489
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:402
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:393
bool m_bFloodSWLSetupSurgeRunupLineSave
Are we saving the flood still water level setup surge runup line? TODO 007 Finish surge and runup stu...
Definition simulation.h:450
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:639
double m_dInmersedToBulkVolumetric
For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) tra...
Definition simulation.h:828
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:267
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:111
CSimulation(void)
The CSimulation constructor.
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:903
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:75
unsigned long m_ulMissingValueBasementCells
The number of basement cells marked with as missing value.
Definition simulation.h:648
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
Definition simulation.h:999
int nReadVectorGISFile(int const)
Reads vector GIS datafiles using GDAL/OGR.
bool bReadRunDataFile(void)
Reads the run details input file and does some initialization.
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:522
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:849
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:975
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitzky-Golay smoothing is used (usually ...
Definition simulation.h:492
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:102
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:120
int m_nRunUpEquation
The run-up equation used TODO 007 Finish surge and runup stuff.
Definition simulation.h:591
long double m_ldGTotCliffCollapseFine
All-simulation total of fine sediment from cliff collapse (m)
bool m_bWorldFile
Write a GIS World file?
Definition simulation.h:384
long double m_ldGTotCliffTalusCoarseDeposition
All-simulation total of coarse sediment deposited as talus following cliff collapse (m)
void AnnounceReadSedimentEventInputValuesGIS(void) const
Tells the user that we are now reading the sediment input events GIS file.
Definition utils.cpp:601
double m_dDepthOverDBMax
Maximum value of deoth over DB, is used in erosion potential look-up function.
Definition simulation.h:909
long double m_ldGTotCliffCollapseCoarse
All-simulation total of coarse sediment from cliff collapse (m)
int m_nCoastNormalInterventionSpacing
Average spacing between coastline normals on interventions, measured in cells.
Definition simulation.h:510
double m_dFineErodibility
The relative erodibility (0-1) of fine unconsolidated beach sediment.
Definition simulation.h:801
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:993
time_t m_tSysStartTime
System start-simulation time.
double m_dBreakingWaveHeightDepthRatio
Breaking wave height-to-depth ratio.
Definition simulation.h:765
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
Definition utils.cpp:616
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:834
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector GDAL/OGR driver supports file creation etc.
bool m_bHaveWaveStationData
Do we have wave station data?
Definition simulation.h:390
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:714
int nDoSimulation(int, char const *[])
Runs the simulation.
void StartClock(void)
Starts the clock ticking.
Definition utils.cpp:292
long double m_ldGTotSuspendedSediment
All-simulation total of suspended sediment (m)
bool m_bSlopeSaveForCliffToe
Save slope raster grids (used for cliff toe location)?
Definition simulation.h:93
int m_nSavGolCliffEdgePoly
The order of the cliff edge smoothing polynomial if Savitzky-Golay smoothing is used (usually 2 or 4,...
Definition simulation.h:501
int nCreateAllPolygons(void)
Create polygons, and mark the polygon boundaries on the raster grid.
double m_dSandErodibilityNormalized
Relative erodibility of sand unconsolidated beach sediment, normalized.
Definition simulation.h:813
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:783
void WritePolygonSedimentInputEventTable(void)
Writes to the log file a table showing per-polygon sediment input event totals for all coasts.
bool m_bCliffCollapseTimestepSave
Are we saving the timestep at which each cliff occurred?
Definition simulation.h:447
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:210
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:213
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
Definition utils.cpp:631
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
Definition utils.cpp:3078
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:855
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:357
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:399
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
Definition utils.cpp:525
int m_nCliffEdgeSmooth
Which method to use for cliff edge smoothing.
Definition simulation.h:495
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:924
double m_dThisIterBeachDepositionCoarse
Total beach deposition (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:876
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:789
void WritePolygonPreExistingSedimentTable(void)
Writes to the log file a table showing per-polygon pre-existing unconsolidated sediment for all coast...
long double m_ldGTotCliffTalusSandDeposition
All-simulation total of sand sediment deposited as talus following cliff collapse (m)
double m_dCellDiagonal
Length of a cell's diagonal (in external CRS units)
Definition simulation.h:678
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:246
double m_dSlopeThresholdForCliffToe
Slope limit for cliff toe detection.
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:132
bool m_bCliffToeSave
Save cliff toe raster grids?
Definition simulation.h:96
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:819
double m_dInvCellSide
Inverse of m_dCellSide.
Definition simulation.h:681
int m_nWavePropagationModel
The wave propagation model used. Possible values are WAVE_MODEL_CSHORE and WAVE_MODEL_COVE.
Definition simulation.h:564
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:771
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:693
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:273
double m_dMinSWLSoFar
Minimum still water level (m)
Definition simulation.h:735
int m_nCliffEdgeSmoothWindow
The size of the window used for cliff edge smoothing. Must be an odd number.
Definition simulation.h:498
int m_nDeepWaterWaveDataNumTimeSteps
The duration of data for deep water waves, expressed as a number of timesteps.
Definition simulation.h:585
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
Definition utils.cpp:495
int nConvertMetresToNumCells(double const) const
Given a length in m, this returns the rounded equivalent number of cells.
long double m_ldGTotCoarseSedimentInput
All-simulation total of coarse sediment input (m)
double m_dFinalMeanSWL
The end-of-simulation still water (m), is same as m_dInitialMeanSWL unless SWL changes.
Definition simulation.h:720
double m_dThisIterUnconsCoarseCliffDeposition
This-iteration total of coarse unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:969
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:378
bool m_bRasterWaveFloodLineSave
Are we saving the raster wave flood line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:429
bool m_bSWLTSSave
Save the SWL (still water level) time series file?
Definition simulation.h:297
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:135
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:846
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:912
int m_nCoastMin
Minimum valid coast length when searching for coasts.
Definition simulation.h:531
double m_dRegularSaveTime
The time of the next save, in hours from the start of the simulation, if we are saving regularly.
Definition simulation.h:696
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:276
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:351
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:966
vector< int > m_VnDeepWaterWaveStationID
ID for deep water wave station, this corresponds with the ID in the wave time series file.
long double m_ldGTotSandSedimentInput
All-simulation total of sand sediment input (m)
bool m_bFloodSetupSurgeTSSave
Save the flood setup surge time series file? TODO 007 Finish surge and runup stuff.
Definition simulation.h:324
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:147
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007 Finish surge and runup stuff.
Definition simulation.h:423
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:129
double m_dNorthWestXExtCRS
The north-west x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:657
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:792
static void AnnounceStart(void)
Tells the user that we have started the simulation.
Definition utils.cpp:272
static int nUpdateIntervention(void)
Check to see if we have a new intervention in place (not yet implemented)
int m_nCoastCurvatureInterval
Coast curvature interval is a length, measured in coastline points.
Definition simulation.h:513
ofstream SWLTSStream
SWL time series file output stream.
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:882
bool m_bHighestSWLSoFar
Do we have the highest SWL so far?
Definition simulation.h:465
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:666
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:153
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
All-simulation total of fine sediment eroded during talus deposition following cliff collapse (m)
~CSimulation(void)
The CSimulation destructor.
long double m_ldGTotCoarseDepositionDiff
All-simulation total of shortfall in unconsolidated coarse sediment deposition (m,...
int nSetAllCoastpointDeepWaterWaveValues(void)
Give every coast point a value for deep water wave height and direction TODO 005 This may not be real...
double m_dStartIterConsFineAllCells
Depth (m) of fine consolidated sediment at the start of the simulation, all cells (both inside and ou...
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:453
int nUpdateGrid(void)
Update all cells in the raster raster grid and do some per-timestep accounting.
int m_nSimStartMonth
Start date of the simulation (month)
Definition simulation.h:579
int nAssignLandformsForAllCells(void)
Each timestep, classify landforms for cells that are not on the coastline.
bool m_bSuspSedSave
Save suspended sediment raster GIS files?
Definition simulation.h:183
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:945
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:867
double m_dAccumulatedSeaLevelChange
If long-term SWL changes, the total change (m) so far since the start of simulation.
Definition simulation.h:732
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:279
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007 Finish surge and runup stuff.
Definition simulation.h:417
vector< string > m_VstrInitialFineUnconsSedimentFile
The name of the initial fine-sized unconsolidated sediment GIS file.
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:144
double m_dThisIterFineSedimentToSuspension
Total fine unconsolidated sediment in suspension for this iteration (depth in m)
Definition simulation.h:879
int nDoAllWaveEnergyToCoastLandforms(void)
double m_dThisIterBeachErosionFine
Total actual beach erosion (fine unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:864
double m_dNotchApexAboveMHW
Distance of notch base below SWL (m)
Definition simulation.h:933
void DoAllPotentialBeachErosion(void)
Uses either the CERC equation or the Kamphuis (1990) equation to calculate potential (unconstrained) ...
double m_dThisIterCliffCollapseSandErodedDuringDeposition
Total sand sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:897
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:570
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
unsigned long m_ulThisIterNumActualBeachErosionCells
The number of grid cells on which actual beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:636
bool bReadIniFile(void)
The bReadIniFile member function reads the initialisation file.
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:72
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:936
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:312
int m_nYMaxBoundingBox
The maximum y value of the bounding box.
Definition simulation.h:561
string m_strTideDataFile
Name of tide data file.
vector< bool > m_bUnconsChangedThisIter
One element per layer: has the consolidated sediment of this layer been changed during this iteration...
bool m_bTotalPotentialBeachErosionSave
Save total potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:159
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
The number of grid cells on which potential platform erosion occurs, for this iteration.
Definition simulation.h:627
double m_dStartIterUnconsSandAllCells
Depth (m) of sand unconsolidated sediment at the start of the simulation, all cells (both inside and ...
long double m_ldGTotActualSandLostBeachErosion
All-simulation total of sand sediment lost via beach (unconsolidated) sediment movement (m)
double m_dDeltaSWLPerTimestep
If long-term SWL changes, the increment per timestep.
Definition simulation.h:723
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:519
string m_strInterventionClassFile
Name of intervention class file.
default_random_engine m_Rand[NUMBER_OF_RNGS]
The c++11 random number generators.
long double m_ldGTotActualFineLostBeachErosion
All-simulation total of fine sediment lost via beach (unconsolidated) sediment movement (m)
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:234
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:957
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:177
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:837
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:582
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:162
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:207
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,...
double m_dThisIterDiffWaveSetupWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:744
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:180
double m_dTotalCoarseConsInPolygons
Total coarse consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
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:621
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
Definition utils.cpp:571
double m_dTotalSandUnconsInPolygons
Total sand unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
void AnnounceReadInitialCoarseConsSedGIS(int const) const
Tells the user that we are now reading the initial coarse consolidated sediment depth GIS file.
Definition utils.cpp:709
bool m_bRiverineFlooding
Are we doing riverine flooding?
Definition simulation.h:411
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:606
int nCreateAllProfiles(void)
Create coastline-normal profiles for all coastlines. The first profiles are created 'around' the most...
double m_dStartIterUnconsFineAllCells
Depth (m) of fine unconsolidated sediment at the start of the simulation, all cells (both inside and ...
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:201
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:405
double m_dThisIterMHWElev
This iteration's Mean High Water (MHW) elevation, calculated using a moving time window....
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:78
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:699
long double m_ldGTotActualFineBeachErosion
All-simulation total of fine sediment eroded during beach (unconsolidated sediment) movement (m)
int nLocateSeaAndCoasts(void)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:255
void MarkPolygonCells(void)
Marks cells of the raster grid that are within each coastal polygon. The cell-by-cell fill (aka 'floo...
double m_dTimeStep
The length of an iteration (a timestep) in hours.
Definition simulation.h:690
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
The number of cells on which on-profile average potential shore platform erosion occurs.
Definition simulation.h:642
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:306
int m_nXMinBoundingBox
The minimum x value of the bounding box.
Definition simulation.h:552
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:675
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:126
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:645
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:972
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:777
bool m_bOutputConsolidatedProfileData
Output profile data?
Definition simulation.h:336
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
Definition utils.cpp:683
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:138
ofstream CliffNotchElevTSStream
Cliff notch elevation time series file output stream.
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:369
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:633
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:198
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:291
bool m_bCliffNotchElevTSSave
Save the cliff notch elevation time series file?
Definition simulation.h:330
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:486
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:249
string m_strInitialLandformFile
Name of initial landform file.
double m_dC_0
Deep water wave speed (m/s)
Definition simulation.h:756
double m_dThisIterCliffCollapseErosionSandCons
This-iteration total of sand consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:960
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:318
double m_dThisIterBeachDepositionSand
Total beach deposition (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:873
int nReadTideDataFile(void)
Reads the tide time series data.
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:204
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:294
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:381
void WriteLookUpData(void)
Output the erosion potential look-up values, for checking purposes.
double m_dThisIterLeftGridUnconsCoarse
Total coarse unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:891
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:951
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:786
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:615
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:354
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:237
bool bOpenLogFile(void)
Opens the log file.
Definition utils.cpp:471
double m_dTotalSandConsInPolygons
Total sand consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:609
void AnnounceLicence(void)
Tells the user about the licence.
Definition utils.cpp:355
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:186
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:795
vector< string > m_VstrInitialCoarseConsSedimentFile
The name of the initial coarse-sized consolidated sediment GIS file.
int nReadRasterBasementDEM(void)
Reads a raster DEM of basement elevation data to the Cell array.
double m_dSimDuration
Duration of simulation, in hours.
Definition simulation.h:687
double m_dTotalFineUnconsInPolygons
Total fine unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
long double m_ldGTotSandDepositionDiff
All-simulation total of shortfall in unconsolidated sand sediment deposition (m, not currently used)
bool m_bTalusSave
Save talus depth?
Definition simulation.h:90
bool m_bCSVPerTimestepResults
Output per-timestep results in CSV format instead of fixed-width?
Definition simulation.h:345
bool m_bCliffNotchAllSave
Are we saving all cliff notches?
Definition simulation.h:444
ofstream FloodSetupSurgeTSStream
Flood setup surge time series file output stream.
bool bTimeToQuit(void)
Checks to see if the simulation has gone on too long, amongst other things.
Definition utils.cpp:1446
double m_dTotalFineConsInPolygons
Total fine consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
Definition simulation.h:996
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:669
int nDoAllPropagateWaves(void)
Simulates wave propagation along all coastline-normal profiles, on all coasts.
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:750
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:672
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:921
long double m_ldGTotActualSandBeachErosion
All-simulation total of sand sediment eroded during beach (unconsolidated sediment) movement (m)
double m_dBreakingWaveHeight
The height of breaking waves (m)
Definition simulation.h:753
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
Definition utils.cpp:1761
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:225
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:774
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:900
int nMarkBoundingBoxEdgeCells(void)
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:702
void WritePolygonCliffCollapseErosion(void)
Writes to the log file a table showing per-polygon per-polygon cliff collapse for all coasts.
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
Definition utils.cpp:541
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
Definition simulation.h:987
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:852
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:918
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:504
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:366
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
Definition utils.cpp:533
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:963
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:888
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:831
int nInitGridAndCalcStillWaterLevel(void)
At the beginning of each timestep: clear vector coasts, profiles, and polygons, initialise the raster...
Definition init_grid.cpp:41
double m_dStartIterSuspFineAllCells
Depth (m) of fine suspended sediment at the start of the simulation, all cells (both inside and outsi...
string m_strOutFile
Name of main output file.
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007 Finish surge and runup stuff.
Definition simulation.h:426
double m_dThisIterDiffTotWaterLevel
TODO 007 Finish surge and runup stuff.
Definition simulation.h:741
vector< bool > m_bConsChangedThisIter
One element per layer: has the consolidated sediment of this layer been changed during this iteration...
ofstream FineSedSuspensionTSStream
Fine sediment in suspension time series file output stream.
ofstream FloodSetupSurgeRunupTSStream
Flood setup surge runup time series file output stream.
bool m_bWaveSetupSave
Are we saving the wave setup? TODO 007 Finish surge and runup stuff.
Definition simulation.h:414
int nDoPolygonSharedBoundaries(void)
For between-polygon potential sediment routing: find which are the adjacent polygons,...
void AnnounceReadTideData(void) const
Now reading tide data file.
Definition utils.cpp:722
bool m_bFloodSWLSetupLineSave
Are we saving the flood still water level setup line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:438
double m_dClkLast
Last value returned by clock()
Definition simulation.h:705
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:240
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:729
int nCheckAndMarkAllProfiles(void)
Check all coastline-normal profiles and modify the profiles if they intersect, then mark valid profil...
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
Definition simulation.h:303
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:141
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
GDALDataType m_GDALWriteFloatDataType
Thw data type used by GDAL for floating point operations, can be GDT_Byte, GDT_Int16,...
Definition simulation.h:600
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:375
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
Definition utils.cpp:670
int nHandleCommandLineParams(int, char const *[])
Handles command-line parameters.
Definition utils.cpp:168
long double m_ldGTotCliffCollapseSand
All-simulation total of sand sediment from cliff collapse (m)
char ** m_papszGDALRasterOptions
Options for GDAL when handling raster files.
Definition simulation.h:471
ofstream OutStream
The main output file stream.
double m_dDurationUnitsMult
Multiplier for duration units, to convert to hours.
Definition simulation.h:654
unsigned long m_ulTotTimestep
The target number of iterations.
Definition simulation.h:612
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:339
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:822
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:342
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP Finish surge and runup stuff.
Definition simulation.h:594
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
Definition simulation.h:408
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:282
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007 Finish surge and runup stuff.
Definition simulation.h:432
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:114
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:360
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:885
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:380
double const TOLERANCE
Definition cme.h:725
unsigned long const UNSIGNED_LONG_NODATA
Definition cme.h:705
int const SAND_CONS_RASTER
Definition cme.h:450
double const INTERVENTION_PROFILE_SPACING_FACTOR
Definition cme.h:733
int const SEDIMENT_INPUT_EVENT_LOCATION_VEC
Definition cme.h:477
string const ERR
Definition cme.h:805
int const RTN_ERR_LOGFILE
Definition cme.h:595
int const DEFAULT_PROFILE_SPACING
Definition cme.h:387
int const RTN_ERR_RASTER_GIS_OUT_FORMAT
Definition cme.h:602
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:605
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:393
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1213
int const FLOOD_LOCATION_VEC
Definition cme.h:482
int const DEEP_WATER_WAVE_STATIONS_VEC
Definition cme.h:474
int const RTN_ERR_RUNDATA
Definition cme.h:592
double const MASS_BALANCE_TOLERANCE
Definition cme.h:727
T tMax(T a, T b)
Definition cme.h:1162
int const SAVEMAX
Definition cme.h:368
int const NUMBER_OF_RNGS
Definition cme.h:367
int const RTN_ERR_PROFILE_SPACING
Definition cme.h:609
int const RTN_ERR_TSFILE
Definition cme.h:597
int const INTERVENTION_CLASS_RASTER
Definition cme.h:457
int const RTN_ERR_VECTOR_GIS_OUT_FORMAT
Definition cme.h:603
int const RTN_USER_ABORT
Definition cme.h:588
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:677
int const COAST_LENGTH_MIN_X_PROF_SPACE
Definition cme.h:373
int const RTN_ERR_CMEDIR
Definition cme.h:591
int const RTN_ERR_INI
Definition cme.h:590
int const RTN_OK
Definition cme.h:585
int const RTN_ERR_TEXT_FILE_WRITE
Definition cme.h:604
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:606
int const SAND_UNCONS_RASTER
Definition cme.h:453
int const FINE_UNCONS_RASTER
Definition cme.h:452
int const COARSE_UNCONS_RASTER
Definition cme.h:454
double const DBL_NODATA
Definition cme.h:736
int const RTN_ERR_OUTFILE
Definition cme.h:596
int const SUSP_SED_RASTER
Definition cme.h:455
int const FINE_CONS_RASTER
Definition cme.h:449
int const COARSE_CONS_RASTER
Definition cme.h:451
int const COAST_LENGTH_MAX
Definition cme.h:372
int const LANDFORM_RASTER
Definition cme.h:456
int const INTERVENTION_HEIGHT_RASTER
Definition cme.h:458
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:607
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Correctly rounds doubles, returns an int.