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-2019 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 and return a clone
147  virtual autoPtr<pointPatchField<vector>> clone() const
148  {
150  (
152  (
153  *this
154  )
155  );
156  }
157 
158  //- Construct as copy setting internal field reference
160  (
163  );
164 
165  //- Construct and return a clone setting internal field reference
167  (
169  ) const
170  {
172  (
174  (
175  *this,
176  iF
177  )
178  );
179  }
180 
182  // Member Functions
183 
184  // Evaluation functions
185 
186  //- Update the coefficients associated with the patch field
187  virtual void updateCoeffs();
188 
189 
190  //- Write
191  virtual void write(Ostream&) const;
192 };
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
TypeName("waveDisplacement")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
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:53
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
Namespace for OpenFOAM.
virtual autoPtr< pointPatchField< vector > > clone() const
Construct and return a clone.