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 | Copyright (C) 2011-2016 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::SRFVelocityFvPatchVectorField
26 
27 Group
28  grpInletBoundaryConditions grpWallBoundaryConditions
29 
30 Description
31  Velocity condition to be used in conjunction with the single
32  rotating frame (SRF) model (see: SRFModel class)
33 
34  Given the free stream velocity in the absolute frame, the condition
35  applies the appropriate rotation transformation in time and space to
36  determine the local velocity.
37 
38  The optional \c relative flag switches the behaviour of the patch
39  such that:
40 
41  - relative = yes: inlet velocity applied 'as is':
42 
43  \f[
44  U_p = U_{in}
45  \f]
46 
47  - relative = no : SRF velocity is subtracted from the inlet velocity:
48 
49  \f[
50  U_p = U_{in} - U_{p,srf}
51  \f]
52 
53  where
54  \vartable
55  U_p = patch velocity [m/s]
56  U_{in} = user-specified inlet velocity
57  U_{p,srf} = SRF velocity
58  \endvartable
59 
60 
61 Usage
62  \table
63  Property | Description | Required | Default value
64  inletValue | inlet velocity | yes |
65  relative | inletValue relative motion to the SRF? | yes |
66  \endtable
67 
68  Example of the boundary condition specification:
69  \verbatim
70  <patchName>
71  {
72  type SRFVelocity;
73  inletValue uniform (0 0 0);
74  relative yes;
75  value uniform (0 0 0); // initial value
76  }
77  \endverbatim
78 
79 See also
80  Foam::fixedValueFvPatchField
81 
82 SourceFiles
83  SRFVelocityFvPatchVectorField.C
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef SRFVelocityFvPatchVectorField_H
88 #define SRFVelocityFvPatchVectorField_H
89 
90 #include "fvPatchFields.H"
92 #include "Switch.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class SRFVelocityFvPatchVectorField Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class SRFVelocityFvPatchVectorField
104 :
105  public fixedValueFvPatchVectorField
106 {
107  // Private data
108 
109  //- Is the supplied inlet value relative to the SRF
110  Switch relative_;
111 
112  //- Inlet value [m/s]
113  vectorField inletValue_;
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("SRFVelocity");
120 
121 
122  // Constructors
123 
124  //- Construct from patch and internal field
126  (
127  const fvPatch&,
129  );
130 
131  //- Construct from patch, internal field and dictionary
133  (
134  const fvPatch&,
136  const dictionary&
137  );
138 
139  //- Construct by mapping given SRFVelocityFvPatchVectorField
140  // onto a new patch
142  (
144  const fvPatch&,
146  const fvPatchFieldMapper&
147  );
148 
149  //- Construct as copy
151  (
153  );
154 
155  //- Construct and return a clone
156  virtual tmp<fvPatchVectorField> clone() const
157  {
159  (
161  );
162  }
163 
164  //- Construct as copy setting internal field reference
166  (
169  );
170 
171  //- Construct and return a clone setting internal field reference
173  (
175  ) const
176  {
178  (
180  );
181  }
182 
183 
184  // Member functions
185 
186  // Access
187 
188  //- Return const access to the relative flag
189  const Switch& relative() const
190  {
191  return relative_;
192  }
193 
194 
195  // Mapping functions
197  //- Map (and resize as needed) from self given a mapping object
198  virtual void autoMap
199  (
200  const fvPatchFieldMapper&
201  );
202 
203  //- Reverse map the given fvPatchField onto this fvPatchField
204  virtual void rmap
205  (
206  const fvPatchVectorField&,
207  const labelList&
208  );
209 
210 
211  // Evaluation functions
213  //- Update the coefficients associated with the patch field
214  virtual void updateCoeffs();
215 
216 
217  // I-O
218 
219  //- Write
220  virtual void write(Ostream&) const;
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
SRFVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
const Switch & relative() const
Return const access to the relative flag.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
TypeName("SRFVelocity")
Runtime type information.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void rmap(const fvPatchVectorField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
Freestream velocity condition to be used in conjunction with the single rotating frame (SRF) model (s...