waveDisplacementPointPatchVectorField.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) 2011-2020 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::waveDisplacementPointPatchVectorField
26 
27 Description
28  Specified surface wave moving boundary.
29 
30  The motion is a cosine wave with specified amplitude, frequency, wave number
31  and optional leading and trailing spacial ramps and temporal ramp
32  to allow the motion to be applied to an initially flat surface.
33 
34 Usage
35  \table
36  Property | Description | Required | Default value
37  amplitude | Amplitude of the cosine wave | yes |
38  omega | Frequency of the cosine wave | yes |
39  waveNumber | Wave number of the cosine wave | no | (0 0 0)
40  startRamp | Leading ramp | no | 1
41  endRamp | Trailing ramp | no | 1
42  timeRamp | Temporal ramp | no | 1
43  \endtable
44 
45  Example of the boundary condition specification:
46  \verbatim
47  <patchName>
48  {
49  type waveDisplacement;
50  value uniform (0 0 0);
51  amplitude (0 0.05 0);
52  omega 2;
53  waveNumber (5 0 0);
54  startRamp
55  {
56  type linearRamp;
57  duration 1;
58  start 4;
59  }
60  endRamp
61  {
62  type linearRamp;
63  duration 1;
64  start 4;
65  }
66  timeRamp
67  {
68  type linearRamp;
69  duration 1;
70  }
71  }
72  \endverbatim
73 
74 SourceFiles
75  waveDisplacementPointPatchVectorField.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef waveDisplacementPointPatchVectorField_H
80 #define waveDisplacementPointPatchVectorField_H
81 
83 #include "Function1.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class waveDisplacementPointPatchVectorField Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class waveDisplacementPointPatchVectorField
95 :
96  public fixedValuePointPatchField<vector>
97 {
98  // Private Data
99 
100  vector amplitude_;
101  scalar omega_;
102  vector waveNumber_;
103 
104  //- Optional leading ramp for the wave
105  autoPtr<Function1<scalar>> startRamp_;
106 
107  //- Optional trailing ramp for the wave
108  autoPtr<Function1<scalar>> endRamp_;
109 
110  //- Optional temporal ramp for the wave
111  autoPtr<Function1<scalar>> timeRamp_;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("waveDisplacement");
118 
119 
120  // Constructors
121 
122  //- Construct from patch and internal field
124  (
125  const pointPatch&,
126  const DimensionedField<vector, pointMesh>&
127  );
129  //- Construct from patch, internal field and dictionary
131  (
132  const pointPatch&,
134  const dictionary&
135  );
136 
137  //- Construct by mapping given patchField<vector> onto a new patch
139  (
141  const pointPatch&,
143  const pointPatchFieldMapper&
144  );
145 
146  //- Construct as copy setting internal field reference
148  (
151  );
152 
153  //- Construct and return a clone setting internal field reference
155  (
157  ) const
158  {
160  (
162  (
163  *this,
164  iF
165  )
166  );
167  }
168 
169 
170  // Member Functions
171 
172  // Evaluation functions
173 
174  //- Update the coefficients associated with the patch field
175  virtual void updateCoeffs();
176 
177 
178  //- Write
179  virtual void write(Ostream&) const;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
TypeName("waveDisplacement")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
waveDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &)
Construct from patch and internal field.
Foam::pointPatchFieldMapper.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:56
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
autoPtr< pointPatchField< vector > > clone() const
Disallow clone without setting internal field reference.
Namespace for OpenFOAM.