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&,
126  const DimensionedField<vector, volMesh>&,
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 and return a clone
147  virtual tmp<fvPatchVectorField> clone() const
148  {
150  (
152  );
153  }
154 
155  //- Construct as copy setting internal field reference
157  (
160  );
161 
162  //- Construct and return a clone setting internal field reference
164  (
166  ) const
167  {
169  (
171  );
172  }
173 
174 
175  // Member functions
176 
177  // Access
178 
179  //- Return the velocity at infinity
180  const vector& UInf() const
181  {
182  return UInf_;
183  }
184 
185  //- Return reference to the velocity at infinity to allow adjustment
186  vector& UInf()
187  {
188  return UInf_;
189  }
190 
191 
192  // Evaluation functions
193 
194  //- Update the coefficients associated with the patch field
195  virtual void updateCoeffs();
196 
197 
198  //- Write
199  virtual void write(Ostream&) const;
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::SRFFreestreamVelocityFvPatchVectorField::UInf
const vector & UInf() const
Return the velocity at infinity.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:214
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::SRFFreestreamVelocityFvPatchVectorField::UInf
vector & UInf()
Return reference to the velocity at infinity to allow adjustment.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:220
Foam::SRFFreestreamVelocityFvPatchVectorField::clone
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
Definition: SRFFreestreamVelocityFvPatchVectorField.H:181
Foam::SRFFreestreamVelocityFvPatchVectorField
Freestream velocity condition to be used in conjunction with the single rotating frame (SRF) model (s...
Definition: SRFFreestreamVelocityFvPatchVectorField.H:128
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::SRFFreestreamVelocityFvPatchVectorField::write
virtual void write(Ostream &) const
Write.
Definition: SRFFreestreamVelocityFvPatchVectorField.C:161
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
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:41
Foam::Vector< scalar >
Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: SRFFreestreamVelocityFvPatchVectorField.C:112
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
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:54