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
15This file is part of CoastalME, the Coastal Modelling Environment.
16
17CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
18
19This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23==============================================================================================================================*/
24#include <assert.h>
25
26#include <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
180
181 m_bGDALCanCreate = true;
182
185
186 m_nLayers =
195 m_nGISSave =
196 m_nUSave =
202 // m_nNThisIterCliffCollapse =
203 // m_nNTotCliffCollapse =
217 m_nLevel =
219
220 // TODO 011 May wish to make this a user-supplied value
222
223 m_nXMinBoundingBox = INT_MAX;
224 m_nXMaxBoundingBox = INT_MIN;
225 m_nYMinBoundingBox = INT_MAX;
226 m_nYMaxBoundingBox = INT_MIN;
227
228 // cppcheck-suppress useInitializationList
229 m_GDALWriteIntDataType = GDT_Unknown;
230 // cppcheck-suppress useInitializationList
231 m_GDALWriteFloatDataType = GDT_Unknown;
232
235
236 m_ulIter =
249
250 for (int i = 0; i < NUMBER_OF_RNGS; i++)
251 m_ulRandSeed[i] = 0;
252
253 for (int i = 0; i < SAVEMAX; i++)
254 m_dUSaveTime[i] = 0;
255
272 m_dClkLast =
277 m_dOrigSWL =
281 m_dC_0 =
282 m_dL_0 =
289 m_dR =
290 m_dD50Fine =
291 m_dD50Sand =
301 m_dKLS =
303 m_dG =
380
381 m_dMinSWL = DBL_MAX;
382 m_dMaxSWL = DBL_MIN;
383
384 for (int i = 0; i < 6; i++)
385 m_dGeoTransform[i] = 0;
386
387 // TODO 011 May wish to make this a user-supplied value
389
421
423 m_tSysEndTime = 0;
424
425 m_pRasterGrid = NULL;
426}
427
428//===============================================================================================================================
430//===============================================================================================================================
432{
433 // Close output files if open
434 if (LogStream && LogStream.is_open())
435 {
436 LogStream.flush();
437 LogStream.close();
438 }
439
440 if (OutStream && OutStream.is_open())
441 {
442 OutStream.flush();
443 OutStream.close();
444 }
445
446 if (SeaAreaTSStream && SeaAreaTSStream.is_open())
447 {
448 SeaAreaTSStream.flush();
449 SeaAreaTSStream.close();
450 }
451
453 {
456 }
457
459 {
462 }
463
465 {
468 }
469
471 {
474 }
475
477 {
480 }
481
483 {
486 }
487
489 {
492 }
493
495 {
498 }
499
500 if (m_pRasterGrid)
501 delete m_pRasterGrid;
502}
503
504//===============================================================================================================================
506//===============================================================================================================================
508{
509 return m_dMissingValue;
510}
511
512//===============================================================================================================================
514//===============================================================================================================================
516{
517 return m_dThisIterSWL;
518}
519
520//===============================================================================================================================
522//===============================================================================================================================
527
528// //===============================================================================================================================
529// //! Returns the max elevation of the beach above SWL
530// //===============================================================================================================================
531// double CSimulation::dGetMaxBeachElevAboveSWL (void) const
532// {
533// return m_dMaxBeachElevAboveSWL;
534// }
535
536//===============================================================================================================================
537// Returns the cell side length
538//===============================================================================================================================
539// double CSimulation::dGetCellSide(void) const
540// {
541// return m_dCellSide;
542// }
543
544//===============================================================================================================================
546//===============================================================================================================================
548{
549 return m_nXGridSize;
550}
551
552//===============================================================================================================================
554//===============================================================================================================================
556{
557 return m_nYGridSize;
558}
559
560//===============================================================================================================================
562//===============================================================================================================================
563double CSimulation::dGetD50Fine (void) const
564{
565 return m_dD50Fine;
566}
567
568//===============================================================================================================================
570//===============================================================================================================================
571double CSimulation::dGetD50Sand (void) const
572{
573 return m_dD50Sand;
574}
575
576//===============================================================================================================================
578//===============================================================================================================================
579double CSimulation::dGetD50Coarse (void) const
580{
581 return m_dD50Coarse;
582}
583
584//===============================================================================================================================
586//===============================================================================================================================
587int CSimulation::nDoSimulation(int nArg, char const* pcArgv[])
588{
589 // ================================================== initialization section ================================================
590 // Hello, World!
592
593 // Start the clock ticking
594 StartClock();
595
596 // Deal with command-line parameters
597 int nRet = nHandleCommandLineParams(nArg, pcArgv);
598 if (nRet != RTN_OK)
599 return (nRet);
600
601 // 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)
602 if (! bFindExeDir(pcArgv[0]))
603 return (RTN_ERR_CMEDIR);
604
605 // OK, we are off, tell the user about the licence and the start time
607
608 // Read the .ini file and get the name of the run-data file, and path for output etc.
609 if (! bReadIniFile())
610 return (RTN_ERR_INI);
611
612 // Check if output dir exists
613 if ((! is_directory(m_strOutPath.c_str())) || (! exists(m_strOutPath.c_str())))
614 {
615 // Output dir does not exist
616 bool bCreateDir = false;
617 if ((isatty(fileno(stdout))) && (isatty(fileno(stderr))))
618 {
619 // Running with stdout and stderr as a tty, so ask the user if they wish to create it
620 char ch;
621 cerr << endl << "Output folder '" << m_strOutPath << "' does not exist. Create it? (Y/N) ";
622 cerr.flush();
623 cin.get(ch);
624
625 if ((ch == 'y') || (ch == 'Y'))
626 bCreateDir = true;
627 }
628 else
629 {
630 // Running with stdout or stderr not a tty, so create output dir rather than abort
631 bCreateDir = true;
632 }
633
634 if (bCreateDir)
635 {
636 // Yes, so create the directory
637 create_directories(m_strOutPath.c_str());
638 cerr << m_strOutPath << " created" << endl << endl;
639 }
640 else
641 // Nope, just end the run
642 return RTN_USER_ABORT;
643 }
644
645 // We have the name of the run-data input file, so read it
646 if (! bReadRunDataFile())
647 return RTN_ERR_RUNDATA;
648
649 // Check raster GIS output format
652
653 // Check vector GIS output format
656
657 // Open log file
658 if (! bOpenLogFile())
659 return (RTN_ERR_LOGFILE);
660
661 // Set up the time series output files
662 if (! bSetUpTSFiles())
663 return (RTN_ERR_TSFILE);
664
665 // Initialize the random number generators
666 for (int n = 0; n < NUMBER_OF_RNGS; n++)
667 m_Rand[n].seed(m_ulRandSeed[n]);
668
669 // If we are doing Savitzky-Golay smoothing of the vector coastline(s), calculate the filter coefficients
672
673 // Create the raster grid object
674 m_pRasterGrid = new CGeomRasterGrid(this);
675
676 // Read in the basement layer (must have this file), create the raster grid, then read in the basement DEM data to the array
678 nRet = nReadRasterBasementDEM();
679 if (nRet != RTN_OK)
680 return nRet;
681
682 // 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
684 {
686 if (nTmp < 3)
687 {
688 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;
689 cerr << strErr << endl;
690 LogStream << strErr << endl;
691 OutStream << strErr << endl;
692 return RTN_ERR_RUNDATA;
693 }
694 }
695
696 // Do some more initialisation
697 // cppcheck-suppress truncLongCastAssignment
699
700 // Mark edge cells, as defined by the basement layer
702 if (nRet != RTN_OK)
703 return nRet;
704
705 // // DEBUG CODE =================================================================================================================
706 // for (int n = 0; n < m_VEdgeCell.size(); n++)
707 // {
708 // LogStream << "[" << m_VEdgeCell[n].nGetX() << "][" << m_VEdgeCell[n].nGetY() << "] = {" << dGridCentroidXToExtCRSX(m_VEdgeCell[n].nGetX()) << ", " << dGridCentroidYToExtCRSY(m_VEdgeCell[n].nGetY()) << "} " << m_VEdgeCellEdge[n] << endl;
709 // }
710 // // DEBUG CODE =================================================================================================================
711
712 // 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
715 else
716 {
717 // The user specified a profile spacing, is this too small?
719
721 {
722 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;
723
724 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;
725
727 }
728 }
729
730 // Set the profile spacing on interventions
733
734 // 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
736
737 for (int nX = 0; nX < m_nXGridSize; nX++)
738 for (int nY = 0; nY < m_nYGridSize; nY++)
739 m_pRasterGrid->m_Cell[nX][nY].AppendLayers (m_nLayers);
740
741 // Tell the user what is happening then read in the layer files
743
744 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
745 {
746 // Read in the initial fine unconsolidated sediment depth file(s)
749 if (nRet != RTN_OK)
750 return (nRet);
751
752 // Read in the initial sand unconsolidated sediment depth file
755 if (nRet != RTN_OK)
756 return (nRet);
757
758 // Read in the initial coarse unconsolidated sediment depth file
761 if (nRet != RTN_OK)
762 return (nRet);
763
764 // Read in the initial fine consolidated sediment depth file
766 nRet = nReadRasterGISFile(FINE_CONS_RASTER, nLayer);
767 if (nRet != RTN_OK)
768 return (nRet);
769
770 // Read in the initial sand consolidated sediment depth file
772 nRet = nReadRasterGISFile(SAND_CONS_RASTER, nLayer);
773 if (nRet != RTN_OK)
774 return (nRet);
775
776 // Read in the initial coarse consolidated sediment depth file
779 if (nRet != RTN_OK)
780 return (nRet);
781 }
782
783 // Read in the initial suspended sediment depth file
786 if (nRet != RTN_OK)
787 return (nRet);
788
789 // Maybe read in the landform class data, otherwise calculate this during the first timestep using identification rules
790 if (! m_strInitialLandformFile.empty())
791 {
794 if (nRet != RTN_OK)
795 return (nRet);
796 }
797
798 // Maybe read in intervention data
799 if (! m_strInterventionClassFile.empty())
800 {
803 if (nRet != RTN_OK)
804 return (nRet);
805
808 if (nRet != RTN_OK)
809 return (nRet);
810 }
811
812 // Maybe read in the tide data
813 if (! m_strTideDataFile.empty())
814 {
816 nRet = nReadTideDataFile();
817 if (nRet != RTN_OK)
818 return (nRet);
819 }
820
821 // Read in the erosion potential shape function data
823 nRet = nReadShapeFunctionFile();
824 if (nRet != RTN_OK)
825 return (nRet);
826
827 // Do we want to output the erosion potential look-up values, for checking purposes?
830
831 // OK, now read in the vector files (if any)
834
835 // Maybe read in deep water wave station data
837 {
838 // We are reading deep water wave height, orientation and period from a file of vector points and file time series
840
841 // Read in vector points
843 if (nRet != RTN_OK)
844 return (nRet);
845
846 int nWaveStations = static_cast<int> (m_VnDeepWaterWaveStationID.size());
847
848 if (nWaveStations == 1)
850
851 // Read in time series values, and initialize the vector which stores each timestep's deep water wave height, orientation and period
852 nRet = nReadWaveStationInputFile (nWaveStations);
853 if (nRet != RTN_OK)
854 return (nRet);
855 }
856
857 // Maybe read in sediment input event data
859 {
860 // We are reading sediment input event data
862
863 // Read in vector points for sediment input events
865 if (nRet != RTN_OK)
866 return (nRet);
867
868 // Read in the time series values for sediment input events
870 if (nRet != RTN_OK)
871 return (nRet);
872 }
873
874 // Maybe read in flood input location
876 {
877 // We are reading sediment input event data
879
880 // Read in vector points for sediment input events
882 if (nRet != RTN_OK)
883 return (nRet);
884 }
885
886 // Open the main output
887 OutStream.open (m_strOutFile.c_str(), ios::out | ios::trunc);
888
889 if (! OutStream)
890 {
891 // Error, cannot open Out file
892 cerr << ERR << "cannot open " << m_strOutFile << " for output" << endl;
893 return (RTN_ERR_OUTFILE);
894 }
895
896 // Write beginning-of-run information to Out and Log files
898
899 // Start initializing
901
902 // Misc initialization calcs
903 m_nCoastMax = COAST_LENGTH_MAX * tMax(m_nXGridSize, m_nYGridSize); // Arbitrary but probably OK
904 m_nCoastMin = tMin(m_nXGridSize, m_nYGridSize); // In some cases the following rule doesn't work TODO 007 Info needed
905 // nRound(COAST_LENGTH_MIN_X_PROF_SPACE * m_dCoastNormalSpacing / m_dCellSide); // TODO 007 Info needed
906 m_nCoastCurvatureInterval = tMax(nRound(m_dCoastNormalSpacing / (m_dCellSide * 2)), 2); // TODO 007 Info needed
907
908 // For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) transport rate (Leo Van Rijn) TODO 007 need full reference
910
911 m_bConsChangedThisIter.resize(m_nLayers, false);
912 m_bUnconsChangedThisIter.resize(m_nLayers, false);
913
914 // Normalize sediment erodibility values, so that none are > 1
919
920 // Intialise SWL
922
923 // If SWL changes during the simulation, calculate the per-timestep increment (could be -ve)
925 {
928 }
929
930 // ===================================================== The main loop ======================================================
931 // Tell the user what is happening
933
934 while (true)
935 {
936 // Check that we haven't gone on too long: if not then update timestep number etc.
937 if (bTimeToQuit())
938 break;
939
940 // Tell the user how the simulation is progressing
942
944 LogStream << "TIMESTEP " << m_ulIter << " " << string(154, '=') << endl;
945
946 LogStream << fixed << setprecision(3);
947
948 // Check to see if there is a new intervention in place: if so, update it on the RasterGrid array
949 nRet = nUpdateIntervention();
950 if (nRet != RTN_OK)
951 return nRet;
952
953 // Calculate changes due to external forcing (change in still water level, tide level and deep water waves height, orientation and period)
954 nRet = nCalcExternalForcing();
955 if (nRet != RTN_OK)
956 return nRet;
957
958 // 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
960 if (nRet != RTN_OK)
961 return nRet;
962
963 // 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()
964 int nValidCoast = 0;
965 nRet = nLocateSeaAndCoasts(nValidCoast);
966 if (nRet != RTN_OK)
967 return nRet;
968
969 // Tell the user how the simulation is progressing
971
972 // Locate estuaries TODO 044 someday...
973
974 // For all cells, use classification rules to assign sea and hinterland landform categories
976 if (nRet != RTN_OK)
977 return nRet;
978
979 // For every coastline, use classification rules to assign landform categories
981 if (nRet != RTN_OK)
982 return nRet;
983
984 // Create all coastline-normal profiles, in coastline-concave-curvature sequence
985 nRet = nCreateAllProfiles();
986 if (nRet != RTN_OK)
987 return nRet;
988
989 // Check the coastline-normal profiles for intersection
990 nRet = nCheckAllProfiles();
991 if (nRet != RTN_OK)
992 return nRet;
993
994 // // DEBUG CODE =================
995 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
996 // {
997 // for (int nCoastPoint = 0; nCoastPoint < m_VCoast[nCoast].nGetCoastlineSize(); nCoastPoint++)
998 // {
999 // if (m_VCoast[nCoast].bIsProfileAtCoastPoint(nCoastPoint))
1000 // {
1001 // CGeomProfile const* pProfile = m_VCoast[nCoast].pGetProfileAtCoastPoint(nCoastPoint);
1002 // int nProfile = pProfile->nGetCoastID();
1003 //
1004 // 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;
1005 // }
1006 // }
1007 // }
1008 // // DEBUG CODE =================
1009
1010 // Tell the user how the simulation is progressing
1012
1013 // Create the coast polygons
1014 nRet = nCreateAllPolygons();
1015 if (nRet != RTN_OK)
1016 return nRet;
1017
1018 // // DEBUG CODE =========================================================================================================
1019 // int nNODATA = 0;
1020 // int nPoly0 = 0;
1021 // int nPoly24 = 0;
1022 // for (int nX = 0; nX < m_nXGridSize; nX++)
1023 // {
1024 // for (int nY = 0; nY < m_nYGridSize; nY++)
1025 // {
1026 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1027 // if (nTmp == INT_NODATA)
1028 // nNODATA++;
1029 //
1030 // if (nTmp == 0)
1031 // nPoly0++;
1032 //
1033 // if (nTmp == 24)
1034 // nPoly24++;
1035 // }
1036 // }
1037 // LogStream << "Before marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1038 // // LogStream << "Before marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1039 // LogStream << "Before marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1040 // // DEBUG CODE =========================================================================================================
1041
1042 // Mark cells of the raster grid that are within each polygon, and do some polygon initialization
1044
1045 // Calculate the length of the shared normal between each polygon and the adjacent polygon(s)
1047 if (nRet != RTN_OK)
1048 return nRet;
1049
1050 // Tell the user how the simulation is progressing
1052
1053 // // DEBUG CODE =========================================================================================================
1054 // nNODATA = 0;
1055 // nPoly0 = 0;
1056 // nPoly24 = 0;
1057 // for (int nX = 0; nX < m_nXGridSize; nX++)
1058 // {
1059 // for (int nY = 0; nY < m_nYGridSize; nY++)
1060 // {
1061 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1062 // if (nTmp == INT_NODATA)
1063 // nNODATA++;
1064 //
1065 // if (nTmp == 0)
1066 // nPoly0++;
1067 //
1068 // if (nTmp == 24)
1069 // nPoly24++;
1070 // }
1071 // }
1072 // LogStream << "After marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1073 // // LogStream << "After marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1074 // LogStream << "After marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1075 // // DEBUG CODE =========================================================================================================
1076 // PropagateWind();
1077
1078 // Give every coast point a value for deep water wave height and direction
1080 if (nRet != RTN_OK)
1081 return nRet;
1082
1083 // // DEBUG CODE ===============
1084 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1085 // {
1086 // LogStream << "====================" << endl;
1087 //
1088 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1089 // {
1090 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfile(nProfile);
1091 // int nCell = pProfile->nGetNumCellsInProfile();
1092 // LogStream << "Profile " << pProfile->nGetCoastID() << " nGetNumCellsInProfile() = " << nCell << endl;
1093 // }
1094 //
1095 // LogStream << endl;
1096 //
1097 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1098 // {
1099 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfileWithDownCoastSeq(nProfile);
1100 // int nCell = pProfile->nGetNumCellsInProfile();
1101 // LogStream << "Profile " << pProfile->nGetCoastID() << " nGetNumCellsInProfile() = " << nCell << endl;
1102 // }
1103 //
1104 // LogStream << "====================" << endl;
1105 // }
1106 // // DEBUG CODE =====================
1107
1108 // Change the wave properties in all shallow water sea cells: propagate waves and define the active zone, also locate wave shadow zones
1109 nRet = nDoAllPropagateWaves();
1110 if (nRet != RTN_OK)
1111 return nRet;
1112
1113 // Output polygon share table and pre-existing sediment table to log file
1115 {
1116 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1117 {
1118 WritePolygonInfoTable(nCoast);
1120 }
1121 }
1122
1123 // Tell the user how the simulation is progressing
1125
1126 // // DEBUG CODE ===========================================================================================================
1127 // string strOutFile = m_strOutPath;
1128 // strOutFile += "sea_wave_height_CHECKPOINT_";
1129 // strOutFile += to_string(m_ulIter);
1130 // strOutFile += ".tif";
1131 //
1132 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1133 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1134 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1135 // pDataSet->SetGeoTransform(m_dGeoTransform);
1136 //
1137 // int nn = 0;
1138 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1139 // for (int nY = 0; nY < m_nYGridSize; nY++)
1140 // {
1141 // for (int nX = 0; nX < m_nXGridSize; nX++)
1142 // {
1143 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1144 // }
1145 // }
1146 //
1147 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1148 // pBand->SetNoDataValue(m_dMissingValue);
1149 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1150 //
1151 // if (nRet == CE_Failure)
1152 // return RTN_ERR_GRIDCREATE;
1153 //
1154 // GDALClose(pDataSet);
1155 // delete[] pdRaster;
1156 // // DEBUG CODE ===========================================================================================================
1157 //
1158 // // DEBUG CODE ===========================================================================================================
1159 // strOutFile = m_strOutPath;
1160 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1161 // strOutFile += to_string(m_ulIter);
1162 // strOutFile += ".tif";
1163 //
1164 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1165 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1166 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1167 // pDataSet->SetGeoTransform(m_dGeoTransform);
1168 //
1169 // nn = 0;
1170 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1171 // for (int nY = 0; nY < m_nYGridSize; nY++)
1172 // {
1173 // for (int nX = 0; nX < m_nXGridSize; nX++)
1174 // {
1175 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1176 // }
1177 // }
1178 //
1179 // pBand = pDataSet->GetRasterBand(1);
1180 // pBand->SetNoDataValue(m_dMissingValue);
1181 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1182 //
1183 // if (nRet == CE_Failure)
1184 // return RTN_ERR_GRIDCREATE;
1185 //
1186 // GDALClose(pDataSet);
1187 // delete[] pdRaster;
1188 // // DEBUG CODE ===========================================================================================================
1189
1190 // Save the not-deposited values, to be shown in the logfile after we've finished beach sediment movement
1193
1196 {
1197 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << " m_dUnconsSandNotDepositedLastIter = " << m_dUnconsSandNotDepositedLastIter << endl;
1198 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea << " m_dUnconsCoarseNotDepositedLastIter = " << m_dUnconsCoarseNotDepositedLastIter << endl;
1199 }
1200
1202 {
1203 // Calculate elevation change on the consolidated sediment which comprises the coastal platform
1205 if (nRet != RTN_OK)
1206 return nRet;
1207 }
1208
1209 // Output shore platform erosion table to log file
1211 {
1212 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1214 }
1215
1217 {
1218 // Do all cliff collapses for this timestep (if any)
1220 if (nRet != RTN_OK)
1221 return nRet;
1222 }
1223
1224 // Output cliff collapse table to log file
1226 {
1227 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1229 }
1230
1231 // Tell the user how the simulation is progressing
1233
1235 {
1236 // 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
1238
1239 // 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
1241 if (nRet != RTN_OK)
1242 return nRet;
1243 }
1244
1245 // 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
1246 if (m_bSedimentInput)
1247 {
1249 if (nRet != RTN_OK)
1250 return nRet;
1251
1252 // If we have had at least one sediment input event this iteration, then output the sediment event per polygon table to the log file
1254 {
1255 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1257 }
1258 }
1259
1260// // 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
1261// double dFineThisIter = m_dThisIterActualPlatformErosionFineCons + m_dThisIterCliffCollapseErosionFineUncons + m_dThisIterCliffCollapseErosionFineCons + m_dThisIterCliffCollapseFineErodedDuringDeposition + m_dThisIterBeachErosionFine - m_dThisIterLeftGridUnconsFine;
1262//
1263// m_dThisIterFineSedimentToSuspension += dFineThisIter;
1264
1265 // Tell the user how the simulation is progressing
1267
1268 // // DEBUG CODE ===========================================================================================================
1269 // string strOutFile = m_strOutPath;
1270 // strOutFile += "sea_wave_height_CHECKPOINT_";
1271 // strOutFile += to_string(m_ulIter);
1272 // strOutFile += ".tif";
1273 //
1274 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1275 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1276 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1277 // pDataSet->SetGeoTransform(m_dGeoTransform);
1278 //
1279 // int nn = 0;
1280 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1281 // for (int nY = 0; nY < m_nYGridSize; nY++)
1282 // {
1283 // for (int nX = 0; nX < m_nXGridSize; nX++)
1284 // {
1285 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1286 // }
1287 // }
1288 //
1289 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1290 // pBand->SetNoDataValue(m_dMissingValue);
1291 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1292 //
1293 // if (nRet == CE_Failure)
1294 // return RTN_ERR_GRIDCREATE;
1295 //
1296 // GDALClose(pDataSet);
1297 // delete[] pdRaster;
1298 // // DEBUG CODE ===========================================================================================================
1299 //
1300 // // DEBUG CODE ===========================================================================================================
1301 // strOutFile = m_strOutPath;
1302 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1303 // strOutFile += to_string(m_ulIter);
1304 // strOutFile += ".tif";
1305 //
1306 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1307 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1308 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1309 // pDataSet->SetGeoTransform(m_dGeoTransform);
1310 //
1311 // nn = 0;
1312 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1313 // for (int nY = 0; nY < m_nYGridSize; nY++)
1314 // {
1315 // for (int nX = 0; nX < m_nXGridSize; nX++)
1316 // {
1317 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1318 // }
1319 // }
1320 //
1321 // pBand = pDataSet->GetRasterBand(1);
1322 // pBand->SetNoDataValue(m_dMissingValue);
1323 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1324 //
1325 // if (nRet == CE_Failure)
1326 // return RTN_ERR_GRIDCREATE;
1327 //
1328 // GDALClose(pDataSet);
1329 // delete[] pdRaster;
1330 // // DEBUG CODE ===========================================================================================================
1331
1332 // Do some end-of-timestep updates to the raster grid, also update per-timestep and running totals
1333 nRet = nUpdateGrid();
1334 if (nRet != RTN_OK)
1335 return nRet;
1336
1337 // Make water level inundation on grid
1339 {
1340 m_nLevel = 0;
1341
1342 nRet = nLocateFloodAndCoasts();
1343 if (nRet != RTN_OK)
1344 return nRet;
1345 }
1346
1348 {
1349 // TODO 007 Info needed
1350 m_nLevel = 1;
1351
1352 nRet = nLocateFloodAndCoasts();
1353 if (nRet != RTN_OK)
1354 return nRet;
1355 }
1356
1357 // Now save results, first the raster and vector GIS files if required
1358 m_bSaveGISThisIter = false;
1359
1361 {
1362 m_bSaveGISThisIter = true;
1363
1364 // Save the values from the RasterGrid array into raster GIS files
1365 if (! bSaveAllRasterGISFiles())
1367
1368 // Tell the user how the simulation is progressing
1370
1371 // Save the vector GIS files
1372 if (! bSaveAllVectorGISFiles())
1374
1375 // Tell the user how the simulation is progressing
1377 }
1378
1379 // Output per-timestep results to the .out file
1381 return (RTN_ERR_TEXT_FILE_WRITE);
1382
1383 // Now output time series CSV stuff
1384 if (! bWriteTSFiles())
1386
1387 // Tell the user how the simulation is progressing
1389
1390 // Update grand totals
1392
1393 } // ================================================ End of main loop ======================================================
1394
1395 // =================================================== post-loop tidying =====================================================
1396 // Tell the user what is happening
1398
1399 // Write end-of-run information to Out, Log and time-series files
1400 nRet = nWriteEndRunDetails();
1401 if (nRet != RTN_OK)
1402 return (nRet);
1403
1404 // Do end-of-run memory clerance
1406
1407 return RTN_OK;
1408}
Geometry cass used to represent the raster grid of cell objects.
Definition raster_grid.h:35
double m_dThisIterPotentialBeachErosion
Total potential beach erosion (all size classes of unconsolidated sediment) for this iteration (depth...
Definition simulation.h:800
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:875
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:204
int m_nLogFileDetail
The level of detail in the log file output. Can be LOG_FILE_LOW_DETAIL, LOG_FILE_MIDDLE_DETAIL,...
Definition simulation.h:531
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:93
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:710
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:231
static void AnnounceInitializing(void)
Tells the user that we are now initializing.
Definition utils.cpp:618
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:459
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
Definition simulation.h:84
int m_nYMinBoundingBox
The minimum y value of the bounding box.
Definition simulation.h:501
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
Definition utils.cpp:610
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:627
bool m_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
Definition simulation.h:81
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:177
int nLocateSeaAndCoasts(int &)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
double m_dNotchDepthAtCollapse
Notch overhang (i.e. length of horizontal incision) to initiate collapse (m)
Definition simulation.h:866
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:414
time_t m_tSysEndTime
System finish-simulation time.
double m_dTotalCoarseUnconsInPolygons
Total coarse unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells ...
Definition simulation.h:965
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:369
double m_dMinSWL
Minimum still water level.
Definition simulation.h:677
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:767
void AnnounceReadDeepWaterWaveValuesGIS(void) const
Tells the user that we are now reading the deep water wave values GIS file.
Definition utils.cpp:465
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:668
int m_nBeachErosionDepositionEquation
Which beach erosion-deposition equation is used. Possible values are UNCONS_SEDIMENT_EQUATION_CERC an...
Definition simulation.h:489
ofstream CliffCollapseNetChangeTSStream
Cliff collapse net change (erosion - deposition) time series file output stream.
bool m_bCoastSave
Save.
Definition simulation.h:249
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:297
bool bWritePerTimestepResults(void)
Write the results for this timestep to the .out file.
CGeomRasterGrid * m_pRasterGrid
Pointer to the raster grid object.
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:572
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:429
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:533
double m_dL_0
Deep water wave length (m)
Definition simulation.h:701
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
Definition simulation.h:917
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:722
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Does this work correctly?
Definition simulation.h:309
bool bSetUpTSFiles(void)
The bSetUpTSFiles member function sets up the time series files.
Definition utils.cpp:1078
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:520
double m_dThisIterBeachErosionCoarse
Total actual beach erosion (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:809
char ** m_papszGDALVectorOptions
Options for GDAL when handling vector files.
Definition simulation.h:426
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
Definition simulation.h:947
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:782
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:312
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
All-simulation total of coarse sediment eroded during talus deposition following cliff collapse (m)
double m_dUnconsCoarseNotDepositedLastIter
Depth of unconsolidated coarse sediment that could not be deposited during the last iteration,...
Definition simulation.h:980
double m_dCPUClock
Total elapsed CPU time.
Definition simulation.h:650
bool bSaveAllVectorGISFiles(void)
The bSaveAllvectorGISFiles member function saves the vector GIS files TODO 081 Choose more files to o...
bool m_bSingleDeepWaterWaveValues
Do we have just a point source for (i.e. only a single measurement of) deep water wave values.
Definition simulation.h:360
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:468
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:548
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:111
double m_dSouthEastXExtCRS
The south-east x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:605
int m_nMissingValue
The value used for integer missing values.
Definition simulation.h:492
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:105
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)
Reads the deep water wave station input data. Each point in m_strDeepWaterWavesInputFile is a triad o...
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:752
void WriteLookUpData(void) const
Output the erosion potential look-up values, for checking purposes.
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Total fine sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:833
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:255
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:270
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
Definition simulation.h:689
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:797
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:144
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:432
double m_dThisIterTopElevMin
This-iteration lowest elevation of DEM.
Definition simulation.h:923
bool m_bStillWaterLevelTSSave
Save the still water level time series file?
Definition simulation.h:279
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:393
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:542
long double m_ldGTotCliffTalusFineToSuspension
All-simulation total of fine sediment moved to suspension, due to cliff collapse (m)
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:210
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:138
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:240
double m_dCoarseErodibility
The relative erodibility (0- 1) of coarse unconsolidated beach sediment.
Definition simulation.h:749
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:653
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:878
double m_dMissingValue
Missing value.
Definition simulation.h:914
int m_nUnconsSedimentHandlingAtGridEdges
How sediment which moves off an edge of the grid is handled. Possible values are GRID_EDGE_CLOSED,...
Definition simulation.h:486
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:746
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:78
double m_dInvCellDiagonal
Inverse of m_dCellDiagonal.
Definition simulation.h:626
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:516
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:758
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:183
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:303
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:291
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
Definition simulation.h:938
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:219
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:569
static void AnnounceSimEnd(void)
Announce the end of the simulation.
Definition utils.cpp:1392
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:563
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:854
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:437
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:704
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:96
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:408
void WriteStartRunDetails(void)
Writes beginning-of-run information to Out and Log files.
double m_dThisIterCliffCollapseErosionCoarseUncons
This-iteration total of coarse unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:890
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:345
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:159
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:845
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:156
int m_nCoastMax
Maximum valid coast length when searching for coasts, actually is COAST_LENGTH_MAX * tMax(m_nXGridSiz...
Definition simulation.h:471
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:740
double dGetMissingValue(void) const
Returns the NODATA value.
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:510
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:519
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:575
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:180
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:282
int m_nCoastNormalSpacing
Average spacing between coastline normals, measured in cells.
Definition simulation.h:450
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
Definition simulation.h:498
long double m_ldGTotPotentialSedLostBeachErosion
All-simulation total of potential sediment lost via beach (unconsolidated) sediment movement (m),...
Definition simulation.h:997
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:884
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:207
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:398
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:336
bool m_bSliceSave
Save slices?
Definition simulation.h:87
void WritePolygonShorePlatformErosion(int const)
Writes to the log file a table showing per-polygon unconsolidated sand/coarse sediment derived from e...
bool m_bRasterPolygonSave
Save raster polygon raster GIS files?
Definition simulation.h:216
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:153
double m_dNorthWestYExtCRS
The north-west y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:602
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:246
int m_nLayers
The number of sediment layers.
Definition simulation.h:435
bool bFindExeDir(char const *)
Finds the folder (directory) in which the CoastalME executable is located.
Definition utils.cpp:208
double m_dStartIterConsCoarseAllCells
Depth (m) of coarse consolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:956
double m_dStartIterConsSandAllCells
Depth (m) of sand consolidated sediment at the start of the simulation, all cells (both inside and ou...
Definition simulation.h:953
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:375
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:366
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:584
double m_dInmersedToBulkVolumetric
For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) tra...
Definition simulation.h:770
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:252
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:99
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:842
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:72
unsigned long m_ulMissingValueBasementCells
The number of basement cells marked with as missing value.
Definition simulation.h:593
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
Definition simulation.h:932
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:465
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:788
bool bWriteTSFiles(void)
Write the results for this timestep to the time series CSV files.
double m_dDeanProfileStartAboveSWL
Berm height i.e. height above SWL of start of depositional Dean profile.
Definition simulation.h:911
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitsky-Golay smoothing is used (usually ...
Definition simulation.h:444
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:90
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:108
double m_dNotchBaseBelowSWL
Notch base below SWL (m)
Definition simulation.h:869
int m_nRunUpEquation
The run-up equation used TODO 007.
Definition simulation.h:534
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:357
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:479
double dGetD50Fine(void) const
Returns the global d50 value for fine sediment.
double m_dDepthOverDBMax
Maximum value of deoth over DB, is used in erosion potential look-up function.
Definition simulation.h:848
long double m_ldGTotCliffCollapseCoarse
All-simulation total of coarse sediment from cliff collapse (m)
int m_nCoastNormalInterventionSpacing
Average spacing between coastline normals on interventions, measured in cells.
Definition simulation.h:453
double m_dFineErodibility
The relative erodibility (0- 1) of fine unconsolidated beach sediment.
Definition simulation.h:743
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:926
time_t m_tSysStartTime
System start-simulation time.
double m_dBreakingWaveHeightDepthRatio
Breaking wave height-to-depth ratio.
Definition simulation.h:707
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
Definition utils.cpp:493
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:776
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:363
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:656
int nDoSimulation(int, char const *[])
Runs the simulation.
void StartClock(void)
Starts the clock ticking.
Definition utils.cpp:185
long double m_ldGTotSuspendedSediment
All-simulation total of suspended sediment (m)
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:755
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:725
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:198
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:201
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
Definition utils.cpp:507
ofstream StillWaterLevelTSStream
SWL time series file output stream.
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
Definition utils.cpp:2772
double m_dThisIterActualPlatformErosionSandCons
Total actual platform erosion (sand consolidated sediment) for this iteration (depth in m)
Definition simulation.h:794
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:330
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:372
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
Definition utils.cpp:407
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:863
double m_dThisIterBeachDepositionCoarse
Total beach deposition (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:815
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:731
long double m_ldGTotCliffTalusSandDeposition
All-simulation total of sand sediment deposited as talus following cliff collapse (m)
double m_dCellDiagonal
Length of a cell's diagonal (in external CRS units)
Definition simulation.h:620
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:234
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:120
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:761
double m_dInvCellSide
Inverse of m_dCellSide.
Definition simulation.h:623
int m_nWavePropagationModel
The wave propagation model used. Possible values are WAVE_MODEL_CSHORE and WAVE_MODEL_COVE.
Definition simulation.h:507
long double m_ldGTotCliffCollapseSandErodedDuringDeposition
All-simulation total of sand sediment eroded during talus deposition following cliff collapse (m)
double m_dAllCellsDeepWaterWaveAngle
Deep water wave angle for all sea cells.
Definition simulation.h:713
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:635
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:258
int nGetGridXMax(void) const
Returns the cell size.
int m_nDeepWaterWaveDataNumTimeSteps
The duration of data for deep water waves, expressed as a number of time steps.
Definition simulation.h:528
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
Definition utils.cpp:377
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_dThisIterUnconsCoarseCliffDeposition
This-iteration total of coarse unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:905
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:351
bool m_bRasterWaveFloodLineSave
Are we saving the raster wave flood line? TODO 007.
Definition simulation.h:402
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:123
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:785
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:851
int m_nCoastMin
Minimum valid coast legth when searching for coass, actualli is tMin(m_nXGridSize,...
Definition simulation.h:474
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:638
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:261
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:324
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
Definition simulation.h:994
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
Definition simulation.h:988
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:902
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 Does this work correctly?
Definition simulation.h:306
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:135
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007.
Definition simulation.h:396
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:117
double m_dNorthWestXExtCRS
The north-west x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:599
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:734
static void AnnounceStart(void)
Tells the user that we have started the simulation.
Definition utils.cpp:177
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:456
ofstream CliffCollapseErosionTSStream
Cliff collapse erosion time series file output stream.
double m_dThisIterPotentialSedLostBeachErosion
Total unconsolidated sediment from beach erosion (all size classes) lost from the grid this iteration...
Definition simulation.h:821
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:608
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:141
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...
Definition simulation.h:950
long double m_ldGTotActualCoarseLostBeachErosion
All-simulation total of coarse sediment lost via beach (unconsolidated) sediment movement (m)
bool m_bGISSaveDigitsSequential
Are the GIS save digits (which are part of each GIS file name) sequential, or are they the iteration ...
Definition simulation.h:420
int 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:522
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:171
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:881
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:806
double m_dAccumulatedSeaLevelChange
If long-term SWL changes, the total change so far since the start of simulation.
Definition simulation.h:674
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:264
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:390
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:132
double m_dThisIterFineSedimentToSuspension
Total fine unconsolidated sediment in suspension for this iteration (depth in m)
Definition simulation.h:818
int nDoAllWaveEnergyToCoastLandforms(void)
Update accumulated wave energy in coastal landform objects.
double m_dThisIterBeachErosionFine
Total actual beach erosion (fine unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:803
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:836
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:513
bool bSaveAllRasterGISFiles(void)
The bSaveAllRasterGISFiles member function saves the raster GIS files using values from the RasterGri...
unsigned long m_ulThisIterNumActualBeachErosionCells
The number of grid cells on which actual beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:581
bool bReadIniFile(void)
The bReadIniFile member function reads the initialization file.
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:69
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:872
string m_strDataPathName
Folder in which the CME data file is found.
string m_strOutPath
Path for all output files.
bool m_bBeachErosionTSSave
Save the beach (unconsolidated sediment) erosion time series file?
Definition simulation.h:294
int m_nYMaxBoundingBox
The maximum y value of the bounding box.
Definition simulation.h:504
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:147
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
The number of grid cells on which potential platform erosion occurs, for this iteration.
Definition simulation.h:572
double m_dStartIterUnconsSandAllCells
Depth (m) of sand unconsolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:944
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:680
long double m_ldGTotActualSandLostBeachErosion
All-simulation total of sand sediment lost via beach (unconsolidated) sediment movement (m)
double m_dDeltaSWLPerTimestep
If long-term SWL changes, the increment per timestep.
Definition simulation.h:665
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:462
string m_strInterventionClassFile
Name of intervention class file.
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_bFloodSWLSetupLine
Are we saving the flood still water level setup line? TODO 007.
Definition simulation.h:411
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:222
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:893
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:165
long double m_ldGTotCoarseSedLostCliffCollapse
All-simulation total of coarse sediment lost via cliff collapse (m)
double m_dCoastNormalInterventionSpacing
Average spacing of the coastline-normal profiles on interventions, in m.
Definition simulation.h:779
long double m_ldGTotSandActualPlatformErosion
All-simulation total of sand sediment actual platform erosion (m)
Definition simulation.h:991
int m_nSimStartYear
Start date of the simulation (year)
Definition simulation.h:525
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:150
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:195
void WritePolygonInfoTable(int const)
Writes to the log file a table showing polygon info.
long double m_ldGTotSandSedLostCliffCollapse
All-simulation total of sand sediment lost via cliff collapse (m)
double m_dUnconsSandNotDepositedLastIter
Depth of unconsolidated sand sediment that could not be deposited during the last iteration,...
Definition simulation.h:977
double m_dThisIterDiffWaveSetupWaterLevel
TODO 007 Info needed.
Definition simulation.h:686
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:168
double m_dTotalCoarseConsInPolygons
Total coarse consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:974
int m_nCoastCurvatureMovingWindowSize
Definition simulation.h:539
ofstream SeaAreaTSStream
Sea area time series file output stream.
unsigned long m_ulThisIterNumSeaCells
The number of grid cells which are marked as sea, for this iteration.
Definition simulation.h:566
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
Definition utils.cpp:451
double m_dTotalSandUnconsInPolygons
Total sand unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:962
void AnnounceReadInitialCoarseConsSedGIS(int const) const
Tells the user that we are now reading the initial coarse consolidated sediment depth GIS file.
Definition utils.cpp:585
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:384
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:551
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 ...
Definition simulation.h:941
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:189
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:378
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:75
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:641
long double m_ldGTotActualFineBeachErosion
All-simulation total of fine sediment eroded during beach (unconsolidated sediment) movement (m)
bool m_bPolygonUnconsSedGainOrLossSave
Save polygon unconsolidated sediment gain or loss raster GIS files?
Definition simulation.h:243
void MarkPolygonCells(void)
Marks cells of the raster grid that are within each coastal polygon. The flood fill code used here is...
double m_dTimeStep
The length of an iteration (a time step) in hours.
Definition simulation.h:632
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
The number of cells on which on-profile average potential shore platform erosion occurs.
Definition simulation.h:587
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:288
int m_nXMinBoundingBox
The minimum x value of the bounding box.
Definition simulation.h:495
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:617
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:114
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:590
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:908
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:719
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
Definition utils.cpp:559
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:126
double m_dFinalSWL
The end-of-simulation still water (m), is same as m_dOrigSWL unless SWL changes.
Definition simulation.h:662
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:342
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:578
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:186
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:273
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:438
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:237
string m_strInitialLandformFile
Name of initial landform file.
double m_dC_0
Deep water wave speed (m/s)
Definition simulation.h:698
double m_dThisIterCliffCollapseErosionSandCons
This-iteration total of sand consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:896
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:300
double m_dThisIterBeachDepositionSand
Total beach deposition (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:812
int nReadTideDataFile(void)
Reads the tide time series data.
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:192
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:276
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:354
double dGetThisIterSWL(void) const
Returns this timestep's still water level.
double m_dThisIterLeftGridUnconsCoarse
Total coarse unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:830
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:887
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:728
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:560
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:327
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:225
bool bOpenLogFile(void)
Opens the log file.
Definition utils.cpp:354
double m_dTotalSandConsInPolygons
Total sand consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
Definition simulation.h:971
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:554
void AnnounceLicence(void)
Tells the user about the licence.
Definition utils.cpp:242
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:174
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:737
int m_nNumPolygonGlobal
Number of global (all coasts) polygons.
Definition simulation.h:483
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:629
double m_dTotalFineUnconsInPolygons
Total fine unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
Definition simulation.h:959
long double m_ldGTotSandDepositionDiff
All-simulation total of shortfall in unconsolidated sand sediment deposition (m, not currently used)
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:1292
double m_dTotalFineConsInPolygons
Total fine consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
Definition simulation.h:968
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
Definition simulation.h:929
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:611
int nDoAllPropagateWaves(void)
Simulates wave propagation along all coastline-normal profiles.
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:315
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:692
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:614
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:860
long double m_ldGTotActualSandBeachErosion
All-simulation total of sand sediment eroded during beach (unconsolidated sediment) movement (m)
double m_dBreakingWaveHeight
The height of breaking waves (m)
Definition simulation.h:695
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
Definition utils.cpp:1601
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:213
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:716
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:839
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
All-simulation total of sand sediment deposited during beach (unconsolidated sediment) movement (m)
double m_dUSaveTime[SAVEMAX]
Save time, in hours from the start of the simukation, if we are not saving regularly.
Definition simulation.h:644
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
Definition utils.cpp:423
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
Definition simulation.h:920
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:791
long double m_ldGTotPotentialBeachErosion
All-simulation total of potential beach erosion (m), all size classes.
double m_dProfileMaxSlope
Maximum slope on coastline-normal profiles.
Definition simulation.h:857
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:447
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:339
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
Definition utils.cpp:415
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:899
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:827
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:773
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:46
double m_dOrigSWL
The start-of-simulation still water level (m)
Definition simulation.h:659
double m_dStartIterSuspFineAllCells
Depth (m) of fine suspended sediment at the start of the simulation, all cells (both inside and outsi...
Definition simulation.h:935
string m_strOutFile
Name of main output file.
bool m_bSetupSurgeRunupFloodMaskSave
Are we saving the setup surge runup flood mask? TODO 007.
Definition simulation.h:399
double m_dThisIterDiffTotWaterLevel
TODO 007 Info needed.
Definition simulation.h:683
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.
Definition simulation.h:387
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:598
double m_dClkLast
Last value returned by clock()
Definition simulation.h:647
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:228
long double m_ldGTotFineSedimentInput
All-simulation total of fine sediment input (m)
double m_dThisIterMeanSWL
The mean still water level for this timestep (does not include tidal changes, but includes any long-t...
Definition simulation.h:671
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
Definition simulation.h:285
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:129
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
Definition simulation.h:985
GDALDataType m_GDALWriteFloatDataType
Thw data type used by GDAL for floating point operations, can be GDT_Byte, GDT_Int16,...
Definition simulation.h:545
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:348
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
Definition utils.cpp:546
int nHandleCommandLineParams(int, char const *[])
Handles command-line parameters.
Definition utils.cpp:86
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:423
ofstream OutStream
The main output file stream.
double m_dDurationUnitsMult
Multiplier for duration units, to convert to hours.
Definition simulation.h:596
bool m_bFloodSWLSetupSurgeRunupLine
Are we saving the flood still water level setup surge runup line? TODO 007.
Definition simulation.h:417
unsigned long m_ulTotTimestep
The target number of iterations.
Definition simulation.h:557
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:318
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:764
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:321
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP.
Definition simulation.h:537
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
Definition simulation.h:381
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:267
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:405
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:102
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:333
int m_nCoastSmoothWindow
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:441
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:824
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:162
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:365
T tMin(T a, T b)
Definition cme.h:1138
double const TOLERANCE
Definition cme.h:699
int const SAND_CONS_RASTER
Definition cme.h:457
double const INTERVENTION_PROFILE_SPACING_FACTOR
Definition cme.h:707
int const SEDIMENT_INPUT_EVENT_LOCATION_VEC
Definition cme.h:484
string const ERR
Definition cme.h:777
int const RTN_ERR_LOGFILE
Definition cme.h:590
int const DEFAULT_PROFILE_SPACING
Definition cme.h:374
int const RTN_ERR_RASTER_GIS_OUT_FORMAT
Definition cme.h:597
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:600
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:380
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1178
int const RTN_ERR_PROFILESPACING
Definition cme.h:604
int const FLOOD_LOCATION_VEC
Definition cme.h:489
int const DEEP_WATER_WAVE_STATIONS_VEC
Definition cme.h:481
int const RTN_ERR_RUNDATA
Definition cme.h:587
double const MASS_BALANCE_TOLERANCE
Definition cme.h:701
T tMax(T a, T b)
Definition cme.h:1125
int const SAVEMAX
Definition cme.h:353
int const NUMBER_OF_RNGS
Definition cme.h:352
int const RTN_ERR_TSFILE
Definition cme.h:592
int const INTERVENTION_CLASS_RASTER
Definition cme.h:464
int const RTN_ERR_VECTOR_GIS_OUT_FORMAT
Definition cme.h:598
int const RTN_USER_ABORT
Definition cme.h:583
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:660
int const RTN_ERR_CMEDIR
Definition cme.h:586
int const RTN_ERR_INI
Definition cme.h:585
int const RTN_OK
Definition cme.h:580
int const RTN_ERR_TEXT_FILE_WRITE
Definition cme.h:599
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:601
int const SAND_UNCONS_RASTER
Definition cme.h:460
int const FINE_UNCONS_RASTER
Definition cme.h:459
int const COARSE_UNCONS_RASTER
Definition cme.h:461
double const DBL_NODATA
Definition cme.h:709
int const RTN_ERR_OUTFILE
Definition cme.h:591
int const SUSP_SED_RASTER
Definition cme.h:462
int const FINE_CONS_RASTER
Definition cme.h:456
int const COARSE_CONS_RASTER
Definition cme.h:458
int const COAST_LENGTH_MAX
Definition cme.h:357
int const LANDFORM_RASTER
Definition cme.h:463
int const INTERVENTION_HEIGHT_RASTER
Definition cme.h:465
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:602
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Version of the above that returns an int.