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-2016 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 Foam::totalPressureFvPatchField.
33 
34 Usage
35  \table
36  Property | Description | Required | Default value
37  U | Velocity field name | no | U
38  phi | Flux field name | no | phi
39  rho | Density field name | no | rho
40  psi | Compressibility field name | no | none
41  gamma | (Cp/Cv) | no | 1
42  p0 | Total pressure as a function of time | yes |
43  \endtable
44 
45  Example of the boundary condition specification:
46  \verbatim
47  <patchName>
48  {
49  type uniformTotalPressure;
50  p0 uniform 1e5;
51  }
52  \endverbatim
53 
54  The \c p0 entry is specified as a Function1 type, able to describe
55  time varying functions.
56 
57 See also
58  Foam::Function1Types
59  Foam::uniformFixedValueFvPatchField
60  Foam::totalPressureFvPatchField
61 
62 SourceFiles
63  uniformTotalPressureFvPatchScalarField.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef uniformTotalPressureFvPatchScalarField_H
68 #define uniformTotalPressureFvPatchScalarField_H
69 
71 #include "Function1.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class uniformTotalPressureFvPatchField Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class uniformTotalPressureFvPatchScalarField
83 :
84  public fixedValueFvPatchScalarField
85 {
86  // Private data
87 
88  //- Name of the velocity field
89  word UName_;
90 
91  //- Name of the flux transporting the field
92  word phiName_;
93 
94  //- Name of the density field used to normalise the mass flux
95  // if neccessary
96  word rhoName_;
97 
98  //- Name of the compressibility field used to calculate the wave speed
99  word psiName_;
100 
101  //- Heat capacity ratio
102  scalar gamma_;
103 
104  //- Table of time vs total pressure, including the bounding treatment
105  autoPtr<Function1<scalar>> p0_;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("uniformTotalPressure");
112 
113 
114  // Constructors
115 
116  //- Construct from patch and internal field
118  (
119  const fvPatch&,
121  );
122 
123  //- Construct from patch, internal field and dictionary
125  (
126  const fvPatch&,
128  const dictionary&
129  );
130 
131  //- Construct by mapping given patch field 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<fvPatchScalarField> 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 name of the velocity field
180  const word& UName() const
181  {
182  return UName_;
183  }
184 
185  //- Return reference to the name of the velocity field
186  // to allow adjustment
187  word& UName()
188  {
189  return UName_;
190  }
191 
192  //- Return the heat capacity ratio
193  scalar gamma() const
194  {
195  return gamma_;
196  }
197 
198  //- Return reference to the heat capacity ratio to allow adjustment
199  scalar& gamma()
200  {
201  return gamma_;
202  }
203 
204 
205  // Evaluation functions
206 
207  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
208  using fixedValueFvPatchScalarField::updateCoeffs;
209 
210  //- Update the coefficients associated with the patch field
211  // using the given patch velocity field
212  virtual void updateCoeffs(const vectorField& Up);
213 
214  //- Update the coefficients associated with the patch field
215  virtual void updateCoeffs();
216 
217 
218  //- Write
219  virtual void write(Ostream&) const;
220 };
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
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...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for managing temporary objects.
Definition: PtrList.H:53
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
TypeName("uniformTotalPressure")
Runtime type information.
scalar gamma() const
Return the heat capacity ratio.
Namespace for OpenFOAM.