Marine systems simulation
WaveEnergySpecter.h
1
13
14#ifndef WAVE_ENERGY_SPECTER
15#define WAVE_ENERGY_SPECTER
16
17#include <random>
18#include <vector>
19
20
22{
23public:
24 enum EWaveSpecter_t
25 {
26 EWaveSpecter_Jonswap=0,
27 EWaveSpecter_Issc,
28 };
29 enum EDirectionSpecter_t
30 {
31 EDirectionSpecter_None=0,
32 EDirectionSpecter_CosineSquared,
33 };
34
36 double dHs;
37 double dT1;
38 double dTheta;
39 double dCosinePower;
43 };
44
45 WaveEnergySpecter(EWaveSpecter_t EWaveSpecter, EDirectionSpecter_t EDirectionSpecter, SSpecterParameters* pSSpecterParameters, int iNumWaves, unsigned int RandomSeed);
47
48
49 //double Cosinesquared (double theta, double theta1, double theta2);
50 //double RandomPhaseAngle ();
51 //void ComputeWaveAmplitudes ();
52
53
54 const std::vector<double>* GetWaveFrequencyArray();
55 const std::vector<double>* GetWaveDirectionArray();
56 const std::vector<double>* GetSpectralValueArray();
57 const std::vector<double>* GetRandomPhaseArray();
58 const std::vector<double>* GetWaveNumberArray();
59
60
61
62protected:
63 typedef double (WaveEnergySpecter::*NormalizedProbabilityDistribution)(const double);
64 void fillRandomVector(NormalizedProbabilityDistribution f, double limit_low, double limit_high, std::vector<double>& result);
65 void makeWaveFrequencyVectorWithRandomIntervals();
66 double randomNumber(double limit_low, double limit_high);
67
68 double cosPower(double theta);
69
70
71 double SpectralEnergy (double omega);
72 double Jonswap (double omega);
73 double NormalizedConstantSteepnessJonswap (double omega);
74 double Issc (double omega);
75 double SpectralDirectionDistribution (double theta);
76 double NormalizedConstantSteepnessIssc(double omega);
77
78 // Member variables
79 double m_dHs;
80 double m_dT1;
81 double m_cosPower;
82 bool m_isLongCrested;
84 //double m_dTheta1; /// Lower sector angle of direction spectrum
85 //double m_dTheta2; /// Upper sector angle of direction spectrum
86 double m_dRho;
87 double m_dGravity;
90
91
92private:
93 EWaveSpecter_t m_EWaveSpecter;
94 EDirectionSpecter_t m_EDirectionSpecter;
95 std::vector<double> m_ZetaA;
96 std::vector<double> m_Epsilon;
97 std::vector<double> m_Omega;
98 std::vector<double> m_deltaOmega;
99 std::vector<double> m_WaveNumber;
100 std::vector<double> m_Theta;
101 int m_iNumWaves;
102
103 std::mt19937 m_rng;
104 std::uniform_real_distribution<double> m_dist;
105};
106
107#endif
Definition: WaveEnergySpecter.h:22
double m_omgUppLim_nDim
Non-dimensional omega omega_nDim = omega*T1/(2*pi) lower limit.
Definition: WaveEnergySpecter.h:89
double m_omgLowLim_nDim
Acceleration of gravity.
Definition: WaveEnergySpecter.h:88
double m_cosPower
Mean wave period.
Definition: WaveEnergySpecter.h:81
double m_dGravity
Mass density of sea water.
Definition: WaveEnergySpecter.h:87
double m_dT1
Significant wave height.
Definition: WaveEnergySpecter.h:80
double m_mainWaveDirection
Boolean. True if sea state is long crested. False if sea state is short crested.
Definition: WaveEnergySpecter.h:83
Definition: WaveEnergySpecter.h:35
double dCosinePower
Mean wave propagation direction.
Definition: WaveEnergySpecter.h:39
double dTheta
Mean wave period.
Definition: WaveEnergySpecter.h:38
double dOmegaNDimLowLim
Boolean. true if sea state is long crested. False if short crested sea is to be evaluated.
Definition: WaveEnergySpecter.h:41
double dT1
Significant wave height.
Definition: WaveEnergySpecter.h:37
double dOmegaNDimUppLim
Non-dimensional omega_nDim = omega*T1/(2*pi) lower limit.
Definition: WaveEnergySpecter.h:42
bool dIsLongCrested
directional specter is given as cos(theta)^dCosinePower.
Definition: WaveEnergySpecter.h:40