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-2020 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::Function1s
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  //- Disallow copy without setting internal field reference
139  (
141  ) = delete;
142 
143  //- Copy constructor setting internal field reference
145  (
148  );
149 
150  //- Construct and return a clone setting internal field reference
152  (
154  ) const
155  {
157  (
159  );
160  }
161 
162 
163  // Member Functions
164 
165  // Access
166 
167  //- Return the name of the velocity field
168  const word& UName() const
169  {
170  return UName_;
171  }
172 
173  //- Return reference to the name of the velocity field
174  // to allow adjustment
175  word& UName()
176  {
177  return UName_;
178  }
179 
180  //- Return the heat capacity ratio
181  scalar gamma() const
182  {
183  return gamma_;
184  }
185 
186  //- Return reference to the heat capacity ratio to allow adjustment
187  scalar& gamma()
188  {
189  return gamma_;
190  }
191 
192 
193  // Evaluation functions
194 
195  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
196  using fixedValueFvPatchScalarField::updateCoeffs;
197 
198  //- Update the coefficients associated with the patch field
199  // using the given patch velocity field
200  virtual void updateCoeffs(const vectorField& Up);
201 
202  //- Update the coefficients associated with the patch field
203  virtual void updateCoeffs();
204 
205 
206  //- Write
207  virtual void write(Ostream&) const;
208 };
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
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:54
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
TypeName("uniformTotalPressure")
Runtime type information.
scalar gamma() const
Return the heat capacity ratio.
Namespace for OpenFOAM.