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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::uniformTotalPressureFvPatchScalarField
28 
29 Group
30  grpInletBoundaryConditions grpOutletBoundaryConditions
31 
32 Description
33  This boundary condition provides a time-varying form of the uniform total
34  pressure boundary condition Foam::totalPressureFvPatchField.
35 
36 Usage
37  \table
38  Property | Description | Required | Default value
39  U | Velocity field name | no | U
40  phi | Flux field name | no | phi
41  rho | Density field name | no | rho
42  psi | Compressibility field name | no | none
43  gamma | (Cp/Cv) | no | 1
44  p0 | Total pressure as a function of time | yes |
45  \endtable
46 
47  Example of the boundary condition specification:
48  \verbatim
49  <patchName>
50  {
51  type uniformTotalPressure;
52  p0 uniform 1e5;
53  }
54  \endverbatim
55 
56  The \c p0 entry is specified as a Function1 type, able to describe
57  time varying functions.
58 
59 See also
60  Foam::Function1Types
61  Foam::uniformFixedValueFvPatchField
62  Foam::totalPressureFvPatchField
63 
64 SourceFiles
65  uniformTotalPressureFvPatchScalarField.C
66 
67 \*---------------------------------------------------------------------------*/
68 
69 #ifndef uniformTotalPressureFvPatchScalarField_H
70 #define uniformTotalPressureFvPatchScalarField_H
71 
73 #include "Function1.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 
80 /*---------------------------------------------------------------------------*\
81  Class uniformTotalPressureFvPatchField Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 class uniformTotalPressureFvPatchScalarField
85 :
86  public fixedValueFvPatchScalarField
87 {
88  // Private data
89 
90  //- Name of the velocity field
91  word UName_;
92 
93  //- Name of the flux transporting the field
94  word phiName_;
95 
96  //- Name of the density field used to normalise the mass flux
97  //- if necessary
98  word rhoName_;
99 
100  //- Name of the compressibility field used to calculate the wave speed
101  word psiName_;
102 
103  //- Heat capacity ratio
104  scalar gamma_;
105 
106  //- Table of time vs total pressure, including the bounding treatment
107  autoPtr<Function1<scalar>> p0_;
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("uniformTotalPressure");
115 
116  // Constructors
117 
118  //- Construct from patch and internal field
120  (
121  const fvPatch&,
123  );
124 
125  //- Construct from patch, internal field and dictionary
127  (
128  const fvPatch&,
130  const dictionary&
131  );
132 
133  //- Construct by mapping given patch field onto a new patch
135  (
137  const fvPatch&,
139  const fvPatchFieldMapper&
140  );
141 
142  //- Construct as copy
144  (
146  );
147 
148  //- Construct as copy setting internal field reference
150  (
153  );
154 
155  //- Return a clone
156  virtual tmp<fvPatchField<scalar>> clone() const
157  {
158  return fvPatchField<scalar>::Clone(*this);
159  }
160 
161  //- Clone with an internal field reference
163  (
165  ) const
166  {
167  return fvPatchField<scalar>::Clone(*this, iF);
168  }
169 
170 
171  // Member functions
172 
173  // Access
174 
175  //- Return the name of the velocity field
176  const word& UName() const
177  {
178  return UName_;
179  }
180 
181  //- Return reference to the name of the velocity field
182  // to allow adjustment
183  word& UName()
184  {
185  return UName_;
186  }
187 
188  //- Return the heat capacity ratio
189  scalar gamma() const
190  {
191  return gamma_;
192  }
193 
194  //- Return reference to the heat capacity ratio to allow adjustment
195  scalar& gamma()
196  {
197  return gamma_;
198  }
199 
200 
201  // Evaluation functions
202 
203  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
204  using fixedValueFvPatchScalarField::updateCoeffs;
205 
206  //- Update the coefficients associated with the patch field
207  // using the given patch velocity field
208  virtual void updateCoeffs(const vectorField& Up);
209 
210  //- Update the coefficients associated with the patch field
211  virtual void updateCoeffs();
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
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
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
uniformTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
This boundary condition provides a time-varying form of the uniform total pressure boundary condition...
const word & UName() const
Return the name of the velocity field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
TypeName("uniformTotalPressure")
Runtime type information.
scalar gamma() const
Return the heat capacity ratio.
Namespace for OpenFOAM.