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 | Copyright (C) 2015 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::prghTotalPressureFvPatchScalarField
26 
27 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  This boundary condition provides static pressure condition for p_rgh,
32  calculated as:
33 
34  \f[
35  p_rgh = p - \rho g (h - hRef)
36  p = p0 - 0.5 \rho |U|^2
37  \f]
38 
39  where
40  \vartable
41  p_rgh | Pseudo hydrostatic pressure [Pa]
42  p | Static pressure [Pa]
43  p0 | Total pressure [Pa]
44  h | Height in the opposite direction to gravity
45  hRef | Reference height in the opposite direction to gravity
46  \rho | density
47  g | acceleration due to gravity [m/s^2]
48  \endtable
49 
50  \heading Patch usage
51 
52  \table
53  Property | Description | Required | Default value
54  U | velocity field name | no | U
55  phi | flux field name | no | phi
56  rho | density field name | no | rho
57  p0 | total pressure | yes |
58  \endtable
59 
60  Example of the boundary condition specification:
61  \verbatim
62  myPatch
63  {
64  type prghTotalPressure;
65  U U;
66  phi phi;
67  rho rho;
68  p0 uniform 0;
69  value uniform 0; // optional initial value
70  }
71  \endverbatim
72 
73 SeeAlso
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  );
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 // ************************************************************************* //
const scalarField & p0() const
Return the total pressure.
This boundary condition provides static pressure condition for p_rgh, calculated as: ...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Foam::fvPatchFieldMapper.
word phiName_
Name of the flux transporting the field.
Namespace for OpenFOAM.
TypeName("prghTotalPressure")
Runtime type information.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
prghTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A class for managing temporary objects.
Definition: PtrList.H:118