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
12
13/* ==============================================================================================================================
14
15 This file is part of CoastalME, the Coastal Modelling Environment.
16
17 CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23==============================================================================================================================*/
24#include <assert.h>
25
26#include <ios>
27using std::fixed;
28
29#include <iostream>
30using std::cerr;
31using std::cout;
32using std::cin;
33using std::endl;
34using std::ios;
35
36#include <iomanip>
37using std::setprecision;
38
39#include <cfloat>
40
41#include <string>
42using std::to_string;
43
44#include <filesystem> // C++17 and later, needed for missing output directory creation
45using std::filesystem::is_directory;
46using std::filesystem::exists;
47using std::filesystem::create_directories;
48
49#include <random>
50using std::random_device;
51
52#include "cme.h"
53#include "simulation.h"
54#include "raster_grid.h"
55#include "coast.h"
56
57//===============================================================================================================================
59//===============================================================================================================================
61{
62 // Initialization
183
184 m_bGDALCanCreate = true;
185 m_bCSVPerTimestepResults = true; // Default to CSV output format
186
189
190 m_nLayers =
202 m_nGISSave =
203 m_nUSave =
209 // m_nNThisIterCliffCollapse =
210 // m_nNTotCliffCollapse =
224 m_nLevel =
226
227 // TODO 011 May wish to make this a user-supplied value
230
231 m_nXMinBoundingBox = INT_MAX;
232 m_nXMaxBoundingBox = INT_MIN;
233 m_nYMinBoundingBox = INT_MAX;
234 m_nYMaxBoundingBox = INT_MIN;
235
236 // cppcheck-suppress useInitializationList
237 m_GDALWriteIntDataType = GDT_Unknown;
238 // cppcheck-suppress useInitializationList
239 m_GDALWriteFloatDataType = GDT_Unknown;
240
243
244 m_ulIter =
257
258 for (int i = 0; i < NUMBER_OF_RNGS; i++)
259 m_ulRandSeed[i] = 0;
260
261 for (int i = 0; i < SAVEMAX; i++)
262 m_dUSaveTime[i] = 0;
263
280 m_dClkLast =
289 m_dC_0 =
290 m_dL_0 =
297 m_dR =
298 m_dD50Fine =
299 m_dD50Sand =
309 m_dKLS =
311 m_dG =
389
390 m_dMinSWL = DBL_MAX;
391 m_dMaxSWL = DBL_MIN;
392
393 for (int i = 0; i < 6; i++)
394 m_dGeoTransform[i] = 0;
395
396 // TODO 011 May wish to make this a user-supplied value
399
431
433 m_tSysEndTime = 0;
434
435 m_pRasterGrid = NULL;
436}
437
438//===============================================================================================================================
440//===============================================================================================================================
442{
443 // Close output files if open
444 if (LogStream && LogStream.is_open())
445 {
446 LogStream.flush();
447 LogStream.close();
448 }
449
450 if (OutStream && OutStream.is_open())
451 {
452 OutStream.flush();
453 OutStream.close();
454 }
455
456 if (SeaAreaTSStream && SeaAreaTSStream.is_open())
457 {
458 SeaAreaTSStream.flush();
459 SeaAreaTSStream.close();
460 }
461
463 {
466 }
467
469 {
472 }
473
475 {
478 }
479
481 {
484 }
485
487 {
490 }
491
493 {
496 }
497
499 {
502 }
503
505 {
508 }
509
510 if (m_pRasterGrid)
511 delete m_pRasterGrid;
512}
513
514//===============================================================================================================================
516//===============================================================================================================================
518{
519 return m_dMissingValue;
520}
521
522//===============================================================================================================================
524//===============================================================================================================================
526{
527 return m_dThisIterSWL;
528}
529
530//===============================================================================================================================
532//===============================================================================================================================
537
538// //===============================================================================================================================
539// //! Returns the max elevation of the beach above SWL
540// //===============================================================================================================================
541// double CSimulation::dGetMaxBeachElevAboveSWL (void) const
542// {
543// return m_dMaxBeachElevAboveSWL;
544// }
545
546//===============================================================================================================================
547// Returns the cell side length
548//===============================================================================================================================
549// double CSimulation::dGetCellSide(void) const
550// {
551// return m_dCellSide;
552// }
553
554//===============================================================================================================================
556//===============================================================================================================================
558{
559 return m_nXGridSize;
560}
561
562//===============================================================================================================================
564//===============================================================================================================================
566{
567 return m_nYGridSize;
568}
569
570//===============================================================================================================================
572//===============================================================================================================================
573double CSimulation::dGetD50Fine (void) const
574{
575 return m_dD50Fine;
576}
577
578//===============================================================================================================================
580//===============================================================================================================================
581double CSimulation::dGetD50Sand (void) const
582{
583 return m_dD50Sand;
584}
585
586//===============================================================================================================================
588//===============================================================================================================================
589double CSimulation::dGetD50Coarse (void) const
590{
591 return m_dD50Coarse;
592}
593
594//===============================================================================================================================
596//===============================================================================================================================
597int CSimulation::nDoSimulation(int nArg, char const* pcArgv[])
598{
599 // ================================================== initialization section ================================================
600 // Hello, World!
602
603 // Start the clock ticking
604 StartClock();
605
606 // Deal with command-line parameters
607 int nRet = nHandleCommandLineParams(nArg, pcArgv);
608
609 if (nRet != RTN_OK)
610 return (nRet);
611
612 // 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)
613 if (! bFindExeDir(pcArgv[0]))
614 return (RTN_ERR_CMEDIR);
615
616 // OK, we are off, tell the user about the licence and the start time
618
619 // Read the .ini file and get the name of the run-data file, and path for output etc.
620 if (! bReadIniFile())
621 return (RTN_ERR_INI);
622
623 // Check if output dir exists
624 if ((! is_directory(m_strOutPath.c_str())) || (! exists(m_strOutPath.c_str())))
625 {
626 // Output dir does not exist
627 bool bCreateDir = false;
628
629 if ((isatty(fileno(stdout))) && (isatty(fileno(stderr))))
630 {
631 // Running with stdout and stderr as a tty, so ask the user if they wish to create it
632 char ch;
633 cerr << endl << "Output folder '" << m_strOutPath << "' does not exist. Create it? (Y/N) ";
634 cerr.flush();
635 cin.get(ch);
636
637 if ((ch == 'y') || (ch == 'Y'))
638 bCreateDir = true;
639 }
640
641 else
642 {
643 // Running with stdout or stderr not a tty, so create output dir rather than abort
644 bCreateDir = true;
645 }
646
647 if (bCreateDir)
648 {
649 // Yes, so create the directory
650 create_directories(m_strOutPath.c_str());
651 cerr << m_strOutPath << " created" << endl << endl;
652 }
653
654 else
655 // Nope, just end the run
656 return RTN_USER_ABORT;
657 }
658
659 // We have the name of the run-data input file, so read it
660 if (! bReadRunDataFile())
661 return RTN_ERR_RUNDATA;
662
663 // Check raster GIS output format
666
667 // Check vector GIS output format
670
671 // Open log file
672 if (! bOpenLogFile())
673 return (RTN_ERR_LOGFILE);
674
675 // Set up the time series output files
676 if (! bSetUpTSFiles())
677 return (RTN_ERR_TSFILE);
678
679 // Initialize the random number generators
680 for (int n = 0; n < NUMBER_OF_RNGS; n++)
681 m_Rand[n].seed(m_ulRandSeed[n]);
682
683 // If we are doing Savitzky-Golay smoothing of the vector coastline(s), calculate the filter coefficients
686
687 // Create the raster grid object
688 m_pRasterGrid = new CGeomRasterGrid(this);
689
690 // Read in the basement layer (must have this file), create the raster grid, then read in the basement DEM data to the array
692 nRet = nReadRasterBasementDEM();
693
694 if (nRet != RTN_OK)
695 return nRet;
696
697 // If we are simulating cliff collapse: then 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
699 {
701
702 if (nTmp < 3)
703 {
704 string 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;
705 cerr << strErr << endl;
706 LogStream << strErr << endl;
707 OutStream << strErr << endl;
708 return RTN_ERR_RUNDATA;
709 }
710 }
711
712 // Do some more initialisation
713 // cppcheck-suppress truncLongCastAssignment
715
716 // Mark edge cells, as defined by the basement layer
718
719 if (nRet != RTN_OK)
720 return nRet;
721
722 // // DEBUG CODE =================================================================================================================
723 // for (int n = 0; n < m_VEdgeCell.size(); n++)
724 // {
725 // LogStream << "[" << m_VEdgeCell[n].nGetX() << "][" << m_VEdgeCell[n].nGetY() << "] = {" << dGridCentroidXToExtCRSX(m_VEdgeCell[n].nGetX()) << ", " << dGridCentroidYToExtCRSY(m_VEdgeCell[n].nGetY()) << "} " << m_VEdgeCellEdge[n] << endl;
726 // }
727 // // DEBUG CODE =================================================================================================================
728
729 // 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
732
733 else
734 {
735 // The user specified a profile spacing, is this too small?
737
739 {
740 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;
741
742 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;
743
745 }
746 }
747
748 // Set the profile spacing on interventions
751
752 // 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
754
755 for (int nX = 0; nX < m_nXGridSize; nX++)
756 for (int nY = 0; nY < m_nYGridSize; nY++)
757 m_pRasterGrid->m_Cell[nX][nY].AppendLayers (m_nLayers);
758
759 // Tell the user what is happening then read in the layer files
761
762 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
763 {
764 // Read in the initial fine unconsolidated sediment depth file(s)
767
768 if (nRet != RTN_OK)
769 return (nRet);
770
771 // Read in the initial sand unconsolidated sediment depth file
774
775 if (nRet != RTN_OK)
776 return (nRet);
777
778 // Read in the initial coarse unconsolidated sediment depth file
781
782 if (nRet != RTN_OK)
783 return (nRet);
784
785 // Read in the initial fine consolidated sediment depth file
787 nRet = nReadRasterGISFile(FINE_CONS_RASTER, nLayer);
788
789 if (nRet != RTN_OK)
790 return (nRet);
791
792 // Read in the initial sand consolidated sediment depth file
794 nRet = nReadRasterGISFile(SAND_CONS_RASTER, nLayer);
795
796 if (nRet != RTN_OK)
797 return (nRet);
798
799 // Read in the initial coarse consolidated sediment depth file
802
803 if (nRet != RTN_OK)
804 return (nRet);
805 }
806
807 // Read in the initial suspended sediment depth file
810
811 if (nRet != RTN_OK)
812 return (nRet);
813
814 // Maybe read in the landform class data, otherwise calculate this during the first timestep using identification rules
815 if (! m_strInitialLandformFile.empty())
816 {
819
820 if (nRet != RTN_OK)
821 return (nRet);
822 }
823
824 // Maybe read in intervention data
825 if (! m_strInterventionClassFile.empty())
826 {
829
830 if (nRet != RTN_OK)
831 return (nRet);
832
835
836 if (nRet != RTN_OK)
837 return (nRet);
838 }
839
840 // Maybe read in the tide data
841 if (! m_strTideDataFile.empty())
842 {
844 nRet = nReadTideDataFile();
845
846 if (nRet != RTN_OK)
847 return (nRet);
848 }
849
850 // Read in the erosion potential shape function data
852 nRet = nReadShapeFunctionFile();
853
854 if (nRet != RTN_OK)
855 return (nRet);
856
857 // Do we want to output the erosion potential look-up values, for checking purposes?
860
861 // OK, now read in the vector files (if any)
864
865 // Maybe read in deep water wave station data
867 {
868 // We are reading deep water wave height, orientation and period from a file of vector points and file time series
870
871 // Read in vector points
873
874 if (nRet != RTN_OK)
875 return (nRet);
876
877 int nWaveStations = static_cast<int> (m_VnDeepWaterWaveStationID.size());
878
879 if (nWaveStations == 1)
881
882 // Read in time series values, and initialize the vector which stores each timestep's deep water wave height, orientation and period
883 nRet = nReadWaveStationInputFile (nWaveStations);
884
885 if (nRet != RTN_OK)
886 return (nRet);
887 }
888
889 // Maybe read in sediment input event data
891 {
892 // We are reading sediment input event data
894
895 // Read in vector points for sediment input events
897
898 if (nRet != RTN_OK)
899 return (nRet);
900
901 // Read in the time series values for sediment input events
903
904 if (nRet != RTN_OK)
905 return (nRet);
906 }
907
908 // Maybe read in flood input location
910 {
911 // We are reading sediment input event data
913
914 // Read in vector points for sediment input events
916
917 if (nRet != RTN_OK)
918 return (nRet);
919 }
920
921 // Open the main output
922 OutStream.open (m_strOutFile.c_str(), ios::out | ios::trunc);
923
924 if (! OutStream)
925 {
926 // Error, cannot open Out file
927 cerr << ERR << "cannot open " << m_strOutFile << " for output" << endl;
928 return (RTN_ERR_OUTFILE);
929 }
930
931 // Write beginning-of-run information to Out and Log files
933
934 // Start initializing
936
937 // Misc initialization calcs
938 m_nCoastMax = COAST_LENGTH_MAX * tMax(m_nXGridSize, m_nYGridSize); // Arbitrary but probably OK
939 m_nCoastMin = tMin(m_nXGridSize, m_nYGridSize); // In some cases the following rule doesn't work TODO 007 Info needed
940 // nRound(COAST_LENGTH_MIN_X_PROF_SPACE * m_dCoastNormalSpacing / m_dCellSide); // TODO 007 Info needed
941 m_nCoastCurvatureInterval = tMax(nRound(m_dCoastNormalSpacing / (m_dCellSide * 2)), 2); // TODO 007 Info needed
942
943 // For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) transport rate (Leo Van Rijn) TODO 007 need full reference
945
946 m_bConsChangedThisIter.resize(m_nLayers, false);
947 m_bUnconsChangedThisIter.resize(m_nLayers, false);
948
949 // Normalize sediment erodibility values, so that none are > 1
954
955 // Intialise SWL
957
958 // If SWL changes during the simulation, calculate the per-timestep increment (could be -ve)
960 {
963 }
964
965 // ===================================================== The main loop ======================================================
966 // Tell the user what is happening
968
969 while (true)
970 {
971 // Check that we haven't gone on too long: if not then update timestep number etc.
972 if (bTimeToQuit())
973 break;
974
975 // Tell the user how the simulation is progressing
977
979 LogStream << "TIMESTEP " << m_ulIter << " " << string(154, '=') << endl;
980
981 LogStream << fixed << setprecision(3);
982
983 // Check to see if there is a new intervention in place: if so, update it on the RasterGrid array
984 nRet = nUpdateIntervention();
985
986 if (nRet != RTN_OK)
987 return nRet;
988
989 // Calculate changes due to external forcing (change in still water level, tide level and deep water waves height, orientation and period)
990 nRet = nCalcExternalForcing();
991
992 if (nRet != RTN_OK)
993 return nRet;
994
995 // Do per-timestep intialization: set up the grid cells ready for this timestep, also initialize per-timestep totals. Note that in the first timestep, all cells (including hinterland cells) are given the deep water wave values
997
998 if (nRet != RTN_OK)
999 return nRet;
1000
1001 // 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()
1002 int nValidCoast = 0;
1003 nRet = nLocateSeaAndCoasts(nValidCoast);
1004
1005 if (nRet != RTN_OK)
1006 return nRet;
1007
1008 // Tell the user how the simulation is progressing
1010
1011 // Locate estuaries TODO 044 someday...
1012
1013 // Locate and trace cliff toe
1014 nRet = nLocateCliffToe();
1015
1016 if (nRet != RTN_OK)
1017 return nRet;
1018
1019 // For all cells, use classification rules to assign sea and hinterland landform categories
1021
1022 if (nRet != RTN_OK)
1023 return nRet;
1024
1025 // For every coastline, use classification rules to assign landform categories
1027
1028 if (nRet != RTN_OK)
1029 return nRet;
1030
1031 // Create all coastline-normal profiles, in coastline-concave-curvature sequence
1032 nRet = nCreateAllProfiles();
1033
1034 if (nRet != RTN_OK)
1035 return nRet;
1036
1037 // Check the coastline-normal profiles for intersection
1038 nRet = nCheckAllProfiles();
1039
1040 if (nRet != RTN_OK)
1041 return nRet;
1042
1043 // // DEBUG CODE =================
1044 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1045 // {
1046 // for (int nCoastPoint = 0; nCoastPoint < m_VCoast[nCoast].nGetCoastlineSize(); nCoastPoint++)
1047 // {
1048 // if (m_VCoast[nCoast].bIsProfileAtCoastPoint(nCoastPoint))
1049 // {
1050 // CGeomProfile const* pProfile = m_VCoast[nCoast].pGetProfileAtCoastPoint(nCoastPoint);
1051 // int nProfile = pProfile->nGetCoastID();
1052 //
1053 // LogStream << m_ulIter << ": profile " << nProfile << " bStartOfCoast = " << pProfile->bStartOfCoast() << " bEndOfCoast = " << pProfile->bEndOfCoast() << " bCShoreProblem = " << pProfile->bCShoreProblem() << " bHitLand = " << pProfile->bHitLand() << " bHitCoast = " << pProfile->bHitCoast() << " bTooShort = " << pProfile->bTooShort() << " bTruncated = " << pProfile->bTruncated() << " bHitAnotherProfile = " << pProfile->bHitAnotherProfile() << endl;
1054 // }
1055 // }
1056 // }
1057 // // DEBUG CODE =================
1058
1059 // Tell the user how the simulation is progressing
1061
1062 // Create the coast polygons
1063 nRet = nCreateAllPolygons();
1064
1065 if (nRet != RTN_OK)
1066 return nRet;
1067
1068 // // DEBUG CODE =========================================================================================================
1069 // int nNODATA = 0;
1070 // int nPoly0 = 0;
1071 // int nPoly24 = 0;
1072 // for (int nX = 0; nX < m_nXGridSize; nX++)
1073 // {
1074 // for (int nY = 0; nY < m_nYGridSize; nY++)
1075 // {
1076 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1077 // if (nTmp == INT_NODATA)
1078 // nNODATA++;
1079 //
1080 // if (nTmp == 0)
1081 // nPoly0++;
1082 //
1083 // if (nTmp == 24)
1084 // nPoly24++;
1085 // }
1086 // }
1087 // LogStream << "Before marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1088 // // LogStream << "Before marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1089 // LogStream << "Before marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1090 // // DEBUG CODE =========================================================================================================
1091
1092 // Mark cells of the raster grid that are within each polygon, and do some polygon initialization
1094
1095 // Calculate the length of the shared normal between each polygon and the adjacent polygon(s)
1097
1098 if (nRet != RTN_OK)
1099 return nRet;
1100
1101 // Tell the user how the simulation is progressing
1103
1104 // // DEBUG CODE =========================================================================================================
1105 // nNODATA = 0;
1106 // nPoly0 = 0;
1107 // nPoly24 = 0;
1108 // for (int nX = 0; nX < m_nXGridSize; nX++)
1109 // {
1110 // for (int nY = 0; nY < m_nYGridSize; nY++)
1111 // {
1112 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1113 // if (nTmp == INT_NODATA)
1114 // nNODATA++;
1115 //
1116 // if (nTmp == 0)
1117 // nPoly0++;
1118 //
1119 // if (nTmp == 24)
1120 // nPoly24++;
1121 // }
1122 // }
1123 // LogStream << "After marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1124 // // LogStream << "After marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1125 // LogStream << "After marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1126 // // DEBUG CODE =========================================================================================================
1127 // PropagateWind();
1128
1129 // Give every coast point a value for deep water wave height and direction
1131
1132 if (nRet != RTN_OK)
1133 return nRet;
1134
1135 // // DEBUG CODE ===============
1136 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1137 // {
1138 // LogStream << "====================" << endl;
1139 //
1140 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1141 // {
1142 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfile(nProfile);
1143 // int nCell = pProfile->nGetNumCellsInProfile();
1144 // LogStream << "Profile " << pProfile->nGetCoastID() << " nGetNumCellsInProfile() = " << nCell << endl;
1145 // }
1146 //
1147 // LogStream << endl;
1148 //
1149 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1150 // {
1151 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfileWithDownCoastSeq(nProfile);
1152 // int nCell = pProfile->nGetNumCellsInProfile();
1153 // LogStream << "Profile " << pProfile->nGetCoastID() << " nGetNumCellsInProfile() = " << nCell << endl;
1154 // }
1155 //
1156 // LogStream << "====================" << endl;
1157 // }
1158 // // DEBUG CODE =====================
1159
1160 // Change the wave properties in all shallow water sea cells: propagate waves and define the active zone, also locate wave shadow zones
1161 nRet = nDoAllPropagateWaves();
1162
1163 if (nRet != RTN_OK)
1164 return nRet;
1165
1166 // Output polygon share table and pre-existing sediment table to log file
1168 {
1169 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1170 {
1171 WritePolygonInfoTable(nCoast);
1173 }
1174 }
1175
1176 // Tell the user how the simulation is progressing
1178
1179 // // DEBUG CODE ===========================================================================================================
1180 // string strOutFile = m_strOutPath;
1181 // strOutFile += "sea_wave_height_CHECKPOINT_";
1182 // strOutFile += to_string(m_ulIter);
1183 // strOutFile += ".tif";
1184 //
1185 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1186 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1187 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1188 // pDataSet->SetGeoTransform(m_dGeoTransform);
1189 //
1190 // int nn = 0;
1191 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1192 // for (int nY = 0; nY < m_nYGridSize; nY++)
1193 // {
1194 // for (int nX = 0; nX < m_nXGridSize; nX++)
1195 // {
1196 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1197 // }
1198 // }
1199 //
1200 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1201 // pBand->SetNoDataValue(m_dMissingValue);
1202 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1203 //
1204 // if (nRet == CE_Failure)
1205 // return RTN_ERR_GRIDCREATE;
1206 //
1207 // GDALClose(pDataSet);
1208 // delete[] pdRaster;
1209 // // DEBUG CODE ===========================================================================================================
1210 //
1211 // // DEBUG CODE ===========================================================================================================
1212 // strOutFile = m_strOutPath;
1213 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1214 // strOutFile += to_string(m_ulIter);
1215 // strOutFile += ".tif";
1216 //
1217 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1218 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1219 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1220 // pDataSet->SetGeoTransform(m_dGeoTransform);
1221 //
1222 // nn = 0;
1223 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1224 // for (int nY = 0; nY < m_nYGridSize; nY++)
1225 // {
1226 // for (int nX = 0; nX < m_nXGridSize; nX++)
1227 // {
1228 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1229 // }
1230 // }
1231 //
1232 // pBand = pDataSet->GetRasterBand(1);
1233 // pBand->SetNoDataValue(m_dMissingValue);
1234 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1235 //
1236 // if (nRet == CE_Failure)
1237 // return RTN_ERR_GRIDCREATE;
1238 //
1239 // GDALClose(pDataSet);
1240 // delete[] pdRaster;
1241 // // DEBUG CODE ===========================================================================================================
1242
1243 // Save the not-deposited values, to be shown in the logfile after we've finished beach sediment movement
1246
1249 {
1250 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << " m_dUnconsSandNotDepositedLastIter = " << m_dUnconsSandNotDepositedLastIter << endl;
1251 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea << " m_dUnconsCoarseNotDepositedLastIter = " << m_dUnconsCoarseNotDepositedLastIter << endl;
1252 }
1253
1255 {
1256 // Calculate elevation change on the consolidated sediment which comprises the coastal platform
1258
1259 if (nRet != RTN_OK)
1260 return nRet;
1261 }
1262
1263 // Output shore platform erosion table to log file
1265 {
1266 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1268 }
1269
1271 {
1272 // Do all cliff collapses for this timestep (if any)
1274
1275 if (nRet != RTN_OK)
1276 return nRet;
1277 }
1278
1279 // Output cliff collapse table to log file
1281 {
1282 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1284 }
1285
1286 // Tell the user how the simulation is progressing
1288
1290 {
1291 // 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
1293
1294 // 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 clases
1296
1297 if (nRet != RTN_OK)
1298 return nRet;
1299 }
1300
1301 // 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
1302 if (m_bSedimentInput)
1303 {
1305
1306 if (nRet != RTN_OK)
1307 return nRet;
1308
1309 // If we have had at least one sediment input event this iteration, then output the sediment event per polygon table to the log file
1311 {
1312 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1314 }
1315 }
1316
1317// // 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
1318// double dFineThisIter = m_dThisIterActualPlatformErosionFineCons + m_dThisIterCliffCollapseErosionFineUncons + m_dThisIterCliffCollapseErosionFineCons + m_dThisIterCliffCollapseFineErodedDuringDeposition + m_dThisIterBeachErosionFine - m_dThisIterLeftGridUnconsFine;
1319//
1320// m_dThisIterFineSedimentToSuspension += dFineThisIter;
1321
1322 // Tell the user how the simulation is progressing
1324
1325 // // DEBUG CODE ===========================================================================================================
1326 // string strOutFile = m_strOutPath;
1327 // strOutFile += "sea_wave_height_CHECKPOINT_";
1328 // strOutFile += to_string(m_ulIter);
1329 // strOutFile += ".tif";
1330 //
1331 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1332 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1333 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1334 // pDataSet->SetGeoTransform(m_dGeoTransform);
1335 //
1336 // int nn = 0;
1337 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1338 // for (int nY = 0; nY < m_nYGridSize; nY++)
1339 // {
1340 // for (int nX = 0; nX < m_nXGridSize; nX++)
1341 // {
1342 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1343 // }
1344 // }
1345 //
1346 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1347 // pBand->SetNoDataValue(m_dMissingValue);
1348 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1349 //
1350 // if (nRet == CE_Failure)
1351 // return RTN_ERR_GRIDCREATE;
1352 //
1353 // GDALClose(pDataSet);
1354 // delete[] pdRaster;
1355 // // DEBUG CODE ===========================================================================================================
1356 //
1357 // // DEBUG CODE ===========================================================================================================
1358 // strOutFile = m_strOutPath;
1359 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1360 // strOutFile += to_string(m_ulIter);
1361 // strOutFile += ".tif";
1362 //
1363 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1364 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1365 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1366 // pDataSet->SetGeoTransform(m_dGeoTransform);
1367 //
1368 // nn = 0;
1369 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1370 // for (int nY = 0; nY < m_nYGridSize; nY++)
1371 // {
1372 // for (int nX = 0; nX < m_nXGridSize; nX++)
1373 // {
1374 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1375 // }
1376 // }
1377 //
1378 // pBand = pDataSet->GetRasterBand(1);
1379 // pBand->SetNoDataValue(m_dMissingValue);
1380 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1381 //
1382 // if (nRet == CE_Failure)
1383 // return RTN_ERR_GRIDCREATE;
1384 //
1385 // GDALClose(pDataSet);
1386 // delete[] pdRaster;
1387 // // DEBUG CODE ===========================================================================================================
1388
1389 // Do some end-of-timestep updates to the raster grid, also update per-timestep and running totals
1390 nRet = nUpdateGrid();
1391
1392 if (nRet != RTN_OK)
1393 return nRet;
1394
1395 // Make water level inundation on grid
1397 {
1398 m_nLevel = 0;
1399
1400 nRet = nLocateFloodAndCoasts();
1401
1402 if (nRet != RTN_OK)
1403 return nRet;
1404 }
1405
1407 {
1408 // TODO 007 Info needed
1409 m_nLevel = 1;
1410
1411 nRet = nLocateFloodAndCoasts();
1412
1413 if (nRet != RTN_OK)
1414 return nRet;
1415 }
1416
1417 // Now save results, first the raster and vector GIS files if required
1418 m_bSaveGISThisIter = false;
1419
1421 {
1422 m_bSaveGISThisIter = true;
1423
1424 // Save the values from the RasterGrid array into raster GIS files
1425 if (! bSaveAllRasterGISFiles())
1427
1428 // Tell the user how the simulation is progressing
1430
1431 // Save the vector GIS files
1432 if (! bSaveAllVectorGISFiles())
1434
1435 // Tell the user how the simulation is progressing
1437 }
1438
1439 // Output per-timestep results to the .out file
1441 return (RTN_ERR_TEXT_FILE_WRITE);
1442
1443 // Now output time series CSV stuff
1444 if (! bWriteTSFiles())
1446
1447 // Tell the user how the simulation is progressing
1449
1450 // Update grand totals
1452
1453 } // ================================================ End of main loop ======================================================
1454
1455 // =================================================== post-loop tidying =====================================================
1456 // Tell the user what is happening
1458
1459 // Write end-of-run information to Out, Log and time-series files
1460 nRet = nWriteEndRunDetails();
1461
1462 if (nRet != RTN_OK)
1463 return (nRet);
1464
1465 // Do end-of-run memory clerance
1467
1468 return RTN_OK;
1469}
Geometry cass used to represent the raster grid of cell objects.
Definition raster_grid.h:35
double m_dThisIterPotentialBeachErosion
Definition simulation.h:890
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:983
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:221
int m_nLogFileDetail
Definition simulation.h:591
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:106
void WritePolygonSedimentInputEventTable(int const)
Writes to the log file a table showing per-polygon sediment input event totals.
double m_dAllCellsDeepWaterWaveHeight
Deep water wave height (m) for all sea cells.
Definition simulation.h:792
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:248
static void AnnounceInitializing(void)
Tells the user that we are now initializing.
Definition utils.cpp:644
int m_nGISMaxSaveDigits
Definition simulation.h:509
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
Definition simulation.h:91
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:636
void CalcSavitzkyGolayCoeffs(void)
Calculates the Savitzky-Golay smoothing coefficients for a given size of smoothing window....
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:653
bool m_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
Definition simulation.h:88
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:194
int nLocateSeaAndCoasts(int &)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
bool m_bHaveConsolidatedSediment
Definition simulation.h:453
double m_dNotchDepthAtCollapse
Definition simulation.h:973
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:442
time_t m_tSysEndTime
System finish-simulation time.
double m_dTotalCoarseUnconsInPolygons
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:397
double m_dMinSWL
Minimum still water level.
Definition simulation.h:759
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:849
void AnnounceReadDeepWaterWaveValuesGIS(void) const
Tells the user that we are now reading the deep water wave values GIS file.
Definition utils.cpp:488
double m_dThisIterSWL
Definition simulation.h:748
int m_nBeachErosionDepositionEquation
Definition simulation.h:543
ofstream CliffCollapseNetChangeTSStream
bool m_bCoastSave
Save.
Definition simulation.h:266
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:317
bool bWritePerTimestepResults(void)
Write the results for this timestep to the .out file.
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
double dGetThisIterTotWaterLevel(void) const
Returns this timestep's total water level.
void AnnounceReadInitialSandConsSedGIS(int const) const
Tells the user that we are now reading the initial sand consolidated sediment depth GIS file.
Definition utils.cpp:598
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:462
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:559
double m_dL_0
Deep water wave length (m)
Definition simulation.h:783
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:804
bool m_bFloodSetupSurgeRunupTSSave
Definition simulation.h:331
bool bSetUpTSFiles(void)
The bSetUpTSFiles member function sets up the time series files.
Definition utils.cpp:1105
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:546
double m_dThisIterBeachErosionCoarse
Definition simulation.h:902
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:459
double m_dStartIterUnconsCoarseAllCells
int nReadRasterGISFile(int const, int const)
Reads all other raster GIS datafiles into the RasterGrid array.
double m_dCoastNormalLength
Length of the coastline-normal profiles, in m.
Definition simulation.h:867
void WritePolygonCliffCollapseErosion(int const)
Writes to the log file a table showing per-polygon per-polygon cliff collapse.
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:334
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
double m_dGISMissingValue
The value for floating-point missing values, as read from GIS input files.
double m_dUnconsCoarseNotDepositedLastIter
double m_dCPUClock
Total elapsed CPU time.
Definition simulation.h:727
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
bool m_bSingleDeepWaterWaveValues
Definition simulation.h:388
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:518
long m_lGDALMaxCanWrite
Definition simulation.h:611
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:124
double m_dSouthEastXExtCRS
Definition simulation.h:679
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:118
long double m_ldGTotActualCoarseBeachErosion
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
int nReadWaveStationInputFile(int const)
Reads the deep water wave station input data. Each point in m_strDeepWaterWavesInputFile is a triad o...
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:269
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:834
void WriteLookUpData(void) const
Output the erosion potential look-up values, for checking purposes.
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Definition simulation.h:934
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:275
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:290
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
Definition simulation.h:771
int nReadSedimentInputEventFile(void)
Reads the sediment input event file.
double m_dThisIterActualPlatformErosionCoarseCons
Definition simulation.h:886
bool m_bActualBeachErosionSave
Definition simulation.h:159
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:465
int nLocateCliffToe(void)
double m_dThisIterTopElevMin
This-iteration lowest elevation of DEM.
bool m_bStillWaterLevelTSSave
Save the still water level time series file?
Definition simulation.h:299
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:421
GDALDataType m_GDALWriteIntDataType
Definition simulation.h:603
long double m_ldGTotCliffTalusFineToSuspension
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:227
bool m_bTotalActualPlatformErosionSave
Definition simulation.h:152
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:257
double m_dCoarseErodibility
The relative erodibility (0- 1) of coarse unconsolidated beach sediment.
Definition simulation.h:831
double m_dGeoTransform[6]
Definition simulation.h:731
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:986
double m_dMissingValue
Used by CoastalME for floating-point missing values.
int m_nUnconsSedimentHandlingAtGridEdges
Definition simulation.h:539
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:828
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:85
double m_dInvCellDiagonal
Inverse of m_dCellDiagonal.
Definition simulation.h:701
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:574
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:840
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:200
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:323
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:311
double m_dStartIterSuspFineInPolygons
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:236
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:633
static void AnnounceSimEnd(void)
Announce the end of the simulation.
Definition utils.cpp:1434
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:627
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:960
int nGetGridYMax(void) const
Returns the size of the grid in the Y direction.
void AnnounceReadICGIS(void) const
Tells the user that we are now reading the Intervention class GIS file.
Definition utils.cpp:458
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:786
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:109
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:436
void WriteStartRunDetails(void)
Writes beginning-of-run information to Out and Log files.
double m_dThisIterCliffCollapseErosionCoarseUncons
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:370
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:176
ofstream CliffCollapseDepositionTSStream
Cliff collapse deposition time series file output stream.
long double m_ldGTotCoarseBeachDeposition
double m_dDepositionCoarseDiff
Definition simulation.h:950
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:173
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:822
double dGetMissingValue(void) const
Returns the NODATA value.
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:568
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:577
unsigned long m_ulThisIterNumActualPlatformErosionCells
Definition simulation.h:641
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:197
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:302
int m_nCoastNormalSpacing
Average spacing between coastline normals, measured in cells.
Definition simulation.h:498
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
Definition simulation.h:555
long double m_ldGTotPotentialSedLostBeachErosion
double m_dThisIterCliffCollapseErosionFineUncons
Definition simulation.h:994
double dGetD50Coarse(void) const
Returns the global d50 value for coarse sediment.
bool m_bTotCliffCollapseSave
Save total cliff collapse raster GIS files?
Definition simulation.h:224
int nReadShapeFunctionFile(void)
Reads the shape of the erosion potential distribution (see shape function in Walkden & Hall,...
static void AnnounceAddLayers(void)
Tells the user that we are now adding layers.
Definition utils.cpp:418
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:361
bool m_bSliceSave
Save slices?
Definition simulation.h:100
void WritePolygonShorePlatformErosion(int const)
Writes to the log file a table showing per-polygon unconsolidated sand/coarse sediment derived from e...
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:233
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:737
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:170
double m_dNorthWestYExtCRS
Definition simulation.h:675
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:263
int m_nLayers
The number of sediment layers.
Definition simulation.h:468
bool bFindExeDir(char const *)
Finds the folder (directory) in which the CoastalME executable is located.
Definition utils.cpp:218
double m_dStartIterConsCoarseAllCells
double m_dStartIterConsSandAllCells
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:403
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:394
unsigned long m_ulThisIterNumBeachDepositionCells
Definition simulation.h:653
double m_dInmersedToBulkVolumetric
Definition simulation.h:854
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:272
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:112
CSimulation(void)
The CSimulation constructor.
double m_dDepositionSandDiff
Definition simulation.h:946
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:79
unsigned long m_ulMissingValueBasementCells
The number of basement cells marked with as missing value.
Definition simulation.h:664
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
int nReadVectorGISFile(int const)
Reads vector GIS datafiles using 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:515
double m_dThisIterPotentialPlatformErosion
Definition simulation.h:874
bool bWriteTSFiles(void)
Write the results for this timestep to the time series CSV files.
double m_dDeanProfileStartAboveSWL
Berm height i.e. height above SWL of start of depositional Dean profile.
int m_nSavGolCoastPoly
Definition simulation.h:478
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:103
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:121
double m_dNotchBaseBelowSWL
Notch base below SWL (m)
Definition simulation.h:976
int m_nRunUpEquation
The run-up equation used TODO 007.
Definition simulation.h:594
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
void AnnounceReadSedimentEventInputValuesGIS(void) const
Tells the user that we are now reading the sediment input events GIS file.
Definition utils.cpp:503
double dGetD50Fine(void) const
Returns the global d50 value for fine sediment.
double m_dDepthOverDBMax
Definition simulation.h:954
long double m_ldGTotCliffCollapseCoarse
All-simulation total of coarse sediment from cliff collapse (m)
int m_nCoastNormalInterventionSpacing
Definition simulation.h:502
double m_dFineErodibility
The relative erodibility (0- 1) of fine unconsolidated beach sediment.
Definition simulation.h:825
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
time_t m_tSysStartTime
System start-simulation time.
double m_dBreakingWaveHeightDepthRatio
Breaking wave height-to-depth ratio.
Definition simulation.h:789
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
Definition utils.cpp:518
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:861
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector OGR driver supports file creation etc.
bool m_bHaveWaveStationData
Do we have wave station data?
Definition simulation.h:391
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:734
int nDoSimulation(int, char const *[])
Runs the simulation.
void StartClock(void)
Starts the clock ticking.
Definition utils.cpp:194
long double m_ldGTotSuspendedSediment
All-simulation total of suspended sediment (m)
int m_nSavGolCliffEdgePoly
Definition simulation.h:488
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:837
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:807
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:215
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:218
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
Definition utils.cpp:533
ofstream StillWaterLevelTSStream
SWL time series file output stream.
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
Definition utils.cpp:2954
double m_dThisIterActualPlatformErosionSandCons
Definition simulation.h:882
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:355
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:400
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
Definition utils.cpp:427
int m_nCliffEdgeSmooth
Which method to use for cliff edge smoothing.
Definition simulation.h:481
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:969
double m_dThisIterBeachDepositionCoarse
Definition simulation.h:910
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:813
long double m_ldGTotCliffTalusSandDeposition
double m_dCellDiagonal
Length of a cell's diagonal (in external CRS units)
Definition simulation.h:695
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:251
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:133
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:843
double m_dInvCellSide
Inverse of m_dCellSide.
Definition simulation.h:698
int m_nWavePropagationModel
Definition simulation.h:565
long double m_ldGTotCliffCollapseSandErodedDuringDeposition
double m_dAllCellsDeepWaterWaveAngle
Deep water wave angle for all sea cells.
Definition simulation.h:795
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:710
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:278
int nGetGridXMax(void) const
Returns the cell size.
int m_nCliffEdgeSmoothWindow
The size of the window used for cliff edge smoothing. Must be an odd number.
Definition simulation.h:484
int m_nDeepWaterWaveDataNumTimeSteps
Definition simulation.h:587
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
Definition utils.cpp:397
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
Definition simulation.h:741
double m_dThisIterUnconsCoarseCliffDeposition
bool m_bGDALCanWriteInt32
Definition simulation.h:378
bool m_bRasterWaveFloodLineSave
Are we saving the raster wave flood line? TODO 007.
Definition simulation.h:430
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:136
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:870
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:957
double m_dRegularSaveTime
Definition simulation.h:714
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:281
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:349
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
double m_dThisIterUnconsSandCliffDeposition
vector< int > m_VnDeepWaterWaveStationID
long double m_ldGTotSandSedimentInput
All-simulation total of sand sediment input (m)
bool m_bFloodSetupSurgeTSSave
Definition simulation.h:327
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:148
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007.
Definition simulation.h:424
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:130
double m_dNorthWestXExtCRS
Definition simulation.h:671
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:816
static void AnnounceStart(void)
Tells the user that we have started the simulation.
Definition utils.cpp:186
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:505
ofstream CliffCollapseErosionTSStream
Cliff collapse erosion time series file output stream.
double m_dThisIterPotentialSedLostBeachErosion
Definition simulation.h:918
double m_dSouthEastYExtCRS
Definition simulation.h:683
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:155
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
~CSimulation(void)
The CSimulation destructor.
long double m_ldGTotCoarseDepositionDiff
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
long double m_ldGTotActualCoarseLostBeachErosion
bool m_bGISSaveDigitsSequential
Definition simulation.h:449
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:580
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:188
double m_dMinCliffTalusHeightFrac
Definition simulation.h:990
double m_dThisIterBeachErosionSand
Definition simulation.h:898
double m_dAccumulatedSeaLevelChange
Definition simulation.h:756
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:284
void WritePolygonPreExistingSedimentTable(int const)
Writes to the log file a table showing per-polygon pre-existing unconsolidated sediment.
bool m_bStormSurgeSave
Are we saving the storm surge? TODO 007.
Definition simulation.h:418
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:145
double m_dThisIterFineSedimentToSuspension
Definition simulation.h:914
int nDoAllWaveEnergyToCoastLandforms(void)
Update accumulated wave energy in coastal landform objects.
double m_dThisIterBeachErosionFine
Definition simulation.h:894
void DoAllPotentialBeachErosion(void)
Uses either the CERC equation or the Kamphuis (1990) equation to calculate potential (unconstrained) ...
double m_dThisIterCliffCollapseSandErodedDuringDeposition
Definition simulation.h:938
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:571
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
unsigned long m_ulThisIterNumActualBeachErosionCells
Definition simulation.h:649
bool bReadIniFile(void)
The bReadIniFile member function reads the initialization file.
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:76
double m_dCliffDepositionA
Definition simulation.h:980
string m_strDataPathName
Folder in which the CME data file is found.
string m_strOutPath
Path for all output files.
bool m_bBeachErosionTSSave
Save the beach (unconsolidated sediment) erosion time series file?
Definition simulation.h:314
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
bool m_bTotalPotentialBeachErosionSave
Definition simulation.h:163
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
Definition simulation.h:637
double m_dStartIterUnconsSandAllCells
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:762
long double m_ldGTotActualSandLostBeachErosion
double m_dDeltaSWLPerTimestep
If long-term SWL changes, the increment per timestep.
Definition simulation.h:744
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:512
string m_strInterventionClassFile
Name of intervention class file.
default_random_engine m_Rand[NUMBER_OF_RNGS]
The c++11 random number generators.
long double m_ldGTotActualFineLostBeachErosion
bool m_bFloodSWLSetupLine
Are we saving the flood still water level setup line? TODO 007.
Definition simulation.h:439
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:239
double m_dThisIterCliffCollapseErosionFineCons
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:182
long double m_ldGTotCoarseSedLostCliffCollapse
All-simulation total of coarse sediment lost via cliff collapse (m)
double m_dCoastNormalInterventionSpacing
Average spacing of the coastline-normal profiles on interventions, in m.
Definition simulation.h:864
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:583
bool m_bTotalActualBeachErosionSave
Definition simulation.h:167
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:212
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
double m_dThisIterDiffWaveSetupWaterLevel
TODO 007 Info needed.
Definition simulation.h:768
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:185
double m_dTotalCoarseConsInPolygons
int m_nCoastCurvatureMovingWindowSize
Definition simulation.h:599
ofstream SeaAreaTSStream
Sea area time series file output stream.
unsigned long m_ulThisIterNumSeaCells
The number of grid cells which are marked as sea, for this iteration.
Definition simulation.h:630
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
Definition utils.cpp:473
double m_dTotalSandUnconsInPolygons
void AnnounceReadInitialCoarseConsSedGIS(int const) const
Tells the user that we are now reading the initial coarse consolidated sediment depth GIS file.
Definition utils.cpp:611
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:412
long m_lGDALMinCanWrite
Definition simulation.h:615
int nCreateAllProfiles(void)
Create coastline-normal profiles for all coastlines. The first profiles are created 'around' the most...
double m_dStartIterUnconsFineAllCells
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:206
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:406
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:82
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:717
long double m_ldGTotActualFineBeachErosion
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:260
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 time step) in hours.
Definition simulation.h:707
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
Definition simulation.h:657
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:308
int m_nXMinBoundingBox
The minimum x value of the bounding box.
Definition simulation.h:552
double dGetD50Sand(void) const
Returns the global d50 value for sand sediment.
ofstream PlatformErosionTSStream
Shore platform erosion time series file output stream.
void DoEndOfTimestepTotals(void)
Update and print totals at the end of each timestep.
double m_dCellArea
Area of a cell (in external CRS units)
Definition simulation.h:692
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:127
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
Definition simulation.h:661
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:801
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
Definition utils.cpp:585
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:139
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:367
unsigned long m_ulThisIterNumPotentialBeachErosionCells
Definition simulation.h:645
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:203
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:293
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:471
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:254
string m_strInitialLandformFile
Name of initial landform file.
double m_dC_0
Deep water wave speed (m/s)
Definition simulation.h:780
double m_dThisIterCliffCollapseErosionSandCons
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:320
double m_dThisIterBeachDepositionSand
Definition simulation.h:906
int nReadTideDataFile(void)
Reads the tide time series data.
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:209
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:296
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:381
double dGetThisIterSWL(void) const
Returns this timestep's still water level.
double m_dThisIterLeftGridUnconsCoarse
Definition simulation.h:930
double m_dThisIterCliffCollapseErosionSandUncons
Definition simulation.h:998
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:810
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:624
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:352
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:242
bool bOpenLogFile(void)
Opens the log file.
Definition utils.cpp:373
double m_dTotalSandConsInPolygons
bool m_bSlopeSave
Save slope raster grids?
Definition simulation.h:94
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:618
void AnnounceLicence(void)
Tells the user about the licence.
Definition utils.cpp:257
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:191
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:819
int m_nNumPolygonGlobal
Number of global (all coasts) polygons.
Definition simulation.h:535
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:704
double m_dTotalFineUnconsInPolygons
long double m_ldGTotSandDepositionDiff
bool m_bCSVPerTimestepResults
Output per-timestep results in CSV format instead of fixed-width?
Definition simulation.h:346
double m_dCliffSlopeLimit
Slope limit for cliff toe detection.
Definition simulation.h:491
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:1331
double m_dTotalFineConsInPolygons
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:686
int nDoAllPropagateWaves(void)
Simulates wave propagation along all coastline-normal profiles.
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:337
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:774
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:689
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:966
long double m_ldGTotActualSandBeachErosion
double m_dBreakingWaveHeight
The height of breaking waves (m)
Definition simulation.h:777
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
Definition utils.cpp:1650
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:230
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:798
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Definition simulation.h:942
int nMarkBoundingBoxEdgeCells(void)
Mark cells which are at the edge of a bounding box which represents the valid part of the grid,...
long double m_ldGTotSandBeachDeposition
double m_dUSaveTime[SAVEMAX]
Definition simulation.h:721
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
Definition utils.cpp:443
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
double m_dThisIterActualPlatformErosionFineCons
Definition simulation.h:878
long double m_ldGTotPotentialBeachErosion
All-simulation total of potential beach erosion (m), all size classes.
double m_dProfileMaxSlope
Maximum slope on coastline-normal profiles.
Definition simulation.h:963
int m_nProfileSmoothWindow
Definition simulation.h:495
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:364
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
Definition utils.cpp:435
double m_dThisIterCliffCollapseErosionCoarseCons
double m_dThisIterLeftGridUnconsSand
Definition simulation.h:926
double m_dDepthOfClosure
Definition simulation.h:858
int nCheckAllProfiles(void)
Check all coastline-normal profiles and modify the profiles if they intersect, then mark valid profil...
int nInitGridAndCalcStillWaterLevel(void)
At the beginning of each timestep: clear vector coasts, profiles, and polygons, initialize the raster...
Definition init_grid.cpp:50
double m_dStartIterSuspFineAllCells
string m_strOutFile
Name of main output file.
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007.
Definition simulation.h:427
double m_dThisIterDiffTotWaterLevel
TODO 007 Info needed.
Definition simulation.h:765
vector< bool > m_bConsChangedThisIter
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.
Definition simulation.h:415
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:624
double m_dClkLast
Last value returned by clock()
Definition simulation.h:724
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:245
long double m_ldGTotFineSedimentInput
All-simulation total of fine sediment input (m)
double m_dThisIterMeanSWL
Definition simulation.h:752
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
Definition simulation.h:305
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:142
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
GDALDataType m_GDALWriteFloatDataType
Definition simulation.h:607
bool m_bGDALCanWriteFloat
Definition simulation.h:374
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
Definition utils.cpp:572
int nHandleCommandLineParams(int, char const *[])
Handles command-line parameters.
Definition utils.cpp:90
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:456
ofstream OutStream
The main output file stream.
double m_dDurationUnitsMult
Multiplier for duration units, to convert to hours.
Definition simulation.h:667
bool m_bFloodSWLSetupSurgeRunupLine
Are we saving the flood still water level setup surge runup line? TODO 007.
Definition simulation.h:445
unsigned long m_ulTotTimestep
The target number of iterations.
Definition simulation.h:621
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:340
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:846
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:343
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP.
Definition simulation.h:597
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
Definition simulation.h:409
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:287
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:433
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:115
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:358
int m_nCoastSmoothWindow
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:474
double m_dThisIterLeftGridUnconsFine
Definition simulation.h:922
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:179
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:474
T tMin(T a, T b)
Definition cme.h:1251
double const TOLERANCE
Definition cme.h:811
int const SAND_CONS_RASTER
Definition cme.h:566
double const INTERVENTION_PROFILE_SPACING_FACTOR
Definition cme.h:820
int const SEDIMENT_INPUT_EVENT_LOCATION_VEC
Definition cme.h:593
string const ERR
Definition cme.h:890
int const RTN_ERR_LOGFILE
Definition cme.h:702
int const DEFAULT_PROFILE_SPACING
Definition cme.h:483
int const RTN_ERR_RASTER_GIS_OUT_FORMAT
Definition cme.h:709
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:712
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:489
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1284
int const RTN_ERR_PROFILESPACING
Definition cme.h:716
int const FLOOD_LOCATION_VEC
Definition cme.h:598
int const DEEP_WATER_WAVE_STATIONS_VEC
Definition cme.h:590
int const RTN_ERR_RUNDATA
Definition cme.h:699
double const MASS_BALANCE_TOLERANCE
Definition cme.h:814
T tMax(T a, T b)
Definition cme.h:1240
int const SAVEMAX
Definition cme.h:462
int const NUMBER_OF_RNGS
Definition cme.h:461
int const RTN_ERR_TSFILE
Definition cme.h:704
int const INTERVENTION_CLASS_RASTER
Definition cme.h:573
int const RTN_ERR_VECTOR_GIS_OUT_FORMAT
Definition cme.h:710
int const RTN_USER_ABORT
Definition cme.h:695
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:772
int const RTN_ERR_CMEDIR
Definition cme.h:698
int const RTN_ERR_INI
Definition cme.h:697
int const RTN_OK
Definition cme.h:692
int const RTN_ERR_TEXT_FILE_WRITE
Definition cme.h:711
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:713
int const SAND_UNCONS_RASTER
Definition cme.h:569
int const FINE_UNCONS_RASTER
Definition cme.h:568
int const COARSE_UNCONS_RASTER
Definition cme.h:570
double const DBL_NODATA
Definition cme.h:822
int const RTN_ERR_OUTFILE
Definition cme.h:703
int const SUSP_SED_RASTER
Definition cme.h:571
int const FINE_CONS_RASTER
Definition cme.h:565
int const COARSE_CONS_RASTER
Definition cme.h:567
int const COAST_LENGTH_MAX
Definition cme.h:466
int const LANDFORM_RASTER
Definition cme.h:572
int const INTERVENTION_HEIGHT_RASTER
Definition cme.h:574
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:714
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Version of the above that returns an int.