Files
Will Bainbridge 96f10fa31a reacting*EulerFoam: Various consistency improvements
Mass transfer rates now have a more comprehensive naming convention.
"dmdt" means a bulk/mixture transfer, whilst "dmidt" is for a
specie-specific transfer. "dmdt" implies a transfer into a phase, whilst
"dmdtf" means a transfer across an interface. Tables or lists of
transfers are denoted by pluralising the name with the suffix "s"; e.g.,
"dmdtfs". All registered mass transfer rate fields have names which
include the name of the sub-model or phase system which generated them.

The phaseTransfer models have been changed so that the mixture and the
specie-specific mass transfers are independent. This simplifies the
naming convention required for registering the resulting mass transfers
and reduces the amount of logic necessary in the phase system.

The inheritance pattern of the alphat wall functions has been altered so
that the code and parameters relating to phase change are reused, and so
that the base (the Jayatilleke wall function) more closely resembles the
library implementation. This should make it easier to remove it when the
library function is generalised enough to use it directly.

The phaseSystem::zero*Field construction functions have been removed as
their behaviour regarding registration was not clear, and in most
instances of their usage the GeometriField<...>::New methods are
similarly convenient.
2019-10-10 09:31:40 +01:00

157 lines
4.3 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2015-2019 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 "rhoReactionThermo.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(interfaceCompositionModel, 0);
defineRunTimeSelectionTable(interfaceCompositionModel, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interfaceCompositionModel::interfaceCompositionModel
(
const dictionary& dict,
const phasePair& pair
)
:
pair_(pair),
species_(dict.lookup("species")),
Le_("Le", dimless, dict),
thermo_
(
pair.phase1().mesh().lookupObject<rhoReactionThermo>
(
IOobject::groupName(basicThermo::dictName, pair.phase1().name())
)
),
otherThermo_
(
pair.phase2().mesh().lookupObject<rhoThermo>
(
IOobject::groupName(basicThermo::dictName, pair.phase2().name())
)
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::interfaceCompositionModel::~interfaceCompositionModel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::interfaceCompositionModel::dY
(
const word& speciesName,
const volScalarField& Tf
) const
{
const label speciei = composition().species()[speciesName];
return Yf(speciesName, Tf) - composition().Y()[speciei];
}
Foam::tmp<Foam::volScalarField> Foam::interfaceCompositionModel::D
(
const word& speciesName
) const
{
const label speciei = composition().species()[speciesName];
const volScalarField& p(thermo_.p());
const volScalarField& T(thermo_.T());
return volScalarField::New
(
IOobject::groupName("D", pair_.name()),
composition().alphah(speciei, p, T)
/composition().rho(speciei, p, T)
/Le_
);
}
Foam::tmp<Foam::volScalarField> Foam::interfaceCompositionModel::L
(
const word& speciesName,
const volScalarField& Tf
) const
{
const label speciei = composition().species()[speciesName];
const volScalarField& p(thermo_.p());
volScalarField Ha(composition().Ha(speciei, p, Tf));
const volScalarField& otherP(otherThermo_.p());
tmp<volScalarField> otherHa(nullptr);
if (otherHasComposition())
{
const label otherSpeciei = otherComposition().species()[speciesName];
otherHa = otherComposition().Ha(otherSpeciei, otherP, Tf);
}
else
{
otherHa = otherThermo_.ha(otherP, Tf);
}
return
volScalarField::New
(
IOobject::groupName("L", pair_.name()),
otherHa - Ha
);
}
void Foam::interfaceCompositionModel::addDmdtL
(
const volScalarField& K,
const volScalarField& Tf,
volScalarField& dmdtL,
volScalarField& dmdtLPrime
) const
{
forAllConstIter(hashedWordList, species_, iter)
{
const volScalarField rhoKDL(thermo_.rho()*K*D(*iter)*L(*iter, Tf));
dmdtL += rhoKDL*dY(*iter, Tf);
dmdtLPrime += rhoKDL*YfPrime(*iter, Tf);
}
}
// ************************************************************************* //