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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::phaseHydrostaticPressureFvPatchScalarField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
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
53Usage
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
75See also
76 Foam::mixedFvPatchScalarField
77
78SourceFiles
79 phaseHydrostaticPressureFvPatchScalarField.C
80
81\*---------------------------------------------------------------------------*/
82
83#ifndef phaseHydrostaticPressureFvPatchScalarField_H
84#define phaseHydrostaticPressureFvPatchScalarField_H
85
86#include "mixedFvPatchFields.H"
87
88// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89
90namespace Foam
91{
92
93/*---------------------------------------------------------------------------*\
94 Class phaseHydrostaticPressureFvPatchScalarField Declaration
95\*---------------------------------------------------------------------------*/
96
97class phaseHydrostaticPressureFvPatchScalarField
98:
99 public mixedFvPatchScalarField
100{
101
102protected:
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
119public:
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 );
142 //- Construct by mapping given
143 // phaseHydrostaticPressureFvPatchScalarField onto a new patch
145 (
147 const fvPatch&,
149 const fvPatchFieldMapper&
150 );
152 //- Construct as copy
156 );
158 //- Construct and return a clone
159 virtual tmp<fvPatchScalarField> clone() const
162 (
164 );
165 }
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 }
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
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// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
This boundary condition provides a phase-based hydrostatic pressure condition, calculated as:
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
const vector & pRefPoint() const
Return the pressure reference location.
word & phaseFraction()
Return reference to the phaseFraction to allow adjustment.
TypeName("phaseHydrostaticPressure")
Runtime type information.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
scalar rho() const
Return the constant density in the far-field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
scalar & pRefValue()
Return reference to the reference pressure to allow adjustment.
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.
A class for managing temporary objects.
Definition: tmp.H:65
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
fvPatchField< scalar > fvPatchScalarField
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73