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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-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::phaseHydrostaticPressureFvPatchScalarField
28 
29 Group
30  grpGenericBoundaryConditions
31 
32 Description
33  This boundary condition provides a phase-based hydrostatic pressure
34  condition, calculated as:
35 
36  \f[
37  p_{hyd} = p_{ref} + \rho g (x - x_{ref})
38  \f]
39 
40  where
41  \vartable
42  p_{hyd} | hyrostatic pressure [Pa]
43  p_{ref} | reference pressure [Pa]
44  x_{ref} | reference point in Cartesian coordinates
45  \rho | density (assumed uniform)
46  g | acceleration due to gravity [m/s2]
47  \endtable
48 
49  The values are assigned according to the phase-fraction field:
50  - 1: apply \f$p_{hyd}\f$
51  - 0: apply a zero-gradient condition
52 
53 Usage
54  \table
55  Property | Description | Required | Default value
56  phaseFraction | phase-fraction field name | no | alpha
57  rho | density field name | no | rho
58  pRefValue | reference pressure [Pa] | yes |
59  pRefPoint | reference pressure location | yes |
60  \endtable
61 
62  Example of the boundary condition specification:
63  \verbatim
64  <patchName>
65  {
66  type phaseHydrostaticPressure;
67  phaseFraction alpha1;
68  rho rho;
69  pRefValue 1e5;
70  pRefPoint (0 0 0);
71  value uniform 0; // optional initial value
72  }
73  \endverbatim
74 
75 See also
76  Foam::mixedFvPatchScalarField
77 
78 SourceFiles
79  phaseHydrostaticPressureFvPatchScalarField.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef phaseHydrostaticPressureFvPatchScalarField_H
84 #define phaseHydrostaticPressureFvPatchScalarField_H
85 
86 #include "mixedFvPatchFields.H"
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 namespace Foam
91 {
92 
93 /*---------------------------------------------------------------------------*\
94  Class phaseHydrostaticPressureFvPatchScalarField Declaration
95 \*---------------------------------------------------------------------------*/
96 
97 class phaseHydrostaticPressureFvPatchScalarField
98 :
99  public mixedFvPatchScalarField
100 {
101 
102 protected:
103 
104  // Protected data
105 
106  //- Name of phase-fraction field
107  word phaseFraction_;
108 
109  //- Constant density in the far-field
110  scalar rho_;
111 
112  //- Reference pressure
113  scalar pRefValue_;
114 
115  //- Reference pressure location
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("phaseHydrostaticPressure");
123 
124 
125  // Constructors
126 
127  //- Construct from patch and internal field
129  (
130  const fvPatch&,
131  const DimensionedField<scalar, volMesh>&
132  );
133 
134  //- Construct from patch, internal field and dictionary
136  (
137  const fvPatch&,
138  const DimensionedField<scalar, volMesh>&,
139  const dictionary&
140  );
141 
142  //- Construct by mapping given
143  // phaseHydrostaticPressureFvPatchScalarField onto a new patch
145  (
147  const fvPatch&,
149  const fvPatchFieldMapper&
150  );
151 
152  //- Construct as copy
154  (
156  );
157 
158  //- Construct and return a clone
159  virtual tmp<fvPatchScalarField> clone() const
160  {
162  (
164  );
165  }
166 
167  //- Construct as copy setting internal field reference
169  (
172  );
173 
174  //- Construct and return a clone setting internal field reference
176  (
178  ) const
179  {
181  (
183  );
184  }
185 
186 
187  // Member functions
188 
189  // Attributes
190 
191  //- Return true: this patch field is altered by assignment
192  virtual bool assignable() const
193  {
194  return true;
195  }
196 
197 
198  // Access
199 
200  //- Return the phaseFraction
201  const word& phaseFraction() const
202  {
204  }
205 
206  //- Return reference to the phaseFraction to allow adjustment
208  {
209  return phaseFraction_;
210  }
211 
212  //- Return the constant density in the far-field
213  scalar rho() const
214  {
215  return rho_;
216  }
217 
218  //- Return reference to the constant density in the far-field
219  // to allow adjustment
220  scalar& rho()
221  {
222  return rho_;
223  }
224 
225  //- Return the reference pressure
226  scalar pRefValue() const
227  {
228  return pRefValue_;
229  }
230 
231  //- Return reference to the reference pressure to allow adjustment
232  scalar& pRefValue()
233  {
234  return pRefValue_;
235  }
236 
237  //- Return the pressure reference location
238  const vector& pRefPoint() const
239  {
240  return pRefPoint_;
241  }
242 
243  //- Return reference to the pressure reference location
244  // to allow adjustment
246  {
247  return pRefPoint_;
248  }
249 
250 
251  //- Update the coefficients associated with the patch field
252  virtual void updateCoeffs();
253 
254  //- Write
255  virtual void write(Ostream&) const;
256 
257 
258  // Member operators
259 
260  virtual void operator=(const fvPatchScalarField& pvf);
261 };
262 
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 } // End namespace Foam
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #endif
271 
272 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:40
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::phaseHydrostaticPressureFvPatchScalarField::TypeName
TypeName("phaseHydrostaticPressure")
Runtime type information.
Foam::phaseHydrostaticPressureFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:203
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefPoint
const vector & pRefPoint() const
Return the pressure reference location.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:282
Foam::phaseHydrostaticPressureFvPatchScalarField::rho
scalar rho() const
Return the constant density in the far-field.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:257
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefPoint_
vector pRefPoint_
Reference pressure location.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:160
Foam::phaseHydrostaticPressureFvPatchScalarField::assignable
virtual bool assignable() const
Return true: this patch field is altered by assignment.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:236
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseFraction_
word phaseFraction_
Name of phase-fraction field.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:151
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefValue
scalar pRefValue() const
Return the reference pressure.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:270
Foam::phaseHydrostaticPressureFvPatchScalarField
This boundary condition provides a phase-based hydrostatic pressure condition, calculated as:
Definition: phaseHydrostaticPressureFvPatchScalarField.H:141
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefValue
scalar & pRefValue()
Return reference to the reference pressure to allow adjustment.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:276
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseHydrostaticPressureFvPatchScalarField
phaseHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: phaseHydrostaticPressureFvPatchScalarField.C:40
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
mixedFvPatchFields.H
Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: phaseHydrostaticPressureFvPatchScalarField.C:137
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseFraction
const word & phaseFraction() const
Return the phaseFraction.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:245
Foam::Vector< scalar >
Foam::phaseHydrostaticPressureFvPatchScalarField::rho_
scalar rho_
Constant density in the far-field.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:154
Foam::phaseHydrostaticPressureFvPatchScalarField::pRefValue_
scalar pRefValue_
Reference pressure.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:157
Foam::phaseHydrostaticPressureFvPatchScalarField::phaseFraction
word & phaseFraction()
Return reference to the phaseFraction to allow adjustment.
Definition: phaseHydrostaticPressureFvPatchScalarField.H:251
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::phaseHydrostaticPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: phaseHydrostaticPressureFvPatchScalarField.C:166
Foam::phaseHydrostaticPressureFvPatchScalarField::operator=
virtual void operator=(const fvPatchScalarField &pvf)
Definition: phaseHydrostaticPressureFvPatchScalarField.C:180
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54