Loading...
Searching...
No Matches
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
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&,
139 const dictionary&
140 );
141
142 //- Construct by mapping given
143 // phaseHydrostaticPressureFvPatchScalarField onto a new patch
145 (
147 const fvPatch&,
150 );
151
152 //- Construct as copy
156 );
157
158 //- Construct as copy setting internal field reference
160 (
163 );
165 //- Return a clone
166 virtual tmp<fvPatchField<scalar>> clone() const
167 {
168 return fvPatchField<scalar>::Clone(*this);
169 }
170
171 //- Clone with an internal field reference
173 (
175 ) const
176 {
177 return fvPatchField<scalar>::Clone(*this, iF);
178 }
179
180
181 // Member Functions
182
183 //- True: this patch field is altered by assignment
184 virtual bool assignable() const { return true; }
185
186
187 // Access
188
189 //- Return the phaseFraction
190 const word& phaseFraction() const
191 {
192 return phaseFraction_;
193 }
194
195 //- Return reference to the phaseFraction to allow adjustment
196 word& phaseFraction()
197 {
198 return phaseFraction_;
199 }
200
201 //- Return the constant density in the far-field
202 scalar rho() const
203 {
204 return rho_;
205 }
206
207 //- Return reference to the constant density in the far-field
208 // to allow adjustment
209 scalar& rho()
210 {
211 return rho_;
212 }
213
214 //- Return the reference pressure
215 scalar pRefValue() const
216 {
217 return pRefValue_;
218 }
219
220 //- Return reference to the reference pressure to allow adjustment
221 scalar& pRefValue()
222 {
223 return pRefValue_;
224 }
225
226 //- Return the pressure reference location
227 const vector& pRefPoint() const
228 {
230 }
231
232 //- Return reference to the pressure reference location
233 // to allow adjustment
235 {
236 return pRefPoint_;
238
239
240 //- Update the coefficients associated with the patch field
241 virtual void updateCoeffs();
242
243 //- Write
244 virtual void write(Ostream&) const;
245
246
247 // Member operators
248
249 virtual void operator=(const fvPatchScalarField& pvf);
250};
252
253// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254
255} // End namespace Foam
256
257// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258
259#endif
260
261// ************************************************************************* //
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:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FieldMapper for finite-volume patch fields.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
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:
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< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
vector & pRefPoint()
Return reference to the pressure reference location.
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
True: this patch field is altered by assignment.
scalar & rho()
Return reference to the constant density in the far-field.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
Vector< scalar > vector
Definition vector.H:57
fvPatchField< scalar > fvPatchScalarField
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68