Stokes2.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-2021 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::Stokes2
26 
27 Description
28  Second-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 equations 18 and 19.
38 
39 SourceFiles
40  Stokes2.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef Stokes2_H
45 #define Stokes2_H
46 
47 #include "Airy.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 namespace waveModels
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class Stokes2 Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class Stokes2
61 :
62  public Airy
63 {
64 protected:
65 
66  // Protected Member Functions
67 
68  //- The wave celerity [m/s]
69  static scalar celerity
70  (
71  const scalar depth,
72  const scalar amplitude,
73  const scalar length,
74  const scalar g
75  );
76 
77  //- The wave celerity [m/s]
78  virtual scalar celerity() const
79  {
80  return celerity(depth(), amplitude(), length(), g());
81  }
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("Stokes2");
88 
89 
90  // Constructors
91 
92  //- Construct from a dictionary and gravity
93  Stokes2
94  (
95  const dictionary& dict,
96  const scalar g,
97  const word& modelName = Stokes2::typeName,
98  scalar (*modelCelerity)(scalar, scalar, scalar, scalar) =
100  );
101 
102  //- Construct a clone
103  virtual autoPtr<waveModel> clone() const
104  {
105  return autoPtr<waveModel>(new Stokes2(*this));
106  }
107 
108 
109  //- Destructor
110  virtual ~Stokes2();
111 
112 
113  // Member Functions
114 
115  //- Get the wave elevation at a given time and local coordinates. Local
116  // x is aligned with the direction of propagation.
118  (
119  const scalar t,
120  const scalarField& x
121  ) const;
122 
123  //- Get the wave velocity at a given time and local coordinates. Local
124  // x is aligned with the direction of propagation, and z with negative
125  // gravity.
127  (
128  const scalar t,
129  const vector2DField& xz
130  ) const;
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 } // End namespace waveModels
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
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:160
A class for managing temporary objects.
Definition: tmp.H:55
scalar g() const
Get the value of gravity.
Definition: waveModel.H:119
First-order wave model.
Definition: Airy.H:62
scalar length() const
Get the length.
Definition: Airy.H:206
scalar amplitude() const
Get the amplitude at steady state.
Definition: Airy.H:200
scalar depth() const
Get the depth.
Definition: Airy.H:188
Second-order wave model.
Definition: Stokes2.H:62
virtual ~Stokes2()
Destructor.
Definition: Stokes2.C:85
Stokes2(const dictionary &dict, const scalar g, const word &modelName=Stokes2::typeName, scalar(*modelCelerity)(scalar, scalar, scalar, scalar)=&Stokes2::celerity)
Construct from a dictionary and gravity.
Definition: Stokes2.C:72
TypeName("Stokes2")
Runtime type information.
virtual tmp< scalarField > elevation(const scalar t, const scalarField &x) const
Get the wave elevation at a given time and local coordinates. Local.
Definition: Stokes2.C:92
virtual autoPtr< waveModel > clone() const
Construct a clone.
Definition: Stokes2.H:102
virtual tmp< vector2DField > velocity(const scalar t, const vector2DField &xz) const
Get the wave velocity at a given time and local coordinates. Local.
Definition: Stokes2.C:117
virtual scalar celerity() const
The wave celerity [m/s].
Definition: Stokes2.H:77
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict