supersonicFreestreamFvPatchVectorField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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::supersonicFreestreamFvPatchVectorField
26 
27 Description
28  This boundary condition provides a supersonic free-stream condition.
29 
30  - supersonic outflow is vented according to ???
31  - supersonic inflow is assumed to occur according to the Prandtl-Meyer
32  expansion process.
33  - subsonic outflow is applied via a zero-gradient condition from inside
34  the domain.
35 
36 Usage
37  \table
38  Property | Description | Required | Default value
39  T | Temperature field name | no | T
40  p | Pressure field name | no | p
41  psi | Compressibility field name | no | thermo:psi
42  UInf | free-stream velocity | yes |
43  pInf | free-stream pressure | yes |
44  TInf | free-stream temperature | yes |
45  gamma | heat capacity ratio (cp/Cv) | yes |
46  \endtable
47 
48  Example of the boundary condition specification:
49  \verbatim
50  <patchName>
51  {
52  type supersonicFreestream;
53  UInf 500;
54  pInf 1e4;
55  TInf 265;
56  gamma 1.4;
57  }
58  \endverbatim
59 
60 Note
61  This boundary condition is ill-posed if the free-stream flow is normal
62  to the boundary.
63 
64 SourceFiles
65  supersonicFreestreamFvPatchVectorField.C
66 
67 \*---------------------------------------------------------------------------*/
68 
69 #ifndef supersonicFreestreamFvPatchVectorField_H
70 #define supersonicFreestreamFvPatchVectorField_H
71 
72 #include "fvPatchFields.H"
73 #include "mixedFvPatchFields.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 
80 /*---------------------------------------------------------------------------*\
81  Class supersonicFreestreamFvPatchVectorField Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 class supersonicFreestreamFvPatchVectorField
85 :
86  public mixedFvPatchVectorField
87 {
88  // Private Data
89 
90  //- Name of temperature field, default = "T"
91  word TName_;
92 
93  //- Name of pressure field, default = "p"
94  word pName_;
95 
96  //- Name of compressibility field field, default = "thermo:psi"
97  word psiName_;
98 
99  //- Velocity of the free stream
100  vector UInf_;
101 
102  //- Pressure of the free stream
103  scalar pInf_;
104 
105  //- Temperature of the free stream
106  scalar TInf_;
107 
108  //- Heat capacity ratio
109  scalar gamma_;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("supersonicFreestream");
116 
117 
118  // Constructors
119 
120  //- Construct from patch and internal field
122  (
123  const fvPatch&,
125  );
126 
127  //- Construct from patch, internal field and dictionary
129  (
130  const fvPatch&,
132  const dictionary&
133  );
134 
135  //- Construct by mapping given supersonicFreestreamFvPatchVectorField
136  // onto a new patch
138  (
140  const fvPatch&,
142  const fvPatchFieldMapper&
143  );
144 
145  //- Copy constructor
147  (
149  );
150 
151  //- Construct and return a clone
152  virtual tmp<fvPatchVectorField> clone() const
153  {
155  (
157  );
158  }
159 
160  //- Copy constructor setting internal field reference
162  (
165  );
166 
167  //- Construct and return a clone setting internal field reference
169  (
171  ) const
172  {
174  (
176  );
177  }
178 
179 
180  // Member Functions
181 
182  // Access
183 
184  //- Return the velocity at infinity
185  const vector& UInf() const
186  {
187  return UInf_;
188  }
189 
190  //- Return reference to the velocity at infinity to allow adjustment
192  {
193  return UInf_;
194  }
195 
196  //- Return the pressure at infinity
197  scalar pInf() const
198  {
199  return pInf_;
200  }
201 
202  //- Return reference to the pressure at infinity to allow adjustment
203  scalar& pInf()
204  {
205  return pInf_;
206  }
207 
208  //- Return the temperature at infinity
209  scalar TInf() const
210  {
211  return TInf_;
212  }
213 
214  //- Return reference to the temperature at infinity
215  // to allow adjustment
216  scalar& TInf()
217  {
218  return TInf_;
219  }
220 
221 
222  // Evaluation functions
223 
224  //- Update the coefficients associated with the patch field
225  virtual void updateCoeffs();
226 
227 
228  //- Write
229  virtual void write(Ostream&) const;
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
virtual tmp< fvPatchVectorField > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const vector & UInf() const
Return the velocity at infinity.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Foam::fvPatchFieldMapper.
scalar pInf() const
Return the pressure at infinity.
TypeName("supersonicFreestream")
Runtime type information.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
This boundary condition provides a supersonic free-stream condition.
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: PtrList.H:53
scalar TInf() const
Return the temperature at infinity.
supersonicFreestreamFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.