GodaJONSWAP.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::GodaJONSWAP
26 
27 Description
28  GodaJONSWAP wave spectrum. This is an alternative, approximate
29  parameterisation of the JONSWAP spectrum, in which the significant wave
30  height and period are specified instead of the wind speed and fetch.
31 
32  References:
33  \verbatim
34  Goda, Y. (1988).
35  Statistical variability of sea state parameters as a function of wave
36  spectrum.
37  Coastal Engineering in Japan, 31(1), 39-52.
38  \endverbatim
39 
40  \verbatim
41  Goda, Y. (2010).
42  Random seas and design of maritime structures.
43  World Scientific Publishing Company.
44  \endverbatim
45 
46  See page 29 of the second reference for a convenient formulation.
47 
48 Usage
49  \table
50  Property | Description | Required? | Default
51  Hs | The significant wave height [m] | yes |
52  Tp | The significant wave period [s] | yes |
53  gamma | Peaked-ness parameter | no | 3.3
54  \endtable
55 
56  Example specification:
57  \verbatim
58  spectrum GodaJONSWAP;
59 
60  GodaJONSWAPCoeffs
61  {
62  Hs 2;
63  Ts 6;
64  }
65  \endverbatim
66 
67 See also
68  Foam::waveSpectra::JONSWAP
69 
70 SourceFiles
71  GodaJONSWAP.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef GodaJONSWAP_H
76 #define GodaJONSWAP_H
77 
78 #include "waveSpectrum.H"
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 namespace waveSpectra
85 {
86 
87 /*---------------------------------------------------------------------------*\
88  Class GodaJONSWAP Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 class GodaJONSWAP
92 :
93  public waveSpectrum
94 {
95  // Private Data
96 
97  //- Significant Wave Height [m]
98  const scalar Hs_;
99 
100  //- Significant wave period [s]
101  const scalar Ts_;
102 
103  //- Peaked-ness parameter
104  const scalar gamma_;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("GodaJONSWAP");
111 
112 
113  // Constructors
114 
115  //- Construct a copy
116  GodaJONSWAP(const GodaJONSWAP& spectrum);
117 
118  //- Construct from a dictionary and gravity
119  GodaJONSWAP(const dictionary& dict, const scalar g);
120 
121  //- Construct a clone
122  virtual autoPtr<waveSpectrum> clone() const
123  {
124  return autoPtr<waveSpectrum>(new GodaJONSWAP(*this));
125  }
126 
127 
128  //- Destructor
129  virtual ~GodaJONSWAP();
130 
131 
132  // Member Functions
133 
134  //- Evaluate the wave spectral density at the given frequencies [m^2/Hz]
135  virtual tmp<scalarField> S(const scalarField& f) const;
136 
137  //- Return the frequency below which a given fraction of the spectrum's
138  // total energy falls []
139  virtual scalar fFraction(const scalar fraction) const;
140 
141  //- Write
142  virtual void write(Ostream& os) const;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace waveSpectra
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
GodaJONSWAP wave spectrum. This is an alternative, approximate parameterisation of the JONSWAP spectr...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for managing temporary objects.
Definition: tmp.H:55
virtual autoPtr< waveSpectrum > clone() const
Construct a clone.
Definition: GodaJONSWAP.H:141
TypeName("GodaJONSWAP")
Runtime type information.
virtual scalar fFraction(const scalar fraction) const
Return the frequency below which a given fraction of the spectrum's.
Definition: GodaJONSWAP.C:96
virtual void write(Ostream &os) const
Write.
Definition: GodaJONSWAP.C:106
GodaJONSWAP(const GodaJONSWAP &spectrum)
Construct a copy.
Definition: GodaJONSWAP.C:47
virtual tmp< scalarField > S(const scalarField &f) const
Evaluate the wave spectral density at the given frequencies [m^2/Hz].
Definition: GodaJONSWAP.C:80
virtual ~GodaJONSWAP()
Destructor.
Definition: GodaJONSWAP.C:73
scalar g() const
Access the gravitation acceleration [m/s^2].
Definition: waveSpectrum.H:132
Namespace for OpenFOAM.
labelList f(nPoints)
dictionary dict