AnisothermalPhaseModel.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) 2015-2021 OpenFOAM Foundation
9 Copyright (C) 2020-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
30#include "phaseSystem.H"
31
32// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
33
34template<class BasePhaseModel>
37(
38 const tmp<volScalarField>& pressureWork
39) const
40{
41 const volScalarField& alpha = *this;
42
43 const scalar pressureWorkAlphaLimit =
44 this->thermo_->getOrDefault("pressureWorkAlphaLimit", scalar(0));
45
46 if (pressureWorkAlphaLimit > 0)
47 {
48 return
49 (
50 max(alpha - pressureWorkAlphaLimit, scalar(0))
51 /max(alpha - pressureWorkAlphaLimit, pressureWorkAlphaLimit)
52 )*pressureWork;
53 }
54
55 return pressureWork;
56}
57
58
59// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60
61template<class BasePhaseModel>
63(
64 const phaseSystem& fluid,
65 const word& phaseName,
66 const label index
67)
68:
69 BasePhaseModel(fluid, phaseName, index)
70{}
71
72
73// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74
75template<class BasePhaseModel>
77{
78 BasePhaseModel::correctThermo();
79
80 this->thermo_->correct();
81}
82
83
84template<class BasePhaseModel>
86{
87 return false;
88}
89
90
91template<class BasePhaseModel>
94{
95 const volScalarField& alpha = *this;
96 const volScalarField& rho = this->rho();
97
98 const tmp<volVectorField> tU(this->U());
99 const volVectorField& U(tU());
100
103
104 const tmp<surfaceScalarField> talphaRhoPhi(this->alphaRhoPhi());
105 const surfaceScalarField& alphaRhoPhi(talphaRhoPhi());
106
107 const tmp<volScalarField> tcontErr(this->continuityError());
108 const volScalarField& contErr(tcontErr());
109
110 tmp<volScalarField> tK(this->K());
111 const volScalarField& K(tK());
112
113 volScalarField& he = this->thermo_->he();
114
116 (
118 + fvm::div(alphaRhoPhi, he)
119 - fvm::Sp(contErr, he)
120
121 + fvc::ddt(alpha, rho, K) + fvc::div(alphaRhoPhi, K)
122 - contErr*K
123
125 (
127 *fvc::interpolate(this->alphaEff()),
128 he
129 )
130 ==
131 alpha*this->Qdot()
132 );
133
134 // Add the appropriate pressure-work term
135 if (he.name() == this->thermo_->phasePropertyName("e"))
136 {
137 tEEqn.ref() += filterPressureWork
138 (
140 + (fvc::ddt(alpha) - contErr/rho)*this->thermo().p()
141 );
142 }
143 else if (this->thermo_->dpdt())
144 {
145 tEEqn.ref() -= filterPressureWork(alpha*this->fluid().dpdt());
146 }
147
148 return tEEqn;
149}
150
151
152// ************************************************************************* //
CGAL::Exact_predicates_exact_constructions_kernel K
Y[inertIndex] max(0.0)
volScalarField & he
Definition: YEEqn.H:52
twoPhaseSystem & fluid
Class which represents a phase for which the temperature (strictly energy) varies....
virtual void correctThermo()
Correct the thermodynamics.
virtual bool isothermal() const
Return whether the phase is isothermal.
virtual tmp< fvScalarMatrix > heEqn()
Return the enthalpy equation.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:76
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
A class for handling words, derived from Foam::string.
Definition: word.H:68
U
Definition: pEqn.H:72
volScalarField & p
volScalarField::Internal contErr((fvc::ddt(rho)+fvc::div(rhoPhi) -(fvOptions(alpha1, mixture.thermo1().rho())&rho1) -(fvOptions(alpha2, mixture.thermo2().rho())&rho2))())
volScalarField & dpdt
volScalarField alphaEff("alphaEff", turbulence->nu()/Pr+alphat)
tmp< surfaceScalarField > talphaPhi
Definition: alphaEqn.H:13
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:49
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:47
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition: fvcMeshPhi.C:190
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:48
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:48
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:48
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
volScalarField & alpha
scalar Qdot
Definition: solveChemistry.H:2
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))