Loading...
Searching...
No Matches
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{
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
73Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::he
74(
75 const volScalarField& p,
76 const volScalarField& T
77) const
78{
80 return nullptr;
81}
82
83
84Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::he
85(
86 const scalarField& p,
87 const scalarField& T,
88 const labelList& cells
89) const
90{
92 return nullptr;
93}
94
95
96Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::he
97(
98 const scalarField& p,
99 const scalarField& T,
100 const label patchi
101) const
102{
104 return nullptr;
105}
106
107
108Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::hc() const
109{
110 const fvMesh& mesh = this->T_.mesh();
111
113 (
115 (
116 "hc",
117 mesh.time().timeName(),
118 mesh,
121 ),
122 mesh,
123 dimensionedScalar("hc", Hf2() - Hf1())
124 );
125}
126
127
128Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
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
141Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::THE
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
154Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cp() const
155{
156 const volScalarField limitedAlpha1
157 (
158 clamp(alpha1_, zero_one{})
159 );
160
162 (
164 (
165 "cp",
166 limitedAlpha1*Cp1() + (scalar(1) - limitedAlpha1)*Cp2()
167 )
168 );
169}
170
171
172Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cp
173(
174 const scalarField& p,
175 const scalarField& T,
176 const label patchi
177) const
178{
179 const scalarField alpha1p
180 (
181 clamp(alpha1_.boundaryField()[patchi], zero_one{})
182 );
183
184 return
185 (
186 alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value()
187 );
188}
189
190
191Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::rho() const
192{
193 const volScalarField limitedAlpha1
194 (
195 clamp(alpha1_, zero_one{})
196 );
197
199 (
201 (
202 "rho",
203 limitedAlpha1*rho1().value()
204 + (scalar(1) - limitedAlpha1)*rho2().value()
205 )
206 );
207}
208
209
210Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::rho
211(
212 const label patchi
213) const
214{
215 const scalarField alpha1p
216 (
217 clamp(alpha1_.boundaryField()[patchi], zero_one{})
218 );
219
220 return
221 (
222 alpha1p*rho1().value() + (scalar(1) - alpha1p)*rho2().value()
223 );
224}
225
226
227Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cv() const
228{
229 const volScalarField limitedAlpha1
230 (
231 clamp(alpha1_, zero_one{})
232 );
233
235 (
237 (
238 "cv",
239 limitedAlpha1*Cv1() + (scalar(1) - limitedAlpha1)*Cv2()
240 )
241 );
242}
243
244
245Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cv
246(
247 const scalarField& p,
248 const scalarField& T,
249 const label patchi
250) const
251{
252 const scalarField alpha1p
253 (
254 clamp(alpha1_.boundaryField()[patchi], zero_one{})
255 );
256
257 return
258 (
259 alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value()
260 );
261}
262
263
264Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::gamma() const
265{
267 (
268 (alpha1_*Cp1() + alpha2_*Cp2())/(alpha1_*Cv1() + alpha2_*Cv2())
269 );
270}
271
272
273Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::gamma
274(
275 const scalarField& p,
276 const scalarField& T,
277 const label patchi
278) const
279{
280 return
281 (
282 gamma()().boundaryField()[patchi]
283 );
284}
285
286
287Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cpv() const
288{
289 // This is an e thermo (Cpv = Cv)
290 return Cv();
291}
292
293
294Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cpv
295(
296 const scalarField& p,
297 const scalarField& T,
298 const label patchi
299) const
300{
301 // This is an e thermo (Cpv = Cv)
302 return Cv(p, T, patchi);
303}
304
305
306Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::CpByCpv() const
307{
309 return nullptr;
310}
311
312
313Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::W() const
314{
316 return nullptr;
317}
318
319
320Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::CpByCpv
321(
322 const scalarField& p,
323 const scalarField& T,
324 const label patchi
325) const
326{
328 return nullptr;
329}
330
331
332Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappa() const
333{
334 const volScalarField limitedAlpha1
335 (
336 clamp(alpha1_, zero_one{})
337 );
338
340 (
342 (
343 "kappa",
344 limitedAlpha1*kappa1() + (scalar(1) - limitedAlpha1)*kappa2()
345 )
346 );
347}
348
349
350Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::kappa
351(
352 const label patchi
353) const
354{
355 const scalarField alpha1p
356 (
357 clamp(alpha1_.boundaryField()[patchi], zero_one{})
358 );
359
360 return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value());
361}
362
363
364Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::alphahe() const
365{
367 return nullptr;
368}
369
370
371Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::alphahe
372(
373 const label patchi
374) const
375{
377 return nullptr;
378}
379
380Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappaEff
381(
382 const volScalarField& kappat
383) const
384{
386 kappaEff.ref().rename("kappaEff");
387 return kappaEff;
388}
389
390
391Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::kappaEff
392(
393 const scalarField& kappat,
394 const label patchi
395) const
396{
397 const scalarField alpha1p
398 (
399 clamp(alpha1_.boundaryField()[patchi], zero_one{})
400 );
401
402 return
403 (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat;
404
405}
406
407
408Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::alphaEff
409(
410 const volScalarField& alphat
411) const
412{
413 const volScalarField rho
414 (
415 alpha1_*rho1() + (1.0 - alpha1_)*rho2()
416 );
417
418 return (kappa()/Cp()/rho + alphat);
419}
420
421
422Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::alphaEff
423(
424 const scalarField& alphat,
425 const label patchi
426) const
427{
428 const scalarField alpha1p
429 (
430 clamp(alpha1_.boundaryField()[patchi], zero_one{})
431 );
432
433 const scalarField rho
434 (
435 alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value()
436 );
437
438 const scalarField kappa
439 (
440 alpha1p*kappa1().value() + (1.0 - alpha1p)*kappa2().value()
441 );
442
443 const scalarField Cp
444 (
445 alpha1p*Cp1().value() + (1.0 - alpha1p)*Cp2().value()
446 );
447
448 return kappa/Cp/rho + alphat;
449}
450
451
453{
455 {
456 basicThermo::readEntry("TSat", TSat_);
457 return true;
458 }
459
460 return false;
461}
462
463
464// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
volScalarField & rho2
volScalarField & rho1
@ NO_READ
Nothing to be read.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition Time.C:714
virtual bool read()
Read thermophysical properties dictionary.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
const Time & time() const
Return the top-level database.
Definition fvMesh.H:360
virtual void correct()
Correct the laminar viscosity.
virtual bool read()
Read base transportProperties dictionary.
A class for managing temporary objects.
Definition tmp.H:75
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition tmp.H:215
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 > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
twoPhaseMixtureEThermo(const volVectorField &U, const surfaceScalarField &phi)
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal diffusivity for temperature of mixture [J/m/s/K].
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
static const word null
An empty word.
Definition word.H:84
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
Definition pTraits.H:51
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
U
Definition pEqn.H:72
volScalarField & p
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:688
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.
List< label > labelList
A List of labels.
Definition List.H:62
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
volScalarField & h
scalar T0