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  \f]
37 
38  where
39  \vartable
40  p_rgh | Pseudo hydrostatic pressure [Pa]
41  p | Static pressure [Pa]
42  h | Height in the opposite direction to gravity
43  hRef | Reference height in the opposite direction to gravity
44  \rho | density
45  g | acceleration due to gravity [m/s^2]
46  \endtable
47 
48  \heading Patch usage
49 
50  \table
51  Property | Description | Required | Default value
52  rhoName | rho field name | no | rho
53  p | static pressure | yes |
54  \endtable
55 
56  Example of the boundary condition specification:
57  \verbatim
58  myPatch
59  {
60  type prghTotalPressure;
61  rhoName rho;
62  p uniform 0;
63  value uniform 0; // optional initial value
64  }
65  \endverbatim
66 
67 SeeAlso
68  Foam::fixedValueFvPatchScalarField
69 
70 SourceFiles
71  prghTotalPressureFvPatchScalarField.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef prghTotalPressureFvPatchScalarField_H
76 #define prghTotalPressureFvPatchScalarField_H
77 
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class prghTotalPressureFvPatchScalarField Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class prghTotalPressureFvPatchScalarField
90 :
91  public fixedValueFvPatchScalarField
92 {
93 
94 protected:
95 
96  // Protected data
97 
98  //- Name of the velocity field
99  word UName_;
100 
101  //- Name of the flux transporting the field
102  word phiName_;
103 
104  //- Name of phase-fraction field
105  word rhoName_;
106 
107  //- Total pressure
109 
110 
111 public:
112 
113  //- Runtime type information
114  TypeName("prghTotalPressure");
115 
116 
117  // Constructors
118 
119  //- Construct from patch and internal field
121  (
122  const fvPatch&,
123  const DimensionedField<scalar, volMesh>&
124  );
125 
126  //- Construct from patch, internal field and dictionary
128  (
129  const fvPatch&,
131  const dictionary&
132  );
133 
134  //- Construct by mapping given
135  // prghTotalPressureFvPatchScalarField onto a new patch
137  (
139  const fvPatch&,
141  const fvPatchFieldMapper&
142  );
143 
144  //- Construct as copy
146  (
148  );
149 
150  //- Construct and return a clone
151  virtual tmp<fvPatchScalarField> clone() const
152  {
154  (
156  );
157  }
158 
159  //- Construct as copy setting internal field reference
161  (
164  );
165 
166  //- Construct and return a clone setting internal field reference
168  (
170  ) const
171  {
173  (
175  );
176  }
177 
178 
179  // Member functions
180 
181  // Access
182 
183  //- Return the rhoName
184  const word& rhoName() const
185  {
186  return rhoName_;
187  }
188 
189  //- Return reference to the rhoName to allow adjustment
190  word& rhoName()
191  {
192  return rhoName_;
193  }
194 
195  //- Return the total pressure
196  const scalarField& p0() const
197  {
198  return p0_;
199  }
200 
201  //- Return reference to the total pressure to allow adjustment
202  scalarField& p0()
203  {
204  return p0_;
205  }
206 
207 
208  // Mapping functions
209 
210  //- Map (and resize as needed) from self given a mapping object
211  virtual void autoMap
212  (
213  const fvPatchFieldMapper&
214  );
215 
216  //- Reverse map the given fvPatchField onto this fvPatchField
217  virtual void rmap
218  (
219  const fvPatchScalarField&,
220  const labelList&
221  );
222 
223 
224  // Evaluation functions
225 
226  //- Update the coefficients associated with the patch field
227  virtual void updateCoeffs();
228 
229 
230  //- Write
231  virtual void write(Ostream&) const;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Foam::prghTotalPressureFvPatchScalarField::phiName_
word phiName_
Name of the flux transporting the field.
Definition: prghTotalPressureFvPatchScalarField.H:140
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::prghTotalPressureFvPatchScalarField
This boundary condition provides static pressure condition for p_rgh, calculated as:
Definition: prghTotalPressureFvPatchScalarField.H:127
Foam::prghTotalPressureFvPatchScalarField::prghTotalPressureFvPatchScalarField
prghTotalPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: prghTotalPressureFvPatchScalarField.C:37
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::prghTotalPressureFvPatchScalarField::p0
scalarField & p0()
Return reference to the total pressure to allow adjustment.
Definition: prghTotalPressureFvPatchScalarField.H:240
Foam::prghTotalPressureFvPatchScalarField::rhoName
word & rhoName()
Return reference to the rhoName to allow adjustment.
Definition: prghTotalPressureFvPatchScalarField.H:228
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::prghTotalPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: prghTotalPressureFvPatchScalarField.C:151
Foam::prghTotalPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: prghTotalPressureFvPatchScalarField.C:191
Foam::prghTotalPressureFvPatchScalarField::p0
const scalarField & p0() const
Return the total pressure.
Definition: prghTotalPressureFvPatchScalarField.H:234
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::prghTotalPressureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: prghTotalPressureFvPatchScalarField.C:127
Foam::prghTotalPressureFvPatchScalarField::TypeName
TypeName("prghTotalPressure")
Runtime type information.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
fixedValueFvPatchFields.H
Foam::prghTotalPressureFvPatchScalarField::UName_
word UName_
Name of the velocity field.
Definition: prghTotalPressureFvPatchScalarField.H:137
Foam::prghTotalPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: prghTotalPressureFvPatchScalarField.H:189
Foam::prghTotalPressureFvPatchScalarField::rhoName
const word & rhoName() const
Return the rhoName.
Definition: prghTotalPressureFvPatchScalarField.H:222
Foam::prghTotalPressureFvPatchScalarField::p0_
scalarField p0_
Total pressure.
Definition: prghTotalPressureFvPatchScalarField.H:146
Foam::prghTotalPressureFvPatchScalarField::rhoName_
word rhoName_
Name of phase-fraction field.
Definition: prghTotalPressureFvPatchScalarField.H:143
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::prghTotalPressureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: prghTotalPressureFvPatchScalarField.C:137