/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2018 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 .
\*---------------------------------------------------------------------------*/
#include "Saturated.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template
Foam::tmp
Foam::interfaceCompositionModels::Saturated::
wRatioByP() const
{
const dimensionedScalar Wi
(
"W",
dimMass/dimMoles,
this->thermo_.composition().W(saturatedIndex_)
);
return Wi/this->thermo_.W()/this->thermo_.p();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::interfaceCompositionModels::Saturated::Saturated
(
const dictionary& dict,
const phasePair& pair
)
:
InterfaceCompositionModel(dict, pair),
saturatedName_(this->speciesNames_[0]),
saturatedIndex_
(
this->thermo_.composition().species().find(saturatedName_)
),
saturationModel_
(
saturationModel::New
(
dict.subDict("saturationPressure"),
pair.phase1().mesh()
)
)
{
if (this->speciesNames_.size() != 1)
{
FatalErrorInFunction
<< "Saturated model is suitable for one species only."
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template
Foam::interfaceCompositionModels::Saturated::~Saturated()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template
void
Foam::interfaceCompositionModels::Saturated::update
(
const volScalarField& Tf
)
{}
template
Foam::tmp
Foam::interfaceCompositionModels::Saturated::Yf
(
const word& speciesName,
const volScalarField& Tf
) const
{
if (saturatedName_ == speciesName)
{
return wRatioByP()*saturationModel_->pSat(Tf);
}
else
{
const label speciesIndex
(
this->thermo_.composition().species().find(speciesName)
);
return
this->thermo_.Y()[speciesIndex]
*(scalar(1) - wRatioByP()*saturationModel_->pSat(Tf))
/max(scalar(1) - this->thermo_.Y()[saturatedIndex_], SMALL);
}
}
template
Foam::tmp
Foam::interfaceCompositionModels::Saturated::YfPrime
(
const word& speciesName,
const volScalarField& Tf
) const
{
if (saturatedName_ == speciesName)
{
return wRatioByP()*saturationModel_->pSatPrime(Tf);
}
else
{
const label speciesIndex
(
this->thermo_.composition().species().find(speciesName)
);
return
- this->thermo_.Y()[speciesIndex]
*wRatioByP()*saturationModel_->pSatPrime(Tf)
/max(scalar(1) - this->thermo_.Y()[saturatedIndex_], SMALL);
}
}
// ************************************************************************* //