Loading...
Searching...
No Matches
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 \c p_rgh and \c ph_rgh.
34
35Usage
36 Minimal example by using \c system/controlDict.functions:
37 \verbatim
38 hydrostaticPressureFO
39 {
40 // Mandatory entries
41 type hydrostaticPressure;
42 libs (initialisationFunctionObjects);
43
44 // Optional entries
45 p_rgh <word>;
46 ph_rgh <word>;
47 pRef <word>;
48 rho <word>;
49 U <word>;
50 gh <word>;
51 ghf <word>;
52 nCorrectors <label>;
53 reInitialise <bool>;
54
55 // Conditional entries
56
57 // when 'pRef' is 'pInf'
58 pRefValue <scalar>;
59
60 // Inherited entries
61 ...
62 }
63 \endverbatim
64
65 where the entries mean:
66 \table
67 Property | Description | Type | Reqd | Deflt
68 type | Type name: hydrostaticPressure | word | yes | -
69 libs | Library name: initialisationFunctionObjects | word | yes | -
70 p_rgh | Name of p - rho*g*h field | word | no | p_rgh
71 ph_rgh | Name of p_hydrostatic - rho*g*h field | word | no | ph_rgh
72 pRef | Name of pressure ref field | word | no | pRef
73 pRefValue | Value of pressure ref | scalar | conditional | 0
74 rho | Name of density field | word | no | rho
75 U | Name of velocity field | word | no | U
76 gh | Name of g*h volume field | word | no | gh
77 ghf | Name of g*h surface field | word | no | ghf
78 nCorrectors | Number of correctors when solving ph_rgh | label | no
79 reInitialise | Re-initialise at start of simulation | bool | no | false
80 \endtable
81
82 The inherited entries are elaborated in:
83 - \link functionObject.H \endlink
84
85Note
86 Calculates the hydrostatic pressure on construction/re-initialisation;
87 the execute and write functions are not used.
88
89SourceFiles
90 hydrostaticPressure.C
91
92\*---------------------------------------------------------------------------*/
93
94#ifndef Foam_functionObjects_hydrostaticPressure_H
95#define Foam_functionObjects_hydrostaticPressure_H
96
99
100// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101
102namespace Foam
103{
104
105namespace functionObjects
106{
107
108/*---------------------------------------------------------------------------*\
109 Class hydrostaticPressure Declaration
110\*---------------------------------------------------------------------------*/
111
113:
115{
116protected:
117
118 // Protected data
119
120 //- Name of p - rho*g*h field, default is "p_rgh"
121 word p_rghName_;
122
123 //- Name of p_hydrostatic - rho*g*h field, default is "ph_rgh"
124 word ph_rghName_;
125
126 //- Name of uniform pressure reference field, default is "pRef"
127 // Set to "none" to set to zero or pInf to set according to pRefValue
128 word pRefName_;
129
130 //- Reference pressure if pRefName is set to "pInf"
131 scalar pRefValue_;
132
133 //- Name of density field, default is "rho"
134 word rhoName_;
135
136 //- Name of velocity field, default is "ph_rgh"
137 word UName_;
138
139 //- Name of g*h volume field, default is "gh"
140 word ghName_;
141
142 //- Name of g*h surface field, default is "ghf"
143 word ghfName_;
144
145 //- Number of correctors when solving for ph_rgh
146 label nCorrectors_;
147
148
149 // Protected Member Functions
150
151 //- Helper function to return the reference pressure
152 // Returns zero if pRefName = none; otherwise returns the value
153 // from the mesh database
154 dimensionedScalar pRef() const;
155
156 //- Calculate the fields and write
157 void calculateAndWrite();
158
159
160public:
161
162 //- Runtime type information
163 TypeName("hydrostaticPressure");
164
165
166 // Constructors
167
168 //- Construct from name, Time and dictionary
170 (
171 const word& name,
172 const Time& runTime,
173 const dictionary& dict
174 );
175
176
177 //- Destructor
178 virtual ~hydrostaticPressure() = default;
179
180
181 // Member Functions
182
183 //- Read the function-object dictionary
184 virtual bool read(const dictionary& dict);
185
186 //- Execute the function-object operations
187 virtual bool execute();
188
189 //- Write the function-object results
190 virtual bool write();
191};
192
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196} // End namespace functionObjects
197} // End namespace Foam
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201#endif
202
203// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
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 function-object dictionary.
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()
Execute the function-object operations.
label nCorrectors_
Number of correctors when solving for ph_rgh.
virtual bool write()
Write the function-object results.
virtual ~hydrostaticPressure()=default
Destructor.
hydrostaticPressure(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
word ghName_
Name of g*h volume field, default is "gh".
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
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:68
Various UniformDimensionedField types.