Airy.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) 2017-2019 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::waveModels::Airy
26 
27 Description
28  First-order wave model.
29 
30  Reference:
31  \verbatim
32  Stokes, G.G. (1847)
33  On the theory of oscillatory waves.
34  Transactions of the Cambridge Philosophical Society, 8, 441.
35  \endverbatim
36 
37  See the leading terms of equations 18 and 19.
38 
39 SourceFiles
40  Airy.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef Airy_H
45 #define Airy_H
46 
47 #include "waveModel.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 namespace waveModels
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class Airy Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class Airy
61 :
62  public waveModel
63 {
64  // Private Data
65 
66  //- Peak-to-peak length [m]
67  const scalar length_;
68 
69  //- Phase offset [rad]
70  const scalar phase_;
71 
72  //- Depth [m]
73  const scalar depth_;
74 
75 
76 protected:
77 
78  // Protected Member Functions
79 
80  //- The angular wavenumber [rad/m]
81  scalar k() const;
82 
83  //- The wave celerity [m/s]
84  scalar celerity() const;
85 
86  //- Angle of the oscillation [rad]
88  (
89  const scalar t,
90  const scalarField& x
91  ) const;
92 
93  //- Return whether shallow and intermediate effects are to be omitted
94  bool deep() const;
95 
96  //- Return the non-dimensionalised i-th harmonic of the velocity
98  (
99  const label i,
100  const scalar t,
101  const vector2DField& xz
102  ) const;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("Airy");
109 
110 
111  // Constructors
112 
113  //- Construct a copy
114  Airy(const Airy& wave);
115 
116  //- Construct from a database and a dictionary
117  Airy(const objectRegistry& db, const dictionary& dict);
118 
119  //- Construct a clone
120  virtual autoPtr<waveModel> clone() const
121  {
122  return autoPtr<waveModel>(new Airy(*this));
123  }
124 
125 
126  //- Destructor
127  virtual ~Airy();
128 
129 
130  // Member Functions
131 
132  // Access
133 
134  //- Get the length
135  scalar length() const
136  {
137  return length_;
138  }
139 
140  //- Get the phase
141  scalar phase() const
142  {
143  return phase_;
144  }
145 
146  //- Get the depth
147  scalar depth() const
148  {
149  return depth_;
150  }
151 
152  //- Get the wave elevation at a given time and local coordinates. Local
153  // x is aligned with the direction of propagation.
155  (
156  const scalar t,
157  const scalarField& x
158  ) const;
159 
160  //- Get the wave velocity at a given time and local coordinates. Local
161  // x is aligned with the direction of propagation, and z with negative
162  // gravity.
164  (
165  const scalar t,
166  const vector2DField& xz
167  ) const;
168 
169  //- Get the wave pressure at a given time and local coordinates. Local
170  // x is aligned with the direction of propagation, and z with negative
171  // gravity.
172  virtual tmp<scalarField> pressure
173  (
174  const scalar t,
175  const vector2DField& xz
176  ) const;
177 
178  //- Write
179  virtual void write(Ostream& os) const;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace waveModels
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
dictionary dict
Airy(const Airy &wave)
Construct a copy.
Definition: Airy.C:102
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
scalar celerity() const
The wave celerity [m/s].
Definition: Airy.C:50
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual tmp< scalarField > elevation(const scalar t, const scalarField &x) const
Get the wave elevation at a given time and local coordinates. Local.
Definition: Airy.C:133
virtual autoPtr< waveModel > clone() const
Construct a clone.
Definition: Airy.H:119
First-order wave model.
Definition: Airy.H:59
bool deep() const
Return whether shallow and intermediate effects are to be omitted.
Definition: Airy.C:66
virtual tmp< vector2DField > velocity(const scalar t, const vector2DField &xz) const
Get the wave velocity at a given time and local coordinates. Local.
Definition: Airy.C:143
TypeName("Airy")
Runtime type information.
virtual tmp< scalarField > pressure(const scalar t, const vector2DField &xz) const
Get the wave pressure at a given time and local coordinates. Local.
Definition: Airy.C:155
tmp< scalarField > angle(const scalar t, const scalarField &x) const
Angle of the oscillation [rad].
Definition: Airy.C:57
Generic base class for waves. Derived classes must implement field functions which return the elevati...
Definition: waveModel.H:56
scalar phase() const
Get the phase.
Definition: Airy.H:140
scalar k() const
The angular wavenumber [rad/m].
Definition: Airy.C:44
scalar length() const
Get the length.
Definition: Airy.H:134
scalar depth() const
Get the depth.
Definition: Airy.H:146
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
tmp< vector2DField > vi(const label i, const scalar t, const vector2DField &xz) const
Return the non-dimensionalised i-th harmonic of the velocity.
Definition: Airy.C:73
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual void write(Ostream &os) const
Write.
Definition: Airy.C:167
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
virtual ~Airy()
Destructor.
Definition: Airy.C:126
Namespace for OpenFOAM.