/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2023 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 .
\*---------------------------------------------------------------------------*/
#include "PopulationBalancePhaseSystem.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::PopulationBalancePhaseSystem::
PopulationBalancePhaseSystem
(
const fvMesh& mesh
)
:
BasePhaseSystem(mesh),
populationBalances_
(
this->lookup("populationBalances"),
diameterModels::populationBalanceModel::iNew(*this)
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template
Foam::PopulationBalancePhaseSystem::
~PopulationBalancePhaseSystem()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template
Foam::tmp
Foam::PopulationBalancePhaseSystem::dmdtf
(
const phaseInterfaceKey& key
) const
{
tmp tDmdtf = BasePhaseSystem::dmdtf(key);
forAll(populationBalances_, popBali)
{
if (populationBalances_[popBali].dmdtfs().found(key))
{
tDmdtf.ref() += *populationBalances_[popBali].dmdtfs()[key];
}
}
return tDmdtf;
}
template
Foam::PtrList
Foam::PopulationBalancePhaseSystem::dmdts() const
{
PtrList dmdts(BasePhaseSystem::dmdts());
forAll(populationBalances_, popBali)
{
forAllConstIter
(
phaseSystem::dmdtfTable,
populationBalances_[popBali].dmdtfs(),
dmdtfIter
)
{
const phaseInterface interface(*this, dmdtfIter.key());
addField(interface.phase1(), "dmdt", *dmdtfIter(), dmdts);
addField(interface.phase2(), "dmdt", - *dmdtfIter(), dmdts);
}
}
return dmdts;
}
template
Foam::autoPtr
Foam::PopulationBalancePhaseSystem::momentumTransfer()
{
autoPtr eqnsPtr =
BasePhaseSystem::momentumTransfer();
phaseSystem::momentumTransferTable& eqns = eqnsPtr();
forAll(populationBalances_, popBali)
{
this->addDmdtUfs(populationBalances_[popBali].dmdtfs(), eqns);
}
return eqnsPtr;
}
template
Foam::autoPtr
Foam::PopulationBalancePhaseSystem::momentumTransferf()
{
autoPtr eqnsPtr =
BasePhaseSystem::momentumTransferf();
phaseSystem::momentumTransferTable& eqns = eqnsPtr();
forAll(populationBalances_, popBali)
{
this->addDmdtUfs(populationBalances_[popBali].dmdtfs(), eqns);
}
return eqnsPtr;
}
template
Foam::autoPtr
Foam::PopulationBalancePhaseSystem::heatTransfer() const
{
autoPtr eqnsPtr =
BasePhaseSystem::heatTransfer();
phaseSystem::heatTransferTable& eqns = eqnsPtr();
forAll(populationBalances_, popBali)
{
this->addDmdtHefs(populationBalances_[popBali].dmdtfs(), eqns);
}
return eqnsPtr;
}
template
Foam::autoPtr
Foam::PopulationBalancePhaseSystem::specieTransfer() const
{
autoPtr eqnsPtr =
BasePhaseSystem::specieTransfer();
phaseSystem::specieTransferTable& eqns = eqnsPtr();
forAll(populationBalances_, popBali)
{
this->addDmdtYfs(populationBalances_[popBali].dmdtfs(), eqns);
}
return eqnsPtr;
}
template
void Foam::PopulationBalancePhaseSystem::solve
(
const PtrList& rAs
)
{
BasePhaseSystem::solve(rAs);
forAll(populationBalances_, i)
{
populationBalances_[i].solve();
}
}
template
void Foam::PopulationBalancePhaseSystem::correct()
{
BasePhaseSystem::correct();
forAll(populationBalances_, i)
{
populationBalances_[i].correct();
}
}
template
bool Foam::PopulationBalancePhaseSystem::read()
{
if (BasePhaseSystem::read())
{
bool readOK = true;
// Read models ...
return readOK;
}
else
{
return false;
}
}
// ************************************************************************* //