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-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::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  \heading Patch usage
49 
50  \table
51  Property | Description | Required | Default value
52  rho | 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 prghPressure;
61  rho 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  prghPressureFvPatchScalarField.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef prghPressureFvPatchScalarField_H
76 #define prghPressureFvPatchScalarField_H
77 
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class prghPressureFvPatchScalarField Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class prghPressureFvPatchScalarField
90 :
91  public fixedValueFvPatchScalarField
92 {
93 
94 protected:
95 
96  // Protected data
97 
98  //- Name of phase-fraction field
99  word rhoName_;
100 
101  //- Static pressure
102  scalarField p_;
103 
104 
105 public:
106 
107  //- Runtime type information
108  TypeName("prghPressure");
109 
110 
111  // Constructors
112 
113  //- Construct from patch and internal field
115  (
116  const fvPatch&,
117  const DimensionedField<scalar, volMesh>&
118  );
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
124  const DimensionedField<scalar, volMesh>&,
125  const dictionary&
126  );
128  //- Construct by mapping given
129  // prghPressureFvPatchScalarField onto a new patch
131  (
133  const fvPatch&,
135  const fvPatchFieldMapper&
136  );
138  //- Construct as copy
140  (
142  );
143 
144  //- Construct and return a clone
145  virtual tmp<fvPatchScalarField> clone() const
146  {
148  (
150  );
151  }
152 
153  //- Construct as copy setting internal field reference
155  (
158  );
159 
160  //- Construct and return a clone setting internal field reference
162  (
164  ) const
165  {
167  (
168  new prghPressureFvPatchScalarField(*this, iF)
169  );
170  }
171 
172 
173  // Member functions
174 
175  // Access
176 
177  //- Return the static pressure
178  const scalarField& p() const
179  {
180  return p_;
181  }
182 
183  //- Return reference to the static pressure to allow adjustment
184  scalarField& p()
185  {
186  return p_;
187  }
188 
189 
190  // Mapping functions
191 
192  //- Map (and resize as needed) from self given a mapping object
193  virtual void autoMap
194  (
195  const fvPatchFieldMapper&
196  );
197 
198  //- Reverse map the given fvPatchField onto this fvPatchField
199  virtual void rmap
200  (
201  const fvPatchScalarField&,
202  const labelList&
203  );
204 
205 
206  // Evaluation functions
207 
208  //- Update the coefficients associated with the patch field
209  virtual void updateCoeffs();
210 
211 
212  //- Write
213  virtual void write(Ostream&) const;
214 };
215 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 } // End namespace Foam
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 #endif
224 
225 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
TypeName("prghPressure")
Runtime type information.
Foam::fvPatchFieldMapper.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
This boundary condition provides static pressure condition for p_rgh, calculated as: ...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
prghPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
virtual void write(Ostream &) const
Write.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
word rhoName_
Name of phase-fraction field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const scalarField & p() const
Return the static pressure.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A class for managing temporary objects.
Definition: PtrList.H:118