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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-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::prghPressureFvPatchScalarField
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  where
41  \vartable
42  p_rgh | Pseudo hydrostatic pressure [Pa]
43  p | Static 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 Usage
51  \table
52  Property | Description | Required | Default value
53  rho | rho field name | no | rho
54  p | static pressure | yes |
55  \endtable
56 
57  Example of the boundary condition specification:
58  \verbatim
59  <patchName>
60  {
61  type prghPressure;
62  rho rho;
63  p uniform 0;
64  value uniform 0; // optional initial value
65  }
66  \endverbatim
67 
68 See also
69  Foam::fixedValueFvPatchScalarField
70 
71 SourceFiles
72  prghPressureFvPatchScalarField.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef prghPressureFvPatchScalarField_H
77 #define prghPressureFvPatchScalarField_H
78 
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class prghPressureFvPatchScalarField Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class prghPressureFvPatchScalarField
91 :
92  public fixedValueFvPatchScalarField
93 {
94 
95 protected:
96 
97  // Protected data
98 
99  //- Name of phase-fraction field
100  word rhoName_;
101 
102  //- Static pressure
103  scalarField p_;
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("prghPressure");
110 
111 
112  // Constructors
113 
114  //- Construct from patch and internal field
116  (
117  const fvPatch&,
118  const DimensionedField<scalar, volMesh>&
119  );
120 
121  //- Construct from patch, internal field and dictionary
123  (
124  const fvPatch&,
126  const dictionary&
127  );
128 
129  //- Construct by mapping given
130  // prghPressureFvPatchScalarField onto a new patch
132  (
134  const fvPatch&,
137  );
138 
139  //- Construct as copy
141  (
143  );
144 
145  //- Construct as copy setting internal field reference
147  (
150  );
151 
152  //- Return a clone
153  virtual tmp<fvPatchField<scalar>> clone() const
154  {
155  return fvPatchField<scalar>::Clone(*this);
156  }
157 
158  //- Clone with an internal field reference
160  (
162  ) const
163  {
164  return fvPatchField<scalar>::Clone(*this, iF);
165  }
166 
167 
168  // Member functions
169 
170  // Access
171 
172  //- Return the static pressure
173  const scalarField& p() const
174  {
175  return p_;
176  }
177 
178  //- Return reference to the static pressure to allow adjustment
179  scalarField& p()
180  {
181  return p_;
182  }
183 
184 
185  // Mapping functions
186 
187  //- Map (and resize as needed) from self given a mapping object
188  virtual void autoMap
189  (
190  const fvPatchFieldMapper&
191  );
192 
193  //- Reverse map the given fvPatchField onto this fvPatchField
194  virtual void rmap
195  (
196  const fvPatchScalarField&,
197  const labelList&
198  );
199 
200 
201  // Evaluation functions
202 
203  //- Update the coefficients associated with the patch field
204  virtual void updateCoeffs();
205 
207  //- Write
208  virtual void write(Ostream&) const;
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
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 list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
This boundary condition provides static pressure condition for p_rgh, calculated as: ...
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
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...
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
const scalarField & p() const
Return the static pressure.
Namespace for OpenFOAM.
virtual void write(Ostream &) const
Write.