prghTotalPressureFvPatchScalarField.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) 2015-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::prghTotalPressureFvPatchScalarField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This boundary condition provides static pressure condition for p_rgh,
34  calculated as:
35 
36  \f[
37  p_rgh = p - \rho g.(h - hRef)
38  \f]
39 
40  \f[
41  p = p0 - 0.5 \rho |U|^2
42  \f]
43 
44  where
45  \vartable
46  p_rgh | Pseudo hydrostatic pressure [Pa]
47  p | Static pressure [Pa]
48  p0 | Total pressure [Pa]
49  h | Height in the opposite direction to gravity
50  hRef | Reference height in the opposite direction to gravity
51  \rho | Density
52  g | Acceleration due to gravity [m/s^2]
53  \endtable
54 
55 Usage
56  \table
57  Property | Description | Required | Default value
58  U | Velocity field name | no | U
59  phi | Flux field name | no | phi
60  rho | Density field name | no | rho
61  p0 | Total pressure | yes |
62  \endtable
63 
64  Example of the boundary condition specification:
65  \verbatim
66  <patchName>
67  {
68  type prghTotalPressure;
69  p0 uniform 0;
70  }
71  \endverbatim
72 
73 See also
74  Foam::fixedValueFvPatchScalarField
75 
76 SourceFiles
77  prghTotalPressureFvPatchScalarField.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef prghTotalPressureFvPatchScalarField_H
82 #define prghTotalPressureFvPatchScalarField_H
83 
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class prghTotalPressureFvPatchScalarField Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class prghTotalPressureFvPatchScalarField
96 :
97  public fixedValueFvPatchScalarField
98 {
99 
100 protected:
101 
102  // Protected data
103 
104  //- Name of the velocity field
105  word UName_;
106 
107  //- Name of the flux transporting the field
108  word phiName_;
109 
110  //- Name of phase-fraction field
111  word rhoName_;
112 
113  //- Total pressure
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("prghTotalPressure");
121 
122 
123  // Constructors
124 
125  //- Construct from patch and internal field
127  (
128  const fvPatch&,
129  const DimensionedField<scalar, volMesh>&
130  );
131 
132  //- Construct from patch, internal field and dictionary
134  (
135  const fvPatch&,
136  const DimensionedField<scalar, volMesh>&,
137  const dictionary&
138  );
139 
140  //- Construct by mapping given
141  // prghTotalPressureFvPatchScalarField onto a new patch
143  (
145  const fvPatch&,
147  const fvPatchFieldMapper&
148  );
149 
150  //- Construct as copy
152  (
154  );
156  //- Construct as copy setting internal field reference
158  (
161  );
162 
163  //- Return a clone
164  virtual tmp<fvPatchField<scalar>> clone() const
165  {
166  return fvPatchField<scalar>::Clone(*this);
167  }
168 
169  //- Clone with an internal field reference
171  (
173  ) const
174  {
175  return fvPatchField<scalar>::Clone(*this, iF);
176  }
177 
178 
179  // Member functions
180 
181  // Access
182 
183  //- Return the total pressure
184  const scalarField& p0() const
185  {
186  return p0_;
187  }
188 
189  //- Return reference to the total pressure to allow adjustment
190  scalarField& p0()
191  {
192  return p0_;
193  }
194 
195 
196  // Mapping functions
197 
198  //- Map (and resize as needed) from self given a mapping object
199  virtual void autoMap
200  (
201  const fvPatchFieldMapper&
202  );
203 
204  //- Reverse map the given fvPatchField onto this fvPatchField
205  virtual void rmap
206  (
207  const fvPatchScalarField&,
208  const labelList&
209  );
210 
211 
212  // Evaluation functions
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 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
const scalarField & p0() const
Return the total pressure.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
This boundary condition provides static pressure condition for p_rgh, calculated as: ...
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A FieldMapper for finite-volume patch fields.
prghTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
word phiName_
Name of the flux transporting the field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
TypeName("prghTotalPressure")
Runtime type information.
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.