buoyancy.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "buoyancy.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 :
32  mesh(mesh_),
33 
34  runTime(mesh.time()),
35 
36  g
37  (
38  IOobject
39  (
40  "g",
41  runTime.constant(),
42  mesh,
43  IOobject::MUST_READ,
44  IOobject::NO_WRITE
45  )
46  ),
47 
48  hRef
49  (
50  IOobject
51  (
52  "hRef",
53  runTime.constant(),
54  mesh,
55  IOobject::READ_IF_PRESENT,
56  IOobject::NO_WRITE
57  ),
59  ),
60 
61  pRef
62  (
63  IOobject
64  (
65  "pRef",
66  runTime.constant(),
67  mesh,
68  IOobject::READ_IF_PRESENT,
69  IOobject::NO_WRITE
70  ),
72  ),
73 
74  ghRef(-mag(g)*hRef),
75 
76  gh("gh", (g & mesh.C()) - ghRef),
77 
78  ghf("ghf", (g & mesh.Cf()) - ghRef),
79 
80  p_rgh
81  (
82  IOobject
83  (
84  "p_rgh",
85  runTime.name(),
86  mesh,
87  IOobject::MUST_READ,
88  IOobject::AUTO_WRITE
89  ),
90  mesh
91  )
92 {
94 }
95 
96 
97 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
98 
100 (
101  const fvMesh& mesh
102 )
103 {
105  (
106  "p_rgh",
107  mesh.time().name(),
108  mesh,
110  ).headerOk()
112  : autoPtr<buoyancy>(nullptr);
113 }
114 
115 
116 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
117 
119 {}
120 
121 
122 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
123 
125 {
126  gh = (g & mesh.C()) - ghRef;
127  ghf = (g & mesh.Cf()) - ghRef;
128 }
129 
130 
131 // ************************************************************************* //
Graphite solid properties.
Definition: C.H:51
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const word & name() const
Return name.
Definition: IOobject.H:310
const word & name() const
Return const reference to name.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:406
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1748
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:503
Buoyancy related data for the Foam::solvers::isothermalFluid solver module when solving buoyant cases...
Definition: buoyancy.H:70
void moveMesh()
Update gh and ghf following mesh-motion.
Definition: buoyancy.C:124
volScalarField p_rgh
Buoyant pressure p - rho*gh - pRef.
Definition: buoyancy.H:101
buoyancy(const fvMesh &mesh)
Construct from the region mesh.
Definition: buoyancy.C:30
virtual ~buoyancy()
Destructor.
Definition: buoyancy.C:118
static autoPtr< buoyancy > New(const fvMesh &mesh)
Select, construct and return the buoyancy.
Definition: buoyancy.C:100
Templated form of IOobject providing type information for file reading and header type checking.
Definition: IOobject.H:531
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
const dimensionSet dimPressure
const dimensionSet dimLength
dimensioned< scalar > mag(const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47