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 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\*---------------------------------------------------------------------------*/
28
29#include "rhoThermo.H"
30
31// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33namespace Foam
34{
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 phasePropertyName("thermo:rho"),
51 mesh.time().timeName(),
52 mesh,
53 IOobject::NO_READ,
54 IOobject::NO_WRITE
55 ),
56 mesh,
58 ),
59
60 psi_
61 (
63 (
64 phasePropertyName("thermo:psi"),
65 mesh.time().timeName(),
66 mesh,
67 IOobject::NO_READ,
68 IOobject::NO_WRITE
69 ),
70 mesh,
71 dimensionSet(0, -2, 2, 0, 0)
72 ),
73
74 mu_
75 (
77 (
78 phasePropertyName("thermo:mu"),
79 mesh.time().timeName(),
80 mesh,
81 IOobject::NO_READ,
82 IOobject::NO_WRITE
83 ),
84 mesh,
85 dimensionSet(1, -1, -1, 0, 0)
86 )
87{}
88
89
91(
92 const fvMesh& mesh,
93 const dictionary& dict,
94 const word& phaseName
95)
96:
97 fluidThermo(mesh, dict, phaseName),
98 rho_
99 (
101 (
102 phasePropertyName("thermo:rho"),
103 mesh.time().timeName(),
104 mesh,
105 IOobject::NO_READ,
106 IOobject::NO_WRITE
107 ),
108 mesh,
110 ),
111
112 psi_
113 (
115 (
116 phasePropertyName("thermo:psi"),
117 mesh.time().timeName(),
118 mesh,
119 IOobject::NO_READ,
120 IOobject::NO_WRITE
121 ),
122 mesh,
123 dimensionSet(0, -2, 2, 0, 0)
124 ),
125
126 mu_
127 (
129 (
130 phasePropertyName("thermo:mu"),
131 mesh.time().timeName(),
132 mesh,
133 IOobject::NO_READ,
134 IOobject::NO_WRITE
135 ),
136 mesh,
137 dimensionSet(1, -1, -1, 0, 0)
138 )
139{}
140
141
143(
144 const fvMesh& mesh,
145 const word& phaseName,
146 const word& dictionaryName
147)
148:
149 fluidThermo(mesh, phaseName, dictionaryName),
150 rho_
151 (
153 (
154 phasePropertyName("thermo:rho"),
155 mesh.time().timeName(),
156 mesh,
157 IOobject::NO_READ,
158 IOobject::NO_WRITE
159 ),
160 mesh,
162 ),
163
164 psi_
165 (
167 (
168 phasePropertyName("thermo:psi"),
169 mesh.time().timeName(),
170 mesh,
171 IOobject::NO_READ,
172 IOobject::NO_WRITE
173 ),
174 mesh,
175 dimensionSet(0, -2, 2, 0, 0)
176 ),
177
178 mu_
179 (
181 (
182 phasePropertyName("thermo:mu"),
183 mesh.time().timeName(),
184 mesh,
185 IOobject::NO_READ,
186 IOobject::NO_WRITE
187 ),
188 mesh,
189 dimensionSet(1, -1, -1, 0, 0)
190 )
191{}
192
193
194// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
195
197(
198 const fvMesh& mesh,
199 const word& phaseName
200)
201{
202 return basicThermo::New<rhoThermo>(mesh, phaseName);
203}
204
205
207(
208 const fvMesh& mesh,
209 const word& phaseName,
210 const word& dictName
211)
212{
213 return basicThermo::New<rhoThermo>(mesh, phaseName, dictName);
214}
215
216// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
217
219{}
220
221
222// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
223
225{
226 return rho_;
227}
228
229
231{
232 return rho_.boundaryField()[patchi];
233}
234
235
237{
238 return rho_;
239}
240
241
243(
244 const Foam::volScalarField& deltaRho,
247)
248{
249 rho_ += deltaRho;
250 rho_ = max(rho_, rhoMin);
251 rho_ = min(rho_, rhoMax);
252}
253
255{
256 rho_ += deltaRho;
257}
258
259
261{
262 return psi_;
263}
264
265
267{
268 return mu_;
269}
270
271
273{
274 return mu_.boundaryField()[patchi];
275}
276
277
278// ************************************************************************* //
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:109
Fundamental fluid thermodynamic properties.
Definition: fluidThermo.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:58
virtual ~rhoThermo()
Destructor.
Definition: rhoThermo.C:218
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition: rhoThermo.C:266
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Definition: rhoThermo.C:224
virtual const volScalarField & psi() const
Compressibility [s^2/m^2].
Definition: rhoThermo.C:260
virtual void correctRho(const volScalarField &deltaRho, const dimensionedScalar &rhoMin, const dimensionedScalar &rhoMax)
Add the given density correction to the density field.
Definition: rhoThermo.C:243
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
const word dictName("faMeshDefinition")
const dimensionedScalar rhoMin
const dimensionedScalar rhoMax
word timeName
Definition: getTimeIndex.H:3
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
const dimensionSet dimDensity
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict