twoPhaseMixtureEThermo.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) 2016-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "twoPhaseMixtureEThermo.H"
29 
34 #include "twoPhaseMixtureEThermo.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40  defineTypeNameAndDebug(twoPhaseMixtureEThermo, 0);
41 }
42 
43 // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
44 
46 (
47  const volVectorField& U,
48  const surfaceScalarField& phi
49 )
50 :
51  basicThermo(U.mesh(), word::null),
52  thermoIncompressibleTwoPhaseMixture(U, phi),
53 
54  TSat_("TSat", dimTemperature, static_cast<const basicThermo&>(*this))
55 {}
56 
57 
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
59 
61 {
63 }
64 
65 
67 {
69  return word::null;
70 }
71 
72 
74 (
75  const volScalarField& p,
76  const volScalarField& T
77 ) const
78 {
80  return nullptr;
81 }
82 
83 
85 (
86  const scalarField& p,
87  const scalarField& T,
88  const labelList& cells
89 ) const
90 {
92  return nullptr;
93 }
94 
95 
97 (
98  const scalarField& p,
99  const scalarField& T,
100  const label patchi
101 ) const
102 {
104  return nullptr;
105 }
106 
107 
109 {
110  const fvMesh& mesh = this->T_.mesh();
111 
113  (
114  IOobject
115  (
116  "hc",
117  mesh.time().timeName(),
118  mesh,
121  ),
122  mesh,
123  dimensionedScalar("hc", Hf2() - Hf1())
124  );
125 }
126 
127 
129 (
130  const scalarField& h,
131  const scalarField& p,
132  const scalarField& T0,
133  const labelList& cells
134 ) const
135 {
137  return nullptr;
138 }
139 
140 
142 (
143  const scalarField& h,
144  const scalarField& p,
145  const scalarField& T0,
146  const label patchi
147 ) const
148 {
150  return nullptr;
151 }
152 
153 
155 {
156  const volScalarField limitedAlpha1
157  (
158  min(max(alpha1_, scalar(0)), scalar(1))
159  );
160 
161  return tmp<volScalarField>
162  (
163  new volScalarField
164  (
165  "cp",
166  limitedAlpha1*Cp1() + (scalar(1) - limitedAlpha1)*Cp2()
167  )
168  );
169 }
170 
171 
173 (
174  const scalarField& p,
175  const scalarField& T,
176  const label patchi
177 ) const
178 {
179  const volScalarField limitedAlpha1
180  (
181  min(max(alpha1_, scalar(0)), scalar(1))
182  );
183 
184  const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
185 
186  return
187  (
188  alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value()
189  );
190 }
191 
192 
194 {
195  const volScalarField limitedAlpha1
196  (
197  min(max(alpha1_, scalar(0)), scalar(1))
198  );
199 
200  return tmp<volScalarField>
201  (
202  new volScalarField
203  (
204  "rho",
205  limitedAlpha1*rho1().value()
206  + (scalar(1) - limitedAlpha1)*rho2().value()
207  )
208  );
209 }
210 
211 
213 (
214  const label patchi
215 ) const
216 {
217  const volScalarField limitedAlpha1
218  (
219  min(max(alpha1_, scalar(0)), scalar(1))
220  );
221 
222  const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
223 
224  return
225  (
226  alpha1p*rho1().value() + (scalar(1) - alpha1p)*rho2().value()
227  );
228 }
229 
230 
232 {
233  const volScalarField limitedAlpha1
234  (
235  min(max(alpha1_, scalar(0)), scalar(1))
236  );
237 
238  return tmp<volScalarField>
239  (
240  new volScalarField
241  (
242  "cv",
243  limitedAlpha1*Cv1() + (scalar(1) - limitedAlpha1)*Cv2()
244  )
245  );
246 }
247 
248 
250 (
251  const scalarField& p,
252  const scalarField& T,
253  const label patchi
254 ) const
255 {
256  const volScalarField limitedAlpha1
257  (
258  min(max(alpha1_, scalar(0)), scalar(1))
259  );
260 
261  const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
262 
263  return
264  (
265  alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value()
266  );
267 }
268 
269 
271 {
272  return tmp<volScalarField>
273  (
274  (alpha1_*Cp1() + alpha2_*Cp2())/(alpha1_*Cv1() + alpha2_*Cv2())
275  );
276 }
277 
278 
280 (
281  const scalarField& p,
282  const scalarField& T,
283  const label patchi
284 ) const
285 {
286  return
287  (
288  gamma()().boundaryField()[patchi]
289  );
290 }
291 
292 
294 {
295  // This is an e thermo (Cpv = Cv)
296  return Cv();
297 }
298 
299 
301 (
302  const scalarField& p,
303  const scalarField& T,
304  const label patchi
305 ) const
306 {
307  // This is an e thermo (Cpv = Cv)
308  return Cv(p, T, patchi);
309 }
310 
311 
313 {
315  return nullptr;
316 }
317 
318 
320 {
322  return nullptr;
323 }
324 
325 
327 (
328  const scalarField& p,
329  const scalarField& T,
330  const label patchi
331 ) const
332 {
334  return nullptr;
335 }
336 
337 
339 {
340  const volScalarField limitedAlpha1
341  (
342  min(max(alpha1_, scalar(0)), scalar(1))
343  );
344 
345  return tmp<volScalarField>
346  (
347  new volScalarField
348  (
349  "kappa",
350  limitedAlpha1*kappa1() + (scalar(1) - limitedAlpha1)*kappa2()
351  )
352  );
353 }
354 
355 
357 (
358  const label patchi
359 ) const
360 {
361  const volScalarField limitedAlpha1
362  (
363  min(max(alpha1_, scalar(0)), scalar(1))
364  );
365 
366  const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
367 
368  return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value());
369 }
370 
371 
373 {
375  return nullptr;
376 }
377 
378 
380 (
381  const label patchi
382 ) const
383 {
385  return nullptr;
386 }
387 
389 (
390  const volScalarField& kappat
391 ) const
392 {
393  tmp<Foam::volScalarField> kappaEff(kappa() + kappat);
394  kappaEff.ref().rename("kappaEff");
395  return kappaEff;
396 }
397 
398 
400 (
401  const scalarField& kappat,
402  const label patchi
403 ) const
404 {
405  const volScalarField limitedAlpha1
406  (
407  min(max(alpha1_, scalar(0)), scalar(1))
408  );
409 
410  const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
411 
412  return
413  (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat;
414 
415 }
416 
417 
419 (
420  const volScalarField& alphat
421 ) const
422 {
423  const volScalarField rho
424  (
425  alpha1_*rho1() + (1.0 - alpha1_)*rho2()
426  );
427 
428  return (kappa()/Cp()/rho + alphat);
429 }
430 
431 
433 (
434  const scalarField& alphat,
435  const label patchi
436 ) const
437 {
438  const volScalarField limitedAlpha1
439  (
440  min(max(alpha1_, scalar(0)), scalar(1))
441  );
442 
443  const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
444 
445  const scalarField rho
446  (
447  alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value()
448  );
449 
450  const scalarField kappa
451  (
452  alpha1p*kappa1().value() + (1.0 - alpha1p)*kappa2().value()
453  );
454 
455  const scalarField Cp
456  (
457  alpha1p*Cp1().value() + (1.0 - alpha1p)*Cp2().value()
458  );
459 
460  return kappa/Cp/rho + alphat;
461 }
462 
463 
465 {
467  {
468  basicThermo::readEntry("TSat", TSat_);
469  return true;
470  }
471 
472  return false;
473 }
474 
475 
476 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::twoPhaseMixtureEThermo::correct
virtual void correct()
Correct the thermo fields.
Foam::twoPhaseMixtureEThermo::hc
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
Foam::twoPhaseMixtureEThermo::Cv
virtual tmp< volScalarField > Cv() const
Return Cv of the mixture.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
twoPhaseMixtureEThermo.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::basicThermo::read
virtual bool read()
Read thermophysical properties dictionary.
Definition: basicThermo.C:548
gradientEnergyFvPatchScalarField.H
Foam::Time::timeName
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:785
kappaEff
kappaEff
Definition: TEqn.H:10
Cv
const volScalarField & Cv
Definition: EEqn.H:8
Foam::twoPhaseMixtureEThermo::alphaEff
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
Foam::twoPhaseMixtureEThermo::gamma
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Foam::twoPhaseMixtureEThermo::he
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
Definition: twoPhaseMixtureEThermo.H:85
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
rho
rho
Definition: readInitialConditions.H:88
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
h
volScalarField & h
Planck constant.
Definition: setRegionSolidFields.H:33
Foam::twoPhaseMixtureEThermo::twoPhaseMixtureEThermo
twoPhaseMixtureEThermo(const volVectorField &U, const surfaceScalarField &phi)
Foam::thermoIncompressibleTwoPhaseMixture::read
virtual bool read()
Read base transportProperties dictionary.
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:436
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::dictionary::readEntry
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
Definition: dictionaryTemplates.C:314
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::twoPhaseMixtureEThermo::CpByCpv
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
rho2
volScalarField & rho2
Definition: setRegionFluidFields.H:30
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
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
rho1
volScalarField & rho1
Definition: setRegionFluidFields.H:27
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::twoPhaseMixtureEThermo::rho
virtual tmp< volScalarField > rho() const
Return rho of the mixture.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fixedEnergyFvPatchScalarField.H
Foam::twoPhaseMixtureEThermo::kappa
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Foam::twoPhaseMixtureEThermo::Cp
virtual tmp< volScalarField > Cp() const
Return Cp of the mixture.
Cp1
const dimensionedScalar Cp1
Definition: TEqn.H:5
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:60
mixedEnergyFvPatchScalarField.H
U
U
Definition: pEqn.H:72
Foam::twoPhaseMixtureEThermo::W
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Foam::twoPhaseMixtureEThermo::Cpv
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Foam::incompressibleTwoPhaseMixture::correct
virtual void correct()
Correct the laminar viscosity.
Definition: incompressibleTwoPhaseMixture.H:159
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Cp2
const dimensionedScalar Cp2
Definition: TEqn.H:6
gamma
const scalar gamma
Definition: EEqn.H:9
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Cp
const volScalarField & Cp
Definition: EEqn.H:7
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:55
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:248
Foam::twoPhaseMixtureEThermo::thermoName
virtual word thermoName() const
Return the name of the thermo physics.
Foam::twoPhaseMixtureEThermo::read
virtual bool read()
Read properties.
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::twoPhaseMixtureEThermo::kappaEff
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Foam::twoPhaseMixtureEThermo::alphahe
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Foam::IOobject::NO_READ
Definition: IOobject.H:123
T0
scalar T0
Definition: createFields.H:22
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
zeroGradientFvPatchFields.H
Foam::twoPhaseMixtureEThermo::THE
virtual tmp< scalarField > THE(const scalarField &h, const scalarField &p, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.