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");
114 
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 and return a clone
149  virtual tmp<fvPatchScalarField> clone() const
150  {
152  (
154  );
155  }
156 
157  //- Construct as copy setting internal field reference
159  (
162  );
163 
164  //- Construct and return a clone setting internal field reference
166  (
168  ) const
169  {
171  (
173  );
174  }
175 
176 
177  // Member functions
178 
179  // Access
180 
181  //- Return the name of the velocity field
182  const word& UName() const
183  {
184  return UName_;
185  }
186 
187  //- Return reference to the name of the velocity field
188  // to allow adjustment
189  word& UName()
190  {
191  return UName_;
192  }
193 
194  //- Return the heat capacity ratio
195  scalar gamma() const
196  {
197  return gamma_;
198  }
199 
200  //- Return reference to the heat capacity ratio to allow adjustment
201  scalar& gamma()
202  {
203  return gamma_;
204  }
205 
206 
207  // Evaluation functions
208 
209  //- Inherit updateCoeffs from fixedValueFvPatchScalarField
210  using fixedValueFvPatchScalarField::updateCoeffs;
211 
212  //- Update the coefficients associated with the patch field
213  // using the given patch velocity field
214  virtual void updateCoeffs(const vectorField& Up);
215 
216  //- Update the coefficients associated with the patch field
217  virtual void updateCoeffs();
218 
219 
220  //- Write
221  virtual void write(Ostream&) const;
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
Foam::uniformTotalPressureFvPatchScalarField::uniformTotalPressureFvPatchScalarField
uniformTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: uniformTotalPressureFvPatchScalarField.C:39
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::uniformTotalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: uniformTotalPressureFvPatchScalarField.C:230
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::uniformTotalPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: uniformTotalPressureFvPatchScalarField.H:183
Function1.H
Foam::uniformTotalPressureFvPatchScalarField
This boundary condition provides a time-varying form of the uniform total pressure boundary condition...
Definition: uniformTotalPressureFvPatchScalarField.H:118
Foam::uniformTotalPressureFvPatchScalarField::gamma
scalar & gamma()
Return reference to the heat capacity ratio to allow adjustment.
Definition: uniformTotalPressureFvPatchScalarField.H:235
Foam::Field< vector >
Foam::uniformTotalPressureFvPatchScalarField::UName
const word & UName() const
Return the name of the velocity field.
Definition: uniformTotalPressureFvPatchScalarField.H:216
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: uniformTotalPressureFvPatchScalarField.C:224
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::uniformTotalPressureFvPatchScalarField::TypeName
TypeName("uniformTotalPressure")
Runtime type information.
fixedValueFvPatchFields.H
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::uniformTotalPressureFvPatchScalarField::gamma
scalar gamma() const
Return the heat capacity ratio.
Definition: uniformTotalPressureFvPatchScalarField.H:229
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54