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