Loading...
Searching...
No Matches
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
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
154
155 //- Number of wave paddles
156 label nPaddle_;
157
158 //- Rotation tensor from global to local system
160
161 //- Rotation tensor from local to global system
164 //- Paddle x co-ordinates / [m]
166
167 //- Paddle y co-ordinates / [m]
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]
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
203
204 // Protected Member Functions
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
218
219public:
221 //- Runtime type information
222 TypeName("waveMaker");
223
224
225 // Constructors
226
227 //- Construct from patch and internal field
229 (
232 );
233
234 //- Construct from patch, internal field and dictionary
236 (
237 const pointPatch&,
239 const dictionary&
240 );
241
242 //- Construct by mapping given patch field onto a new patch
244 (
246 const pointPatch&,
249 );
251 //- Construct as copy setting internal field reference
253 (
256 );
257
258 //- Return a clone
261 return pointPatchField<vector>::Clone(*this);
262 }
263
264 //- Construct and return a clone setting internal field reference
266 (
268 ) const
269 {
271 }
272
273
274 // Member functions
276 // Evaluation functions
277
278 //- Update the coefficients associated with the patch field
279 virtual void updateCoeffs();
281
282 //- Write
283 virtual void write(Ostream&) const;
284};
286
287// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288
289} // End namespace Foam
291// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292
293#endif
294
295// ************************************************************************* //
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:57
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FixedValue boundary condition for pointField.
fixedValuePointPatchField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Foam::pointPatchFieldMapper.
static autoPtr< pointPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
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].
waveMakerPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
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
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.
List< label > labelList
A List of labels.
Definition List.H:62
Tensor< scalar > tensor
Definition symmTensor.H:57
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Vector< scalar > vector
Definition vector.H:57
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
runTime write()
volScalarField & h
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68