SRFVelocityFvPatchVectorField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::SRFVelocityFvPatchVectorField
28 
29 Group
30  grpInletBoundaryConditions grpWallBoundaryConditions
31 
32 Description
33  Velocity condition to be used in conjunction with the single
34  rotating frame (SRF) model (see: SRFModel class)
35 
36  Given the free stream velocity in the absolute frame, the condition
37  applies the appropriate rotation transformation in time and space to
38  determine the local velocity.
39 
40  The optional \c relative flag switches the behaviour of the patch
41  such that:
42 
43  - relative = yes: inlet velocity applied 'as is':
44 
45  \f[
46  U_p = U_{in}
47  \f]
48 
49  - relative = no : SRF velocity is subtracted from the inlet velocity:
50 
51  \f[
52  U_p = U_{in} - U_{p,srf}
53  \f]
54 
55  where
56  \vartable
57  U_p | patch velocity [m/s]
58  U_{in} | user-specified inlet velocity
59  U_{p,srf} | SRF velocity
60  \endvartable
61 
62 
63 Usage
64  \table
65  Property | Description | Required | Default value
66  inletValue | inlet velocity | yes |
67  relative | inletValue relative motion to the SRF? | yes |
68  \endtable
69 
70  Example of the boundary condition specification:
71  \verbatim
72  <patchName>
73  {
74  type SRFVelocity;
75  inletValue uniform (0 0 0);
76  relative yes;
77  value uniform (0 0 0); // initial value
78  }
79  \endverbatim
80 
81 See also
82  Foam::fixedValueFvPatchField
83 
84 SourceFiles
85  SRFVelocityFvPatchVectorField.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef SRFVelocityFvPatchVectorField_H
90 #define SRFVelocityFvPatchVectorField_H
91 
92 #include "fvPatchFields.H"
94 #include "Switch.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class SRFVelocityFvPatchVectorField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class SRFVelocityFvPatchVectorField
106 :
107  public fixedValueFvPatchVectorField
108 {
109  // Private data
110 
111  //- Is the supplied inlet value relative to the SRF
112  Switch relative_;
113 
114  //- Inlet value [m/s]
115  vectorField inletValue_;
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("SRFVelocity");
122 
123 
124  // Constructors
125 
126  //- Construct from patch and internal field
128  (
129  const fvPatch&,
130  const DimensionedField<vector, volMesh>&
131  );
132 
133  //- Construct from patch, internal field and dictionary
135  (
136  const fvPatch&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given SRFVelocityFvPatchVectorField
142  // onto a new patch
144  (
146  const fvPatch&,
148  const fvPatchFieldMapper&
149  );
150 
151  //- Construct as copy
153  (
155  );
156 
157  //- Construct and return a clone
158  virtual tmp<fvPatchVectorField> clone() const
159  {
161  (
163  );
164  }
165 
166  //- Construct as copy setting internal field reference
168  (
171  );
172 
173  //- Construct and return a clone setting internal field reference
175  (
177  ) const
178  {
180  (
181  new SRFVelocityFvPatchVectorField(*this, iF)
182  );
183  }
184 
185 
186  // Member functions
187 
188  // Access
189 
190  //- Return const access to the relative flag
191  const Switch& relative() const
192  {
193  return relative_;
194  }
195 
196 
197  // Mapping functions
198 
199  //- Map (and resize as needed) from self given a mapping object
200  virtual void autoMap
201  (
202  const fvPatchFieldMapper&
203  );
204 
205  //- Reverse map the given fvPatchField onto this fvPatchField
206  virtual void rmap
207  (
208  const fvPatchVectorField&,
209  const labelList&
210  );
211 
212 
213  // Evaluation functions
214 
215  //- Update the coefficients associated with the patch field
216  virtual void updateCoeffs();
217 
218 
219  // I-O
220 
221  //- Write
222  virtual void write(Ostream&) const;
223 };
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
Foam::fvPatchField< vector >
Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField
SRFVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: SRFVelocityFvPatchVectorField.C:37
Foam::SRFVelocityFvPatchVectorField::TypeName
TypeName("SRFVelocity")
Runtime type information.
Foam::SRFVelocityFvPatchVectorField::rmap
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: SRFVelocityFvPatchVectorField.C:111
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:70
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::SRFVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: SRFVelocityFvPatchVectorField.C:125
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::Field< vector >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Foam::SRFVelocityFvPatchVectorField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: SRFVelocityFvPatchVectorField.C:101
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SRFVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: SRFVelocityFvPatchVectorField.H:184
fvPatchFields.H
Foam::List< label >
Foam::SRFVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: SRFVelocityFvPatchVectorField.C:155
fixedValueFvPatchFields.H
Foam::SRFVelocityFvPatchVectorField
Velocity condition to be used in conjunction with the single rotating frame (SRF) model (see: SRFMode...
Definition: SRFVelocityFvPatchVectorField.H:131
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::SRFVelocityFvPatchVectorField::relative
const Switch & relative() const
Return const access to the relative flag.
Definition: SRFVelocityFvPatchVectorField.H:217