prghPressureFvPatchScalarField.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) 2013-2016 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::prghPressureFvPatchScalarField
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 Usage
49  \table
50  Property | Description | Required | Default value
51  rho | rho field name | no | rho
52  p | static pressure | yes |
53  \endtable
54 
55  Example of the boundary condition specification:
56  \verbatim
57  <patchName>
58  {
59  type prghPressure;
60  rho rho;
61  p uniform 0;
62  value uniform 0; // optional initial value
63  }
64  \endverbatim
65 
66 See also
67  Foam::fixedValueFvPatchScalarField
68 
69 SourceFiles
70  prghPressureFvPatchScalarField.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef prghPressureFvPatchScalarField_H
75 #define prghPressureFvPatchScalarField_H
76 
78 
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 
81 namespace Foam
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class prghPressureFvPatchScalarField Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 class prghPressureFvPatchScalarField
89 :
90  public fixedValueFvPatchScalarField
91 {
92 
93 protected:
94 
95  // Protected data
96 
97  //- Name of phase-fraction field
98  word rhoName_;
99 
100  //- Static pressure
101  scalarField p_;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("prghPressure");
108 
109 
110  // Constructors
111 
112  //- Construct from patch and internal field
114  (
115  const fvPatch&,
116  const DimensionedField<scalar, volMesh>&
117  );
118 
119  //- Construct from patch, internal field and dictionary
121  (
122  const fvPatch&,
123  const DimensionedField<scalar, volMesh>&,
124  const dictionary&
125  );
127  //- Construct by mapping given
128  // prghPressureFvPatchScalarField onto a new patch
130  (
132  const fvPatch&,
134  const fvPatchFieldMapper&
135  );
137  //- Construct as copy
139  (
141  );
142 
143  //- Construct and return a clone
144  virtual tmp<fvPatchScalarField> clone() const
145  {
147  (
149  );
150  }
151 
152  //- Construct as copy setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
166  (
167  new prghPressureFvPatchScalarField(*this, iF)
168  );
169  }
170 
171 
172  // Member functions
173 
174  // Access
175 
176  //- Return the static pressure
177  const scalarField& p() const
178  {
179  return p_;
180  }
181 
182  //- Return reference to the static pressure to allow adjustment
183  scalarField& p()
184  {
185  return p_;
186  }
187 
188 
189  // Mapping functions
190 
191  //- Map (and resize as needed) from self given a mapping object
192  virtual void autoMap
193  (
194  const fvPatchFieldMapper&
195  );
196 
197  //- Reverse map the given fvPatchField onto this fvPatchField
198  virtual void rmap
199  (
200  const fvPatchScalarField&,
201  const labelList&
202  );
203 
204 
205  // Evaluation functions
206 
207  //- Update the coefficients associated with the patch field
208  virtual void updateCoeffs();
209 
210 
211  //- Write
212  virtual void write(Ostream&) const;
213 };
214 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 #endif
223 
224 // ************************************************************************* //
prghPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
word rhoName_
Name of phase-fraction field.
TypeName("prghPressure")
Runtime type information.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
This boundary condition provides static pressure condition for p_rgh, calculated as: ...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
const scalarField & p() const
Return the static pressure.
Namespace for OpenFOAM.
virtual void write(Ostream &) const
Write.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.