phaseHydrostaticPressureFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 Description
28  This boundary condition provides a phase-based hydrostatic pressure
29  condition, calculated as:
30 
31  \f[
32  p_{hyd} = p_{ref} + \rho g (x - x_{ref})
33  \f]
34 
35  where
36  \vartable
37  p_{hyd} | hyrostatic pressure [Pa]
38  p_{ref} | reference pressure [Pa]
39  x_{ref} | reference point in Cartesian co-ordinates
40  \rho | density (assumed uniform)
41  g | acceleration due to gravity [m/s^2]
42  \endtable
43 
44  The values are assigned according to the phase-fraction field:
45  - 1: apply \$fp_{hyd}\$f
46  - 0: apply a zero-gradient condition
47 
48 Usage
49  \table
50  Property | Description | Required | Default value
51  phaseFraction | phase-fraction field name | no | alpha
52  rho | density field name | no | rho
53  pRefValue | reference pressure [Pa] | yes |
54  pRefPoint | reference pressure location | yes |
55  \endtable
56 
57  Example of the boundary condition specification:
58  \verbatim
59  <patchName>
60  {
61  type phaseHydrostaticPressure;
62  phaseFraction alpha1;
63  rho rho;
64  pRefValue 1e5;
65  pRefPoint (0 0 0);
66  value uniform 0; // optional initial value
67  }
68  \endverbatim
69 
70 See also
71  Foam::mixedFvPatchScalarField
72 
73 SourceFiles
74  phaseHydrostaticPressureFvPatchScalarField.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef phaseHydrostaticPressureFvPatchScalarField_H
79 #define phaseHydrostaticPressureFvPatchScalarField_H
80 
81 #include "mixedFvPatchFields.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class phaseHydrostaticPressureFvPatchScalarField Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class phaseHydrostaticPressureFvPatchScalarField
93 :
94  public mixedFvPatchScalarField
95 {
96 
97 protected:
98 
99  // Protected data
100 
101  //- Name of phase-fraction field
102  word phaseFraction_;
103 
104  //- Constant density in the far-field
105  scalar rho_;
106 
107  //- Reference pressure
108  scalar pRefValue_;
109 
110  //- Reference pressure location
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("phaseHydrostaticPressure");
118 
119 
120  // Constructors
121 
122  //- Construct from patch and internal field
124  (
125  const fvPatch&,
126  const DimensionedField<scalar, volMesh>&
127  );
128 
129  //- Construct from patch, internal field and dictionary
131  (
132  const fvPatch&,
133  const DimensionedField<scalar, volMesh>&,
134  const dictionary&
135  );
137  //- Construct by mapping given
138  // phaseHydrostaticPressureFvPatchScalarField onto a new patch
140  (
142  const fvPatch&,
144  const fvPatchFieldMapper&
145  );
147  //- Copy constructor
149  (
151  );
153  //- Construct and return a clone
154  virtual tmp<fvPatchScalarField> clone() const
155  {
157  (
159  );
160  }
161 
162  //- Copy constructor setting internal field reference
164  (
167  );
168 
169  //- Construct and return a clone setting internal field reference
171  (
173  ) const
174  {
176  (
178  );
179  }
180 
181 
182  // Member Functions
183 
184  // Attributes
185 
186  //- Return true: this patch field is altered by assignment
187  virtual bool assignable() const
188  {
189  return true;
190  }
191 
192 
193  // Access
194 
195  //- Return the phaseFraction
196  const word& phaseFraction() const
197  {
199  }
200 
201  //- Return reference to the phaseFraction to allow adjustment
203  {
204  return phaseFraction_;
205  }
206 
207  //- Return the constant density in the far-field
208  scalar rho() const
209  {
210  return rho_;
211  }
212 
213  //- Return reference to the constant density in the far-field
214  // to allow adjustment
215  scalar& rho()
216  {
217  return rho_;
218  }
219 
220  //- Return the reference pressure
221  scalar pRefValue() const
222  {
223  return pRefValue_;
224  }
225 
226  //- Return reference to the reference pressure to allow adjustment
227  scalar& pRefValue()
228  {
229  return pRefValue_;
230  }
232  //- Return the pressure reference location
233  const vector& pRefPoint() const
234  {
235  return pRefPoint_;
236  }
237 
238  //- Return reference to the pressure reference location
239  // to allow adjustment
241  {
242  return pRefPoint_;
243  }
244 
245 
246  //- Update the coefficients associated with the patch field
247  virtual void updateCoeffs();
248 
249  //- Write
250  virtual void write(Ostream&) const;
251 
253  // Member Operators
254 
255  virtual void operator=(const fvPatchScalarField& pvf);
256 };
257 
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 } // End namespace Foam
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #endif
266 
267 // ************************************************************************* //
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.