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
15This file is part of CoastalME, the Coastal Modelling Environment.
16
17CoastalME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
18
19This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23==============================================================================================================================*/
24#include <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 int nSize = static_cast<int>(m_VdTideData.size());
41 if (nSize != 0)
42 {
43 // We have tide data
44 static int snTideDataCount = 0;
45
46 // Wrap the tide data, i.e. start again with the first record if we do not have enough
47 if (snTideDataCount > nSize-1)
48 snTideDataCount = 0;
49
50 // This-iteration SWL includes both tidal change and long-term SWL change
52
53 // This-iteration mean SWL includes only long-term SWL change
55
56 // cout << m_dThisIterSWL << endl;
57 snTideDataCount++;
58 }
59
60 // Update min and max still water levels
63
64 // Update the wave height, orientation and period for this time step and start again with the first record if we do not have enough
66 {
67 static int snWaveStationDataCount = 0;
68
69 if (snWaveStationDataCount > m_nDeepWaterWaveDataNumTimeSteps-1)
70 {
71 // Wrap the tide data, i.e. start again with the first record if we do not have enough
72 snWaveStationDataCount = 0;
73 }
74
75 // Do we have just a single wave station?
77 {
78 // Yes, just a single wave station
82 }
83 else
84 {
85 // 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
86 int nNumberDeepWaterWaveStations = static_cast<int>(m_VnDeepWaterWaveStationID.size());
87 int nTot = nNumberDeepWaterWaveStations * snWaveStationDataCount;
88
89 for (int j = 0; j < nNumberDeepWaterWaveStations; j++)
90 {
94 }
95 }
96
97 snWaveStationDataCount++;
98 }
99
100 return RTN_OK;
101}
double m_dAllCellsDeepWaterWaveHeight
Deep water wave height (m) for all sea cells.
Definition simulation.h:709
vector< double > m_VdTSDeepWaterWaveStationPeriod
Time series of wave period at deep water wave station.
double m_dMinSWL
Minimum still water level.
Definition simulation.h:676
double m_dThisIterSWL
The still water level for this timestep (this includes tidal changes and any long-term SWL change)
Definition simulation.h:667
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:362
int nCalcExternalForcing(void)
Calculate external forcings: change in still water level, tide level and deep water waves height,...
vector< double > m_VdTideData
Tide data: one record per timestep, is the change (m) from still water level for that timestep.
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:365
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:712
int m_nDeepWaterWaveDataNumTimeSteps
The duration of data for deep water waves, expressed as a number of time steps.
Definition simulation.h:527
vector< int > m_VnDeepWaterWaveStationID
ID for deep water wave station, this corresponds with the ID in the wave time series file.
double m_dAccumulatedSeaLevelChange
If long-term SWL changes, the total change so far since the start of simulation.
Definition simulation.h:673
double m_dMaxSWL
Maximum still water level.
Definition simulation.h:679
double m_dDeltaSWLPerTimestep
If long-term SWL changes, the increment per timestep.
Definition simulation.h:664
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:715
double m_dOrigSWL
The start-of-simulation still water level (m)
Definition simulation.h:658
vector< double > m_VdTSDeepWaterWaveStationHeight
Time series of wave heights at deep water wave station.
double m_dThisIterMeanSWL
The mean still water level for this timestep (does not include tidal changes, but includes any long-t...
Definition simulation.h:670
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:1136
T tMax(T a, T b)
Definition cme.h:1123
int const RTN_OK
Definition cme.h:577
Contains CSimulation definitions.