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