AiryCoeffs.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::AiryCoeffs
26 
27 Description
28  Calculation engine for the Airy wave model and other models that are a
29  correction on top of the Airy model or a superposition of Airy models
30 
31 SourceFiles
32  AiryCoeffs.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef AiryCoeffs_H
37 #define AiryCoeffs_H
38 
39 #include "waveModel.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 namespace waveModels
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class AiryCoeffs Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class AiryCoeffs
53 {
54 private:
55 
56  // Private Static Member Functions
57 
58  //- Calculate the length from the depth, amplitude, period and g.
59  // Requires a function which returns celerity given the depth,
60  // amplitude, length and g. Iterates to solve this function for the
61  // specified period.
62  static scalar calcLength
63  (
64  const scalar depth,
65  const scalar amplitude,
66  const scalar period,
67  const scalar g,
68  scalar (*celerityPtr)(const AiryCoeffs&)
69  );
70 
71 
72 public:
73 
74  // Public Data
75 
76  //- Depth [m]
77  const scalar depth;
78 
79  //- Amplitude [m]
80  const scalar amplitude;
81 
82  //- Wavelength [m]
83  const scalar length;
84 
85  //- Gravitational acceleration [m/s^2]
86  const scalar g;
87 
88 
89  // Constructors
90 
91  //- Construct from components
93  (
94  const scalar depth,
95  const scalar amplitude,
96  const scalar length,
97  const scalar g
98  );
99 
100  //- Construct from components but with period instead of length
101  AiryCoeffs
102  (
103  const scalar depth,
104  const scalar amplitude,
105  const scalar period,
106  const scalar g,
107  scalar (*celerityPtr)(const AiryCoeffs&)
108  );
109 
110 
111  // Member Functions
112 
113  //- The angular wavenumber [rad/m]
114  scalar k() const;
115 
116  //- Return whether shallow and intermediate effects are to be omitted
117  bool deep() const;
118 
119  //- The wave celerity [m/s]
120  static scalar celerity(const AiryCoeffs& coeffs);
121 
122  //- The wave celerity [m/s]
123  scalar celerity() const;
124 
125  //- Angle of the oscillation [rad]
127  (
128  const scalar phase,
129  const scalar t,
130  const scalarField& x
131  ) const;
132 
133  //- Get the wave elevation at a given time and local coordinates. Local
134  // x is aligned with the direction of propagation.
136  (
137  const scalar phase,
138  const scalar t,
139  const scalarField& x
140  ) const;
141 
142  //- Return the non-dimensionalised i-th harmonic of the velocity
144  (
145  const label i,
146  const scalar phase,
147  const scalar t,
148  const vector2DField& xz
149  ) const;
150 
151  //- Get the wave velocity at a given time and local coordinates. Local
152  // x is aligned with the direction of propagation, and z with negative
153  // gravity.
155  (
156  const scalar phase,
157  const scalar t,
158  const vector2DField& xz
159  ) const;
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace waveModels
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
A class for managing temporary objects.
Definition: tmp.H:55
Calculation engine for the Airy wave model and other models that are a correction on top of the Airy ...
Definition: AiryCoeffs.H:52
const scalar depth
Depth [m].
Definition: AiryCoeffs.H:76
bool deep() const
Return whether shallow and intermediate effects are to be omitted.
Definition: AiryCoeffs.C:99
scalar celerity() const
The wave celerity [m/s].
Definition: AiryCoeffs.C:111
tmp< vector2DField > vi(const label i, const scalar phase, const scalar t, const vector2DField &xz) const
Return the non-dimensionalised i-th harmonic of the velocity.
Definition: AiryCoeffs.C:140
const scalar amplitude
Amplitude [m].
Definition: AiryCoeffs.H:79
tmp< scalarField > elevation(const scalar phase, const scalar t, const scalarField &x) const
Get the wave elevation at a given time and local coordinates. Local.
Definition: AiryCoeffs.C:129
tmp< scalarField > angle(const scalar phase, const scalar t, const scalarField &x) const
Angle of the oscillation [rad].
Definition: AiryCoeffs.C:118
tmp< vector2DField > velocity(const scalar phase, const scalar t, const vector2DField &xz) const
Get the wave velocity at a given time and local coordinates. Local.
Definition: AiryCoeffs.C:170
AiryCoeffs(const scalar depth, const scalar amplitude, const scalar length, const scalar g)
Construct from components.
Definition: AiryCoeffs.C:61
const scalar g
Gravitational acceleration [m/s^2].
Definition: AiryCoeffs.H:85
scalar k() const
The angular wavenumber [rad/m].
Definition: AiryCoeffs.C:93
const scalar length
Wavelength [m].
Definition: AiryCoeffs.H:82
Namespace for OpenFOAM.
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