Loading...
Searching...
No Matches
rhoThermo.C
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-2017 OpenFOAM Foundation
9 Copyright (C) 2017-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
29#include "rhoThermo.H"
31// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33namespace Foam
34{
37 defineRunTimeSelectionTable(rhoThermo, fvMeshDictPhase);
38}
39
40
41// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42
43Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
44:
45 fluidThermo(mesh, phaseName),
46 rho_
47 (
49 (
50 phaseScopedName("thermo", "rho"),
51 mesh.time().timeName(),
52 mesh,
53 IOobject::NO_READ,
54 IOobject::NO_WRITE,
55 IOobject::REGISTER
56 ),
57 mesh,
59 ),
60
61 psi_
62 (
64 (
65 phaseScopedName("thermo", "psi"),
66 mesh.time().timeName(),
67 mesh,
68 IOobject::NO_READ,
69 IOobject::NO_WRITE,
70 IOobject::REGISTER
71 ),
72 mesh,
73 dimensionSet(0, -2, 2, 0, 0)
74 ),
75
76 mu_
77 (
79 (
80 phaseScopedName("thermo", "mu"),
81 mesh.time().timeName(),
82 mesh,
83 IOobject::NO_READ,
84 IOobject::NO_WRITE,
85 IOobject::REGISTER
86 ),
87 mesh,
88 dimensionSet(1, -1, -1, 0, 0)
89 )
90{}
91
92
94(
95 const fvMesh& mesh,
96 const dictionary& dict,
97 const word& phaseName
98)
99:
100 fluidThermo(mesh, dict, phaseName),
101 rho_
102 (
104 (
105 phaseScopedName("thermo", "rho"),
106 mesh.time().timeName(),
107 mesh,
108 IOobject::NO_READ,
109 IOobject::NO_WRITE,
110 IOobject::REGISTER
111 ),
112 mesh,
114 ),
115
116 psi_
117 (
119 (
120 phaseScopedName("thermo", "psi"),
121 mesh.time().timeName(),
122 mesh,
123 IOobject::NO_READ,
124 IOobject::NO_WRITE,
125 IOobject::REGISTER
126 ),
127 mesh,
128 dimensionSet(0, -2, 2, 0, 0)
129 ),
130
131 mu_
132 (
134 (
135 phaseScopedName("thermo", "mu"),
136 mesh.time().timeName(),
137 mesh,
138 IOobject::NO_READ,
139 IOobject::NO_WRITE,
140 IOobject::REGISTER
141 ),
142 mesh,
143 dimensionSet(1, -1, -1, 0, 0)
144 )
145{}
146
147
149(
150 const fvMesh& mesh,
151 const word& phaseName,
152 const word& dictionaryName
153)
154:
155 fluidThermo(mesh, phaseName, dictionaryName),
156 rho_
157 (
159 (
160 phaseScopedName("thermo", "rho"),
161 mesh.time().timeName(),
162 mesh,
163 IOobject::NO_READ,
164 IOobject::NO_WRITE,
165 IOobject::REGISTER
166 ),
167 mesh,
169 ),
170
171 psi_
172 (
174 (
175 phaseScopedName("thermo", "psi"),
176 mesh.time().timeName(),
177 mesh,
178 IOobject::NO_READ,
179 IOobject::NO_WRITE,
180 IOobject::REGISTER
181 ),
182 mesh,
183 dimensionSet(0, -2, 2, 0, 0)
184 ),
185
186 mu_
187 (
189 (
190 phaseScopedName("thermo", "mu"),
191 mesh.time().timeName(),
192 mesh,
193 IOobject::NO_READ,
194 IOobject::NO_WRITE,
195 IOobject::REGISTER
196 ),
197 mesh,
198 dimensionSet(1, -1, -1, 0, 0)
199 )
200{}
201
202
203// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
204
206(
207 const fvMesh& mesh,
208 const word& phaseName
209)
210{
211 return basicThermo::New<rhoThermo>(mesh, phaseName);
212}
213
214
216(
217 const fvMesh& mesh,
218 const word& phaseName,
219 const word& dictName
221{
222 return basicThermo::New<rhoThermo>(mesh, phaseName, dictName);
223}
224
225// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
230
231// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
236}
237
240{
241 return rho_.boundaryField()[patchi];
242}
243
246{
247 return rho_;
248}
249
250
252(
253 const Foam::volScalarField& deltaRho,
256)
257{
258 rho_ += deltaRho;
259 rho_.clamp_range(rhoMin, rhoMax);
260}
263{
264 rho_ += deltaRho;
265}
266
269{
270 return psi_;
271}
272
277}
278
279
281{
282 return mu_.boundaryField()[patchi];
283}
284
285
286// ************************************************************************* //
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static const word dictName
The dictionary name ("thermophysicalProperties").
word phaseScopedName(const std::string &scope, const word &name) const
The phase property name scoped as scope:property.phase.
static autoPtr< Thermo > New(const fvMesh &, const word &phaseName=word::null)
Generic New for each of the related thermodynamics packages.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Fundamental fluid thermodynamic properties.
Definition fluidThermo.H:52
fluidThermo(const fvMesh &, const word &phaseName)
Construct from mesh and phase name.
Definition fluidThermo.C:36
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Basic thermodynamic properties based on density.
Definition rhoThermo.H:54
volScalarField rho_
Density field [kg/m^3].
Definition rhoThermo.H:65
rhoThermo(const rhoThermo &)
Construct as copy (not implemented).
virtual ~rhoThermo()
Destructor.
Definition rhoThermo.C:220
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition rhoThermo.C:267
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Selector.
Definition rhoThermo.C:199
volScalarField mu_
Dynamic viscosity [kg/m/s].
Definition rhoThermo.H:75
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Definition rhoThermo.C:226
volScalarField psi_
Compressibility [s^2/m^2].
Definition rhoThermo.H:70
virtual const volScalarField & psi() const
Compressibility [s^2/m^2].
Definition rhoThermo.C:261
virtual void correctRho(const volScalarField &deltaRho, const dimensionedScalar &rhoMin, const dimensionedScalar &rhoMax)
Add the given density correction to the density field.
Definition rhoThermo.C:245
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
const word dictName("faMeshDefinition")
const dimensionedScalar rhoMin
const dimensionedScalar rhoMax
word timeName
Definition getTimeIndex.H:3
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimDensity
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict