FreeFOAM The Cross-Platform CFD Toolkit
turbulentInletFvPatchField.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::turbulentInletFvPatchField
26 
27 Description
28  Generate a fluctuating inlet condition by adding a random component
29  to a reference (mean) field.
30  Input:
31  referenceField
32  Mean field.
33  fluctuationScale
34  RMS fluctuation, provided as the fraction of the mean field.
35  alpha
36  temporal correlation factor;
37  the fraction of the new random component added to the previous
38  time-step (defaults to 0.1).
39 
40 SourceFiles
41  turbulentInletFvPatchField.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef turbulentInletFvPatchField_H
46 #define turbulentInletFvPatchField_H
47 
48 #include <OpenFOAM/Random.H>
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class turbulentInletFvPatch Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Type>
62 :
63  public fixedValueFvPatchField<Type>
64 {
65  // Private data
66 
67  Random ranGen_;
68  Type fluctuationScale_;
69  Field<Type> referenceField_;
70  scalar alpha_;
71  label curTimeIndex_;
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("turbulentInlet");
78 
79 
80  // Constructors
81 
82  //- Construct from patch and internal field
84  (
85  const fvPatch&,
87  );
88 
89  //- Construct from patch, internal field and dictionary
91  (
92  const fvPatch&,
94  const dictionary&
95  );
96 
97  //- Construct by mapping given turbulentInletFvPatchField
98  // onto a new patch
100  (
102  const fvPatch&,
104  const fvPatchFieldMapper&
105  );
106 
107  //- Construct as copy
109  (
111  );
112 
113  //- Construct and return a clone
114  virtual tmp<fvPatchField<Type> > clone() const
115  {
116  return tmp<fvPatchField<Type> >
117  (
119  );
120  }
121 
122  //- Construct as copy setting internal field reference
124  (
127  );
128 
129  //- Construct and return a clone setting internal field reference
130  virtual tmp<fvPatchField<Type> > clone
131  (
133  ) const
134  {
135  return tmp<fvPatchField<Type> >
136  (
137  new turbulentInletFvPatchField<Type>(*this, iF)
138  );
139  }
140 
141 
142  // Member functions
143 
144  // Access
145 
146  //- Return the fluctuation scale
147  const Type& fluctuationScale() const
148  {
149  return fluctuationScale_;
150  }
151 
152  //- Return reference to the fluctuation scale to allow adjustment
154  {
155  return fluctuationScale_;
156  }
157 
158  //- Return the reference field
160  {
161  return referenceField_;
162  }
163 
164  //- Return reference to the reference field to allow adjustment
166  {
167  return referenceField_;
168  }
169 
170 
171  // Mapping functions
172 
173  //- Map (and resize as needed) from self given a mapping object
174  virtual void autoMap
175  (
176  const fvPatchFieldMapper&
177  );
178 
179  //- Reverse map the given fvPatchField onto this fvPatchField
180  virtual void rmap
181  (
182  const fvPatchField<Type>&,
183  const labelList&
184  );
185 
186 
187  // Evaluation functions
188 
189  //- Update the coefficients associated with the patch field
190  virtual void updateCoeffs();
191 
192 
193  //- Write
194  virtual void write(Ostream&) const;
195 };
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace Foam
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #ifdef NoRepository
206 #endif
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************ vim: set sw=4 sts=4 et: ************************ //