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-2026 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 spatial 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 
82 #include "pointPatchFields.H"
84 #include "Function1.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class waveDisplacementPointPatchVectorField Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class waveDisplacementPointPatchVectorField
96 :
97  public fixedValuePointPatchVectorField
98 {
99  // Private Data
100 
101  vector amplitude_;
102  scalar omega_;
103  vector waveNumber_;
104 
105  //- Optional leading ramp for the wave
106  autoPtr<Function1<scalar>> startRamp_;
107 
108  //- Optional trailing ramp for the wave
109  autoPtr<Function1<scalar>> endRamp_;
110 
111  //- Optional temporal ramp for the wave
112  autoPtr<Function1<scalar>> timeRamp_;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("waveDisplacement");
119 
120 
121  // Constructors
122 
123  //- Construct from patch, internal field and dictionary
125  (
126  const pointPatch&,
127  const DimensionedField<vector, pointMesh>&,
128  const dictionary&
129  );
130 
131  //- Construct by mapping given patchField<vector> onto a new patch
133  (
135  const pointPatch&,
137  const fieldMapper&
138  );
139 
140  //- Construct as copy setting internal field reference
142  (
145  );
146 
147  //- Construct and return a clone setting internal field reference
149  (
151  ) const
152  {
154  (
156  (
157  *this,
158  iF
159  )
160  );
161  }
162 
163 
164  // Member Functions
165 
166  // Evaluation functions
167 
168  //- Update the coefficients associated with the patch field
169  virtual void updateCoeffs();
170 
171 
172  //- Write
173  virtual void write(Ostream&) const;
174 
175 
176  // Member Operators
177 
178  //- Inherit assignment
179  using fixedValuePointPatchVectorField::operator=;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:61
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual autoPtr< pointPatchVectorField > clone(const DimensionedField< vector, pointMesh > &iF) const
Construct and return a clone setting internal field reference.
waveDisplacementPointPatchVectorField(const pointPatch &, const DimensionedField< vector, pointMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
TypeName("waveDisplacement")
Runtime type information.
Namespace for OpenFOAM.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49