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
194
195 m_nLayers =
207 m_nGISSave =
208 m_nUSave =
214 //m_nNThisIterCliffCollapse =
215 //m_nNTotCliffCollapse =
229 m_nLevel =
231
232 // TODO 011 May wish to make this a user-supplied value
235
236 m_nXMinBoundingBox = INT_MAX;
237 m_nXMaxBoundingBox = INT_MIN;
238 m_nYMinBoundingBox = INT_MAX;
239 m_nYMaxBoundingBox = INT_MIN;
240
241 // cppcheck-suppress useInitializationList
242 m_GDALWriteIntDataType = GDT_Unknown;
243 // cppcheck-suppress useInitializationList
244 m_GDALWriteFloatDataType = GDT_Unknown;
245
248
249 m_ulIter =
262
263 for (int i = 0; i < NUMBER_OF_RNGS; i++)
264 m_ulRandSeed[i] = 0;
265
266 for (int i = 0; i < SAVEMAX; i++)
267 m_dUSaveTime[i] = 0;
268
285 m_dClkLast =
294 m_dC_0 =
295 m_dL_0 =
302 m_dR =
303 m_dD50Fine =
304 m_dD50Sand =
314 m_dKLS =
316 m_dG =
394
395 m_dMinSWL = DBL_MAX;
396 m_dMaxSWL = DBL_MIN;
397
398 for (int i = 0; i < 6; i++)
399 m_dGeoTransform[i] = 0;
400
401 // TODO 011 May wish to make this a user-supplied value
404
436
438 m_tSysEndTime = 0;
439
440 m_pRasterGrid = NULL;
441}
442
443//===============================================================================================================================
445//===============================================================================================================================
447{
448 // Close output files if open
449 if (LogStream && LogStream.is_open())
450 {
451 LogStream.flush();
452 LogStream.close();
453 }
454
455 if (OutStream && OutStream.is_open())
456 {
457 OutStream.flush();
458 OutStream.close();
459 }
460
461 if (SeaAreaTSStream && SeaAreaTSStream.is_open())
462 {
463 SeaAreaTSStream.flush();
464 SeaAreaTSStream.close();
465 }
466
468 {
471 }
472
474 {
477 }
478
480 {
483 }
484
486 {
489 }
490
492 {
495 }
496
498 {
501 }
502
504 {
507 }
508
510 {
513 }
514
515 if (m_pRasterGrid)
516 delete m_pRasterGrid;
517}
518
519//===============================================================================================================================
521//===============================================================================================================================
523{
524 return m_dMissingValue;
525}
526
527//===============================================================================================================================
529//===============================================================================================================================
531{
532 return m_dThisIterSWL;
533}
534
535//===============================================================================================================================
537//===============================================================================================================================
542
543// //===============================================================================================================================
544// //! Returns the max elevation of the beach above SWL
545// //===============================================================================================================================
546// double CSimulation::dGetMaxBeachElevAboveSWL (void) const
547// {
548// return m_dMaxBeachElevAboveSWL;
549// }
550
551//===============================================================================================================================
552// Returns the cell side length
553//===============================================================================================================================
554// double CSimulation::dGetCellSide(void) const
555// {
556// return m_dCellSide;
557// }
558
559//===============================================================================================================================
561//===============================================================================================================================
563{
564 return m_nXGridSize;
565}
566
567//===============================================================================================================================
569//===============================================================================================================================
571{
572 return m_nYGridSize;
573}
574
575//===============================================================================================================================
577//===============================================================================================================================
578double CSimulation::dGetD50Fine(void) const
579{
580 return m_dD50Fine;
581}
582
583//===============================================================================================================================
585//===============================================================================================================================
586double CSimulation::dGetD50Sand(void) const
587{
588 return m_dD50Sand;
589}
590
591//===============================================================================================================================
593//===============================================================================================================================
595{
596 return m_dD50Coarse;
597}
598
599//===============================================================================================================================
601//===============================================================================================================================
602int CSimulation::nDoSimulation(int nArg, char const* pcArgv[])
603{
604 // ================================================== initialization section ================================================
605 // Hello, World!
607
608 // Start the clock ticking
609 StartClock();
610
611 // Deal with command-line parameters
612 int nRet = nHandleCommandLineParams(nArg, pcArgv);
613
614 if (nRet != RTN_OK)
615 return (nRet);
616
617 // 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)
618 if (! bFindExeDir(pcArgv[0]))
619 return (RTN_ERR_CMEDIR);
620
621 // OK, we are off, tell the user about the licence and the start time
623
624 // Read the .ini file and get the name of the run-data file, and path for output etc.
625 if (! bReadIniFile())
626 return (RTN_ERR_INI);
627
628 // Check if output dir exists
629 if ((! is_directory(m_strOutPath.c_str())) || (! exists(m_strOutPath.c_str())))
630 {
631 // Output dir does not exist
632 bool bCreateDir = false;
633
634 if ((isatty(fileno(stdout))) && (isatty(fileno(stderr))))
635 {
636 // Running with stdout and stderr as a tty, so ask the user if they wish to create it
637 char ch;
638 cerr << endl
639 << "Output folder '" << m_strOutPath << "' does not exist. Create it? (Y/N) ";
640 cerr.flush();
641 cin.get(ch);
642
643 if ((ch == 'y') || (ch == 'Y'))
644 bCreateDir = true;
645 }
646
647 else
648 {
649 // Running with stdout or stderr not a tty, so create output dir rather than abort
650 bCreateDir = true;
651 }
652
653 if (bCreateDir)
654 {
655 // Yes, so create the directory
656 create_directories(m_strOutPath.c_str());
657 cerr << m_strOutPath << " created" << endl << endl;
658 }
659
660 else
661 // Nope, just end the run
662 return RTN_USER_ABORT;
663 }
664
665 // We have the name of the run-data input file, so read it
666 if (! bReadRunDataFile())
667 return RTN_ERR_RUNDATA;
668
669 // Check raster GIS output format
672
673 // Check vector GIS output format
676
677 // Open log file
678 if (! bOpenLogFile())
679 return (RTN_ERR_LOGFILE);
680
681 // Set up the time series output files
682 if (! bSetUpTSFiles())
683 return (RTN_ERR_TSFILE);
684
685 // Initialize the random number generators
686 for (int n = 0; n < NUMBER_OF_RNGS; n++)
687 m_Rand[n].seed(m_ulRandSeed[n]);
688
689 // If we are doing Savitzky-Golay smoothing of the vector coastline(s), calculate the filter coefficients
692
693 // Create the raster grid object
694 m_pRasterGrid = new CGeomRasterGrid(this);
695
696 // Read in the basement layer (must have this file), create the raster grid, then read in the basement DEM data to the array
698 nRet = nReadRasterBasementDEM();
699
700 if (nRet != RTN_OK)
701 return nRet;
702
703 // 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
705 {
707
708 if (nTmp < 3)
709 {
710 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;
711 cerr << strErr << endl;
712 LogStream << strErr << endl;
713 OutStream << strErr << endl;
714 return RTN_ERR_RUNDATA;
715 }
716 }
717
718 // Do some more initialisation
719 // cppcheck-suppress truncLongCastAssignment
721
722 // Mark edge cells, as defined by the basement layer
724
725 if (nRet != RTN_OK)
726 return nRet;
727
728 // // DEBUG CODE =================================================================================================================
729 // for (int n = 0; n < m_VEdgeCell.size(); n++)
730 // {
731 // LogStream << "[" << m_VEdgeCell[n].nGetX() << "][" << m_VEdgeCell[n].nGetY() << "] = {" << dGridCentroidXToExtCRSX(m_VEdgeCell[n].nGetX()) << ", " << dGridCentroidYToExtCRSY(m_VEdgeCell[n].nGetY()) << "} " << m_VEdgeCellEdge[n] << endl;
732 // }
733 // // DEBUG CODE =================================================================================================================
734
735 // 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
738
739 else
740 {
741 // The user specified a profile spacing, is this too small?
743
745 {
746 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;
747
748 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;
749
751 }
752 }
753
754 // Set the profile spacing on interventions
757
758 // 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
760
761 for (int nX = 0; nX < m_nXGridSize; nX++)
762 for (int nY = 0; nY < m_nYGridSize; nY++)
763 m_pRasterGrid->m_Cell[nX][nY].AppendLayers(m_nLayers);
764
765 // Tell the user what is happening then read in the layer files
767
768 for (int nLayer = 0; nLayer < m_nLayers; nLayer++)
769 {
770 // Read in the initial fine unconsolidated sediment depth file(s)
773 if (nRet != RTN_OK)
774 return (nRet);
775
776 // Read in the initial sand unconsolidated sediment depth file
779 if (nRet != RTN_OK)
780 return (nRet);
781
782 // Read in the initial coarse unconsolidated sediment depth file
785 if (nRet != RTN_OK)
786 return (nRet);
787
788 // Read in the initial fine consolidated sediment depth file
790 nRet = nReadRasterGISFile(FINE_CONS_RASTER, nLayer);
791 if (nRet != RTN_OK)
792 return (nRet);
793
794 // Read in the initial sand consolidated sediment depth file
796 nRet = nReadRasterGISFile(SAND_CONS_RASTER, nLayer);
797 if (nRet != RTN_OK)
798 return (nRet);
799
800 // Read in the initial coarse consolidated sediment depth file
803 if (nRet != RTN_OK)
804 return (nRet);
805 }
806
807 // Read in the initial suspended sediment depth file
810 if (nRet != RTN_OK)
811 return (nRet);
812
813 // Maybe read in the landform class data, otherwise calculate this during the first timestep using identification rules
814 if (! m_strInitialLandformFile.empty())
815 {
818 if (nRet != RTN_OK)
819 return (nRet);
820 }
821
822 // Maybe read in intervention data
823 if (! m_strInterventionClassFile.empty())
824 {
827 if (nRet != RTN_OK)
828 return (nRet);
829
832 if (nRet != RTN_OK)
833 return (nRet);
834 }
835
836 // Maybe read in the tide data
837 if (! m_strTideDataFile.empty())
838 {
840 nRet = nReadTideDataFile();
841 if (nRet != RTN_OK)
842 return (nRet);
843 }
844
845 // Read in the erosion potential shape function data
847 nRet = nReadShapeFunctionFile();
848 if (nRet != RTN_OK)
849 return (nRet);
850
851 // Do we want to output the erosion potential look-up values, for checking purposes?
854
855 // OK, now read in the vector files (if any)
858
859 // Maybe read in deep water wave station data
861 {
862 // We are reading deep water wave height, orientation and period from a file of vector points and file time series
864
865 // Read in vector points
867 if (nRet != RTN_OK)
868 return (nRet);
869
870 int const nWaveStations = static_cast<int>(m_VnDeepWaterWaveStationID.size());
871
872 if (nWaveStations == 1)
874
875 // Read in time series values, and initialize the vector which stores each timestep's deep water wave height, orientation and period
876 nRet = nReadWaveStationInputFile(nWaveStations);
877 if (nRet != RTN_OK)
878 return (nRet);
879 }
880
881 // Maybe read in sediment input event data
883 {
884 // We are reading sediment input event data
886
887 // Read in vector points for sediment input events
889 if (nRet != RTN_OK)
890 return (nRet);
891
892 // Read in the time series values for sediment input events
894 if (nRet != RTN_OK)
895 return (nRet);
896 }
897
898 // Maybe read in flood input location
900 {
901 // We are reading sediment input event data
903
904 // Read in vector points for sediment input events
906 if (nRet != RTN_OK)
907 return (nRet);
908 }
909
910 // Open the main output
911 OutStream.open(m_strOutFile.c_str(), ios::out | ios::trunc);
912
913 if (!OutStream)
914 {
915 // Error, cannot open Out file
916 cerr << ERR << "cannot open " << m_strOutFile << " for output" << endl;
917 return (RTN_ERR_OUTFILE);
918 }
919
920 // Write beginning-of-run information to Out and Log files
922
923 // Start initializing
925
926 // Misc initialization calcs
927 m_nCoastMax = COAST_LENGTH_MAX * tMax(m_nXGridSize, m_nYGridSize); // Arbitrary but probably OK
928 m_nCoastMin = tMin(m_nXGridSize, m_nYGridSize); // In some cases the following rule doesn't work TODO 007 Info needed
929 // nRound(COAST_LENGTH_MIN_X_PROF_SPACE * m_dCoastNormalSpacing / m_dCellSide); // TODO 007 Info needed
930 m_nCoastCurvatureInterval = tMax(nRound(m_dCoastNormalSpacing / (m_dCellSide * 2)), 2); // TODO 007 Info needed
931
932 // For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) transport rate (Leo Van Rijn) TODO 007 need full reference
934
935 m_bConsChangedThisIter.resize(m_nLayers, false);
936 m_bUnconsChangedThisIter.resize(m_nLayers, false);
937
938 // Normalize sediment erodibility values, so that none are > 1
943
944 // Intialise SWL
946
947 // If SWL changes during the simulation, calculate the per-timestep increment (could be -ve)
949 {
952 }
953
954 // ===================================================== The main loop ======================================================
955 // Tell the user what is happening
957
958 while (true)
959 {
960 // Check that we haven't gone on too long: if not then update timestep number etc.
961 if (bTimeToQuit())
962 break;
963
964 // Tell the user how the simulation is progressing
966
968 LogStream << "TIMESTEP " << m_ulIter << " " << string(154, '=') << endl;
969
970 LogStream << fixed << setprecision(3);
971
972 // Check to see if there is a new intervention in place: if so, update it on the RasterGrid array
973 nRet = nUpdateIntervention();
974 if (nRet != RTN_OK)
975 return nRet;
976
977 // Calculate changes due to external forcing (change in still water level, tide level and deep water waves height, orientation and period)
978 nRet = nCalcExternalForcing();
979 if (nRet != RTN_OK)
980 return nRet;
981
982 // 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
984 if (nRet != RTN_OK)
985 return nRet;
986
987 // 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()
988 int nValidCoast = 0;
989 nRet = nLocateSeaAndCoasts(nValidCoast);
990 if (nRet != RTN_OK)
991 return nRet;
992
993 // Tell the user how the simulation is progressing
995
996 // Locate estuaries TODO 044 someday...
997
998 // Locate and trace cliff toe
999 nRet = nLocateCliffToe();
1000 if (nRet != RTN_OK)
1001 return nRet;
1002
1003 // For all cells, use classification rules to assign sea and hinterland landform categories
1005 if (nRet != RTN_OK)
1006 return nRet;
1007
1008 // For every coastline, use classification rules to assign landform categories
1010 if (nRet != RTN_OK)
1011 return nRet;
1012
1013 // Create all coastline-normal profiles, in coastline-concave-curvature sequence
1014 nRet = nCreateAllProfiles();
1015 if (nRet != RTN_OK)
1016 return nRet;
1017
1018 // // DEBUG CODE ================
1019 // if (! bWriteVectorGISFile(VECTOR_PLOT_COAST, &VECTOR_PLOT_COAST_TITLE))
1020 // return false;
1021 // if (! bWriteVectorGISFile(VECTOR_PLOT_NORMALS, &VECTOR_PLOT_NORMALS_TITLE))
1022 // return false;
1023 // if (! bWriteVectorGISFile(VECTOR_PLOT_INVALID_NORMALS, &VECTOR_PLOT_INVALID_NORMALS_TITLE))
1024 // return false;
1025 // // DEBUG CODE ================
1026
1027 // Check the coastline-normal profiles for intersection, modify the profiles if they intersect, then mark valid profiles on the raster grid
1028 nRet = nCheckAndMarkAllProfiles();
1029 if (nRet != RTN_OK)
1030 return nRet;
1031
1032 // // DEBUG CODE ================
1033 // m_nGISSave++;
1034 // if (! bWriteVectorGISFile(VECTOR_PLOT_COAST, &VECTOR_PLOT_COAST_TITLE))
1035 // return false;
1036 // if (! bWriteVectorGISFile(VECTOR_PLOT_NORMALS, &VECTOR_PLOT_NORMALS_TITLE))
1037 // return false;
1038 // if (! bWriteVectorGISFile(VECTOR_PLOT_INVALID_NORMALS, &VECTOR_PLOT_INVALID_NORMALS_TITLE))
1039 // return false;
1040 // // DEBUG CODE ================
1041
1042 if (m_VCoast.size() > 0)
1043 {
1044 // We have multiple coastlines
1045 nRet = nDoMultipleCoastlines();
1046 if (nRet != RTN_OK)
1047 return nRet;
1048 }
1049
1050 // DEBUG CODE ================
1051 // m_nGISSave++;
1053 return false;
1055 return false;
1057 return false;
1059 return false;
1061 return false;
1062 // DEBUG CODE ================
1063
1064 // // DEBUG CODE =================
1065 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1066 // {
1067 // for (int nCoastPoint = 0; nCoastPoint < m_VCoast[nCoast].nGetCoastlineSize(); nCoastPoint++)
1068 // {
1069 // if (m_VCoast[nCoast].bIsProfileAtCoastPoint(nCoastPoint))
1070 // {
1071 // CGeomProfile const* pProfile = m_VCoast[nCoast].pGetProfileAtCoastPoint(nCoastPoint);
1072 // int nProfile = pProfile->nGetProfileID();
1073 //
1074 // 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;
1075 // }
1076 // }
1077 // }
1078 // // DEBUG CODE =================
1079
1080 // Tell the user how the simulation is progressing
1082
1083 // Create the coast polygons
1084 nRet = nCreateAllPolygons();
1085 if (nRet != RTN_OK)
1086 return nRet;
1087
1088 // // DEBUG CODE ====================
1089 // if (! bWriteVectorGISFile(VECTOR_PLOT_POLYGON_BOUNDARY, &VECTOR_PLOT_POLYGON_BOUNDARY_TITLE))
1090 // return false;
1091 // // DEBUG CODE ====================
1092
1093 // // DEBUG CODE =========================================================================================================
1094 // int nNODATA = 0;
1095 // int nPoly0 = 0;
1096 // int nPoly24 = 0;
1097 // for (int nX = 0; nX < m_nXGridSize; nX++)
1098 // {
1099 // for (int nY = 0; nY < m_nYGridSize; nY++)
1100 // {
1101 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1102 // if (nTmp == INT_NODATA)
1103 // nNODATA++;
1104 //
1105 // if (nTmp == 0)
1106 // nPoly0++;
1107 //
1108 // if (nTmp == 24)
1109 // nPoly24++;
1110 // }
1111 // }
1112 // LogStream << "Before marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1113 // // LogStream << "Before marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1114 // LogStream << "Before marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1115 // // DEBUG CODE =========================================================================================================
1116
1117 // Mark cells of the raster grid that are within each polygon, and do some polygon initialization
1119
1120 // Calculate the length of the shared normal between each polygon and the adjacent polygon(s)
1122 if (nRet != RTN_OK)
1123 return nRet;
1124
1125 // Tell the user how the simulation is progressing
1127
1128 // // DEBUG CODE =========================================================================================================
1129 // nNODATA = 0;
1130 // nPoly0 = 0;
1131 // nPoly24 = 0;
1132 // for (int nX = 0; nX < m_nXGridSize; nX++)
1133 // {
1134 // for (int nY = 0; nY < m_nYGridSize; nY++)
1135 // {
1136 // int nTmp = m_pRasterGrid->m_Cell[nX][nY].nGetPolygonID();
1137 // if (nTmp == INT_NODATA)
1138 // nNODATA++;
1139 //
1140 // if (nTmp == 0)
1141 // nPoly0++;
1142 //
1143 // if (nTmp == 24)
1144 // nPoly24++;
1145 // }
1146 // }
1147 // LogStream << "After marking polygon cells, N cells with NODATA polygon ID = " << nNODATA << endl;
1148 // // LogStream << "After marking polygon cells, N cells with zero polygon ID = " << nPoly0 << endl;
1149 // LogStream << "After marking polygon cells, N cells with 24 polygon ID = " << nPoly24 << endl;
1150 // // DEBUG CODE =========================================================================================================
1151 // PropagateWind();
1152
1153 // Give every coast point a value for deep water wave height and direction
1155 if (nRet != RTN_OK)
1156 return nRet;
1157
1158 // // DEBUG CODE ===============
1159 // for (int nCoast = 0; nCoast < static_cast<int>(m_VCoast.size()); nCoast++)
1160 // {
1161 // LogStream << "====================" << endl;
1162 //
1163 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1164 // {
1165 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfile(nProfile);
1166 // int nCell = pProfile->nGetNumCellsInProfile();
1167 // LogStream << "Profile " << pProfile->nGetProfileID() << " nGetNumCellsInProfile() = " << nCell << endl;
1168 // }
1169 //
1170 // LogStream << endl;
1171 //
1172 // for (int nProfile = 0; nProfile < m_VCoast[nCoast].nGetNumProfiles(); nProfile++)
1173 // {
1174 // CGeomProfile* pProfile = m_VCoast[nCoast].pGetProfileWithDownCoastSeq(nProfile);
1175 // int nCell = pProfile->nGetNumCellsInProfile();
1176 // LogStream << "Profile " << pProfile->nGetProfileID() << " nGetNumCellsInProfile() = " << nCell << endl;
1177 // }
1178 //
1179 // LogStream << "====================" << endl;
1180 // }
1181 // // DEBUG CODE =====================
1182
1183 // Change the wave properties in all shallow water sea cells: propagate waves and define the active zone, also locate wave shadow zones
1184 nRet = nDoAllPropagateWaves();
1185 if (nRet != RTN_OK)
1186 return nRet;
1187
1188 // Output polygon share table and pre-existing sediment table to log file
1190 {
1191 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1192 {
1193 WritePolygonInfoTable(nCoast);
1195 }
1196 }
1197
1198 // Tell the user how the simulation is progressing
1200
1201 // // DEBUG CODE ===========================================================================================================
1202 // string strOutFile = m_strOutPath;
1203 // strOutFile += "sea_wave_height_CHECKPOINT_";
1204 // strOutFile += to_string(m_ulIter);
1205 // strOutFile += ".tif";
1206 //
1207 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1208 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1209 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1210 // pDataSet->SetGeoTransform(m_dGeoTransform);
1211 //
1212 // int nn = 0;
1213 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1214 // for (int nY = 0; nY < m_nYGridSize; nY++)
1215 // {
1216 // for (int nX = 0; nX < m_nXGridSize; nX++)
1217 // {
1218 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1219 // }
1220 // }
1221 //
1222 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1223 // pBand->SetNoDataValue(m_dMissingValue);
1224 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1225 //
1226 // if (nRet == CE_Failure)
1227 // return RTN_ERR_GRIDCREATE;
1228 //
1229 // GDALClose(pDataSet);
1230 // delete[] pdRaster;
1231 // // DEBUG CODE ===========================================================================================================
1232 //
1233 // // DEBUG CODE ===========================================================================================================
1234 // strOutFile = m_strOutPath;
1235 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1236 // strOutFile += to_string(m_ulIter);
1237 // strOutFile += ".tif";
1238 //
1239 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1240 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1241 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1242 // pDataSet->SetGeoTransform(m_dGeoTransform);
1243 //
1244 // nn = 0;
1245 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1246 // for (int nY = 0; nY < m_nYGridSize; nY++)
1247 // {
1248 // for (int nX = 0; nX < m_nXGridSize; nX++)
1249 // {
1250 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1251 // }
1252 // }
1253 //
1254 // pBand = pDataSet->GetRasterBand(1);
1255 // pBand->SetNoDataValue(m_dMissingValue);
1256 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1257 //
1258 // if (nRet == CE_Failure)
1259 // return RTN_ERR_GRIDCREATE;
1260 //
1261 // GDALClose(pDataSet);
1262 // delete[] pdRaster;
1263 // // DEBUG CODE ===========================================================================================================
1264
1265 // Save the not-deposited values, to be shown in the logfile after we've finished beach sediment movement
1268
1271 {
1272 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionSandDiff = " << m_dDepositionSandDiff * m_dCellArea << " m_dUnconsSandNotDepositedLastIter = " << m_dUnconsSandNotDepositedLastIter << endl;
1273 LogStream << m_ulIter << ": AT ITERATION START m_dDepositionCoarseDiff = " << m_dDepositionCoarseDiff * m_dCellArea << " m_dUnconsCoarseNotDepositedLastIter = " << m_dUnconsCoarseNotDepositedLastIter << endl;
1274 }
1275
1277 {
1278 // Calculate elevation change on the consolidated sediment which comprises the coastal platform
1280 if (nRet != RTN_OK)
1281 return nRet;
1282 }
1283
1284 // Output shore platform erosion table to log file
1286 {
1287 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1289 }
1290
1292 {
1293 // Do all cliff collapses for this timestep (if any)
1295 if (nRet != RTN_OK)
1296 return nRet;
1297 }
1298
1299 // Output cliff collapse table to log file
1301 {
1302 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1304 }
1305
1306 // Tell the user how the simulation is progressing
1308
1310 {
1311 // 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
1313
1314 // 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
1316 if (nRet != RTN_OK)
1317 return nRet;
1318 }
1319
1320 // 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
1321 if (m_bSedimentInput)
1322 {
1324 if (nRet != RTN_OK)
1325 return nRet;
1326
1327 // If we have had at least one sediment input event this iteration, then output the sediment event per polygon table to the log file
1329 {
1330 for (int nCoast = 0; nCoast < nValidCoast; nCoast++)
1332 }
1333 }
1334
1335 // // 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
1336 // double dFineThisIter = m_dThisIterActualPlatformErosionFineCons + m_dThisIterCliffCollapseErosionFineUncons + m_dThisIterCliffCollapseErosionFineCons + m_dThisIterCliffCollapseFineErodedDuringDeposition + m_dThisIterBeachErosionFine - m_dThisIterLeftGridUnconsFine;
1337 //
1338 // m_dThisIterFineSedimentToSuspension += dFineThisIter;
1339
1340 // Tell the user how the simulation is progressing
1342
1343 // // DEBUG CODE ===========================================================================================================
1344 // string strOutFile = m_strOutPath;
1345 // strOutFile += "sea_wave_height_CHECKPOINT_";
1346 // strOutFile += to_string(m_ulIter);
1347 // strOutFile += ".tif";
1348 //
1349 // GDALDriver* pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1350 // GDALDataset* pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1351 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1352 // pDataSet->SetGeoTransform(m_dGeoTransform);
1353 //
1354 // int nn = 0;
1355 // double* pdRaster = new double[m_nXGridSize * m_nYGridSize];
1356 // for (int nY = 0; nY < m_nYGridSize; nY++)
1357 // {
1358 // for (int nX = 0; nX < m_nXGridSize; nX++)
1359 // {
1360 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveHeight();
1361 // }
1362 // }
1363 //
1364 // GDALRasterBand* pBand = pDataSet->GetRasterBand(1);
1365 // pBand->SetNoDataValue(m_dMissingValue);
1366 // int nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1367 //
1368 // if (nRet == CE_Failure)
1369 // return RTN_ERR_GRIDCREATE;
1370 //
1371 // GDALClose(pDataSet);
1372 // delete[] pdRaster;
1373 // // DEBUG CODE ===========================================================================================================
1374 //
1375 // // DEBUG CODE ===========================================================================================================
1376 // strOutFile = m_strOutPath;
1377 // strOutFile += "sea_wave_angle_CHECKPOINT_";
1378 // strOutFile += to_string(m_ulIter);
1379 // strOutFile += ".tif";
1380 //
1381 // pDriver = GetGDALDriverManager()->GetDriverByName("gtiff");
1382 // pDataSet = pDriver->Create(strOutFile.c_str(), m_nXGridSize, m_nYGridSize, 1, GDT_Float64, m_papszGDALRasterOptions);
1383 // pDataSet->SetProjection(m_strGDALBasementDEMProjection.c_str());
1384 // pDataSet->SetGeoTransform(m_dGeoTransform);
1385 //
1386 // nn = 0;
1387 // pdRaster = new double[m_nXGridSize * m_nYGridSize];
1388 // for (int nY = 0; nY < m_nYGridSize; nY++)
1389 // {
1390 // for (int nX = 0; nX < m_nXGridSize; nX++)
1391 // {
1392 // pdRaster[nn++] = m_pRasterGrid->m_Cell[nX][nY].dGetWaveAngle();
1393 // }
1394 // }
1395 //
1396 // pBand = pDataSet->GetRasterBand(1);
1397 // pBand->SetNoDataValue(m_dMissingValue);
1398 // nRet = pBand->RasterIO(GF_Write, 0, 0, m_nXGridSize, m_nYGridSize, pdRaster, m_nXGridSize, m_nYGridSize, GDT_Float64, 0, 0, NULL);
1399 //
1400 // if (nRet == CE_Failure)
1401 // return RTN_ERR_GRIDCREATE;
1402 //
1403 // GDALClose(pDataSet);
1404 // delete[] pdRaster;
1405 // // DEBUG CODE ===========================================================================================================
1406
1407 // Do some end-of-timestep updates to the raster grid, also update per-timestep and running totals
1408 nRet = nUpdateGrid();
1409 if (nRet != RTN_OK)
1410 return nRet;
1411
1412 // Make water level inundation on grid
1414 {
1415 m_nLevel = 0;
1416
1417 nRet = nLocateFloodAndCoasts();
1418 if (nRet != RTN_OK)
1419 return nRet;
1420 }
1421
1423 {
1424 // TODO 007 Info needed
1425 m_nLevel = 1;
1426
1427 nRet = nLocateFloodAndCoasts();
1428 if (nRet != RTN_OK)
1429 return nRet;
1430 }
1431
1432 // Now save results, first the raster and vector GIS files if required
1433 m_bSaveGISThisIter = false;
1434
1436 {
1437 m_bSaveGISThisIter = true;
1438
1439 // Save the values from the RasterGrid array into raster GIS files
1440 if (! bSaveAllRasterGISFiles())
1442
1443 // Tell the user how the simulation is progressing
1445
1446 // Save the vector GIS files
1447 if (! bSaveAllVectorGISFiles())
1449
1450 // Tell the user how the simulation is progressing
1452 }
1453
1454 // Output per-timestep results to the .out file
1456 return (RTN_ERR_TEXT_FILE_WRITE);
1457
1458 // Now output time series CSV stuff
1459 if (! bWriteTSFiles())
1461
1462 // Tell the user how the simulation is progressing
1464
1465 // Update grand totals
1467
1468 } // ================================================ End of main loop ======================================================
1469
1470 // =================================================== post-loop tidying =====================================================
1471 // Tell the user what is happening
1473
1474 // Write end-of-run information to Out, Log and time-series files
1475 nRet = nWriteEndRunDetails();
1476 if (nRet != RTN_OK)
1477 return (nRet);
1478
1479 // Do end-of-run memory clearance
1481 return RTN_OK;
1482}
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:844
double m_dCliffDepositionPlanviewWidth
Planview width of cliff collapse talus (m)
Definition simulation.h:919
bool m_bCliffCollapseSave
Save cliff collapse raster GIS files?
Definition simulation.h:223
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:574
bool m_bAvgSeaDepthSave
Save average sea depth raster GIS files?
Definition simulation.h:112
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:754
bool m_bDeepWaterWaveAngleSave
Save deep water wave angle raster GIS files?
Definition simulation.h:250
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:648
int m_nGISMaxSaveDigits
The maximum number of digits in GIS filenames. These can be sequential, or the iteration number.
Definition simulation.h:499
bool m_bTopSurfSave
Save fop surface (sediment and sea) raster DEMs?
Definition simulation.h:97
int m_nYMinBoundingBox
The minimum y value of the bounding box.
Definition simulation.h:544
static void AnnounceReadSCAPEShapeFunctionFile(void)
Now reading the SCAPE shape function file.
Definition utils.cpp:640
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:657
bool m_bSedimentTopSurfSave
Save sediment top surface raster DEMs?
Definition simulation.h:94
bool m_bFineUnconsSedSave
Save fine unconsolidated sediment raster GIS files?
Definition simulation.h:196
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:448
double m_dNotchDepthAtCollapse
Notch overhang (i.e. length of horizontal incision) to initiate collapse (m)
Definition simulation.h:910
bool m_bFloodSWLSetupSurgeLine
Are we saving the flood still water level setup surge line? TODO 007.
Definition simulation.h:439
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:394
double m_dMinSWL
Minimum still water level.
Definition simulation.h:721
double m_dG
Gravitational acceleration (m**2/sec)
Definition simulation.h:811
void AnnounceReadDeepWaterWaveValuesGIS(void) const
Tells the user that we are now reading the deep water wave values GIS file.
Definition utils.cpp:492
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:712
int m_nBeachErosionDepositionEquation
Which beach erosion-deposition equation is used. Possible values are UNCONS_SEDIMENT_EQUATION_CERC an...
Definition simulation.h:529
ofstream CliffCollapseNetChangeTSStream
bool m_bCoastSave
Save.
Definition simulation.h:268
bool m_bBeachDepositionTSSave
Save the beach (unconsolidated sediment) deposition time series file?
Definition simulation.h:319
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:602
int m_nXGridSize
The size of the grid in the x direction.
Definition simulation.h:457
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:563
double m_dL_0
Deep water wave length (m)
Definition simulation.h:745
double m_dWaveDataWrapHours
Number of hours after which deep water wave data wraps.
Definition simulation.h:964
double m_dMaxUserInputWavePeriod
Used to constrain depth of closure.
Definition simulation.h:766
bool m_bFloodSetupSurgeRunupTSSave
Save the flood setup surge runup time series file? TODO 007 Does this work correctly?
Definition simulation.h:331
bool bSetUpTSFiles(void)
The bSetUpTSFiles member function sets up the time series files.
Definition utils.cpp:1109
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:550
double m_dThisIterBeachErosionCoarse
Total actual beach erosion (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:853
int m_nGISMissingValue
The value for integer missing values, as read from GIS input files.
Definition simulation.h:532
char ** m_papszGDALVectorOptions
Options for GDAL when handling vector files.
Definition simulation.h:454
double m_dStartIterUnconsCoarseAllCells
Depth (m) of coarse unconsolidated sediment at the start of the simulation, all cells (both inside an...
Definition simulation.h:994
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:826
void WritePolygonCliffCollapseErosion(int const)
Writes to the log file a table showing per-polygon per-polygon cliff collapse.
int nLocateFloodAndCoasts(void)
First find all connected sea areas, then locate the vector coastline(s), then put these onto the rast...
bool m_bSaveGISThisIter
Save GIS files this iteration?
Definition simulation.h:334
long double m_ldGTotCliffCollapseCoarseErodedDuringDeposition
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:958
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:694
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:385
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:508
long m_lGDALMaxCanWrite
The maximum integer value which GDAL can write, can be UINT8_MAX, INT16_MAX, UINT16_MAX,...
Definition simulation.h:592
bool m_bAvgWaveAngleAndHeightSave
Save average wave angle and average wave height raster GIS files?
Definition simulation.h:130
double m_dSouthEastXExtCRS
The south-east x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:649
int m_nMissingValue
Used by CoastalME for integer missing values.
Definition simulation.h:535
bool m_bAvgWaveAngleSave
Save average wave angle raster GIS files?
Definition simulation.h:124
long double m_ldGTotActualCoarseBeachErosion
All-simulation total of coarse sediment eroded during beach (unconsolidated sediment) movement (m)
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
int nReadWaveStationInputFile(int const)
Reads the deep water wave station input data. Each point in m_strDeepWaterWavesInputFile is a triad o...
bool m_bCliffEdgeSave
Save cliff edge vector GIS files?
Definition simulation.h:271
double m_dFineErodibilityNormalized
Relative erodibility of fine unconsolidated beach sediment, normalized.
Definition simulation.h:796
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:877
bool m_bInvalidNormalsSave
Save invalid coastline-normal vector GIS files?
Definition simulation.h:277
bool m_bShadowBoundarySave
Save wave shadow boundary vector GIS files?
Definition simulation.h:292
double m_dThisIterDiffWaveSetupSurgeWaterLevel
TODO 007 Info needed.
Definition simulation.h:733
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:841
bool m_bActualBeachErosionSave
Save actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:163
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:460
int nLocateCliffToe(void)
double m_dThisIterTopElevMin
This-iteration lowest elevation of DEM.
Definition simulation.h:970
bool m_bStillWaterLevelTSSave
Save the still water level time series file?
Definition simulation.h:301
bool m_bRunUpSave
Are we saving runup? TODO 007.
Definition simulation.h:418
GDALDataType m_GDALWriteIntDataType
The data type used by GDAL for integer operations, can be GDT_Byte, GDT_Int16, GDT_UInt16,...
Definition simulation.h:586
long double m_ldGTotCliffTalusFineToSuspension
All-simulation total of fine sediment moved to suspension, due to cliff collapse (m)
bool m_bCliffCollapseDepositionSave
Save cliff collapse deposition raster GIS files?
Definition simulation.h:229
bool m_bTotalActualPlatformErosionSave
Save total actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:157
bool m_bPolygonUnconsSedUpOrDownDriftSave
Save polygon unconsolidated sediment up- or down-drift raster GIS files?
Definition simulation.h:259
double m_dCoarseErodibility
The relative erodibility (0- 1) of coarse unconsolidated beach sediment.
Definition simulation.h:793
double m_dGeoTransform[6]
GDAL geotransformation info (see http://www.gdal.org/classGDALDataset.html)
Definition simulation.h:697
double m_dCliffTalusMinDepositionLength
Planview length of cliff deposition talus (m)
Definition simulation.h:922
double m_dMissingValue
Used by CoastalME for floating-point missing values.
Definition simulation.h:961
int m_nUnconsSedimentHandlingAtGridEdges
How sediment which moves off an edge of the grid is handled. Possible values are GRID_EDGE_CLOSED,...
Definition simulation.h:526
double m_dSandErodibility
The relative erodibility (0- 1) of sand unconsolidated beach sediment.
Definition simulation.h:790
bool m_bBasementElevSave
Save basement raster DEMs?
Definition simulation.h:91
double m_dInvCellDiagonal
Inverse of m_dCellDiagonal.
Definition simulation.h:670
int m_nSimStartHour
Start time of the simulation (hours)
Definition simulation.h:559
double m_dCoarseErodibilityNormalized
Relative erodibility of coarse unconsolidated beach sediment, normalized.
Definition simulation.h:802
bool m_bCoarseUnconsSedSave
Save coarse unconsolidated sediment raster GIS files?
Definition simulation.h:202
bool m_bSuspSedTSSave
Save the suspended sediment time series file?
Definition simulation.h:325
bool m_bCliffCollapseNetTSSave
Save the cliff collapse net change time series file?
Definition simulation.h:313
double m_dStartIterSuspFineInPolygons
Depth (m) of fine suspended sediment at the start of the simulation (only cells in polygons)
Definition simulation.h:985
bool m_bPotentialPlatformErosionMaskSave
Save potential platform erosion mask raster GIS files?
Definition simulation.h:238
unsigned long m_ulThisIterNumCoastCells
The number of grid cells which are marked as coast, for this iteration.
Definition simulation.h:613
static void AnnounceSimEnd(void)
Announce the end of the simulation.
Definition utils.cpp:1438
unsigned long m_ulNumCells
The number of cells in the grid.
Definition simulation.h:607
double m_dTotPotentialPlatformErosionBetweenProfiles
Total potential platform erosion between profiles.
Definition simulation.h:898
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:462
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:748
bool m_bWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:115
bool m_bFloodLocation
Are we saving the flood location? TODO 007.
Definition simulation.h:433
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:934
bool m_bGDALCanCreate
Is the selected GDAL output file format capable of writing files?
Definition simulation.h:370
bool m_bLandformSave
Save coast landform raster GIS files?
Definition simulation.h:178
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:889
bool m_bTotalBeachDepositionSave
Save total beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:175
int m_nCoastMax
Maximum valid coast length when searching for coasts.
Definition simulation.h:511
double m_dBeachSedimentPorosity
The porosity of unconsolidated beach sediment (0 - 1)
Definition simulation.h:784
double dGetMissingValue(void) const
Returns the NODATA value.
int m_nSimStartSec
Start time of the simulation (seconds)
Definition simulation.h:553
int m_nSimStartDay
Start date of the simulation (day)
Definition simulation.h:562
unsigned long m_ulThisIterNumActualPlatformErosionCells
The number of grid cells on which actual platform erosion occurs, for this iteration.
Definition simulation.h:619
bool m_bSandUnconsSedSave
Save sand unconsolidated sediment raster GIS files?
Definition simulation.h:199
bool m_bActualPlatformErosionTSSave
Save the actual (supply-limited) shore platform erosion time series file?
Definition simulation.h:304
int m_nCoastNormalSpacing
Average spacing between coastline normals, measured in cells.
Definition simulation.h:490
int m_nXMaxBoundingBox
The maximum x value of the bounding box.
Definition simulation.h:541
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:928
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:226
int nReadShapeFunctionFile(void)
Reads the shape of the erosion potential distribution (see shape function in Walkden & Hall,...
static void AnnounceAddLayers(void)
Tells the user that we are now adding layers.
Definition utils.cpp:422
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:103
bool m_bDoShorePlatformErosion
Simulate shore platform erosion?
Definition simulation.h:361
bool m_bSliceSave
Save slices?
Definition simulation.h:106
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:235
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:703
bool m_bBeachDepositionSave
Save beach (unconsolidated sediment) deposition raster GIS files?
Definition simulation.h:172
double m_dNorthWestYExtCRS
The north-west y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:646
bool m_bSaveRegular
Save GIS files at regular intervals?
Definition simulation.h:265
int m_nLayers
The number of sediment layers.
Definition simulation.h:463
bool bFindExeDir(char const *)
Finds the folder (directory) in which the CoastalME executable is located.
Definition utils.cpp:222
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:469
bool m_bSedimentInputAlongLine
Do we have sediment input along a line?
Definition simulation.h:400
bool m_bSedimentInput
Do we have sediment input events?
Definition simulation.h:391
unsigned long m_ulThisIterNumBeachDepositionCells
The number of grid cells on which beach (unconsolidated sediment) deposition occurs,...
Definition simulation.h:628
double m_dInmersedToBulkVolumetric
For beach erosion/deposition, conversion from immersed weight to bulk volumetric (sand and voids) tra...
Definition simulation.h:814
bool m_bNormalsSave
Save coastline-normal vector GIS files?
Definition simulation.h:274
bool m_bAvgWaveHeightSave
Save wave height raster GIS files?
Definition simulation.h:118
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:886
bool m_bHaveSandSediment
Does this simulation consider sand-sized sediment?
Definition simulation.h:85
unsigned long m_ulMissingValueBasementCells
The number of basement cells marked with as missing value.
Definition simulation.h:637
double m_dThisiterUnconsCoarseInput
Depth (m) of coarse unconsolidated sediment added, at this iteration.
Definition simulation.h:979
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:505
double m_dThisIterPotentialPlatformErosion
Total potential platform erosion (all size classes of consolidated sediment) for this iteration (dept...
Definition simulation.h:832
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:955
int m_nSavGolCoastPoly
The order of the coastline profile smoothing polynomial if Savitzky-Golay smoothing is used (usually ...
Definition simulation.h:472
bool m_bSeaDepthSave
Save sea depth raster GIS files?
Definition simulation.h:109
bool m_bWaveAngleAndHeightSave
Save wave angle and wave height raster GIS files?
Definition simulation.h:127
double m_dNotchBaseBelowSWL
Notch base below SWL (m)
Definition simulation.h:913
int m_nRunUpEquation
The run-up equation used TODO 007.
Definition simulation.h:577
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:382
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:507
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:892
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:493
double m_dFineErodibility
The relative erodibility (0- 1) of fine unconsolidated beach sediment.
Definition simulation.h:787
double m_dThisiterUnconsFineInput
Depth (m) of fine unconsolidated sediment added, at this iteration.
Definition simulation.h:973
time_t m_tSysStartTime
System start-simulation time.
double m_dBreakingWaveHeightDepthRatio
Breaking wave height-to-depth ratio.
Definition simulation.h:751
void AnnounceReadFloodLocationGIS(void) const
Tells the user that we are now reading the flood location GIS file.
Definition utils.cpp:522
double m_dCoastNormalSpacing
Average spacing of the coastline-normal profiles, in m.
Definition simulation.h:820
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:388
double m_dSeaWaterDensity
Density of sea water in kg/m**3.
Definition simulation.h:700
int nDoSimulation(int, char const *[])
Runs the simulation.
void StartClock(void)
Starts the clock ticking.
Definition utils.cpp:198
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:481
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:799
double m_dR
Coast platform resistance to erosion R, see Walkden & Hall, 2011.
Definition simulation.h:769
bool m_bRasterNormalProfileSave
Save rasterized coastline-normal profiles GIS files?
Definition simulation.h:217
bool m_bActiveZoneSave
Save active zone raster GIS files?
Definition simulation.h:220
void AnnounceReadInitialSuspSedGIS(void) const
Tells the user that we are now reading the initial suspended sediment depth GIS file.
Definition utils.cpp:537
ofstream StillWaterLevelTSStream
SWL time series file output stream.
void DoEndOfRunDeletes(void)
Do end-of-run memory clearance.
Definition utils.cpp:2990
double m_dThisIterActualPlatformErosionSandCons
Total actual platform erosion (sand consolidated sediment) for this iteration (depth in m)
Definition simulation.h:838
bool m_bOmitSearchWestEdge
Omit the west edge of the grid from coast-end searches?
Definition simulation.h:355
bool m_bSedimentInputAtCoast
Do we have sediment input at the coast?
Definition simulation.h:397
static void AnnounceReadRasterFiles(void)
Now reading raster GIS files.
Definition utils.cpp:431
int m_nCliffEdgeSmooth
Which method to use for cliff edge smoothing.
Definition simulation.h:475
double m_dCliffErosionResistance
Resistance of cliff to notch erosion.
Definition simulation.h:907
double m_dThisIterBeachDepositionCoarse
Total beach deposition (coarse unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:859
double m_dD50Sand
The D50 for sand sediment.
Definition simulation.h:775
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:664
bool m_bDeepWaterWaveHeightSave
Save deep water wave height raster GIS files?
Definition simulation.h:253
bool m_bMeanWaveEnergySave
Save mean wave energy raster GIS files?
Definition simulation.h:139
double m_dKLS
Transport parameter KLS in the CERC equation.
Definition simulation.h:805
double m_dInvCellSide
Inverse of m_dCellSide.
Definition simulation.h:667
int m_nWavePropagationModel
The wave propagation model used. Possible values are WAVE_MODEL_CSHORE and WAVE_MODEL_COVE.
Definition simulation.h:550
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:757
double m_dSimElapsed
Time simulated so far, in hours.
Definition simulation.h:679
bool m_bCoastCurvatureSave
Save coastline-curvature vector GIS files?
Definition simulation.h:280
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:478
int m_nDeepWaterWaveDataNumTimeSteps
The duration of data for deep water waves, expressed as a number of timesteps.
Definition simulation.h:571
void AnnounceReadBasementDEM(void) const
Tells the user that we are now reading the DEM file.
Definition utils.cpp:401
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:706
double m_dThisIterUnconsCoarseCliffDeposition
This-iteration total of coarse unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:949
bool m_bGDALCanWriteInt32
Is the selected GDAL output file format capable of writing 32-bit integers to files?
Definition simulation.h:376
bool m_bRasterWaveFloodLineSave
Are we saving the raster wave flood line? TODO 007.
Definition simulation.h:427
bool m_bBreakingWaveHeightSave
Save breaking wave height raster GIS files?
Definition simulation.h:142
double m_dThisIterTotSeaDepth
Total sea depth (m) for this iteration.
Definition simulation.h:829
double m_dTotPotentialPlatformErosionOnProfiles
Total potential platform erosion on profiles.
Definition simulation.h:895
int m_nCoastMin
Minimum valid coast length when searching for coasts.
Definition simulation.h:514
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:682
bool m_bPolygonNodeSave
Save polygon node vector GIS files?
Definition simulation.h:283
bool m_bOmitSearchNorthEdge
Omit the north edge of the grid from coast-end searches?
Definition simulation.h:349
long double m_ldGTotCoarseActualPlatformErosion
All-simulation total of coarse sediment actual platform erosion (m)
long double m_ldGTotFineActualPlatformErosion
All-simulation total of fine sediment actual platform erosion (m)
double m_dThisIterUnconsSandCliffDeposition
This-iteration total of sand unconsolidated sediment deposited due to cliff collapse (m^3)
Definition simulation.h:946
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:328
bool m_bTotalPotentialPlatformErosionSave
Save total potential shore platform erosion raster GIS files?
Definition simulation.h:154
bool m_bSetupSurgeFloodMaskSave
Are we saving the setup surge flood mask? TODO 007.
Definition simulation.h:421
bool m_bWaveEnergySinceCollapseSave
Save wave energy since cliff collapse raster GIS files?
Definition simulation.h:136
double m_dNorthWestXExtCRS
The north-west x coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:643
double m_dD50Coarse
The D50 for coarse sediment.
Definition simulation.h:778
static void AnnounceStart(void)
Tells the user that we have started the simulation.
Definition utils.cpp:189
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:496
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:865
double m_dSouthEastYExtCRS
The south-east y coordinate, in the external coordinate reference system (CRS)
Definition simulation.h:652
bool m_bPotentialBeachErosionSave
Save potential beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:160
long double m_ldGTotCliffCollapseFineErodedDuringDeposition
All-simulation total of fine sediment eroded during talus deposition following cliff collapse (m)
~CSimulation(void)
The CSimulation destructor.
long double m_ldGTotCoarseDepositionDiff
All-simulation total of shortfall in unconsolidated coarse sediment deposition (m,...
int nSetAllCoastpointDeepWaterWaveValues(void)
Give every coast point a value for deep water wave height and direction TODO 005 This may not be real...
double m_dStartIterConsFineAllCells
Depth (m) of fine consolidated sediment at the start of the simulation, all cells (both inside and ou...
Definition simulation.h:997
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:445
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:565
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:190
double m_dMinCliffTalusHeightFrac
Minimum height of the landward end of cliff collapse talus, as a fraction of cliff elevation.
Definition simulation.h:925
double m_dThisIterBeachErosionSand
Total actual beach erosion (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:850
double m_dAccumulatedSeaLevelChange
If long-term SWL changes, the total change so far since the start of simulation.
Definition simulation.h:718
bool m_bPolygonBoundarySave
Save polygon boundary vector GIS files?
Definition simulation.h:286
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:415
bool m_bActualPlatformErosionSave
Save actual (supply-limited) shore platform erosion raster GIS files?
Definition simulation.h:151
double m_dThisIterFineSedimentToSuspension
Total fine unconsolidated sediment in suspension for this iteration (depth in m)
Definition simulation.h:862
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:847
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:880
int m_nSimStartMin
Start time of the simulation (minutes)
Definition simulation.h:556
bool bSaveAllRasterGISFiles(void)
unsigned long m_ulThisIterNumActualBeachErosionCells
The number of grid cells on which actual beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:625
bool bReadIniFile(void)
The bReadIniFile member function reads the initialization file.
bool m_bHaveFineSediment
Does this simulation consider fine-sized sediment?
Definition simulation.h:82
double m_dCliffDepositionA
Scale parameter A for cliff deposition (m^(1/3)), may be zero for auto-calculation.
Definition simulation.h:916
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:316
int m_nYMaxBoundingBox
The maximum y value of the bounding box.
Definition simulation.h:547
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:166
unsigned long m_ulThisIterNumPotentialPlatformErosionCells
The number of grid cells on which potential platform erosion occurs, for this iteration.
Definition simulation.h:616
double m_dStartIterUnconsSandAllCells
Depth (m) of sand unconsolidated sediment at the start of the simulation, all cells (both inside and ...
Definition simulation.h:991
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:724
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:709
int m_nGISSave
The save number for GIS files (can be sequential, or the iteration number)
Definition simulation.h:502
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:436
bool m_bSeaMaskSave
Save sea mask raster GIS files?
Definition simulation.h:241
double m_dThisIterCliffCollapseErosionFineCons
This-iteration total of fine consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:937
bool m_bInterventionClassSave
Save intervention class raster GIS files?
Definition simulation.h:184
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:823
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:568
bool m_bTotalActualBeachErosionSave
Save total actual (supply-limited) beach (unconsolidated sediment) erosion raster GIS files?
Definition simulation.h:169
bool m_bRasterCoastlineSave
Save rasterized coastline GIS files?
Definition simulation.h:214
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:730
bool m_bInterventionHeightSave
Save intervention height raster GIS files?
Definition simulation.h:187
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:583
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:610
void AnnounceReadIHGIS(void) const
Tells the user that we are now reading the Intervention height GIS file.
Definition utils.cpp:477
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:615
bool m_bRiverineFlooding
Are we doing flooding? TODO 007.
Definition simulation.h:409
long m_lGDALMinCanWrite
The minimum integer value which GDAL can write, can be zero, INT16_MIN, INT32_MIN.
Definition simulation.h:595
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:988
bool m_bSandConsSedSave
Save sand consolidated sediment raster GIS files?
Definition simulation.h:208
bool m_bSedimentInputEventSave
Save sediment inut data?
Definition simulation.h:403
bool m_bHaveCoarseSediment
Does this simulation consider coarse-sized sediment?
Definition simulation.h:88
double m_dRegularSaveInterval
The interval between regular saves, in hours.
Definition simulation.h:685
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:262
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:676
unsigned long m_ulTotPotentialPlatformErosionOnProfiles
The number of cells on which on-profile average potential shore platform erosion occurs.
Definition simulation.h:631
bool m_bCliffCollapseDepositionTSSave
Save the cliff collapse deposition time series file?
Definition simulation.h:310
int m_nXMinBoundingBox
The minimum x value of the bounding box.
Definition simulation.h:538
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:661
bool m_bDeepWaterWaveAngleAndHeightSave
Save deep water wave angle and wave height raster GIS files?
Definition simulation.h:133
unsigned long m_ulTotPotentialPlatformErosionBetweenProfiles
The number of cells on which between-profile average potential shore platform erosion occurs.
Definition simulation.h:634
double m_dCoastNormalRandSpacingFactor
Random factor for spacing of along-coast normals.
Definition simulation.h:952
double m_dMaxUserInputWaveHeight
Maximum deep water wave height.
Definition simulation.h:763
void AnnounceReadInitialFineConsSedGIS(int const) const
Tells the user that we are now reading the initial fine consolidated sediment depth GIS file.
Definition utils.cpp:589
bool m_bBeachProtectionSave
Save beach protection raster GIS files>
Definition simulation.h:145
bool m_bDoBeachSedimentTransport
Simulate unconsolidated sediment (beach) transport?
Definition simulation.h:367
unsigned long m_ulThisIterNumPotentialBeachErosionCells
The number of grid cells on which potential beach (unconsolidated sediment) erosion occurs,...
Definition simulation.h:622
bool m_bFineConsSedSave
Save fine consolidated sediment raster GIS files?
Definition simulation.h:205
bool m_bShadowDowndriftBoundarySave
Save wave shadow downdrift boundary vector GIS files?
Definition simulation.h:295
int m_nCoastSmooth
Which method to use for coast smoothing.
Definition simulation.h:466
bool m_bDeepWaterWavePeriodSave
Save deep water wave period raster GIS files?
Definition simulation.h:256
string m_strInitialLandformFile
Name of initial landform file.
double m_dC_0
Deep water wave speed (m/s)
Definition simulation.h:742
double m_dThisIterCliffCollapseErosionSandCons
This-iteration total of sand consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:940
bool m_bBeachSedimentChangeNetTSSave
Save the beach (unconsolidated sediment) net change time series file?
Definition simulation.h:322
double m_dThisIterBeachDepositionSand
Total beach deposition (sand unconsolidated sediment) for this iteration (depth in m)
Definition simulation.h:856
int nReadTideDataFile(void)
Reads the tide time series data.
bool m_bCoarseConsSedSave
Save coarse consolidated sediment raster GIS files?
Definition simulation.h:211
bool m_bSeaAreaTSSave
Save the sea area time series file?
Definition simulation.h:298
bool m_bScaleRasterOutput
Scale raster output?
Definition simulation.h:379
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:874
double m_dThisIterCliffCollapseErosionSandUncons
This-iteration total of sand unconsolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:931
double m_dD50Fine
The D50 for fine sediment.
Definition simulation.h:772
unsigned long m_ulRandSeed[NUMBER_OF_RNGS]
A seed for each of the random number generators.
Definition simulation.h:604
bool m_bOmitSearchSouthEdge
Omit the south edge of the grid from coast-end searches?
Definition simulation.h:352
bool m_bBeachMaskSave
Save beach mask raster GIS files?
Definition simulation.h:244
bool bOpenLogFile(void)
Opens the log file.
Definition utils.cpp:377
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:100
unsigned long m_ulIter
The number of the current iteration (time step)
Definition simulation.h:598
void AnnounceLicence(void)
Tells the user about the licence.
Definition utils.cpp:261
bool m_bAvgSuspSedSave
Save average suspended sediment raster GIS files?
Definition simulation.h:193
double m_dBeachSedimentDensity
The density of unconsolidated beach sediment (kg/m**3)
Definition simulation.h:781
int m_nNumPolygonGlobal
Number of global (all coasts) polygons.
Definition simulation.h:523
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:673
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:346
double m_dCliffSlopeLimit
Slope limit for cliff toe detection.
Definition simulation.h:484
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:1335
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:976
double m_dExtCRSGridArea
The area of the grid (in external CRS units)
Definition simulation.h:655
int nDoAllPropagateWaves(void)
Simulates wave propagation along all coastline-normal profiles, on all coasts.
bool m_bOutputProfileData
Output profile data?
Definition simulation.h:337
double m_dThisIterDiffWaveSetupSurgeRunupWaterLevel
TODO 007 Info needed.
Definition simulation.h:736
double m_dCellSide
Length of a cell side (in external CRS units)
Definition simulation.h:658
double m_dMaxBeachElevAboveSWL
Maximum elevation of beach above SWL (m)
Definition simulation.h:904
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:739
void AnnounceProgress(void)
Displays information regarding the progress of the simulation.
Definition utils.cpp:1655
bool m_bTotCliffCollapseDepositionSave
Save total cliff collapse deposition raster GIS files?
Definition simulation.h:232
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:760
double m_dThisIterCliffCollapseCoarseErodedDuringDeposition
Total coarse sediment eroded during Dean profile deposition of talus following cliff collapse (depth ...
Definition simulation.h:883
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:688
void AnnounceReadLGIS(void) const
Tells the user that we are now reading the Landscape category GIS file.
Definition utils.cpp:447
double m_dThisIterTopElevMax
This-iteration highest elevation of DEM.
Definition simulation.h:967
double m_dThisIterActualPlatformErosionFineCons
Total actual platform erosion (fine consolidated sediment) for this iteration (depth in m)
Definition simulation.h:835
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:901
int m_nProfileSmoothWindow
The size of the window used for running-mean coast-normal profile smoothing (must be odd)
Definition simulation.h:487
bool m_bDoCliffCollapse
Simulate cliff collapse?
Definition simulation.h:364
static void AnnounceReadVectorFiles(void)
Now reading vector GIS files.
Definition utils.cpp:439
double m_dThisIterCliffCollapseErosionCoarseCons
This-iteration total of coarse consolidated sediment produced by cliff collapse (m^3)
Definition simulation.h:943
double m_dThisIterLeftGridUnconsSand
Total sand unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:871
double m_dDepthOfClosure
Depth of closure (in m) TODO 007 can be calculated using Hallermeier, R.J. (1978) or Birkemeier (1985...
Definition simulation.h:817
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:982
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:424
double m_dThisIterDiffTotWaterLevel
TODO 007 Info needed.
Definition simulation.h:727
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:412
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:628
double m_dClkLast
Last value returned by clock()
Definition simulation.h:691
bool m_bShadowZoneCodesSave
Save wave shadow zones raster GIS files?
Definition simulation.h:247
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:715
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:307
bool m_bPotentialPlatformErosionSave
Save potential shore platform erosion raster GIS files?
Definition simulation.h:148
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:589
bool m_bGDALCanWriteFloat
Is the selected GDAL output file format capable of writing floating-point values to files?
Definition simulation.h:373
void AnnounceReadInitialCoarseUnconsSedGIS(int const) const
Tells the user that we are now reading the initial coarse unconsolidated sediment depth GIS file.
Definition utils.cpp:576
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:451
ofstream OutStream
The main output file stream.
double m_dDurationUnitsMult
Multiplier for duration units, to convert to hours.
Definition simulation.h:640
bool m_bFloodSWLSetupSurgeRunupLine
Are we saving the flood still water level setup surge runup line? TODO 007.
Definition simulation.h:442
unsigned long m_ulTotTimestep
The target number of iterations.
Definition simulation.h:601
bool m_bOutputParallelProfileData
Output parallel profile data?
Definition simulation.h:340
double m_dKamphuis
Transport parameter for the Kamphuis equation.
Definition simulation.h:808
bool m_bOutputErosionPotentialData
Output erosion potential data?
Definition simulation.h:343
int m_nLevel
TODO 007 Used in WAVESETUP + SURGE + RUNUP.
Definition simulation.h:580
bool m_bSedimentInputThisIter
Do we have a sediment input event this iteration?
Definition simulation.h:406
bool m_bCliffNotchSave
Save cliff notch incision depth vector GIS files?
Definition simulation.h:289
bool m_bVectorWaveFloodLineSave
Are we saving the vector wave flood line? TODO 007.
Definition simulation.h:430
bool m_bWaveAngleSave
Save wave angle raster GIS files?
Definition simulation.h:121
bool m_bOmitSearchEastEdge
Omit the east edge of the grid from coast-end searches?
Definition simulation.h:358
double m_dThisIterLeftGridUnconsFine
Total fine unconsolidated sediment lost from the grid this iteration (depth in m)
Definition simulation.h:868
bool m_bLocalSlopeSave
Save local slope raster GIS files?
Definition simulation.h:181
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:1265
string const VECTOR_PLOT_INVALID_NORMALS_TITLE
Definition cme.h:1191
double const TOLERANCE
Definition cme.h:823
string const VECTOR_PLOT_NORMALS_TITLE
Definition cme.h:1193
string const RASTER_PLOT_POLYGON_TITLE
Definition cme.h:1101
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:902
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:1303
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:1252
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:1187
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:1098
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.