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  clamp(alpha1_, zero_one{})
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 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 
192 {
193  const volScalarField limitedAlpha1
194  (
195  clamp(alpha1_, zero_one{})
196  );
197 
198  return tmp<volScalarField>
199  (
200  new volScalarField
201  (
202  "rho",
203  limitedAlpha1*rho1().value()
204  + (scalar(1) - limitedAlpha1)*rho2().value()
205  )
206  );
207 }
208 
209 
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 
228 {
229  const volScalarField limitedAlpha1
230  (
231  clamp(alpha1_, zero_one{})
232  );
233 
234  return tmp<volScalarField>
235  (
236  new volScalarField
237  (
238  "cv",
239  limitedAlpha1*Cv1() + (scalar(1) - limitedAlpha1)*Cv2()
240  )
241  );
242 }
243 
244 
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 
265 {
266  return tmp<volScalarField>
267  (
268  (alpha1_*Cp1() + alpha2_*Cp2())/(alpha1_*Cv1() + alpha2_*Cv2())
269  );
270 }
271 
272 
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 
288 {
289  // This is an e thermo (Cpv = Cv)
290  return Cv();
291 }
292 
293 
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 
307 {
309  return nullptr;
310 }
311 
312 
314 {
316  return nullptr;
317 }
318 
319 
321 (
322  const scalarField& p,
323  const scalarField& T,
324  const label patchi
325 ) const
326 {
328  return nullptr;
329 }
330 
331 
333 {
334  const volScalarField limitedAlpha1
335  (
336  clamp(alpha1_, zero_one{})
337  );
338 
339  return tmp<volScalarField>
340  (
341  new volScalarField
342  (
343  "kappa",
344  limitedAlpha1*kappa1() + (scalar(1) - limitedAlpha1)*kappa2()
345  )
346  );
347 }
348 
349 
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 
365 {
367  return nullptr;
368 }
369 
370 
372 (
373  const label patchi
374 ) const
375 {
377  return nullptr;
378 }
379 
381 (
382  const volScalarField& kappat
383 ) const
384 {
385  tmp<volScalarField> kappaEff(kappa() + kappat);
386  kappaEff.ref().rename("kappaEff");
387  return kappaEff;
388 }
389 
390 
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 
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 
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
virtual bool read()
Read base transportProperties dictionary.
virtual word thermoName() const
Return the name of the thermo physics.
virtual tmp< volScalarField > Cp() const
Return Cp of the mixture.
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 > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
virtual tmp< volScalarField > Cv() const
Return Cv of the mixture.
volScalarField & rho1
virtual tmp< volScalarField > rho() const
Return rho of the mixture.
virtual bool read()
Read properties.
const volScalarField & Cv
Definition: EEqn.H:8
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
virtual tmp< volScalarField > hc() const
Chemical enthalpy [J/kg].
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:76
kappaEff
Definition: TEqn.H:10
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:72
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...
virtual tmp< volScalarField > kappaEff(const volScalarField &) const
Effective thermal diffusivity for temperature of mixture [J/m/s/K].
dynamicFvMesh & mesh
const cellShapeList & cells
A class for handling words, derived from Foam::string.
Definition: word.H:63
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
virtual void correct()
Correct the thermo fields.
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
static const word null
An empty word.
Definition: word.H:84
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Definition: tmp.H:206
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
const volScalarField & Cp
Definition: EEqn.H:7
defineTypeNameAndDebug(combustionModel, 0)
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
volScalarField & rho2
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
const dimensionedScalar h
Planck constant.
virtual void correct()
Correct the laminar viscosity.
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
U
Definition: pEqn.H:72
const dimensionedScalar Cp1
Definition: TEqn.H:5
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
twoPhaseMixtureEThermo(const volVectorField &U, const surfaceScalarField &phi)
Nothing to be read.
Automatically write from objectRegistry::writeObject()
virtual bool read()
Read thermophysical properties dictionary.
Definition: basicThermo.C:643
const scalar gamma
Definition: EEqn.H:9
const dimensionedScalar Cp2
Definition: TEqn.H:6
List< label > labelList
A List of labels.
Definition: List.H:62
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:696
Namespace for OpenFOAM.
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
Definition: dimensionSet.C:271
scalar T0
Definition: createFields.H:22
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].