phaseHydrostaticPressureFvPatchScalarField.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) 2011-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::phaseHydrostaticPressureFvPatchScalarField
26 
27 Group
28  grpGenericBoundaryConditions
29 
30 Description
31  This boundary condition provides a phase-based hydrostatic pressure
32  condition, calculated as:
33 
34  \f[
35  p_{hyd} = p_{ref} + \rho g (x - x_{ref})
36  \f]
37 
38  where
39  \vartable
40  p_{hyd} | hyrostatic pressure [Pa]
41  p_{ref} | reference pressure [Pa]
42  x_{ref} | reference point in Cartesian co-ordinates
43  \rho | density (assumed uniform)
44  g | acceleration due to gravity [m/s2]
45  \endtable
46 
47  The values are assigned according to the phase-fraction field:
48  - 1: apply \$fp_{hyd}\$f
49  - 0: apply a zero-gradient condition
50 
51 Usage
52  \table
53  Property | Description | Required | Default value
54  phaseFraction | phase-fraction field name | no | alpha
55  rho | density field name | no | rho
56  pRefValue | reference pressure [Pa] | yes |
57  pRefPoint | reference pressure location | yes |
58  \endtable
59 
60  Example of the boundary condition specification:
61  \verbatim
62  <patchName>
63  {
64  type phaseHydrostaticPressure;
65  phaseFraction alpha1;
66  rho rho;
67  pRefValue 1e5;
68  pRefPoint (0 0 0);
69  value uniform 0; // optional initial value
70  }
71  \endverbatim
72 
73 See also
74  Foam::mixedFvPatchScalarField
75 
76 SourceFiles
77  phaseHydrostaticPressureFvPatchScalarField.C
78 
79 \*---------------------------------------------------------------------------*/
80 
81 #ifndef phaseHydrostaticPressureFvPatchScalarField_H
82 #define phaseHydrostaticPressureFvPatchScalarField_H
83 
84 #include "mixedFvPatchFields.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 /*---------------------------------------------------------------------------*\
92  Class phaseHydrostaticPressureFvPatchScalarField Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class phaseHydrostaticPressureFvPatchScalarField
96 :
97  public mixedFvPatchScalarField
98 {
99 
100 protected:
101 
102  // Protected data
103 
104  //- Name of phase-fraction field
105  word phaseFraction_;
106 
107  //- Constant density in the far-field
108  scalar rho_;
109 
110  //- Reference pressure
111  scalar pRefValue_;
112 
113  //- Reference pressure location
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("phaseHydrostaticPressure");
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  );
140  //- Construct by mapping given
141  // phaseHydrostaticPressureFvPatchScalarField onto a new patch
143  (
145  const fvPatch&,
147  const fvPatchFieldMapper&
148  );
150  //- Construct as copy
152  (
154  );
156  //- Construct and return a clone
157  virtual tmp<fvPatchScalarField> clone() const
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  // Attributes
188 
189  //- Return true: this patch field is altered by assignment
190  virtual bool assignable() const
191  {
192  return true;
193  }
194 
195 
196  // Access
197 
198  //- Return the phaseFraction
199  const word& phaseFraction() const
200  {
202  }
203 
204  //- Return reference to the phaseFraction to allow adjustment
206  {
207  return phaseFraction_;
208  }
209 
210  //- Return the constant density in the far-field
211  scalar rho() const
212  {
213  return rho_;
214  }
215 
216  //- Return reference to the constant density in the far-field
217  // to allow adjustment
218  scalar& rho()
219  {
220  return rho_;
221  }
222 
223  //- Return the reference pressure
224  scalar pRefValue() const
225  {
226  return pRefValue_;
227  }
228 
229  //- Return reference to the reference pressure to allow adjustment
230  scalar& pRefValue()
231  {
232  return pRefValue_;
233  }
235  //- Return the pressure reference location
236  const vector& pRefPoint() const
237  {
238  return pRefPoint_;
239  }
240 
241  //- Return reference to the pressure reference location
242  // to allow adjustment
244  {
245  return pRefPoint_;
246  }
247 
248 
249  //- Update the coefficients associated with the patch field
250  virtual void updateCoeffs();
251 
252  //- Write
253  virtual void write(Ostream&) const;
254 
256  // Member operators
257 
258  virtual void operator=(const fvPatchScalarField& pvf);
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
TypeName("phaseHydrostaticPressure")
Runtime type information.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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
scalar rho() const
Return the constant density in the far-field.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
const vector & pRefPoint() const
Return the pressure reference location.
This boundary condition provides a phase-based hydrostatic pressure condition, calculated as: ...
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
phaseHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual bool assignable() const
Return true: this patch field is altered by assignment.
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.
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
Namespace for OpenFOAM.