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-------------------------------------------------------------------------------
10License
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
29
35
36// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37
38namespace 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 (
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 (
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 (
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 (
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
surfaceScalarField & phi
volScalarField & rho2
volScalarField & rho1
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
static word timeName(const scalar t, const int precision=precision_)
Definition: Time.C:780
virtual bool read()
Read thermophysical properties dictionary.
Definition: basicThermo.C:646
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
virtual void correct()
Correct the laminar viscosity.
tmp< volScalarField > alphaEff() const
Effective thermal turbulent diffusivity of mixture [kg/m/s].
virtual bool read()
Read base transportProperties dictionary.
A class for managing temporary objects.
Definition: tmp.H:65
virtual word thermoName() const
Return the name of the thermo physics.
virtual tmp< volScalarField > Cv() const
Return Cv of the mixture.
virtual tmp< volScalarField > rho() const
Return rho of the mixture.
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
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.
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
virtual tmp< volScalarField > Cp() const
Return Cp of the mixture.
virtual void correct()
Correct the thermo fields.
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
virtual bool read()
Read properties.
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
A class for handling words, derived from Foam::string.
Definition: word.H:68
static const word null
An empty word.
Definition: word.H:80
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
U
Definition: pEqn.H:72
volScalarField & p
const volScalarField & T
const volScalarField & Cv
Definition: EEqn.H:8
const scalar gamma
Definition: EEqn.H:9
const volScalarField & Cp
Definition: EEqn.H:7
dynamicFvMesh & mesh
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
const cellShapeList & cells
kappaEff
Definition: TEqn.H:10
const dimensionedScalar Cp1
Definition: TEqn.H:5
const dimensionedScalar Cp2
Definition: TEqn.H:6
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
List< label > labelList
A List of labels.
Definition: List.H:66
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
volScalarField & h
scalar T0
Definition: createFields.H:22