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
88class uniformDensityHydrostaticPressureFvPatchScalarField
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&,
123 const DimensionedField<scalar, volMesh>&,
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 and return a clone
144 virtual tmp<fvPatchScalarField> clone() const
145 {
147 (
149 );
150 }
151
152 //- Construct as copy setting internal field reference
154 (
157 );
158
159 //- Construct and return a clone setting internal field reference
161 (
163 ) const
164 {
166 (
168 (
169 *this,
170 iF
171 )
172 );
173 }
174
175
176 // Member functions
177
178 // Access
179
180 //- Return the constant density in the far-field
181 scalar rho() const
182 {
183 return rho_;
184 }
185
186 //- Return reference to the constant density in the far-field
187 // to allow adjustment
188 scalar& rho()
189 {
190 return rho_;
191 }
192
193 //- Return the reference pressure
194 scalar pRefValue() const
195 {
196 return pRefValue_;
197 }
198
199 //- Return reference to the reference pressure to allow adjustment
200 scalar& pRefValue()
201 {
202 return pRefValue_;
203 }
204
205 //- Return the pressure reference location
206 const vector& pRefPoint() const
207 {
208 return pRefPoint_;
209 }
210
211 //- Return reference to the pressure reference location
212 // to allow adjustment
214 {
215 return pRefPoint_;
216 }
217
218
219 // Evaluation functions
221 //- Update the coefficients associated with the patch field
222 virtual void updateCoeffs();
223
224
225 //- Write
226 virtual void write(Ostream&) const;
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232} // End namespace Foam
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
237
238// ************************************************************************* //
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
A class for managing temporary objects.
Definition: tmp.H:65
This boundary condition provides a hydrostatic pressure condition, calculated as:
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
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.
uniformDensityHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73