Loading...
Searching...
No Matches
uniformDensityHydrostaticPressureFvPatchScalarField.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::uniformDensityHydrostaticPressureFvPatchScalarField
28
29Group
30 grpGenericBoundaryConditions
31
32Description
33 This boundary condition provides a hydrostatic pressure condition,
34 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
49Usage
50 \table
51 Property | Description | Required | Default value
52 rho | uniform density [kg/m3] | yes |
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 uniformDensityHydrostaticPressure;
62 rho rho;
63 pRefValue 1e5;
64 pRefPoint (0 0 0);
65 value uniform 0; // optional initial value
66 }
67 \endverbatim
68
69SourceFiles
70 uniformDensityHydrostaticPressureFvPatchScalarField.C
71
72\*---------------------------------------------------------------------------*/
73
74#ifndef uniformDensityHydrostaticPressureFvPatchScalarField_H
75#define uniformDensityHydrostaticPressureFvPatchScalarField_H
76
78
79// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80
81namespace Foam
82{
83
84/*---------------------------------------------------------------------------*\
85 Class uniformDensityHydrostaticPressureFvPatchScalarField Declaration
86\*---------------------------------------------------------------------------*/
87
89:
90 public fixedValueFvPatchScalarField
91{
92 // Private data
93
94 //- Constant density in the far-field
95 scalar rho_;
96
97 //- Reference pressure
98 scalar pRefValue_;
99
100 //- Reference pressure location
101 vector pRefPoint_;
102
103
104public:
105
106 //- Runtime type information
107 TypeName("uniformDensityHydrostaticPressure");
108
109
110 // Constructors
111
112 //- Construct from patch and internal field
114 (
115 const fvPatch&,
116 const DimensionedField<scalar, volMesh>&
117 );
118
119 //- Construct from patch, internal field and dictionary
121 (
122 const fvPatch&,
124 const dictionary&
125 );
126
127 //- Construct by mapping given
128 // uniformDensityHydrostaticPressureFvPatchScalarField onto a new patch
130 (
132 const fvPatch&,
134 const fvPatchFieldMapper&
135 );
136
137 //- Construct as copy
139 (
141 );
142
143 //- Construct as copy setting internal field reference
145 (
148 );
149
150 //- Return a clone
151 virtual tmp<fvPatchField<scalar>> clone() const
152 {
153 return fvPatchField<scalar>::Clone(*this);
154 }
155
156 //- Clone with an internal field reference
158 (
160 ) const
161 {
162 return fvPatchField<scalar>::Clone(*this, iF);
163 }
164
165
166 // Member functions
167
168 // Access
169
170 //- Return the constant density in the far-field
171 scalar rho() const
172 {
173 return rho_;
174 }
175
176 //- Return reference to the constant density in the far-field
177 // to allow adjustment
178 scalar& rho()
179 {
180 return rho_;
181 }
182
183 //- Return the reference pressure
184 scalar pRefValue() const
185 {
186 return pRefValue_;
187 }
188
189 //- Return reference to the reference pressure to allow adjustment
190 scalar& pRefValue()
191 {
192 return pRefValue_;
193 }
194
195 //- Return the pressure reference location
196 const vector& pRefPoint() const
197 {
198 return pRefPoint_;
199 }
200
201 //- Return reference to the pressure reference location
202 // to allow adjustment
204 {
205 return pRefPoint_;
206 }
208
209 // Evaluation functions
210
211 //- Update the coefficients associated with the patch field
212 virtual void updateCoeffs();
213
214
215 //- Write
216 virtual void write(Ostream&) const;
217};
218
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222} // End namespace Foam
223
224// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225
226#endif
227
228// ************************************************************************* //
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
A class for managing temporary objects.
Definition tmp.H:75
This boundary condition provides a hydrostatic pressure condition, calculated as:
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
scalar & pRefValue()
Return reference to the reference pressure to allow adjustment.
TypeName("uniformDensityHydrostaticPressure")
Runtime type information.
scalar & rho()
Return reference to the constant density in the far-field.
uniformDensityHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Namespace for OpenFOAM.
Vector< scalar > vector
Definition vector.H:57
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68