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-2023 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 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, internal field and dictionary
115  (
116  const fvPatch&,
118  const dictionary&
119  );
120 
121  //- Construct by mapping given patch field onto a new patch
123  (
125  const fvPatch&,
127  const fieldMapper&
128  );
129 
130  //- Disallow copy without setting internal field reference
132  (
134  ) = delete;
135 
136  //- Copy constructor setting internal field reference
138  (
141  );
142 
143  //- Construct and return a clone setting internal field reference
145  (
147  ) const
148  {
150  (
152  );
153  }
154 
155 
156  // Member Functions
157 
158  // Access
159 
160  //- Return the name of the velocity field
161  const word& UName() const
162  {
163  return UName_;
164  }
165 
166  //- Return reference to the name of the velocity field
167  // to allow adjustment
168  word& UName()
169  {
170  return UName_;
171  }
172 
173  //- Return the heat capacity ratio
174  scalar gamma() const
175  {
176  return gamma_;
177  }
178 
179  //- Return reference to the heat capacity ratio to allow adjustment
180  scalar& gamma()
181  {
182  return gamma_;
183  }
184 
185 
186  // Evaluation functions
187 
188  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
189  using fixedValueFvPatchScalarField::updateCoeffs;
190 
191  //- Update the coefficients associated with the patch field
192  // using the given patch velocity field
193  virtual void updateCoeffs(const vectorField& Up);
194 
195  //- Update the coefficients associated with the patch field
196  virtual void updateCoeffs();
197 
198 
199  //- Write
200  virtual void write(Ostream&) const;
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
This boundary condition provides a time-varying form of the uniform total pressure boundary condition...
TypeName("uniformTotalPressure")
Runtime type information.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
uniformTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const word & UName() const
Return the name of the velocity field.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.