waveMakerPointPatchVectorField.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2018-2019 IH-Cantabria
9 Copyright (C) 2018-2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::waveMakerPointPatchVectorField
29
30Description
31 Point motion boundary condition to generate waves based on either piston
32 or flap motions.
33
34 Based on the reference
35 \verbatim
36 Hughes, S.A. (1993).
37 Physical Models And Laboratory Techniques In Coastal Engineering.
38 Advanced Series On Ocean Engineering, volume 7
39 \endverbatim
40
41Usage
42 Example patch specification
43 \verbatim
44 leftwall
45 {
46 type waveMaker;
47 motionType flap;
48 n (1 0 0);
49 initialDepth 0.25;
50 wavePeriod 2.0;
51 waveHeight 0.06;
52 wavePhase 0;
53 rampTime 2.0;
54 }
55 \endverbatim
56
57 where
58 \table
59 Property | Description | Required | Default value
60 motionType | See motion types below | yes |
61 n | Direction of motion | yes |
62 initialDepth | Initial depth | yes |
63 wavePeriod | wave period | yes |
64 waveHeight | Wave height | yes |
65 wavePhase | wave phase | yes |
66 waveAngle | wave angle | no | 0
67 startTime | Start time | no | case start time
68 rampTime | Time to reach maximum motion | yes |
69 secondOrder | Second order calculation | no | no
70 nPaddle | Number of paddles | no | 1
71 \endtable
72
73 Available motion types include:
74 - piston
75 - flap
76 - solitary
77
78SourceFiles
79 waveMakerPointPatchVectorField.C
80
81\*---------------------------------------------------------------------------*/
82
83#ifndef waveMakerPointPatchVectorField_H
84#define waveMakerPointPatchVectorField_H
85
87#include "Enum.H"
88
89// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90
91namespace Foam
92{
93
94/*---------------------------------------------------------------------------*\
95 Class waveMakerPointPatchVectorField Declaration
96\*---------------------------------------------------------------------------*/
97
98class waveMakerPointPatchVectorField
99:
100 public fixedValuePointPatchField<vector>
101{
102 public:
103
104 enum motionTypes
105 {
106 piston,
107 flap,
109 };
110
111 //- Names for motion types
112 static const Enum<motionTypes> motionTypeNames;
113
114
115 // Private data
116
117 //- Motion type
119
120 //- Patch normal direction
121 // Note: cannot use patch normal of the initial patch unless it is
122 // in its neutral position (flap mode)
123 vector n_;
124
125 //- Vertical direction
127
128 //- Initial water depth
129 scalar initialDepth_;
130
131 //- Wave period
132 scalar wavePeriod_;
133
134 //- Wave height
135 scalar waveHeight_;
136
137 //- Wave phase
138 scalar wavePhase_;
139
140 //- Wave angle
141 scalar waveAngle_;
142
143 //- Wave length
144 scalar waveLength_;
145
146 //- Start time
147 scalar startTime_;
148
149 //- Ramp time
150 scalar rampTime_;
151
152 //- On/off second order calculation switch
153 scalar secondOrder_;
154
155 //- Number of wave paddles
156 label nPaddle_;
158 //- Rotation tensor from global to local system
159 tensor Rgl_;
160
161 //- Rotation tensor from local to global system
162 tensor Rlg_;
164 //- Paddle x co-ordinates / [m]
167 //- Paddle y co-ordinates / [m]
169
170 //- Addressing from point patch index to paddle index
172
173 //- Addressing from patch face index to paddle index
175
176 //- Patch face centre x co-ordinates / [m]
178
179 //- Patch face centre y co-ordinates / [m]
181
182 //- Patch face centre z co-ordinates / [m]
184
185 //- Overall (point) span in z-direction / [m]
186 scalar zSpan_;
187
188 //- Minimum z (point) height per patch face / [m]
190
191 //- Global Minimum z (point) / [m]
192 scalar zMinGb_;
193
194 //- Maximum z (point) height per patch face / [m]
196
197 //- Calculated water depth at the patch
199
200 //
201 scalar firstTime = 0;
202
204 // Protected Member Functions
205
206 //- Return the gravitational acceleration
207 const vector& g();
208
209 //- Dispersion equation
210 virtual scalar waveLength(const scalar h, const scalar T);
211
212 //- Return the time scaling coefficient
213 virtual scalar timeCoeff(const scalar t) const;
214
215 //- Initialise
216 virtual void initialiseGeometry();
217
219public:
220
221 //- Runtime type information
222 TypeName("waveMaker");
223
225 // Constructors
226
227 //- Construct from patch and internal field
229 (
232 );
234 //- Construct from patch, internal field and dictionary
237 const pointPatch&,
240 );
241
242 //- Construct by mapping given patchField<vector> onto a new patch
244 (
246 const pointPatch&,
249 );
250
251 //- Construct and return a clone
253 {
255 (
258 *this
259 )
260 );
261 }
262
263 //- Construct as copy setting internal field reference
265 (
268 );
269
270 //- Construct and return a clone setting internal field reference
272 (
274 ) const
275 {
277 (
279 (
280 *this,
281 iF
282 )
283 );
284 }
285
286
287 // Member functions
288
289 // Evaluation functions
290
291 //- Update the coefficients associated with the patch field
292 virtual void updateCoeffs();
293
294
295 //- Write
296 virtual void write(Ostream&) const;
297};
298
299
300// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301
302} // End namespace Foam
303
304// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
305
306#endif
307
308// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
Definition: Field.C:605
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FixedValue boundary condition for pointField.
Foam::pointPatchFieldMapper.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:64
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Point motion boundary condition to generate waves based on either piston or flap motions.
scalarField zMin_
Minimum z (point) height per patch face / [m].
scalarField z_
Patch face centre z co-ordinates / [m].
static const Enum< motionTypes > motionTypeNames
Names for motion types.
TypeName("waveMaker")
Runtime type information.
tensor Rlg_
Rotation tensor from local to global system.
scalar zSpan_
Overall (point) span in z-direction / [m].
tensor Rgl_
Rotation tensor from global to local system.
scalarField waterDepthRef_
Calculated water depth at the patch.
scalar zMinGb_
Global Minimum z (point) / [m].
scalarField yPaddle_
Paddle y co-ordinates / [m].
scalarField xPaddle_
Paddle x co-ordinates / [m].
labelList pointToPaddle_
Addressing from point patch index to paddle index.
scalar secondOrder_
On/off second order calculation switch.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
scalarField zMax_
Maximum z (point) height per patch face / [m].
virtual scalar timeCoeff(const scalar t) const
Return the time scaling coefficient.
virtual scalar waveLength(const scalar h, const scalar T)
Dispersion equation.
labelList faceToPaddle_
Addressing from patch face index to paddle index.
scalarField y_
Patch face centre y co-ordinates / [m].
virtual autoPtr< pointPatchField< vector > > clone() const
Construct and return a clone.
scalarField x_
Patch face centre x co-ordinates / [m].
virtual autoPtr< pointPatchField< vector > > clone(const DimensionedField< vector, pointMesh > &iF) const
Construct and return a clone setting internal field reference.
const vector & g()
Return the gravitational acceleration.
Namespace for OpenFOAM.
runTime write()
volScalarField & h
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73