Loading...
Searching...
No Matches
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>
36Foam::AnisothermalPhaseModel<BasePhaseModel>::filterPressureWork
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>
87 return false;
88}
89
90
91template<class BasePhaseModel>
94{
95 const volScalarField& alpha = *this;
96 const tmp<volScalarField> trho(this->rho());
97 const volScalarField& rho(trho());
98
99 const tmp<volVectorField> tU(this->U());
100 const volVectorField& U(tU());
101
104
105 const tmp<surfaceScalarField> talphaRhoPhi(this->alphaRhoPhi());
106 const surfaceScalarField& alphaRhoPhi(talphaRhoPhi());
107
108 const tmp<volScalarField> tcontErr(this->continuityError());
109 const volScalarField& contErr(tcontErr());
110
111 tmp<volScalarField> tK(this->K());
112 const volScalarField& K(tK());
113
114 volScalarField& he = this->thermo_->he();
115
117 (
119 + fvm::div(alphaRhoPhi, he)
120 - fvm::Sp(contErr, he)
121
122 + fvc::ddt(alpha, rho, K) + fvc::div(alphaRhoPhi, K)
123 - contErr*K
124
126 (
128 *fvc::interpolate(this->alphaEff()),
129 he
130 )
131 ==
132 alpha*this->Qdot()
133 );
134
135 // Add the appropriate pressure-work term
136 if (he.name() == this->thermo_->phasePropertyName("e"))
137 {
138 tEEqn.ref() += filterPressureWork
139 (
141 + (fvc::ddt(alpha) - contErr/rho)*this->thermo().p()
142 );
143 }
144 else if (this->thermo_->dpdt())
145 {
146 tEEqn.ref() -= filterPressureWork(alpha*this->fluid().dpdt());
147 }
148
149 return tEEqn;
150}
151
152
153// ************************************************************************* //
CGAL::Exact_predicates_exact_constructions_kernel K
volScalarField & he
Definition YEEqn.H:52
twoPhaseSystem & fluid
virtual void correctThermo()
Correct the thermodynamics.
AnisothermalPhaseModel(const phaseSystem &fluid, const word &phaseName, const label index)
Construct from phase system and phase name.
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:205
Class to represent a system of phases and model interfacial transfers between them.
Definition phaseSystem.H:72
A class for managing temporary objects.
Definition tmp.H:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
A class for handling words, derived from Foam::string.
Definition word.H:66
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:42
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition fvcDdt.C:40
tmp< surfaceScalarField > absolute(const tmp< surfaceScalarField > &tphi, const volVectorField &U)
Return the given relative flux in absolute form.
Definition fvcMeshPhi.C:183
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition fvmDiv.C:41
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition fvmDdt.C:41
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
GeometricField< vector, fvPatchField, volMesh > volVectorField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
volScalarField & alpha
tmp< volScalarField > trho
scalar Qdot
psiReactionThermo & thermo
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))