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-2023 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 
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, internal field and dictionary
124  (
125  const pointPatch&,
126  const DimensionedField<vector, pointMesh>&,
127  const dictionary&
128  );
129 
130  //- Construct by mapping given patchField<vector> onto a new patch
132  (
134  const pointPatch&,
136  const pointPatchFieldMapper&
137  );
138 
139  //- Construct as copy setting internal field reference
141  (
144  );
145 
146  //- Construct and return a clone setting internal field reference
148  (
150  ) const
151  {
153  (
155  (
156  *this,
157  iF
158  )
159  );
160  }
161 
162 
163  // Member Functions
164 
165  // Evaluation functions
166 
167  //- Update the coefficients associated with the patch field
168  virtual void updateCoeffs();
169 
170 
171  //- Write
172  virtual void write(Ostream&) const;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
tmp< Field< Type > > clone() const
Clone.
Definition: Field.C:240
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
Foam::pointPatchFieldMapper.
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:57
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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