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 -------------------------------------------------------------------------------
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);
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  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  (
63  IOobject
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  (
78  IOobject
79  (
80  phaseScopedName("thermo", "mu"),
81  mesh.time().timeName(),
82  mesh,
83  IOobject::NO_READ,
84  IOobject::NO_WRITE,
85  IOobject::REGISTER
86  ),
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  (
103  IOobject
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,
113  dimDensity
114  ),
115 
116  psi_
117  (
118  IOobject
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  (
133  IOobject
134  (
135  phaseScopedName("thermo", "mu"),
136  mesh.time().timeName(),
137  mesh,
138  IOobject::NO_READ,
139  IOobject::NO_WRITE,
140  IOobject::REGISTER
141  ),
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  (
158  IOobject
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,
168  dimDensity
169  ),
170 
171  psi_
172  (
173  IOobject
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  (
188  IOobject
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
220 )
221 {
222  return basicThermo::New<rhoThermo>(mesh, phaseName, dictName);
223 }
224 
225 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
228 {}
229 
230 
231 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
234 {
235  return rho_;
236 }
237 
239 Foam::tmp<Foam::scalarField> Foam::rhoThermo::rho(const label patchi) const
240 {
241  return rho_.boundaryField()[patchi];
242 }
243 
244 
246 {
247  return rho_;
248 }
249 
250 
252 (
253  const Foam::volScalarField& deltaRho,
254  const dimensionedScalar& rhoMin,
256 )
257 {
258  rho_ += deltaRho;
259  rho_ = max(rho_, rhoMin);
260  rho_ = min(rho_, rhoMax);
261 }
264 {
265  rho_ += deltaRho;
266 }
267 
270 {
271  return psi_;
272 }
273 
276 {
277  return mu_;
278 }
279 
280 
281 Foam::tmp<Foam::scalarField> Foam::rhoThermo::mu(const label patchi) const
282 {
283  return mu_.boundaryField()[patchi];
284 }
285 
286 
287 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
const word dictName("faMeshDefinition")
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
static autoPtr< rhoThermo > New(const fvMesh &, const word &phaseName=word::null)
Selector.
Definition: rhoThermo.C:199
const dimensionedScalar rhoMin
rhoThermo(const rhoThermo &)
Construct as copy (not implemented)
word timeName
Definition: getTimeIndex.H:3
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
dynamicFvMesh & mesh
virtual const volScalarField & psi() const
Compressibility [s^2/m^2].
Definition: rhoThermo.C:262
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition: rhoThermo.C:268
A class for handling words, derived from Foam::string.
Definition: word.H:63
Fundamental fluid thermodynamic properties.
Definition: fluidThermo.H:48
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Definition: rhoThermo.C:226
const dimensionSet dimDensity
virtual ~rhoThermo()
Destructor.
Definition: rhoThermo.C:220
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Basic thermodynamic properties based on density.
Definition: rhoThermo.H:51
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180
Namespace for OpenFOAM.
const dimensionedScalar rhoMax