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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2015 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::SRFFreestreamVelocityFvPatchVectorField
29 
30 Description
31  Freestream 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 using:
37 
38  \f[
39  U_p = cos(\theta) U_{Inf} + sin(\theta) (n \times U_{Inf}) - U_{p,srf}
40  \f]
41 
42  where
43  \vartable
44  U_p | patch velocity [m/s]
45  U_{Inf} | free stream velocity in the absolute frame [m/s]
46  \theta | swept angle [rad]
47  n | axis direction of the SRF
48  U_{p,srf} | SRF velocity of the patch [m/s]
49  \endvartable
50 
51 
52 Usage
53  \table
54  Property | Description | Required | Default value
55  UInf | freestream velocity | yes |
56  relative | UInf relative to the SRF? | no |
57  \endtable
58 
59  Example of the boundary condition specification:
60  \verbatim
61  <patchName>
62  {
63  type SRFFreestreamVelocity;
64  UInf uniform (0 0 0);
65  relative no;
66  value uniform (0 0 0); // initial value
67  }
68  \endverbatim
69 
70 See also
71  Foam::freestreamFvPatchField
72  Foam::SRFVelocityFvPatchVectorField
73 
74 SourceFiles
75  SRFFreestreamVelocityFvPatchVectorField.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef SRFFreestreamVelocityFvPatchVectorField_H
80 #define SRFFreestreamVelocityFvPatchVectorField_H
81 
83 #include "Switch.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class SRFFreestreamVelocityFvPatchVectorField Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class SRFFreestreamVelocityFvPatchVectorField
95 :
96  public inletOutletFvPatchVectorField
97 {
98  // Private data
99 
100  //- Is the supplied inlet value relative to the SRF
101  Switch relative_;
102 
103  //- Velocity of the free stream in the absolute frame [m/s]
104  vector UInf_;
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("SRFFreestreamVelocity");
111 
112 
113  // Constructors
114 
115  //- Construct from patch and internal field
117  (
118  const fvPatch&,
119  const DimensionedField<vector, volMesh>&
120  );
121 
122  //- Construct from patch, internal field and dictionary
124  (
125  const fvPatch&,
127  const dictionary&
128  );
129 
130  //- Construct by mapping given SRFFreestreamVelocityFvPatchVectorField
131  // onto a new patch
133  (
135  const fvPatch&,
137  const fvPatchFieldMapper&
138  );
139 
140  //- Construct as copy
142  (
144  );
145 
146  //- Construct as copy setting internal field reference
148  (
151  );
152 
153  //- Return a clone
154  virtual tmp<fvPatchField<vector>> clone() const
155  {
156  return fvPatchField<vector>::Clone(*this);
157  }
158 
159  //- Clone with an internal field reference
161  (
163  ) const
164  {
165  return fvPatchField<vector>::Clone(*this, iF);
166  }
167 
168 
169  // Member functions
170 
171  // Access
172 
173  //- Return the velocity at infinity
174  const vector& UInf() const
175  {
176  return UInf_;
177  }
178 
179  //- Return reference to the velocity at infinity to allow adjustment
180  vector& UInf()
181  {
182  return UInf_;
183  }
184 
185 
186  // Evaluation functions
187 
188  //- Update the coefficients associated with the patch field
189  virtual void updateCoeffs();
190 
191 
192  //- Write
193  virtual void write(Ostream&) const;
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
virtual tmp< fvPatchField< vector > > clone() const
Return a clone.
A FieldMapper for finite-volume patch fields.
SRFFreestreamVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Vector< scalar > vector
Definition: vector.H:57
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Freestream velocity condition to be used in conjunction with the single rotating frame (SRF) model (s...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const vector & UInf() const
Return the velocity at infinity.
TypeName("SRFFreestreamVelocity")
Runtime type information.
Namespace for OpenFOAM.