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-2026 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  dimensions::acceleration
47  ),
48 
49  hRef
50  (
51  IOobject
52  (
53  "hRef",
54  runTime.constant(),
55  mesh,
56  IOobject::READ_IF_PRESENT,
57  IOobject::NO_WRITE
58  ),
60  ),
61 
62  pRef
63  (
64  IOobject
65  (
66  "pRef",
67  runTime.constant(),
68  mesh,
69  IOobject::READ_IF_PRESENT,
70  IOobject::NO_WRITE
71  ),
73  ),
74 
75  ghRef(-mag(g)*hRef),
76 
77  gh("gh", (g & mesh.C()) - ghRef),
78 
79  ghf("ghf", (g & mesh.Cf()) - ghRef),
80 
81  p_rgh
82  (
83  IOobject
84  (
85  "p_rgh",
86  runTime.name(),
87  mesh,
88  IOobject::MUST_READ,
89  IOobject::AUTO_WRITE
90  ),
91  mesh,
92  dimensions::pressure
93  )
94 {
96 }
97 
98 
99 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
100 
102 (
103  const fvMesh& mesh
104 )
105 {
107  (
108  "p_rgh",
109  mesh.time().name(),
110  mesh,
112  ).headerOk()
114  : autoPtr<buoyancy>(nullptr);
115 }
116 
117 
118 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
119 
121 {}
122 
123 
124 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
125 
127 {
128  gh = (g & mesh.C()) - ghRef;
129  ghf = (g & mesh.Cf()) - ghRef;
130 }
131 
132 
133 // ************************************************************************* //
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:307
const word & name() const
Return const reference to name.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
const volVectorField & C() const
Return cell centres.
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1795
const surfaceVectorField & Cf() const
Return face centres.
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:434
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:126
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:120
static autoPtr< buoyancy > New(const fvMesh &mesh)
Select, construct and return the buoyancy.
Definition: buoyancy.C:102
Templated form of IOobject providing type information for file reading and header type checking.
Definition: IOobject.H:545
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionSet time
const dimensionSet pressure
const dimensionSet acceleration
const dimensionSet & dimLength
Definition: dimensions.C:276
const dimensionSet & dimPressure
Definition: dimensions.C:294
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)