Files
Henry Weller eb53f9bdf0 reactingTwoPhaseEulerFoam: New twoPhaseEulerFoam supporting mass-transfer and reactions
Multi-species, mass-transfer and reaction support and multi-phase
structure provided by William Bainbridge.

Integration of the latest p-U and face-p_U algorithms with William's
multi-phase structure is not quite complete due to design
incompatibilities which needs further development.  However the
integration of the functionality is complete.

The results of the tutorials are not exactly the same for the
twoPhaseEulerFoam and reactingTwoPhaseEulerFoam solvers but are very
similar.  Further analysis in needed to ensure these differences are
physical or to resolve them; in the meantime the twoPhaseEulerFoam
solver will be maintained.
2015-06-12 09:52:17 +01:00

249 lines
6.2 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "InterfaceCompositionModel.H"
#include "phaseModel.H"
#include "phasePair.H"
#include "pureMixture.H"
#include "multiComponentMixture.H"
#include "rhoThermo.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
template<class ThermoType>
const typename Foam::multiComponentMixture<ThermoType>::thermoType&
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
(
const word& speciesName,
const multiComponentMixture<ThermoType>& globalThermo
) const
{
return
globalThermo.getLocalThermo
(
globalThermo.species()
[
speciesName
]
);
}
template<class Thermo, class OtherThermo>
template<class ThermoType>
const typename Foam::pureMixture<ThermoType>::thermoType&
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
(
const word& speciesName,
const pureMixture<ThermoType>& globalThermo
) const
{
return globalThermo.cellMixture(0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::InterfaceCompositionModel
(
const dictionary& dict,
const phasePair& pair
)
:
interfaceCompositionModel(dict, pair),
thermo_
(
pair.phase1().mesh().lookupObject<Thermo>
(
IOobject::groupName(basicThermo::dictName, pair.phase1().name())
)
),
otherThermo_
(
pair.phase2().mesh().lookupObject<OtherThermo>
(
IOobject::groupName(basicThermo::dictName, pair.phase2().name())
)
),
Le_("Le", dimless, dict.lookup("Le"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::
~InterfaceCompositionModel()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
(
const word& speciesName,
const volScalarField& Tf
) const
{
return
Yf(speciesName, Tf)
- thermo_.composition().Y()
[
thermo_.composition().species()[speciesName]
];
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
(
const word& speciesName
) const
{
const typename Thermo::thermoType& localThermo =
getLocalThermo
(
speciesName,
thermo_
);
const volScalarField& p(thermo_.p());
const volScalarField& T(thermo_.T());
tmp<volScalarField> tmpD
(
new volScalarField
(
IOobject
(
IOobject::groupName("D", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar("zero", dimArea/dimTime, 0)
)
);
volScalarField& D(tmpD());
forAll(p, cellI)
{
D[cellI] =
localThermo.alphah(p[cellI], T[cellI])
/localThermo.rho(p[cellI], T[cellI]);
}
D /= Le_;
return tmpD;
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
(
const word& speciesName,
const volScalarField& Tf
) const
{
const typename Thermo::thermoType& localThermo =
getLocalThermo
(
speciesName,
thermo_
);
const typename OtherThermo::thermoType& otherLocalThermo =
getLocalThermo
(
speciesName,
otherThermo_
);
const volScalarField& p(thermo_.p());
const volScalarField& otherP(otherThermo_.p());
tmp<volScalarField> tmpL
(
new volScalarField
(
IOobject
(
IOobject::groupName("L", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar("zero", dimEnergy/dimMass, 0)
)
);
volScalarField& L(tmpL());
forAll(p, cellI)
{
L[cellI] =
localThermo.Ha(p[cellI], Tf[cellI])
- otherLocalThermo.Ha(otherP[cellI], Tf[cellI]);
}
return tmpL;
}
template<class Thermo, class OtherThermo>
void Foam::InterfaceCompositionModel<Thermo, OtherThermo>::addMDotL
(
const volScalarField& K,
const volScalarField& Tf,
volScalarField& mDotL,
volScalarField& mDotLPrime
) const
{
forAllConstIter(hashedWordList, this->speciesNames_, iter)
{
volScalarField rhoKDL
(
thermo_.rhoThermo::rho()
*K
*D(*iter)
*L(*iter, Tf)
);
mDotL += rhoKDL*dY(*iter, Tf);
mDotLPrime += rhoKDL*YfPrime(*iter, Tf);
}
}
// ************************************************************************* //