uniformTotalPressureFvPatchScalarField.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-2018 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 Description
28  This boundary condition provides a time-varying form of the uniform total
29  pressure boundary condition Foam::totalPressureFvPatchField.
30 
31 Usage
32  \table
33  Property | Description | Required | Default value
34  U | Velocity field name | no | U
35  phi | Flux field name | no | phi
36  rho | Density field name | no | rho
37  psi | Compressibility field name | no | none
38  gamma | (Cp/Cv) | no | 1
39  p0 | Total pressure as a function of time | yes |
40  \endtable
41 
42  Example of the boundary condition specification:
43  \verbatim
44  <patchName>
45  {
46  type uniformTotalPressure;
47  p0 uniform 1e5;
48  }
49  \endverbatim
50 
51  The \c p0 entry is specified as a Function1 type, able to describe
52  time varying functions.
53 
54 See also
55  Foam::Function1Types
56  Foam::uniformFixedValueFvPatchField
57  Foam::totalPressureFvPatchField
58 
59 SourceFiles
60  uniformTotalPressureFvPatchScalarField.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef uniformTotalPressureFvPatchScalarField_H
65 #define uniformTotalPressureFvPatchScalarField_H
66 
68 #include "Function1.H"
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 namespace Foam
73 {
74 
75 /*---------------------------------------------------------------------------*\
76  Class uniformTotalPressureFvPatchField Declaration
77 \*---------------------------------------------------------------------------*/
78 
79 class uniformTotalPressureFvPatchScalarField
80 :
81  public fixedValueFvPatchScalarField
82 {
83  // Private data
84 
85  //- Name of the velocity field
86  word UName_;
87 
88  //- Name of the flux transporting the field
89  word phiName_;
90 
91  //- Name of the density field used to normalise the mass flux
92  // if necessary
93  word rhoName_;
94 
95  //- Name of the compressibility field used to calculate the wave speed
96  word psiName_;
97 
98  //- Heat capacity ratio
99  scalar gamma_;
100 
101  //- Table of time vs total pressure, including the bounding treatment
102  autoPtr<Function1<scalar>> p0_;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("uniformTotalPressure");
109 
110 
111  // Constructors
112 
113  //- Construct from patch and internal field
115  (
116  const fvPatch&,
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping given patch field onto a new patch
130  (
132  const fvPatch&,
134  const fvPatchFieldMapper&
135  );
136 
137  //- Construct as copy
139  (
141  );
142 
143  //- Construct and return a clone
144  virtual tmp<fvPatchScalarField> clone() const
145  {
147  (
149  );
150  }
151 
152  //- Construct as copy setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
166  (
168  );
169  }
170 
171 
172  // Member functions
173 
174  // Access
175 
176  //- Return the name of the velocity field
177  const word& UName() const
178  {
179  return UName_;
180  }
181 
182  //- Return reference to the name of the velocity field
183  // to allow adjustment
184  word& UName()
185  {
186  return UName_;
187  }
188 
189  //- Return the heat capacity ratio
190  scalar gamma() const
191  {
192  return gamma_;
193  }
194 
195  //- Return reference to the heat capacity ratio to allow adjustment
196  scalar& gamma()
197  {
198  return gamma_;
199  }
200 
201 
202  // Evaluation functions
203 
204  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
205  using fixedValueFvPatchScalarField::updateCoeffs;
206 
207  //- Update the coefficients associated with the patch field
208  // using the given patch velocity field
209  virtual void updateCoeffs(const vectorField& Up);
210 
211  //- Update the coefficients associated with the patch field
212  virtual void updateCoeffs();
213 
214 
215  //- Write
216  virtual void write(Ostream&) const;
217 };
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
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.