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 <cstdio>
27#include <unistd.h>
28#include <stdio.h>
29
30#include <climits>
31
32#include <ios>
33using std::fixed;
34
35#include <iostream>
36using std::cerr;
37using std::cin;
38using std::endl;
39using std::ios;
40
41#include <iomanip>
42using std::setprecision;
43
44#include <cfloat>
45
46#include <string>
47using std::to_string;
48
49#include <filesystem> // C++17 and later, needed for missing output directory creation
50using std::filesystem::is_directory;
51using std::filesystem::exists;
52using std::filesystem::create_directories;
53
54#include <gdal.h>
55
56#include "cme.h"
57#include "simulation.h"
58#include "raster_grid.h"
59#include "coast.h"
60
61//===============================================================================================================================
63//===============================================================================================================================
65{
66 // Initialization
188
189 m_bGDALCanCreate = true;
190 m_bCSVPerTimestepResults = true; // Default to CSV output format
191 m_bYamlInputFormat = false; // Default to .dat format
192
195
196 m_nLayers =
208 m_nGISSave =
209 m_nUSave =
215 //m_nNThisIterCliffCollapse =
216 //m_nNTotCliffCollapse =
230 m_nLevel =
232
233 // TODO 011 May wish to make this a user-supplied value
236
237 m_nXMinBoundingBox = INT_MAX;
238 m_nXMaxBoundingBox = INT_MIN;
239 m_nYMinBoundingBox = INT_MAX;
240 m_nYMaxBoundingBox = INT_MIN;
241
242 // cppcheck-suppress useInitializationList
243 m_GDALWriteIntDataType = GDT_Unknown;
244 // cppcheck-suppress useInitializationList
245 m_GDALWriteFloatDataType = GDT_Unknown;
246
249
250 m_ulIter =
263
264 for (int i = 0; i < NUMBER_OF_RNGS; i++)
265 m_ulRandSeed[i] = 0;
266
267 for (int i = 0; i < SAVEMAX; i++)
268 m_dUSaveTime[i] = 0;
269
286 m_dClkLast =
295 m_dC_0 =
296 m_dL_0 =
303 m_dR =
304 m_dD50Fine =
305 m_dD50Sand =
315 m_dKLS =
317 m_dG =
395
396 m_dMinSWL = DBL_MAX;
397 m_dMaxSWL = DBL_MIN;
398
399 for (int i = 0; i < 6; i++)
400 m_dGeoTransform[i] = 0;
401
402 // TODO 011 May wish to make this a user-supplied value
405
437
439 m_tSysEndTime = 0;
440
441 m_pRasterGrid = NULL;
442}
443
444//===============================================================================================================================
446//===============================================================================================================================
448{
449 // Close output files if open
450 if (LogStream && LogStream.is_open())
451 {
452 LogStream.flush();
453 LogStream.close();
454 }
455
456 if (OutStream && OutStream.is_open())
457 {
458 OutStream.flush();
459 OutStream.close();
460 }
461
462 if (SeaAreaTSStream && SeaAreaTSStream.is_open())
463 {
464 SeaAreaTSStream.flush();
465 SeaAreaTSStream.close();
466 }
467
469 {
472 }
473
475 {
478 }
479
481 {
484 }
485
487 {
490 }
491
493 {
496 }
497
499 {
502 }
503
505 {
508 }
509
511 {
514 }
515
516 if (m_pRasterGrid)
517 delete m_pRasterGrid;
518}
519
520//===============================================================================================================================
522//===============================================================================================================================
524{
525 return m_dMissingValue;
526}
527
528//===============================================================================================================================
530//===============================================================================================================================
532{
533 return m_dThisIterSWL;
534}
535
536//===============================================================================================================================
538//===============================================================================================================================
543
544// //===============================================================================================================================
545// //! Returns the max elevation of the beach above SWL
546// //===============================================================================================================================
547// double CSimulation::dGetMaxBeachElevAboveSWL (void) const
548// {
549// return m_dMaxBeachElevAboveSWL;
550// }
551
552//===============================================================================================================================
553// Returns the cell side length
554//===============================================================================================================================
555// double CSimulation::dGetCellSide(void) const
556// {
557// return m_dCellSide;
558// }
559
560//===============================================================================================================================
562//===============================================================================================================================
564{
565 return m_nXGridSize;
566}
567
568//===============================================================================================================================
570//===============================================================================================================================
572{
573 return m_nYGridSize;
574}
575
576//===============================================================================================================================
578//===============================================================================================================================
579double CSimulation::dGetD50Fine(void) const
580{
581 return m_dD50Fine;
582}
583
584//===============================================================================================================================
586//===============================================================================================================================
587double CSimulation::dGetD50Sand(void) const
588{
589 return m_dD50Sand;
590}
591
592//===============================================================================================================================
594//===============================================================================================================================
596{
597 return m_dD50Coarse;
598}
599
600//===============================================================================================================================
602//===============================================================================================================================
603int CSimulation::nDoSimulation(int nArg, char const* pcArgv[])
604{
605 // ================================================== initialization section ================================================
606 // Hello, World!
608
609 // Start the clock ticking
610 StartClock();
611
612 // Deal with command-line parameters
613 int nRet = nHandleCommandLineParams(nArg, pcArgv);
614
615 if (nRet != RTN_OK)
616 return (nRet);
617
618 // 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)
619 if (! bFindExeDir(pcArgv[0]))
620 return (RTN_ERR_CMEDIR);
621
622 // OK, we are off, tell the user about the licence and the start time
624
625 // Read the .ini file and get the name of the run-data file, and path for output etc.
626 if (! bReadIniFile())
627 return (RTN_ERR_INI);
628
629 // Check if output dir exists
630 if ((! is_directory(m_strOutPath.c_str())) || (! exists(m_strOutPath.c_str())))
631 {
632 // Output dir does not exist
633 bool bCreateDir = false;
634
635 if ((isatty(fileno(stdout))) && (isatty(fileno(stderr))))
636 {
637 // Running with stdout and stderr as a tty, so ask the user if they wish to create it
638 char ch;
639 cerr << endl
640 << "Output folder '" << m_strOutPath << "' does not exist. Create it? (Y/N) ";
641 cerr.flush();
642 cin.get(ch);
643
644 if ((ch == 'y') || (ch == 'Y'))
645 bCreateDir = true;
646 }
647
648 else
649 {
650 // Running with stdout or stderr not a tty, so create output dir rather than abort
651 bCreateDir = true;
652 }
653
654 if (bCreateDir)
655 {
656 // Yes, so create the directory
657 create_directories(m_strOutPath.c_str());
658 cerr << m_strOutPath << " created" << endl << endl;
659 }
660
661 else
662 // Nope, just end the run
663 return RTN_USER_ABORT;
664 }
665
666 // We have the name of the run-data input file, so read it
667 if (! bReadRunDataFile())
668 return RTN_ERR_RUNDATA;
669
670 // Check raster GIS output format
673
674 // Check vector GIS output format
677
678 // Open log file
679 if (! bOpenLogFile())
680 return (RTN_ERR_LOGFILE);
681
682 // Set up the time series output files
683 if (! bSetUpTSFiles())
684 return (RTN_ERR_TSFILE);
685
686 // Initialize the random number generators
687 for (int n = 0; n < NUMBER_OF_RNGS; n++)
688 m_Rand[n].seed(m_ulRandSeed[n]);
689
690 // If we are doing Savitzky-Golay smoothing of the vector coastline(s), calculate the filter coefficients
693
694 // Create the raster grid object
695 m_pRasterGrid = new CGeomRasterGrid(this);
696
697 // Read in the basement layer (must have this file), create the raster grid, then read in the basement DEM data to the array
699 nRet = nReadRasterBasementDEM();
700
701 if (nRet != RTN_OK)
702 return nRet;
703
704 // 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
706 {
708
709 if (nTmp < 3)
710 {
711 string const strErr = ERR + "cliff deposition must have a planview width of at least three cells. The current setting of " + to_string(m_dCliffDepositionPlanviewWidth) + " m gives a planview width of " + to_string(nTmp) + " cells. Please edit " + m_strDataPathName;
712 cerr << strErr << endl;
713 LogStream << strErr << endl;
714 OutStream << strErr << endl;
715 return RTN_ERR_RUNDATA;
716 }
717 }
718
719 // Do some more initialisation
720 // cppcheck-suppress truncLongCastAssignment
722
723 // Mark edge cells, as defined by the basement layer
725
726 if (nRet != RTN_OK)
727 return nRet;
728
729 // // DEBUG CODE =================================================================================================================
730 // for (int n = 0; n < m_VEdgeCell.size(); n++)
731 // {
732 // LogStream << "[" << m_VEdgeCell[n].nGetX() << "][" << m_VEdgeCell[n].nGetY() << "] = {" << dGridCentroidXToExtCRSX(m_VEdgeCell[n].nGetX()) << ", " << dGridCentroidYToExtCRSY(m_VEdgeCell[n].nGetY()) << "} " << m_VEdgeCellEdge[n] << endl;
733 // }
734 // // DEBUG CODE =================================================================================================================
735
736 // 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
739
740 else
741 {
742 // The user specified a profile spacing, is this too small?
744
746 {
747 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;
748
749 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;
750
752 }
753 }
754
755 // Set the profile spacing on interventions
758
759 // 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
761
762 for (int nX = 0; nX < m_nXGridSize; nX++)
763 for (int nY = 0; nY < m_nYGridSize; nY++)
764 m_pRasterGrid->m_Cell[nX][nY].AppendLayers(m_nLayers);
765
766 // Tell the user what is happening then read in the layer files
768
769 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
770 {
771 // Read in the initial fine unconsolidated sediment depth file(s)
774 if (nRet != RTN_OK)
775 return (nRet);
776
777 // Read in the initial sand unconsolidated sediment depth file
780 if (nRet != RTN_OK)
781 return (nRet);
782
783 // Read in the initial coarse unconsolidated sediment depth file
786 if (nRet != RTN_OK)
787 return (nRet);
788
789 // Read in the initial fine consolidated sediment depth file
791 nRet = nReadRasterGISFile(FINE_CONS_RASTER, nLayer);
792 if (nRet != RTN_OK)
793 return (nRet);
794
795 // Read in the initial sand consolidated sediment depth file
797 nRet = nReadRasterGISFile(SAND_CONS_RASTER, nLayer);
798 if (nRet != RTN_OK)
799 return (nRet);
800
801 // Read in the initial coarse consolidated sediment depth file
804 if (nRet != RTN_OK)
805 return (nRet);
806 }
807
808 // Read in the initial suspended sediment depth file
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 if (nRet != RTN_OK)
820 return (nRet);
821 }
822
823 // Maybe read in intervention data
824 if (! m_strInterventionClassFile.empty())
825 {
828 if (nRet != RTN_OK)
829 return (nRet);
830
833 if (nRet != RTN_OK)
834 return (nRet);
835 }
836
837 // Maybe read in the tide data
838 if (! m_strTideDataFile.empty())
839 {
841 nRet = nReadTideDataFile();
842 if (nRet != RTN_OK)
843 return (nRet);
844 }
845
846 // Read in the erosion potential shape function data
848 nRet = nReadShapeFunctionFile();
849 if (nRet != RTN_OK)
850 return (nRet);
851
852 // Do we want to output the erosion potential look-up values, for checking purposes?
855
856 // OK, now read in the vector files (if any)
859
860 // Maybe read in deep water wave station data
862 {
863 // We are reading deep water wave height, orientation and period from a file of vector points and file time series
865
866 // Read in vector points
868 if (nRet != RTN_OK)
869 return (nRet);
870
871 int const nWaveStations = static_cast<int>(m_VnDeepWaterWaveStationID.size());
872
873 if (nWaveStations == 1)
875
876 // Read in time series values, and initialize the vector which stores each timestep's deep water wave height, orientation and period
877 nRet = nReadWaveStationInputFile(nWaveStations);
878 if (nRet != RTN_OK)
879 return (nRet);
880 }
881
882 // Maybe read in sediment input event data
884 {
885 // We are reading sediment input event data
887
888 // Read in vector points for sediment input events
890 if (nRet != RTN_OK)
891 return (nRet);
892
893 // Read in the time series values for sediment input events
895 if (nRet != RTN_OK)
896 return (nRet);
897 }
898
899 // Maybe read in flood input location
901 {
902 // We are reading sediment input event data
904
905 // Read in vector points for sediment input events
907 if (nRet != RTN_OK)
908 return (nRet);
909 }
910
911 // Open the main output
912 OutStream.open(m_strOutFile.c_str(), ios::out | ios::trunc);
913
914 if (!OutStream)
915 {
916 // Error, cannot open Out file
917 cerr << ERR << "cannot open " << m_strOutFile << " for output" << endl;
918 return (RTN_ERR_OUTFILE);
919 }
920
921 // Write beginning-of-run information to Out and Log files
923
924 // Start initializing
926
927 // Misc initialization calcs
928 m_nCoastMax = COAST_LENGTH_MAX * tMax(m_nXGridSize, m_nYGridSize); // Arbitrary but probably OK
929 m_nCoastMin = tMin(m_nXGridSize, m_nYGridSize); // In some cases the following rule doesn't work TODO 007 Info needed
930 // nRound(COAST_LENGTH_MIN_X_PROF_SPACE * m_dCoastNormalSpacing / m_dCellSide); // TODO 007 Info needed
931 m_nCoastCurvatureInterval = tMax(nRound(m_dCoastNormalSpacing / (m_dCellSide * 2)), 2); // TODO 007 Info needed
932
933 // For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) transport rate (Leo Van Rijn) TODO 007 need full reference
935
936 m_bConsChangedThisIter.resize(m_nLayers, false);
937 m_bUnconsChangedThisIter.resize(m_nLayers, false);
938
939 // Normalize sediment erodibility values, so that none are > 1
944
945 // Intialise SWL
947
948 // If SWL changes during the simulation, calculate the per-timestep increment (could be -ve)
950 {
953 }
954
955 // ===================================================== The main loop ======================================================
956 // Tell the user what is happening
958
959 while (true)
960 {
961 // Check that we haven't gone on too long: if not then update timestep number etc.
962 if (bTimeToQuit())
963 break;
964
965 // Tell the user how the simulation is progressing
967
969 LogStream << "TIMESTEP " << m_ulIter << " " << string(154, '=') << endl;
970
971 LogStream << fixed << setprecision(3);
972
973 // Check to see if there is a new intervention in place: if so, update it on the RasterGrid array
974 nRet = nUpdateIntervention();
975 if (nRet != RTN_OK)
976 return nRet;
977
978 // Calculate changes due to external forcing (change in still water level, tide level and deep water waves height, orientation and period)
979 nRet = nCalcExternalForcing();
980 if (nRet != RTN_OK)
981 return nRet;
982
983 // 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
985 if (nRet != RTN_OK)
986 return nRet;
987
988 // 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()
989 int nValidCoast = 0;
990 nRet = nLocateSeaAndCoasts(nValidCoast);
991 if (nRet != RTN_OK)
992 return nRet;
993
994 // Tell the user how the simulation is progressing
996
997 // Locate estuaries TODO 044 someday...
998
999 // Locate and trace cliff toe
1000 nRet = nLocateCliffToe();
1001 if (nRet != RTN_OK)
1002 return nRet;
1003
1004 // For all cells, use classification rules to assign sea and hinterland landform categories
1006 if (nRet != RTN_OK)
1007 return nRet;
1008
1009 // For every coastline, use classification rules to assign landform categories
1011 if (nRet != RTN_OK)
1012 return nRet;
1013
1014 // Create all coastline-normal profiles, in coastline-concave-curvature sequence
1015 nRet = nCreateAllProfiles();
1016 if (nRet != RTN_OK)
1017 return nRet;
1018
1019 // // DEBUG CODE ================
1020 // if (! bWriteVectorGISFile(VECTOR_PLOT_COAST, &VECTOR_PLOT_COAST_TITLE))
1021 // return false;
1022 // if (! bWriteVectorGISFile(VECTOR_PLOT_NORMALS, &VECTOR_PLOT_NORMALS_TITLE))
1023 // return false;
1024 // if (! bWriteVectorGISFile(VECTOR_PLOT_INVALID_NORMALS, &VECTOR_PLOT_INVALID_NORMALS_TITLE))
1025 // return false;
1026 // // DEBUG CODE ================
1027
1028 // Check the coastline-normal profiles for intersection, modify the profiles if they intersect, then mark valid profiles on the raster grid
1029 nRet = nCheckAndMarkAllProfiles();
1030 if (nRet != RTN_OK)
1031 return nRet;
1032
1033 // // DEBUG CODE ================
1034 // m_nGISSave++;
1035 // if (! bWriteVectorGISFile(VECTOR_PLOT_COAST, &VECTOR_PLOT_COAST_TITLE))
1036 // return false;
1037 // if (! bWriteVectorGISFile(VECTOR_PLOT_NORMALS, &VECTOR_PLOT_NORMALS_TITLE))
1038 // return false;
1039 // if (! bWriteVectorGISFile(VECTOR_PLOT_INVALID_NORMALS, &VECTOR_PLOT_INVALID_NORMALS_TITLE))
1040 // return false;
1041 // // DEBUG CODE ================
1042
1043 if (m_VCoast.size() > 0)
1044 {
1045 // We have multiple coastlines
1046 nRet = nDoMultipleCoastlines();
1047 if (nRet != RTN_OK)
1048 return nRet;
1049 }
1050
1051 // DEBUG CODE ================
1052 // m_nGISSave++;
1054 return false;
1056 return false;
1058 return false;
1060 return false;
1062 return false;
1063 // DEBUG CODE ================
1064
1065 // // DEBUG CODE =================
1066 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1067 // {
1068 // for (int nCoastPoint = 0; nCoastPoint < m_VCoast[nCoast].nGetCoastlineSize(); nCoastPoint++)
1069 // {
1070 // if (m_VCoast[nCoast].bIsProfileAtCoastPoint(nCoastPoint))
1071 // {
1072 // CGeomProfile const* pProfile = m_VCoast[nCoast].pGetProfileAtCoastPoint(nCoastPoint);
1073 // int nProfile = pProfile->nGetProfileID();
1074 //
1075 // LogStream << m_ulIter << ": profile " << nProfile << " bStartOfCoast = " << pProfile->bStartOfCoast() << " bEndOfCoast = " << pProfile->bEndOfCoast() << " bCShoreProblem = " << pProfile->bCShoreProblem() << " bHitLand = " << pProfile->bHitLand() << " bHitCoast = " << pProfile->bHitCoast() << " bTooShort = " << pProfile->bTooShort() << " bTruncatedSameCoast = " << pProfile->bTruncatedSameCoast() << " bHitAnotherProfile = " << pProfile->bHitAnotherProfile() << endl;
1076 // }
1077 // }
1078 // }
1079 // // DEBUG CODE =================
1080
1081 // Tell the user how the simulation is progressing
1083
1084 // Create the coast polygons
1085 nRet = nCreateAllPolygons();
1086 if (nRet != RTN_OK)
1087 return nRet;
1088
1089 // // DEBUG CODE ====================
1090 // if (! bWriteVectorGISFile(VECTOR_PLOT_POLYGON_BOUNDARY, &VECTOR_PLOT_POLYGON_BOUNDARY_TITLE))
1091 // return false;
1092 // // DEBUG CODE ====================
1093
1094 // // DEBUG CODE =========================================================================================================
1095 // int nNODATA = 0;
1096 // int nPoly0 = 0;
1097 // int nPoly24 = 0;
1098 // for (int nX = 0; nX < m_nXGridSize; nX++)
1099 // {
1100 // for (int nY = 0; nY < m_nYGridSize; nY++)
1101 // {
1102 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1103 // if (nTmp == INT_NODATA)
1104 // nNODATA++;
1105 //
1106 // if (nTmp == 0)
1107 // nPoly0++;
1108 //
1109 // if (nTmp == 24)
1110 // nPoly24++;
1111 // }
1112 // }
1113 // LogStream << "Before marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1114 // // LogStream << "Before marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1115 // LogStream << "Before marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1116 // // DEBUG CODE =========================================================================================================
1117
1118 // Mark cells of the raster grid that are within each polygon, and do some polygon initialization
1120
1121 // Calculate the length of the shared normal between each polygon and the adjacent polygon(s)
1123 if (nRet != RTN_OK)
1124 return nRet;
1125
1126 // Tell the user how the simulation is progressing
1128
1129 // // DEBUG CODE =========================================================================================================
1130 // nNODATA = 0;
1131 // nPoly0 = 0;
1132 // nPoly24 = 0;
1133 // for (int nX = 0; nX < m_nXGridSize; nX++)
1134 // {
1135 // for (int nY = 0; nY < m_nYGridSize; nY++)
1136 // {
1137 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1138 // if (nTmp == INT_NODATA)
1139 // nNODATA++;
1140 //
1141 // if (nTmp == 0)
1142 // nPoly0++;
1143 //
1144 // if (nTmp == 24)
1145 // nPoly24++;
1146 // }
1147 // }
1148 // LogStream << "After marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1149 // // LogStream << "After marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1150 // LogStream << "After marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1151 // // DEBUG CODE =========================================================================================================
1152 // PropagateWind();
1153
1154 // Give every coast point a value for deep water wave height and direction
1156 if (nRet != RTN_OK)
1157 return nRet;
1158
1159 // // DEBUG CODE ===============
1160 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1161 // {
1162 // LogStream << "====================" << endl;
1163 //
1164 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1165 // {
1166 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfile(nProfile);
1167 // int nCell = pProfile->nGetNumCellsInProfile();
1168 // LogStream << "Profile " << pProfile->nGetProfileID() << " nGetNumCellsInProfile() = " << nCell << endl;
1169 // }
1170 //
1171 // LogStream << endl;
1172 //
1173 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1174 // {
1175 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfileWithDownCoastSeq(nProfile);
1176 // int nCell = pProfile->nGetNumCellsInProfile();
1177 // LogStream << "Profile " << pProfile->nGetProfileID() << " nGetNumCellsInProfile() = " << nCell << endl;
1178 // }
1179 //
1180 // LogStream << "====================" << endl;
1181 // }
1182 // // DEBUG CODE =====================
1183
1184 // Change the wave properties in all shallow water sea cells: propagate waves and define the active zone, also locate wave shadow zones
1185 nRet = nDoAllPropagateWaves();
1186 if (nRet != RTN_OK)
1187 return nRet;
1188
1189 // Output polygon share table and pre-existing sediment table to log file
1191 {
1192 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1193 {
1194 WritePolygonInfoTable(nCoast);
1196 }
1197 }
1198
1199 // Tell the user how the simulation is progressing
1201
1202 // // DEBUG CODE ===========================================================================================================
1203 // string strOutFile = m_strOutPath;
1204 // strOutFile += "sea_wave_height_CHECKPOINT_";
1205 // strOutFile += to_string(m_ulIter);
1206 // strOutFile += ".tif";
1207 //
1208 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1209 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1210 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1211 // pDataSet->SetGeoTransform(m_dGeoTransform);
1212 //
1213 // int nn = 0;
1214 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1215 // for (int nY = 0; nY < m_nYGridSize; nY++)
1216 // {
1217 // for (int nX = 0; nX < m_nXGridSize; nX++)
1218 // {
1219 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1220 // }
1221 // }
1222 //
1223 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1224 // pBand->SetNoDataValue(m_dMissingValue);
1225 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1226 //
1227 // if (nRet == CE_Failure)
1228 // return RTN_ERR_GRIDCREATE;
1229 //
1230 // GDALClose(pDataSet);
1231 // delete[] pdRaster;
1232 // // DEBUG CODE ===========================================================================================================
1233 //
1234 // // DEBUG CODE ===========================================================================================================
1235 // strOutFile = m_strOutPath;
1236 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1237 // strOutFile += to_string(m_ulIter);
1238 // strOutFile += ".tif";
1239 //
1240 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1241 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1242 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1243 // pDataSet->SetGeoTransform(m_dGeoTransform);
1244 //
1245 // nn = 0;
1246 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1247 // for (int nY = 0; nY < m_nYGridSize; nY++)
1248 // {
1249 // for (int nX = 0; nX < m_nXGridSize; nX++)
1250 // {
1251 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1252 // }
1253 // }
1254 //
1255 // pBand = pDataSet->GetRasterBand(1);
1256 // pBand->SetNoDataValue(m_dMissingValue);
1257 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1258 //
1259 // if (nRet == CE_Failure)
1260 // return RTN_ERR_GRIDCREATE;
1261 //
1262 // GDALClose(pDataSet);
1263 // delete[] pdRaster;
1264 // // DEBUG CODE ===========================================================================================================
1265
1266 // Save the not-deposited values, to be shown in the logfile after we've finished beach sediment movement
1269
1272 {
1273 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << " m_dUnconsSandNotDepositedLastIter = " << m_dUnconsSandNotDepositedLastIter << endl;
1274 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea << " m_dUnconsCoarseNotDepositedLastIter = " << m_dUnconsCoarseNotDepositedLastIter << endl;
1275 }
1276
1278 {
1279 // Calculate elevation change on the consolidated sediment which comprises the coastal platform
1281 if (nRet != RTN_OK)
1282 return nRet;
1283 }
1284
1285 // Output shore platform erosion table to log file
1287 {
1288 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1290 }
1291
1293 {
1294 // Do all cliff collapses for this timestep (if any)
1296 if (nRet != RTN_OK)
1297 return nRet;
1298 }
1299
1300 // Output cliff collapse table to log file
1302 {
1303 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1305 }
1306
1307 // Tell the user how the simulation is progressing
1309
1311 {
1312 // 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
1314
1315 // 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
1317 if (nRet != RTN_OK)
1318 return nRet;
1319 }
1320
1321 // 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
1322 if (m_bSedimentInput)
1323 {
1325 if (nRet != RTN_OK)
1326 return nRet;
1327
1328 // If we have had at least one sediment input event this iteration, then output the sediment event per polygon table to the log file
1330 {
1331 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1333 }
1334 }
1335
1336 // // 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
1337 // double dFineThisIter = m_dThisIterActualPlatformErosionFineCons + m_dThisIterCliffCollapseErosionFineUncons + m_dThisIterCliffCollapseErosionFineCons + m_dThisIterCliffCollapseFineErodedDuringDeposition + m_dThisIterBeachErosionFine - m_dThisIterLeftGridUnconsFine;
1338 //
1339 // m_dThisIterFineSedimentToSuspension += dFineThisIter;
1340
1341 // Tell the user how the simulation is progressing
1343
1344 // // DEBUG CODE ===========================================================================================================
1345 // string strOutFile = m_strOutPath;
1346 // strOutFile += "sea_wave_height_CHECKPOINT_";
1347 // strOutFile += to_string(m_ulIter);
1348 // strOutFile += ".tif";
1349 //
1350 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1351 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1352 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1353 // pDataSet->SetGeoTransform(m_dGeoTransform);
1354 //
1355 // int nn = 0;
1356 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1357 // for (int nY = 0; nY < m_nYGridSize; nY++)
1358 // {
1359 // for (int nX = 0; nX < m_nXGridSize; nX++)
1360 // {
1361 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1362 // }
1363 // }
1364 //
1365 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1366 // pBand->SetNoDataValue(m_dMissingValue);
1367 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1368 //
1369 // if (nRet == CE_Failure)
1370 // return RTN_ERR_GRIDCREATE;
1371 //
1372 // GDALClose(pDataSet);
1373 // delete[] pdRaster;
1374 // // DEBUG CODE ===========================================================================================================
1375 //
1376 // // DEBUG CODE ===========================================================================================================
1377 // strOutFile = m_strOutPath;
1378 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1379 // strOutFile += to_string(m_ulIter);
1380 // strOutFile += ".tif";
1381 //
1382 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1383 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1384 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1385 // pDataSet->SetGeoTransform(m_dGeoTransform);
1386 //
1387 // nn = 0;
1388 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1389 // for (int nY = 0; nY < m_nYGridSize; nY++)
1390 // {
1391 // for (int nX = 0; nX < m_nXGridSize; nX++)
1392 // {
1393 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1394 // }
1395 // }
1396 //
1397 // pBand = pDataSet->GetRasterBand(1);
1398 // pBand->SetNoDataValue(m_dMissingValue);
1399 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1400 //
1401 // if (nRet == CE_Failure)
1402 // return RTN_ERR_GRIDCREATE;
1403 //
1404 // GDALClose(pDataSet);
1405 // delete[] pdRaster;
1406 // // DEBUG CODE ===========================================================================================================
1407
1408 // Do some end-of-timestep updates to the raster grid, also update per-timestep and running totals
1409 nRet = nUpdateGrid();
1410 if (nRet != RTN_OK)
1411 return nRet;
1412
1413 // Make water level inundation on grid
1415 {
1416 m_nLevel = 0;
1417
1418 nRet = nLocateFloodAndCoasts();
1419 if (nRet != RTN_OK)
1420 return nRet;
1421 }
1422
1424 {
1425 // TODO 007 Info needed
1426 m_nLevel = 1;
1427
1428 nRet = nLocateFloodAndCoasts();
1429 if (nRet != RTN_OK)
1430 return nRet;
1431 }
1432
1433 // Now save results, first the raster and vector GIS files if required
1434 m_bSaveGISThisIter = false;
1435
1437 {
1438 m_bSaveGISThisIter = true;
1439
1440 // Save the values from the RasterGrid array into raster GIS files
1441 if (! bSaveAllRasterGISFiles())
1443
1444 // Tell the user how the simulation is progressing
1446
1447 // Save the vector GIS files
1448 if (! bSaveAllVectorGISFiles())
1450
1451 // Tell the user how the simulation is progressing
1453 }
1454
1455 // Output per-timestep results to the .out file
1457 return (RTN_ERR_TEXT_FILE_WRITE);
1458
1459 // Now output time series CSV stuff
1460 if (! bWriteTSFiles())
1462
1463 // Tell the user how the simulation is progressing
1465
1466 // Update grand totals
1468
1469 } // ================================================ End of main loop ======================================================
1470
1471 // =================================================== post-loop tidying =====================================================
1472 // Tell the user what is happening
1474
1475 // Write end-of-run information to Out, Log and time-series files
1476 nRet = nWriteEndRunDetails();
1477 if (nRet != RTN_OK)
1478 return (nRet);
1479
1480 // Do end-of-run memory clearance
1482 return RTN_OK;
1483}
Geometry cass used to represent the raster grid of cell objects.
Definition raster_grid.h:33
double m_dThisIterPotentialBeachErosion
Total potential beach erosion (all size classes of unconsolidated sediment) for this iteration (depth...
Definition simulation.h:849
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:924
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:225
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:579
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:114
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:759
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:252
bool bWriteRasterGISFile(int const, string const *, int const =0, double const =0)
Writes GIS raster files using GDAL, using data from the RasterGrid array.
static void AnnounceInitializing(void)
Tells the user that we are now initializing.
Definition utils.cpp:655
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:504
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
Definition simulation.h:99
int m_nYMinBoundingBox
The minimum y value of the bounding box.
Definition simulation.h:549
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
Definition utils.cpp:647
void CalcSavitzkyGolayCoeffs(void)
Calculates the Savitzky-Golay smoothing coefficients for a given size of smoothing window....
bool bCheckRasterGISOutputFormat(void)
static void AnnounceIsRunning(void)
Tell the user that the simulation is now running.
Definition utils.cpp:664
bool m_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
Definition simulation.h:96
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:198
int nLocateSeaAndCoasts(int &)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
bool m_bHaveConsolidatedSediment
Does this simulation consider consolidated sediment, or is it an unconsolidated sediment only simulat...
Definition simulation.h:453
double m_dNotchDepthAtCollapse
Notch overhang (i.e. length of horizontal incision) to initiate collapse (m)
Definition simulation.h:915
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:444
time_t m_tSysEndTime
System finish-simulation time.
double m_dTotalCoarseUnconsInPolygons
Total coarse unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells ...
bool m_bSedimentInputAtPoint
Do we have sediment inputat a point?
Definition simulation.h:399
double m_dMinSWL
Minimum still water level.
Definition simulation.h:726
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:816
void AnnounceReadDeepWaterWaveValuesGIS(void) const
Tells the user that we are now reading the deep water wave values GIS file.
Definition utils.cpp:499
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:717
int m_nBeachErosionDepositionEquation
Which beach erosion-deposition equation is used. Possible values are UNCONS_SEDIMENT_EQUATION_CERC an...
Definition simulation.h:534
ofstream CliffCollapseNetChangeTSStream
bool m_bCoastSave
Save.
Definition simulation.h:270
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:321
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:609
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:570
double m_dL_0
Deep water wave length (m)
Definition simulation.h:750
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
Definition simulation.h:969
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:771
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Does this work correctly?
Definition simulation.h:333
bool bSetUpTSFiles(void)
The bSetUpTSFiles member function sets up the time series files.
Definition utils.cpp:1116
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:557
double m_dThisIterBeachErosionCoarse
Total actual beach erosion (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:858
int m_nGISMissingValue
The value for integer missing values, as read from GIS input files.
Definition simulation.h:537
char ** m_papszGDALVectorOptions
Options for GDAL when handling vector files.
Definition simulation.h:459
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
Definition simulation.h:999
int nReadRasterGISFile(int const, int const)
Reads all other raster GIS datafiles into the RasterGrid array.
vector< CRWCoast > m_VCoast
The coastline objects.
double m_dCoastNormalLength
Length of the coastline-normal profiles, in m.
Definition simulation.h:831
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:336
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
All-simulation total of coarse sediment eroded during talus deposition following cliff collapse (m)
double m_dGISMissingValue
The value for floating-point missing values, as read from GIS input files.
Definition simulation.h:963
double m_dUnconsCoarseNotDepositedLastIter
Depth of unconsolidated coarse sediment that could not be deposited during the last iteration,...
double m_dCPUClock
Total elapsed CPU time.
Definition simulation.h:699
bool bSaveAllVectorGISFiles(void)
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:390
int nDoMultipleCoastlines(void)
Checks all profiles on all coasts for intersections between profiles belonging to different coasts.
int m_nThisSave
Used in calculations of GIS save intervals.
Definition simulation.h:513
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:597
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:132
double m_dSouthEastXExtCRS
The south-east x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:654
int m_nMissingValue
Used by CoastalME for integer missing values.
Definition simulation.h:540
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:126
long double m_ldGTotActualCoarseBeachErosion
All-simulation total of coarse sediment eroded during beach (unconsolidated sediment) movement (m)
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
int nReadWaveStationInputFile(int const)
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:273
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:801
bool bWriteVectorGISFile(int const, string const *)
Writes vector GIS files using GDAL/OGR.
double m_dThisIterCliffCollapseFineErodedDuringDeposition
Total fine sediment eroded during Dean profile deposition of talus following cliff collapse (depth in...
Definition simulation.h:882
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:279
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:294
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
Definition simulation.h:738
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:846
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:165
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.
Definition simulation.h:975
bool m_bStillWaterLevelTSSave
Save the still water level time series file?
Definition simulation.h:303
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:423
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:591
long double m_ldGTotCliffTalusFineToSuspension
All-simulation total of fine sediment moved to suspension, due to cliff collapse (m)
bool m_bYamlInputFormat
Use YAML format for input datafile instead of .dat format?
Definition simulation.h:351
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:231
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:159
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:261
double m_dCoarseErodibility
The relative erodibility (0- 1) of coarse unconsolidated beach sediment.
Definition simulation.h:798
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:702
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:927
double m_dMissingValue
Used by CoastalME for floating-point missing values.
Definition simulation.h:966
int m_nUnconsSedimentHandlingAtGridEdges
How sediment which moves off an edge of the grid is handled. Possible values are GRID_EDGE_CLOSED,...
Definition simulation.h:531
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:795
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:93
double m_dInvCellDiagonal
Inverse of m_dCellDiagonal.
Definition simulation.h:675
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:564
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:807
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:204
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:327
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:315
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
Definition simulation.h:990
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:240
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:618
static void AnnounceSimEnd(void)
Announce the end of the simulation.
Definition utils.cpp:1445
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:612
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:903
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:469
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:753
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:117
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:438
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:939
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:375
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:180
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:894
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:177
int m_nCoastMax
Maximum valid coast length when searching for coasts.
Definition simulation.h:516
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:789
double dGetMissingValue(void) const
Returns the NODATA value.
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:558
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:567
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:624
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:201
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:306
int m_nCoastNormalSpacing
Average spacing between coastline normals, measured in cells.
Definition simulation.h:495
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
Definition simulation.h:546
long double m_ldGTotPotentialSedLostBeachErosion
All-simulation total of potential sediment lost via beach (unconsolidated) sediment movement (m),...
double m_dThisIterCliffCollapseErosionFineUncons
This-iteration total of fine unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:933
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:228
int nReadShapeFunctionFile(void)
static void AnnounceAddLayers(void)
Tells the user that we are now adding layers.
Definition utils.cpp:429
int nDoAllActualBeachErosionAndDeposition(void)
Does between-polygon and within-polygon actual (supply-limited) redistribution of transported beach s...
bool m_bCliffSave
Save cliff region raster grids?
Definition simulation.h:105
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:366
bool m_bSliceSave
Save slices?
Definition simulation.h:108
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:237
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:708
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:174
double m_dNorthWestYExtCRS
The north-west y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:651
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:267
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:229
double m_dStartIterConsCoarseAllCells
Depth (m) of coarse consolidated sediment at the start of the simulation, all cells (both inside and ...
double m_dStartIterConsSandAllCells
Depth (m) of sand consolidated sediment at the start of the simulation, all cells (both inside and ou...
int m_nCoastSmoothingWindowSize
The size of the window used for coast smoothing. Must be an odd number.
Definition simulation.h:474
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:405
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:396
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:633
double m_dInmersedToBulkVolumetric
For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) tra...
Definition simulation.h:819
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:276
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:120
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:891
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:87
unsigned long m_ulMissingValueBasementCells
The number of basement cells marked with as missing value.
Definition simulation.h:642
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
Definition simulation.h:984
int nReadVectorGISFile(int const)
Reads vector GIS datafiles using GDAL/OGR.
bool bReadRunDataFile(void)
Reads the run details input file and does some initialization.
int m_nUSave
If user-defined GIS save intervals, the number of these.
Definition simulation.h:510
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:837
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:960
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitzky-Golay smoothing is used (usually ...
Definition simulation.h:477
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:111
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:129
double m_dNotchBaseBelowSWL
Notch base below SWL (m)
Definition simulation.h:918
int m_nRunUpEquation
The run-up equation used TODO 007.
Definition simulation.h:582
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:387
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:514
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:897
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:498
double m_dFineErodibility
The relative erodibility (0- 1) of fine unconsolidated beach sediment.
Definition simulation.h:792
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:978
time_t m_tSysStartTime
System start-simulation time.
double m_dBreakingWaveHeightDepthRatio
Breaking wave height-to-depth ratio.
Definition simulation.h:756
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
Definition utils.cpp:529
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:825
bool bCheckVectorGISOutputFormat(void)
Checks whether the selected vector GDAL/OGR driver supports file creation etc.
bool m_bHaveWaveStationData
Do we have wave station data?
Definition simulation.h:393
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:705
int nDoSimulation(int, char const *[])
Runs the simulation.
void StartClock(void)
Starts the clock ticking.
Definition utils.cpp:205
long double m_ldGTotSuspendedSediment
All-simulation total of suspended sediment (m)
int m_nSavGolCliffEdgePoly
The order of the cliff edge smoothing polynomial if Savitzky-Golay smoothing is used (usually 2 or 4,...
Definition simulation.h:486
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:804
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:774
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:219
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:222
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
Definition utils.cpp:544
ofstream StillWaterLevelTSStream
SWL time series file output stream.
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
Definition utils.cpp:2997
double m_dThisIterActualPlatformErosionSandCons
Total actual platform erosion (sand consolidated sediment) for this iteration (depth in m)
Definition simulation.h:843
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:360
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:402
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
Definition utils.cpp:438
int m_nCliffEdgeSmooth
Which method to use for cliff edge smoothing.
Definition simulation.h:480
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:912
double m_dThisIterBeachDepositionCoarse
Total beach deposition (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:864
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:780
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:669
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:255
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:141
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:810
double m_dInvCellSide
Inverse of m_dCellSide.
Definition simulation.h:672
int m_nWavePropagationModel
The wave propagation model used. Possible values are WAVE_MODEL_CSHORE and WAVE_MODEL_COVE.
Definition simulation.h:555
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:762
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:684
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:282
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:483
int m_nDeepWaterWaveDataNumTimeSteps
The duration of data for deep water waves, expressed as a number of timesteps.
Definition simulation.h:576
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
Definition utils.cpp:408
int nConvertMetresToNumCells(double const) const
Given a length in m, this returns the rounded equivalent number of cells.
long double m_ldGTotCoarseSedimentInput
All-simulation total of coarse sediment input (m)
double m_dFinalMeanSWL
The end-of-simulation still water (m), is same as m_dInitialMeanSWL unless SWL changes.
Definition simulation.h:711
double m_dThisIterUnconsCoarseCliffDeposition
This-iteration total of coarse unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:954
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:381
bool m_bRasterWaveFloodLineSave
Are we saving the raster wave flood line? TODO 007.
Definition simulation.h:432
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:144
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:834
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:900
int m_nCoastMin
Minimum valid coast length when searching for coasts.
Definition simulation.h:519
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:687
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:285
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:354
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:951
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:330
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:156
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007.
Definition simulation.h:426
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:138
double m_dNorthWestXExtCRS
The north-west x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:648
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:783
static void AnnounceStart(void)
Tells the user that we have started the simulation.
Definition utils.cpp:196
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:501
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:870
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:657
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:162
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
All-simulation total of fine sediment eroded during talus deposition following cliff collapse (m)
~CSimulation(void)
The CSimulation destructor.
long double m_ldGTotCoarseDepositionDiff
All-simulation total of shortfall in unconsolidated coarse sediment deposition (m,...
int nSetAllCoastpointDeepWaterWaveValues(void)
Give every coast point a value for deep water wave height and direction TODO 005 This may not be real...
double m_dStartIterConsFineAllCells
Depth (m) of fine consolidated sediment at the start of the simulation, all cells (both inside and ou...
long double m_ldGTotActualCoarseLostBeachErosion
All-simulation total of coarse sediment lost via beach (unconsolidated) sediment movement (m)
bool m_bGISSaveDigitsSequential
Are the GIS save digits (which are part of each GIS file name) sequential, or are they the iteration ...
Definition simulation.h:450
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:570
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:192
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:930
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:855
double m_dAccumulatedSeaLevelChange
If long-term SWL changes, the total change so far since the start of simulation.
Definition simulation.h:723
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:288
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:420
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:153
double m_dThisIterFineSedimentToSuspension
Total fine unconsolidated sediment in suspension for this iteration (depth in m)
Definition simulation.h:867
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:852
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:885
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:561
bool bSaveAllRasterGISFiles(void)
unsigned long m_ulThisIterNumActualBeachErosionCells
The number of grid cells on which actual beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:630
bool bReadIniFile(void)
The bReadIniFile member function reads the initialization file.
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:84
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:921
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:318
int m_nYMaxBoundingBox
The maximum y value of the bounding box.
Definition simulation.h:552
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:168
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
The number of grid cells on which potential platform erosion occurs, for this iteration.
Definition simulation.h:621
double m_dStartIterUnconsSandAllCells
Depth (m) of sand unconsolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:996
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:729
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:714
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:507
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:441
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:243
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:942
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:186
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:828
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:573
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:171
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:216
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,...
double m_dThisIterDiffWaveSetupWaterLevel
TODO 007 Info needed.
Definition simulation.h:735
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:189
double m_dTotalCoarseConsInPolygons
Total coarse consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
int m_nCoastCurvatureMovingWindowSize
WHAT IS THOS FOR?
Definition simulation.h:588
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:615
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
Definition utils.cpp:484
double m_dTotalSandUnconsInPolygons
Total sand unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
void AnnounceReadInitialCoarseConsSedGIS(int const) const
Tells the user that we are now reading the initial coarse consolidated sediment depth GIS file.
Definition utils.cpp:622
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:414
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:600
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:993
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:210
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:408
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:90
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:690
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:264
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:681
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
The number of cells on which on-profile average potential shore platform erosion occurs.
Definition simulation.h:636
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:312
int m_nXMinBoundingBox
The minimum x value of the bounding box.
Definition simulation.h:543
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:666
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:135
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:639
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:957
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:768
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
Definition utils.cpp:596
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:147
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:372
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:627
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:207
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:297
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:258
string m_strInitialLandformFile
Name of initial landform file.
double m_dC_0
Deep water wave speed (m/s)
Definition simulation.h:747
double m_dThisIterCliffCollapseErosionSandCons
This-iteration total of sand consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:945
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:324
double m_dThisIterBeachDepositionSand
Total beach deposition (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:861
int nReadTideDataFile(void)
Reads the tide time series data.
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:213
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:300
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:384
double dGetThisIterSWL(void) const
Returns this timestep's still water level.
void WriteLookUpData(void)
Output the erosion potential look-up values, for checking purposes.
double m_dThisIterLeftGridUnconsCoarse
Total coarse unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:879
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:936
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:777
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:609
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:357
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:246
bool bOpenLogFile(void)
Opens the log file.
Definition utils.cpp:384
double m_dTotalSandConsInPolygons
Total sand consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
bool m_bSlopeSave
Save slope raster grids?
Definition simulation.h:102
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:603
void AnnounceLicence(void)
Tells the user about the licence.
Definition utils.cpp:268
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:195
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:786
int m_nNumPolygonGlobal
Number of global (all coasts) polygons.
Definition simulation.h:528
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:678
double m_dTotalFineUnconsInPolygons
Total fine unconsolidated sediment in all polygons, before polygon-to-polygon movement (only cells in...
long double m_ldGTotSandDepositionDiff
All-simulation total of shortfall in unconsolidated sand sediment deposition (m, not currently used)
bool m_bCSVPerTimestepResults
Output per-timestep results in CSV format instead of fixed-width?
Definition simulation.h:348
double m_dCliffSlopeLimit
Slope limit for cliff toe detection.
Definition simulation.h:489
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:1342
double m_dTotalFineConsInPolygons
Total fine consolidated sediment in all polygons, before polygon-to-polygon movement (only cells in p...
double m_dThisiterUnconsSandInput
Depth (m) of sand unconsolidated sediment added, at this iteration.
Definition simulation.h:981
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:660
int nDoAllPropagateWaves(void)
Simulates wave propagation along all coastline-normal profiles, on all coasts.
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:339
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:741
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:663
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:909
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:744
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
Definition utils.cpp:1662
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:234
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:765
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:888
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:693
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
Definition utils.cpp:454
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
Definition simulation.h:972
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:840
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:906
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:492
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:369
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
Definition utils.cpp:446
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:948
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:876
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:822
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_dStartIterSuspFineAllCells
Depth (m) of fine suspended sediment at the start of the simulation, all cells (both inside and outsi...
Definition simulation.h:987
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:429
double m_dThisIterDiffTotWaterLevel
TODO 007 Info needed.
Definition simulation.h:732
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:417
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:635
double m_dClkLast
Last value returned by clock()
Definition simulation.h:696
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:249
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:720
int nCheckAndMarkAllProfiles(void)
Check all coastline-normal profiles and modify the profiles if they intersect, then mark valid profil...
bool m_bCliffCollapseErosionTSSave
Save the cliff collapse erosion time series file?
Definition simulation.h:309
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:150
long double m_ldGTotPotentialPlatformErosion
All-simulation total of potential platform erosion (m), all size classes.
GDALDataType m_GDALWriteFloatDataType
Thw data type used by GDAL for floating point operations, can be GDT_Byte, GDT_Int16,...
Definition simulation.h:594
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:378
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
Definition utils.cpp:583
int nHandleCommandLineParams(int, char const *[])
Handles command-line parameters.
Definition utils.cpp:92
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:645
bool m_bFloodSWLSetupSurgeRunupLine
Are we saving the flood still water level setup surge runup line? TODO 007.
Definition simulation.h:447
unsigned long m_ulTotTimestep
The target number of iterations.
Definition simulation.h:606
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:342
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:813
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:345
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP.
Definition simulation.h:585
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
Definition simulation.h:411
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:291
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:435
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:123
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:363
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:873
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:183
This file contains global definitions for CoastalME.
int const INT_NODATA
Definition cme.h:476
int const RASTER_PLOT_POLYGON
Definition cme.h:635
T tMin(T a, T b)
Definition cme.h:1266
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
Definition cme.h:1192
double const TOLERANCE
Definition cme.h:823
string const VECTOR_PLOT_NORMALS_TITLE
Definition cme.h:1194
string const RASTER_PLOT_POLYGON_TITLE
Definition cme.h:1102
int const VECTOR_PLOT_NORMALS
Definition cme.h:679
int const SAND_CONS_RASTER
Definition cme.h:568
double const INTERVENTION_PROFILE_SPACING_FACTOR
Definition cme.h:832
int const SEDIMENT_INPUT_EVENT_LOCATION_VEC
Definition cme.h:595
string const ERR
Definition cme.h:903
int const RTN_ERR_LOGFILE
Definition cme.h:704
int const DEFAULT_PROFILE_SPACING
Definition cme.h:485
int const RTN_ERR_RASTER_GIS_OUT_FORMAT
Definition cme.h:711
int const RTN_ERR_RASTER_FILE_WRITE
Definition cme.h:714
int const LOG_FILE_MIDDLE_DETAIL
Definition cme.h:491
bool bFPIsEqual(const T d1, const T d2, const T dEpsilon)
Definition cme.h:1304
int const RTN_ERR_PROFILESPACING
Definition cme.h:718
int const VECTOR_PLOT_INVALID_NORMALS
Definition cme.h:677
int const FLOOD_LOCATION_VEC
Definition cme.h:600
int const DEEP_WATER_WAVE_STATIONS_VEC
Definition cme.h:592
int const RTN_ERR_RUNDATA
Definition cme.h:701
double const MASS_BALANCE_TOLERANCE
Definition cme.h:826
T tMax(T a, T b)
Definition cme.h:1253
int const SAVEMAX
Definition cme.h:464
int const VECTOR_PLOT_COAST
Definition cme.h:672
int const NUMBER_OF_RNGS
Definition cme.h:463
int const RTN_ERR_TSFILE
Definition cme.h:706
int const INTERVENTION_CLASS_RASTER
Definition cme.h:575
string const VECTOR_PLOT_COAST_TITLE
Definition cme.h:1188
int const RTN_ERR_VECTOR_GIS_OUT_FORMAT
Definition cme.h:712
int const RTN_USER_ABORT
Definition cme.h:697
int const SMOOTH_SAVITZKY_GOLAY
Definition cme.h:783
int const RTN_ERR_CMEDIR
Definition cme.h:700
int const RTN_ERR_INI
Definition cme.h:699
int const RTN_OK
Definition cme.h:694
int const RTN_ERR_TEXT_FILE_WRITE
Definition cme.h:713
int const RTN_ERR_VECTOR_FILE_WRITE
Definition cme.h:715
int const SAND_UNCONS_RASTER
Definition cme.h:571
string const RASTER_PLOT_NORMAL_PROFILE_TITLE
Definition cme.h:1099
int const FINE_UNCONS_RASTER
Definition cme.h:570
int const COARSE_UNCONS_RASTER
Definition cme.h:572
int const RASTER_PLOT_NORMAL_PROFILE
Definition cme.h:633
double const DBL_NODATA
Definition cme.h:834
int const RTN_ERR_OUTFILE
Definition cme.h:705
int const SUSP_SED_RASTER
Definition cme.h:573
int const FINE_CONS_RASTER
Definition cme.h:567
int const COARSE_CONS_RASTER
Definition cme.h:569
int const COAST_LENGTH_MAX
Definition cme.h:468
int const LANDFORM_RASTER
Definition cme.h:574
int const INTERVENTION_HEIGHT_RASTER
Definition cme.h:576
int const RTN_ERR_TIMESERIES_FILE_WRITE
Definition cme.h:716
Contains CRWCoast definitions.
Contains CGeomRasterGrid definitions.
Contains CSimulation definitions.
int nRound(double const d)
Version of the above that returns an int.