SRFFreestreamVelocityFvPatchVectorField.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-2013 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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::SRFFreestreamVelocityFvPatchVectorField
26 
27 Description
28  Freestream velocity condition to be used in conjunction with the single
29  rotating frame (SRF) model (see: SRFModel class)
30 
31  Given the free stream velocity in the absolute frame, the condition
32  applies the appropriate rotation transformation in time and space to
33  determine the local velocity using:
34 
35  \f[
36  U_p = cos(\theta) U_{Inf} + sin(\theta) (n \times U_{Inf}) - U_{p,srf}
37  \f]
38 
39  where
40  \vartable
41  U_p | patch velocity [m/s]
42  U_{Inf} | free stream velocity in the absolute frame [m/s]
43  \theta | swept angle [rad]
44  n | axis direction of the SRF
45  U_{p,srf} | SRF velocity of the patch [m/s]
46  \endvartable
47 
48 
49  \heading Patch usage
50 
51  \table
52  Property | Description | Required | Default value
53  UInf | freestream velocity | yes |
54  relative | UInf relative to the SRF? | no |
55  \endtable
56 
57  Example of the boundary condition specification:
58  \verbatim
59  myPatch
60  {
61  type SRFFreestreamVelocity;
62  UInf uniform (0 0 0);
63  relative no;
64  value uniform (0 0 0); // initial value
65  }
66  \endverbatim
67 
68 SeeAlso
69  Foam::freestreamFvPatchField
70  Foam::SRFVelocityFvPatchVectorField
71 
72 SourceFiles
73  SRFFreestreamVelocityFvPatchVectorField.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef SRFFreestreamVelocityFvPatchVectorField_H
78 #define SRFFreestreamVelocityFvPatchVectorField_H
79 
81 #include "Switch.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class SRFFreestreamVelocityFvPatchVectorField Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class SRFFreestreamVelocityFvPatchVectorField
93 :
94  public inletOutletFvPatchVectorField
95 {
96  // Private data
97 
98  //- Is the supplied inlet value relative to the SRF
99  Switch relative_;
100 
101  //- Velocity of the free stream in the absolute frame [m/s]
102  vector UInf_;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("SRFFreestreamVelocity");
109 
110 
111  // Constructors
112 
113  //- Construct from patch and internal field
115  (
116  const fvPatch&,
117  const DimensionedField<vector, volMesh>&
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
124  const DimensionedField<vector, volMesh>&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping given SRFFreestreamVelocityFvPatchVectorField
129  // onto a new patch
131  (
133  const fvPatch&,
135  const fvPatchFieldMapper&
136  );
137 
138  //- Construct as copy
140  (
142  );
143 
144  //- Construct and return a clone
145  virtual tmp<fvPatchVectorField> clone() const
146  {
148  (
150  );
151  }
152 
153  //- Construct as copy setting internal field reference
155  (
158  );
159 
160  //- Construct and return a clone setting internal field reference
162  (
164  ) const
165  {
167  (
169  );
170  }
171 
172 
173  // Member functions
174 
175  // Access
176 
177  //- Return the velocity at infinity
178  const vector& UInf() const
179  {
180  return UInf_;
181  }
182 
183  //- Return reference to the velocity at infinity to allow adjustment
184  vector& UInf()
185  {
186  return UInf_;
187  }
188 
189 
190  // Evaluation functions
191 
192  //- Update the coefficients associated with the patch field
193  virtual void updateCoeffs();
194 
195 
196  //- Write
197  virtual void write(Ostream&) const;
198 };
199 
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 } // End namespace Foam
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 #endif
208 
209 // ************************************************************************* //
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::SRFFreestreamVelocityFvPatchVectorField::UInf
const vector & UInf() const
Return the velocity at infinity.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:212
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::SRFFreestreamVelocityFvPatchVectorField::UInf_
vector UInf_
Velocity of the free stream in the absolute frame [m/s].
Definition: SRFFreestreamVelocityFvPatchVectorField.H:136
Foam::SRFFreestreamVelocityFvPatchVectorField::UInf
vector & UInf()
Return reference to the velocity at infinity to allow adjustment.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:218
Foam::SRFFreestreamVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:179
Foam::SRFFreestreamVelocityFvPatchVectorField
Freestream velocity condition to be used in conjunction with the single rotating frame (SRF) model (s...
Definition: SRFFreestreamVelocityFvPatchVectorField.H:126
Foam::SRFFreestreamVelocityFvPatchVectorField::relative_
Switch relative_
Is the supplied inlet value relative to the SRF.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:133
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::SRFFreestreamVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: SRFFreestreamVelocityFvPatchVectorField.C:158
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
Foam::SRFFreestreamVelocityFvPatchVectorField::TypeName
TypeName("SRFFreestreamVelocity")
Runtime type information.
Foam::SRFFreestreamVelocityFvPatchVectorField::SRFFreestreamVelocityFvPatchVectorField
SRFFreestreamVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Definition: SRFFreestreamVelocityFvPatchVectorField.C:38
Foam::Vector< scalar >
Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: SRFFreestreamVelocityFvPatchVectorField.C:109
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
inletOutletFvPatchFields.H
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51