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&,
146  const DimensionedField<scalar, volMesh>&,
148  );
149 
150  //- Construct as copy
152  (
154  );
155 
156  //- Construct and return a clone
158  {
160  (
162  );
163  }
164 
165  //- Construct as copy setting internal field reference
167  (
170  );
171 
172  //- Construct and return a clone setting internal field reference
174  (
176  ) const
177  {
179  (
181  );
182  }
183 
184 
185  // Member functions
186 
187  // Access
188 
189  //- Return the total pressure
190  const scalarField& p0() const
191  {
192  return p0_;
193  }
194 
195  //- Return reference to the total pressure to allow adjustment
196  scalarField& p0()
197  {
198  return p0_;
199  }
200 
201 
202  // Mapping functions
203 
204  //- Map (and resize as needed) from self given a mapping object
205  virtual void autoMap
206  (
207  const fvPatchFieldMapper&
208  );
209 
210  //- Reverse map the given fvPatchField onto this fvPatchField
211  virtual void rmap
212  (
213  const fvPatchScalarField&,
214  const labelList&
215  );
216 
217 
218  // Evaluation functions
219 
220  //- Update the coefficients associated with the patch field
221  virtual void updateCoeffs();
222 
223 
224  //- Write
225  virtual void write(Ostream&) const;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::prghTotalPressureFvPatchScalarField::phiName_
word phiName_
Name of the flux transporting the field.
Definition: prghTotalPressureFvPatchScalarField.H:160
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::prghTotalPressureFvPatchScalarField
This boundary condition provides static pressure condition for p_rgh, calculated as:
Definition: prghTotalPressureFvPatchScalarField.H:147
Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: prghTotalPressureFvPatchScalarField.C:39
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::prghTotalPressureFvPatchScalarField::p0
scalarField & p0()
Return reference to the total pressure to allow adjustment.
Definition: prghTotalPressureFvPatchScalarField.H:248
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::prghTotalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: prghTotalPressureFvPatchScalarField.C:149
Foam::prghTotalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: prghTotalPressureFvPatchScalarField.C:189
Foam::prghTotalPressureFvPatchScalarField::p0
const scalarField & p0() const
Return the total pressure.
Definition: prghTotalPressureFvPatchScalarField.H:242
Foam::Field< scalar >
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
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::prghTotalPressureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: prghTotalPressureFvPatchScalarField.C:125
Foam::prghTotalPressureFvPatchScalarField::TypeName
TypeName("prghTotalPressure")
Runtime type information.
Foam::List< label >
fixedValueFvPatchFields.H
Foam::prghTotalPressureFvPatchScalarField::UName_
word UName_
Name of the velocity field.
Definition: prghTotalPressureFvPatchScalarField.H:157
Foam::prghTotalPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: prghTotalPressureFvPatchScalarField.H:209
Foam::prghTotalPressureFvPatchScalarField::p0_
scalarField p0_
Total pressure.
Definition: prghTotalPressureFvPatchScalarField.H:166
Foam::prghTotalPressureFvPatchScalarField::rhoName_
word rhoName_
Name of phase-fraction field.
Definition: prghTotalPressureFvPatchScalarField.H:163
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
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
Foam::prghTotalPressureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: prghTotalPressureFvPatchScalarField.C:135