uniformTotalPressureFvPatchScalarField.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-2015 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::uniformTotalPressureFvPatchScalarField
26 
27 Group
28  grpInletBoundaryConditions grpOutletBoundaryConditions
29 
30 Description
31  This boundary condition provides a time-varying form of the uniform total
32  pressure boundary condition.
33 
34  \heading Patch usage
35 
36  \table
37  Property | Description | Required | Default value
38  U | velocity field name | no | U
39  phi | flux field name | no | phi
40  rho | density field name | no | none
41  psi | compressibility field name | no | none
42  gamma | ratio of specific heats (Cp/Cv) | yes |
43  pressure | total pressure as a function of time | yes |
44  \endtable
45 
46  Example of the boundary condition specification:
47  \verbatim
48  myPatch
49  {
50  type uniformTotalPressure;
51  U U;
52  phi phi;
53  rho rho;
54  psi psi;
55  gamma 1.4;
56  pressure uniform 1e5;
57  }
58  \endverbatim
59 
60  The \c pressure entry is specified as a DataEntry type, able to describe
61  time varying functions.
62 
63 Note
64  The default boundary behaviour is for subsonic, incompressible flow.
65 
66 
67 SeeAlso
68  Foam::DataEntry
69  Foam::uniformFixedValueFvPatchField
70  Foam::totalPressureFvPatchField
71 
72 SourceFiles
73  uniformTotalPressureFvPatchScalarField.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef uniformTotalPressureFvPatchScalarField_H
78 #define uniformTotalPressureFvPatchScalarField_H
79 
81 #include "DataEntry.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class uniformTotalPressureFvPatchField Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class uniformTotalPressureFvPatchScalarField
93 :
94  public fixedValueFvPatchScalarField
95 {
96  // Private data
97 
98  //- Name of the velocity field
99  word UName_;
100 
101  //- Name of the flux transporting the field
102  word phiName_;
103 
104  //- Name of the density field used to normalise the mass flux
105  // if neccessary
106  word rhoName_;
107 
108  //- Name of the compressibility field used to calculate the wave speed
109  word psiName_;
110 
111  //- Heat capacity ratio
112  scalar gamma_;
113 
114  //- Table of time vs total pressure, including the bounding treatment
115  autoPtr<DataEntry<scalar> > pressure_;
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("uniformTotalPressure");
122 
123 
124  // Constructors
125 
126  //- Construct from patch and internal field
128  (
129  const fvPatch&,
131  );
132 
133  //- Construct from patch, internal field and dictionary
135  (
136  const fvPatch&,
138  const dictionary&
139  );
140 
141  //- Construct by mapping given patch field onto a new patch
143  (
145  const fvPatch&,
147  const fvPatchFieldMapper&
148  );
149 
150  //- Construct as copy
152  (
154  );
155 
156  //- Construct and return a clone
157  virtual tmp<fvPatchScalarField> clone() const
158  {
160  (
162  );
163  }
164 
165  //- Construct as copy setting internal field reference
167  (
170  );
171 
172  //- Construct and return a clone setting internal field reference
174  (
176  ) const
177  {
179  (
181  );
182  }
183 
184 
185  // Member functions
186 
187  // Access
188 
189  //- Return the name of the velocity field
190  const word& UName() const
191  {
192  return UName_;
193  }
194 
195  //- Return reference to the name of the velocity field
196  // to allow adjustment
197  word& UName()
198  {
199  return UName_;
200  }
201 
202  //- Return the heat capacity ratio
203  scalar gamma() const
204  {
205  return gamma_;
206  }
207 
208  //- Return reference to the heat capacity ratio to allow adjustment
209  scalar& gamma()
210  {
211  return gamma_;
212  }
213 
214 
215  // Evaluation functions
216 
217  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
218  using fixedValueFvPatchScalarField::updateCoeffs;
219 
220  //- Update the coefficients associated with the patch field
221  // using the given patch velocity field
222  virtual void updateCoeffs(const vectorField& Up);
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 };
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
TypeName("uniformTotalPressure")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const word & UName() const
Return the name of the velocity field.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
scalar gamma() const
Return the heat capacity ratio.
This boundary condition provides a time-varying form of the uniform total pressure boundary condition...
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
uniformTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: PtrList.H:118