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 -------------------------------------------------------------------------------
11 License
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 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(rhoThermo, 0);
36  defineRunTimeSelectionTable(rhoThermo, fvMesh);
37  defineRunTimeSelectionTable(rhoThermo, fvMeshDictPhase);
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
43 Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName)
44 :
45  fluidThermo(mesh, phaseName),
46  rho_
47  (
48  IOobject
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  (
62  IOobject
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  (
76  IOobject
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  (
100  IOobject
101  (
102  phasePropertyName("thermo:rho"),
103  mesh.time().timeName(),
104  mesh,
107  ),
108  mesh,
109  dimDensity
110  ),
111 
112  psi_
113  (
114  IOobject
115  (
116  phasePropertyName("thermo:psi"),
117  mesh.time().timeName(),
118  mesh,
121  ),
122  mesh,
123  dimensionSet(0, -2, 2, 0, 0)
124  ),
125 
126  mu_
127  (
128  IOobject
129  (
130  phasePropertyName("thermo:mu"),
131  mesh.time().timeName(),
132  mesh,
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  (
152  IOobject
153  (
154  phasePropertyName("thermo:rho"),
155  mesh.time().timeName(),
156  mesh,
159  ),
160  mesh,
161  dimDensity
162  ),
163 
164  psi_
165  (
166  IOobject
167  (
168  phasePropertyName("thermo:psi"),
169  mesh.time().timeName(),
170  mesh,
173  ),
174  mesh,
175  dimensionSet(0, -2, 2, 0, 0)
176  ),
177 
178  mu_
179  (
180  IOobject
181  (
182  phasePropertyName("thermo:mu"),
183  mesh.time().timeName(),
184  mesh,
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,
245  const dimensionedScalar& rhoMin,
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 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::rhoThermo::rhoThermo
rhoThermo(const rhoThermo &)
Construct as copy (not implemented)
Foam::rhoThermo::correctRho
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
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::dimDensity
const dimensionSet dimDensity
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
dictName
const word dictName("faMeshDefinition")
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
Foam::fluidThermo
Fundamental fluid thermodynamic properties.
Definition: fluidThermo.H:52
Foam::dimensionSet
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:108
Foam::rhoThermo::psi
virtual const volScalarField & psi() const
Compressibility [s^2/m^2].
Definition: rhoThermo.C:260
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
rhoThermo.H
Foam::rhoThermo::rho
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Definition: rhoThermo.C:224
Foam::rhoThermo::New
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Selector.
Definition: rhoThermo.C:197
rhoMin
const dimensionedScalar rhoMin
Definition: setRegionFluidFields.H:67
Foam::rhoThermo::~rhoThermo
virtual ~rhoThermo()
Destructor.
Definition: rhoThermo.C:218
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
timeName
word timeName
Definition: getTimeIndex.H:3
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned< scalar >
Foam::rhoThermo::mu
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition: rhoThermo.C:266
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr< Foam::rhoThermo >
rhoMax
const dimensionedScalar rhoMax
Definition: setRegionFluidFields.H:66
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:280
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:188
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)