CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
calc_external_forcing.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 <iostream>
25using std::cerr;
26using std::endl;
27using std::cout;
28
29#include "cme.h"
30#include "simulation.h"
31
32//===============================================================================================================================
34//===============================================================================================================================
36{
37 // Increment SWL (note that increment may be zero)
39
40 // This-iteration mean SWL includes only long-term SWL change
42
43 int nSize = static_cast<int>(m_VdTideData.size());
44
45 if (nSize == 0)
46 {
47 // No tide data
49 }
50
51 else
52 {
53 // We have tide data
54 static int snTideDataCount = 0;
55
56 // Wrap the tide data, i.e. start again with the first record if we do not have enough
57 if (snTideDataCount > nSize - 1)
58 snTideDataCount = 0;
59
60 // This-iteration SWL includes both tidal change and long-term SWL change
62
63 snTideDataCount++;
64 }
65
66 // Update min and max still water levels
69
70 // Update the wave height, orientation and period for this time step and start again with the first record if we do not have enough
72 {
73 static int snWaveStationDataCount = 0;
74
75 if (snWaveStationDataCount > m_nDeepWaterWaveDataNumTimeSteps - 1)
76 {
77 // Wrap the tide data, i.e. start again with the first record if we do not have enough
78 snWaveStationDataCount = 0;
79 }
80
81 // Do we have just a single wave station?
83 {
84 // Yes, just a single wave station
88 }
89
90 else
91 {
92 // More than one wave station, so update this time step's deep water wave values for use in the nInterpolateAllDeepWaterWaveValues() routine. Note that the order on the vector is determined by the points ID i.e. to ensure that stations match with time series
93 int nNumberDeepWaterWaveStations = static_cast<int>(m_VnDeepWaterWaveStationID.size());
94 int nTot = nNumberDeepWaterWaveStations * snWaveStationDataCount;
95
96 for (int j = 0; j < nNumberDeepWaterWaveStations; j++)
97 {
101 }
102 }
103
104 snWaveStationDataCount++;
105 }
106
107 return RTN_OK;
108}
double m_dAllCellsDeepWaterWaveHeight
Deep water wave height (m) for all sea cells.
Definition simulation.h:792
vector< double > m_VdTSDeepWaterWaveStationPeriod
Time series of wave period at deep water wave station.
double m_dMinSWL
Minimum still water level.
Definition simulation.h:759
double m_dThisIterSWL
Definition simulation.h:748
bool m_bSingleDeepWaterWaveValues
Definition simulation.h:388
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
vector< double > m_VdTideData
double m_dInitialMeanSWL
The start-of-simulation still water level (m)
Definition simulation.h:737
vector< double > m_VdThisIterDeepWaterWaveStationHeight
This-iteration wave height at deep water wave station.
bool m_bHaveWaveStationData
Do we have wave station data?
Definition simulation.h:391
vector< double > m_VdThisIterDeepWaterWaveStationPeriod
This-iteration wave period at deep water wave station.
double m_dAllCellsDeepWaterWaveAngle
Deep water wave angle for all sea cells.
Definition simulation.h:795
int m_nDeepWaterWaveDataNumTimeSteps
Definition simulation.h:587
vector< int > m_VnDeepWaterWaveStationID
double m_dAccumulatedSeaLevelChange
Definition simulation.h:756
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:762
double m_dDeltaSWLPerTimestep
If long-term SWL changes, the increment per timestep.
Definition simulation.h:744
vector< double > m_VdThisIterDeepWaterWaveStationAngle
This-iteration wave orientation at deep water wave station.
double m_dAllCellsDeepWaterWavePeriod
Deep water wave period for all sea cells.
Definition simulation.h:798
vector< double > m_VdTSDeepWaterWaveStationHeight
Time series of wave heights at deep water wave station.
double m_dThisIterMeanSWL
Definition simulation.h:752
vector< double > m_VdTSDeepWaterWaveStationAngle
Time series of wave orientation at deep water wave station.
This file contains global definitions for CoastalME.
T tMin(T a, T b)
Definition cme.h:1251
T tMax(T a, T b)
Definition cme.h:1240
int const RTN_OK
Definition cme.h:692
Contains CSimulation definitions.