hydrostaticPressure.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) 2018-2020 OpenCFD Ltd.
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::functionObjects::hydrostaticPressure
28
29Group
30 grpInitialisationFunctionObjects
31
32Description
33 Calculates and outputs the pressure fields p_rgh and ph_rgh
34
35Usage
36 Example of function object specification to calculate hydrostatic pressure:
37 \verbatim
38 hydrostaticPressure1
39 {
40 type hydrostaticPressure;
41 libs (initialisationFunctionObjects);
42 ...
43 }
44 \endverbatim
45
46 Where the entries comprise:
47 \table
48 Property | Description | Required | Default value
49 log | Log to standard output | no | yes
50 p_rgh | Name of p_rgh field | no | p_rgh
51 ph_rgh | Name of ph_rgh field | no | ph_rgh
52 pRef | Name of pressure ref field | no | pRef
53 pRefValue | Value of pressure ref | when pRef set to pInf | 0
54 rho | Name of density field | no | rho
55 U | Name of velocity field | no | U
56 gh | Name of gravity*height volume field | no | gh
57 ghf | Name of gravity*height surface field | no | ghf
58 nCorrectors | Number of correctors when solving ph_rgh | no | 5
59 \endtable
60
61Note
62 Calculates the hydrostatic pressure on construction/re-initialisation;
63 the execute and write functions are not used.
64
65SourceFiles
66 hydrostaticPressure.C
67
68\*---------------------------------------------------------------------------*/
69
70#ifndef functionObjects_hydrostaticPressure_H
71#define functionObjects_hydrostaticPressure_H
72
75
76// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77
78namespace Foam
79{
80
81namespace functionObjects
82{
83
84/*---------------------------------------------------------------------------*\
85 Class hydrostaticPressure Declaration
86\*---------------------------------------------------------------------------*/
87
88class hydrostaticPressure
89:
90 public fvMeshFunctionObject
91{
92protected:
93
94 // Protected data
95
96 //- Name of p - rho*g*h field, default is "p_rgh"
97 word p_rghName_;
98
99 //- Name of p_hydrostatic - rho*g*h field, default is "ph_rgh"
100 word ph_rghName_;
101
102 //- Name of uniform pressure reference field, default is "pRef"
103 // Set to "none" to set to zero or pInf to set according to pRefValue
104 word pRefName_;
105
106 //- Reference pressure if pRefName is set to "pInf"
107 scalar pRefValue_;
108
109 //- Name of density field, default is "rho"
110 word rhoName_;
111
112 //- Name of velocity field, default is "ph_rgh"
113 word UName_;
114
115 //- Name of g*h volume field, default is "gh"
116 word ghName_;
117
118 //- Name of g*h surface field, default is "ghf"
119 word ghfName_;
120
121 //- Number of correctors when solving for ph_rgh
122 label nCorrectors_;
123
124
125 // Protected Member Functions
126
127 //- Helper function to return the reference pressure
128 // Returns zero if pRefName = none; otherwise returns the value
129 // from the mesh database
130 dimensionedScalar pRef() const;
131
132 //- Calculate the fields and write
133 void calculateAndWrite();
134
135
136public:
137
138 //- Runtime type information
139 TypeName("hydrostaticPressure");
140
141
142 // Constructors
143
144 //- Construct from Time and dictionary
146 (
147 const word& name,
148 const Time& runTime,
149 const dictionary& dict
150 );
152
153 //- Destructor
154 virtual ~hydrostaticPressure() = default;
155
156
157 // Member Functions
159 //- Read the hydrostaticPressure data
160 virtual bool read(const dictionary& dict);
162 //- Calculate the p_rgh field
163 virtual bool execute();
165 //- Write the p_rgh and derived fields
166 virtual bool write();
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172} // End namespace functionObjects
173} // End namespace Foam
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177#endif
178
179// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Calculates and outputs the pressure fields p_rgh and ph_rgh.
void calculateAndWrite()
Calculate the fields and write.
word ph_rghName_
Name of p_hydrostatic - rho*g*h field, default is "ph_rgh".
word UName_
Name of velocity field, default is "ph_rgh".
word pRefName_
Name of uniform pressure reference field, default is "pRef".
TypeName("hydrostaticPressure")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the hydrostaticPressure data.
word rhoName_
Name of density field, default is "rho".
dimensionedScalar pRef() const
Helper function to return the reference pressure.
word p_rghName_
Name of p - rho*g*h field, default is "p_rgh".
word ghfName_
Name of g*h surface field, default is "ghf".
scalar pRefValue_
Reference pressure if pRefName is set to "pInf".
virtual bool execute()
Calculate the p_rgh field.
label nCorrectors_
Number of correctors when solving for ph_rgh.
virtual bool write()
Write the p_rgh and derived fields.
virtual ~hydrostaticPressure()=default
Destructor.
word ghName_
Name of g*h volume field, default is "gh".
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73