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 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
Foam::uniformTotalPressureFvPatchScalarField::uniformTotalPressureFvPatchScalarField
uniformTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: uniformTotalPressureFvPatchScalarField.C:36
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::uniformTotalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: uniformTotalPressureFvPatchScalarField.C:217
Foam::uniformTotalPressureFvPatchScalarField::phiName_
word phiName_
Name of the flux transporting the field.
Definition: uniformTotalPressureFvPatchScalarField.H:136
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::uniformTotalPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: uniformTotalPressureFvPatchScalarField.H:191
Foam::uniformTotalPressureFvPatchScalarField::gamma_
scalar gamma_
Heat capacity ratio.
Definition: uniformTotalPressureFvPatchScalarField.H:146
Foam::uniformTotalPressureFvPatchScalarField
This boundary condition provides a time-varying form of the uniform total pressure boundary condition...
Definition: uniformTotalPressureFvPatchScalarField.H:126
Foam::uniformTotalPressureFvPatchScalarField::rhoName_
word rhoName_
Name of the density field used to normalise the mass flux.
Definition: uniformTotalPressureFvPatchScalarField.H:140
Foam::uniformTotalPressureFvPatchScalarField::gamma
scalar & gamma()
Return reference to the heat capacity ratio to allow adjustment.
Definition: uniformTotalPressureFvPatchScalarField.H:243
Foam::uniformTotalPressureFvPatchScalarField::psiName_
word psiName_
Name of the compressibility field used to calculate the wave speed.
Definition: uniformTotalPressureFvPatchScalarField.H:143
DataEntry.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::uniformTotalPressureFvPatchScalarField::UName
const word & UName() const
Return the name of the velocity field.
Definition: uniformTotalPressureFvPatchScalarField.H:224
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: uniformTotalPressureFvPatchScalarField.C:211
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::uniformTotalPressureFvPatchScalarField::UName_
word UName_
Name of the velocity field.
Definition: uniformTotalPressureFvPatchScalarField.H:133
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::uniformTotalPressureFvPatchScalarField::TypeName
TypeName("uniformTotalPressure")
Runtime type information.
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::uniformTotalPressureFvPatchScalarField::gamma
scalar gamma() const
Return the heat capacity ratio.
Definition: uniformTotalPressureFvPatchScalarField.H:237
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::uniformTotalPressureFvPatchScalarField::pressure_
autoPtr< DataEntry< scalar > > pressure_
Table of time vs total pressure, including the bounding treatment.
Definition: uniformTotalPressureFvPatchScalarField.H:149
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51