Stokes5.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "Stokes5.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace waveModels
34 {
35  defineTypeNameAndDebug(Stokes5, 0);
36  addToRunTimeSelectionTable(waveModel, Stokes5, objectRegistry);
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const objectRegistry& db,
46  const dictionary& dict
47 )
48 :
49  Stokes2(db, dict)
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
54 
56 {}
57 
58 
59 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
60 
62 (
63  const scalar t,
64  const scalarField& x
65 ) const
66 {
67  const scalar kd = k()*depth(), ka = k()*amplitude(t);
68 
69  const scalar S = deep() ? 0 : 1/cosh(2*kd), T = deep() ? 1 : tanh(kd);
70 
71  const scalar B31 =
72  - 3.0/8/pow3(1 - S)
73  *(
74  1 + 3*S + 3*sqr(S) + 2*pow3(S)
75  );
76 
77  const scalar B42 =
78  1.0/6/T/(3 + 2*S)/pow4(1 - S)
79  *(
80  6 - 26*S - 182*sqr(S) - 204*pow3(S) - 25*pow4(S) + 26*pow5(S)
81  );
82 
83  const scalar B44 =
84  1.0/24/T/(3 + 2*S)/pow4(1 - S)
85  *(
86  24 + 92*S + 122*sqr(S) + 66*pow3(S) + 67*pow4(S) + 34*pow5(S)
87  );
88 
89  const scalar B53 =
90  9.0/128/(3 + 2*S)/(4 + S)/pow6(1 - S)
91  *(
92  132 + 17*S - 2216*sqr(S) - 5897*pow3(S) - 6292*pow4(S)
93  - 2687*pow5(S) + 194*pow6(S) + 467*S*pow6(S) + 82*sqr(pow4(S))
94  );
95 
96  const scalar B55 =
97  5.0/384/(3 + 2*S)/(4 + S)/pow6(1 - S)
98  *(
99  300 + 1579*S + 3176*sqr(S) + 2949*pow3(S) + 1188*pow4(S)
100  + 675*pow5(S) + 1326*pow6(S) + 827*S*pow6(S) + 130*sqr(pow4(S))
101  );
102 
103  if (debug)
104  {
105  Info<< "B31 = " << B31 << endl
106  << "B42 = " << B42 << endl
107  << "B44 = " << B44 << endl
108  << "B53 = " << B53 << endl
109  << "B55 = " << B55 << endl;
110  }
111 
112  const scalarField phi(angle(t, x));
113 
114  return
115  Stokes2::elevation(t, x)
116  + (1/k())
117  *(
118  pow3(ka)*B31*(cos(phi) - cos(3*phi))
119  + pow4(ka)*(B42*cos(2*phi) + B44*cos(4*phi))
120  + pow5(ka)*(- (B53 + B55)*cos(phi) + B53*cos(3*phi) + B55*cos(5*phi))
121  );
122 }
123 
124 
126 (
127  const scalar t,
128  const vector2DField& xz
129 ) const
130 {
131  const scalar kd = k()*depth(), ka = k()*amplitude(t);
132 
133  const scalar S = deep() ? 0 : 1/cosh(2*kd);
134  const scalar SByA11 = deep() ? 0 : S*sinh(kd);
135 
136  const scalar A31ByA11 =
137  1.0/8/pow3(1 - S)
138  *(
139  - 4 - 20*S + 10*sqr(S) - 13*pow3(S)
140  );
141 
142  const scalar A33ByA11 =
143  1.0/8/pow3(1 - S)
144  *(
145  - 2*sqr(S) + 11*pow3(S)
146  );
147 
148  const scalar A42ByA11 =
149  SByA11/24/pow5(1 - S)
150  *(
151  12 - 14*S - 264*sqr(S) - 45*pow3(S) - 13*pow4(S)
152  );
153 
154  const scalar A44ByA11 =
155  SByA11/48/(3 + 2*S)/pow5(1 - S)
156  *(
157  10*sqr(S) - 174*pow3(S) + 291*pow4(S) + 278*pow5(S)
158  );
159 
160  const scalar A51ByA11 =
161  1.0/64/(3 + 2*S)/(4 + S)/pow6(1 - S)
162  *(
163  - 1184 + 32*S + 13232*sqr(S) + 21712*pow3(S) + 20940*pow4(S)
164  + 12554*pow5(S) - 500*pow6(S) - 3341*S*pow6(S) - 670*sqr(pow4(S))
165  );
166 
167  const scalar A53ByA11 =
168  1.0/32/(3 + 2*S)/pow6(1 - S)
169  *(
170  4*S + 105*sqr(S) + 198*pow3(S) - 1376*pow4(S) - 1302*pow5(S)
171  - 117*pow6(S) + 58*S*pow6(S)
172  );
173 
174  const scalar A55ByA11 =
175  1.0/64/(3 + 2*S)/(4 + S)/pow6(1 - S)
176  *(
177  - 6*pow3(S) + 272*pow4(S) - 1552*pow5(S) + 852*pow6(S)
178  + 2029*S*pow6(S) + 430*sqr(pow4(S))
179  );
180 
181  if (debug)
182  {
183  const scalar A11 = 1/sinh(kd);
184  Info<< "A31 = " << A31ByA11*A11 << endl
185  << "A33 = " << A33ByA11*A11 << endl
186  << "A42 = " << A42ByA11*A11 << endl
187  << "A44 = " << A44ByA11*A11 << endl
188  << "A51 = " << A51ByA11*A11 << endl
189  << "A53 = " << A53ByA11*A11 << endl
190  << "A55 = " << A55ByA11*A11 << endl;
191  }
192 
193  const vector2DField v1(vi(1, t, xz)), v3(vi(3, t, xz));
194 
195  return
196  Stokes2::velocity(t, xz)
197  + celerity()
198  *(
199  pow3(ka)*(A31ByA11*v1 + A33ByA11*v3)
200  + pow4(ka)*(A42ByA11*vi(2, t, xz) + A44ByA11*vi(4, t, xz))
201  + pow5(ka)*(A51ByA11*v1 + A53ByA11*v3 + A55ByA11*vi(5, t, xz))
202  );
203 }
204 
205 
206 // ************************************************************************* //
dimensionedScalar tanh(const dimensionedScalar &ds)
surfaceScalarField & phi
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
defineTypeNameAndDebug(Airy, 0)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
label k
Boltzmann constant.
virtual ~Stokes5()
Destructor.
Definition: Stokes5.C:55
dimensionedScalar pow5(const dimensionedScalar &ds)
Macros for easy insertion into run-time selection tables.
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:62
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:85
dimensionedScalar cos(const dimensionedScalar &ds)
virtual tmp< vector2DField > velocity(const scalar t, const vector2DField &xz) const
Get the wave velocity at a given time and local coordinates. Local.
Definition: Stokes5.C:126
Stokes5(const objectRegistry &db, const dictionary &dict)
Construct from a database and a dictionary.
Definition: Stokes5.C:44
addToRunTimeSelectionTable(waveModel, Airy, objectRegistry)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual tmp< scalarField > elevation(const scalar t, const scalarField &x) const
Get the wave elevation at a given time and local coordinates. Local.
Definition: Stokes5.C:62
dimensionedScalar pow3(const dimensionedScalar &ds)
Second-order wave model.
Definition: Stokes2.H:59
dimensionedScalar sinh(const dimensionedScalar &ds)
dimensionedScalar pow4(const dimensionedScalar &ds)
dimensionedScalar pow6(const dimensionedScalar &ds)
messageStream Info
dimensionedScalar cosh(const dimensionedScalar &ds)
A class for managing temporary objects.
Definition: PtrList.H:53
Registry of regIOobjects.
Namespace for OpenFOAM.