FreeFOAM The Cross-Platform CFD Toolkit
oscillatingFixedValueFvPatchField.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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::oscillatingFixedValueFvPatchField
26 
27 Description
28  Foam::oscillatingFixedValueFvPatchField
29 
30 SourceFiles
31  oscillatingFixedValueFvPatchField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef oscillatingFixedValueFvPatchField_H
36 #define oscillatingFixedValueFvPatchField_H
37 
38 #include <OpenFOAM/Random.H>
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class oscillatingFixedValueFvPatch Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class Type>
52 :
53  public fixedValueFvPatchField<Type>
54 {
55  // Private data
56 
57  //- Reference value
58  Field<Type> refValue_;
59 
60  //- Amplitude
61  scalar amplitude_;
62 
63  //- Frequency
64  scalar frequency_;
65 
66  //- Current time index
67  label curTimeIndex_;
68 
69 
70  // Private member functions
71 
72  //- Return current scale
73  scalar currentScale() const;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("oscillatingFixedValue");
80 
81 
82  // Constructors
83 
84  //- Construct from patch and internal field
86  (
87  const fvPatch&,
89  );
90 
91  //- Construct from patch, internal field and dictionary
93  (
94  const fvPatch&,
96  const dictionary&
97  );
98 
99  //- Construct by mapping given oscillatingFixedValueFvPatchField
100  // onto a new patch
102  (
104  const fvPatch&,
106  const fvPatchFieldMapper&
107  );
108 
109  //- Construct as copy
111  (
113  );
114 
115  //- Construct and return a clone
116  virtual tmp<fvPatchField<Type> > clone() const
117  {
118  return tmp<fvPatchField<Type> >
119  (
121  );
122  }
123 
124  //- Construct as copy setting internal field reference
126  (
129  );
130 
131  //- Construct and return a clone setting internal field reference
132  virtual tmp<fvPatchField<Type> > clone
133  (
135  ) const
136  {
137  return tmp<fvPatchField<Type> >
138  (
140  );
141  }
142 
143 
144  // Member functions
145 
146  // Access
147 
148  //- Return the ref value
149  const Field<Type>& refValue() const
150  {
151  return refValue_;
152  }
153 
154  //- Return reference to the ref value to allow adjustment
156  {
157  return refValue_;
158  }
159 
160  //- Return amplitude
161  scalar amplitude() const
162  {
163  return amplitude_;
164  }
165 
166  scalar& amplitude()
167  {
168  return amplitude_;
169  }
170 
171  //- Return frequency
172  scalar frequency() const
173  {
174  return frequency_;
175  }
176 
177  scalar& frequency()
178  {
179  return frequency_;
180  }
181 
182 
183  // Mapping functions
184 
185  //- Map (and resize as needed) from self given a mapping object
186  virtual void autoMap
187  (
188  const fvPatchFieldMapper&
189  );
190 
191  //- Reverse map the given fvPatchField onto this fvPatchField
192  virtual void rmap
193  (
194  const fvPatchField<Type>&,
195  const labelList&
196  );
197 
198 
199  // Evaluation functions
200 
201  //- Update the coefficients associated with the patch field
202  virtual void updateCoeffs();
203 
204 
205  //- Write
206  virtual void write(Ostream&) const;
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #ifdef NoRepository
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************ vim: set sw=4 sts=4 et: ************************ //