Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry Weller
2020-09-03 10:30:49 +01:00
55 changed files with 177 additions and 577 deletions

View File

@ -77,7 +77,6 @@ $(driftModels)/phaseChange/phaseChange.C
nucleationModels = populationBalanceModel/nucleationModels
$(nucleationModels)/nucleationModel/nucleationModel.C
$(nucleationModels)/constantNucleation/constantNucleation.C
$(nucleationModels)/reactionDriven/reactionDriven.C
$(nucleationModels)/wallBoiling/wallBoiling.C

View File

@ -80,9 +80,7 @@ PopulationBalancePhaseSystem
this->phasePairs_[key]->name()
),
this->mesh().time().timeName(),
this->mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
this->mesh()
),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, 0)
@ -202,24 +200,6 @@ Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::specieTransfer() const
}
template<class BasePhaseSystem>
bool Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::read()
{
if (BasePhaseSystem::read())
{
bool readOK = true;
// Models ...
return readOK;
}
else
{
return false;
}
}
template<class BasePhaseSystem>
void Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::solve
(
@ -236,4 +216,34 @@ void Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::solve
}
template<class BasePhaseSystem>
void Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::correct()
{
BasePhaseSystem::correct();
forAll(populationBalances_, i)
{
populationBalances_[i].correct();
}
}
template<class BasePhaseSystem>
bool Foam::PopulationBalancePhaseSystem<BasePhaseSystem>::read()
{
if (BasePhaseSystem::read())
{
bool readOK = true;
// Read models ...
return readOK;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -97,15 +97,18 @@ public:
virtual autoPtr<phaseSystem::specieTransferTable>
specieTransfer() const;
//- Read base phaseProperties dictionary
virtual bool read();
//- Solve all population balance equations
virtual void solve
(
const PtrList<volScalarField>& rAUs,
const PtrList<surfaceScalarField>& rAUfs
);
//- Correct derived properties
virtual void correct();
//- Read base phaseProperties dictionary
virtual bool read();
};

View File

@ -196,7 +196,6 @@ void Foam::diameterModels::shapeModels::fractal::correct()
const sizeGroup& fi = sizeGroup_;
const phaseModel& phase = fi.phase();
const volScalarField& alpha = phase;
const volScalarField& rho = phase.thermo().rho();
const populationBalanceModel& popBal =
sizeGroup_.mesh().lookupObject<populationBalanceModel>
@ -204,32 +203,22 @@ void Foam::diameterModels::shapeModels::fractal::correct()
sizeGroup_.VelocityGroup().popBalName()
);
surfaceScalarField fAlphaRhoPhi
surfaceScalarField fAlphaPhi
(
"fAlphaRhoPhi",
max(fvc::interpolate(fi, "fi"), SMALL)*phase.alphaRhoPhi()
"fAlphaPhi",
max(fvc::interpolate(fi, "fi"), small)*phase.alphaPhi()
);
fvScalarMatrix kappaEqn
(
fvc::ddt(alpha, rho, fi)*kappa_.oldTime()
+ alpha*rho*fi*fvm::ddt(kappa_)
+ fvm::div(fAlphaRhoPhi, kappa_)
+ fvm::SuSp
(
fi
*(
fi.VelocityGroup().dmdt()
- (fvc::ddt(alpha, rho) + fvc::div(phase.alphaRhoPhi()))
),
kappa_
)
fvm::ddt(alpha, fi, kappa_)
+ fvm::div(fAlphaPhi, kappa_)
==
- sinteringModel_->R()
+ fvc::Su(Su_*rho, kappa_)
- fvm::SuSp(popBal.SuSp(fi.i()())*fi*rho, kappa_)
+ fvc::ddt(fi.phase().residualAlpha()*rho, kappa_)
- fvm::ddt(fi.phase().residualAlpha()*rho, kappa_)
+ Su_
- fvm::SuSp(popBal.SuSp(fi.i()())*fi, kappa_)
+ fvc::ddt(fi.phase().residualAlpha(), kappa_)
- fvm::ddt(fi.phase().residualAlpha(), kappa_)
);
kappaEqn.relax();

View File

@ -108,7 +108,6 @@ Foam::diameterModels::shapeModels::sinteringModels::KochFriedlander::R() const
const sizeGroup& fi = fractal_.SizeGroup();
const volScalarField& kappai = fractal_.fld();
const volScalarField& alpha = fi.phase();
const volScalarField& rho = fi.phase().thermo().rho();
volScalarField::Internal R
(
@ -119,14 +118,14 @@ Foam::diameterModels::shapeModels::sinteringModels::KochFriedlander::R() const
fi.mesh()
),
fi.mesh(),
dimensionedScalar(dimDensity/dimTime, 0)
dimensionedScalar(inv(dimTime), 0)
);
volScalarField::Internal tau(this->tau());
forAll(R, celli)
{
R[celli] = fi[celli]*alpha[celli]*rho[celli]/tau[celli];
R[celli] = fi[celli]*alpha[celli]/tau[celli];
}
return fvm::Sp(R, kappai) - 6.0/fi.dSph()*R;

View File

@ -135,27 +135,6 @@ void Foam::diameterModels::velocityGroup::scale()
}
Foam::tmp<Foam::fv::convectionScheme<Foam::scalar>>
Foam::diameterModels::velocityGroup::mvconvection() const
{
tmp<fv::convectionScheme<Foam::scalar>> mvConvection
(
fv::convectionScheme<Foam::scalar>::New
(
phase().mesh(),
fields_,
phase().alphaRhoPhi(),
phase().mesh().divScheme
(
"div(" + phase().alphaRhoPhi()().name() + ",f)"
)
)
);
return mvConvection;
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
@ -226,24 +205,8 @@ Foam::diameterModels::velocityGroup::velocityGroup
diameterProperties.lookup("sizeGroups"),
sizeGroup::iNew(phase, *this)
),
d_(dRef()),
dmdt_
(
IOobject
(
IOobject::groupName("source", phase.name()),
phase.time().timeName(),
phase.mesh()
),
phase.mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
)
d_(dRef())
{
forAll(sizeGroups_, i)
{
fields_.add(sizeGroups_[i]);
}
d_ = dsm();
}
@ -256,14 +219,13 @@ Foam::diameterModels::velocityGroup::~velocityGroup()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::velocityGroup::preSolve()
void Foam::diameterModels::velocityGroup::correct()
{
mvConvection_ = mvconvection();
}
forAll(sizeGroups_, i)
{
sizeGroups_[i].correct();
}
void Foam::diameterModels::velocityGroup::postSolve()
{
if
(
phase().mesh().solverDict(popBalName_).lookupOrDefault<Switch>

View File

@ -110,15 +110,6 @@ class velocityGroup
//- Sauter-mean diameter of the phase
volScalarField& d_;
//- Multivariate convection scheme
tmp<fv::convectionScheme<scalar>> mvConvection_;
//- Table of fields for multivariate convection
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields_;
//- Mass transfer rate
volScalarField dmdt_;
// Private Member Functions
@ -130,8 +121,6 @@ class velocityGroup
void scale();
tmp<Foam::fv::convectionScheme<Foam::scalar>> mvconvection() const;
protected:
@ -175,20 +164,8 @@ public:
//- Return sizeGroups belonging to this velocityGroup
inline const PtrList<sizeGroup>& sizeGroups() const;
//- Return const-reference to multivariate convectionScheme
inline const tmp<fv::convectionScheme<scalar>>& mvConvection() const;
//- Return const-reference to the mass transfer rate
inline const volScalarField& dmdt() const;
//- Return reference to the mass transfer rate
inline volScalarField& dmdtRef();
//- Corrections before populationBalanceModel::solve()
void preSolve();
//- Corrections after populationBalanceModel::solve()
void postSolve();
//- Correct the diameter field
virtual void correct();
//- Read diameterProperties dictionary
virtual bool read(const dictionary& diameterProperties);

View File

@ -46,24 +46,4 @@ Foam::diameterModels::velocityGroup::sizeGroups() const
}
inline const Foam::tmp<Foam::fv::convectionScheme<Foam::scalar>>&
Foam::diameterModels::velocityGroup::mvConvection() const
{
return mvConvection_;
}
inline const Foam::volScalarField& Foam::diameterModels::velocityGroup::
dmdt() const
{
return dmdt_;
}
inline Foam::volScalarField& Foam::diameterModels::velocityGroup::dmdtRef()
{
return dmdt_;
}
// ************************************************************************* //

View File

@ -104,7 +104,7 @@ addToBinaryBreakupRate
*exp(-sqrt(2.0)/pow3(fj.dSph()/L))
*6.0/pow(pi, 1.5)/pow3(fi.dSph()/L)
*exp(-9.0/4.0*sqr(log(pow(2.0, 0.4)*fi.dSph()/L)))
/max(1.0 + erf(1.5*log(pow(2.0, 1.0/15.0)*fj.dSph()/L)), SMALL)
/max(1.0 + erf(1.5*log(pow(2.0, 1.0/15.0)*fj.dSph()/L)), small)
/(T*pow3(L));
}

View File

@ -147,7 +147,7 @@ Foam::diameterModels::binaryBreakupModels::LuoSvendsen::LuoSvendsen
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::binaryBreakupModels::LuoSvendsen::correct()
void Foam::diameterModels::binaryBreakupModels::LuoSvendsen::precompute()
{
kolmogorovLengthScale_ =
pow025

View File

@ -202,8 +202,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to binary breakupRate
virtual void addToBinaryBreakupRate

View File

@ -78,7 +78,7 @@ Foam::diameterModels::binaryBreakupModel::binaryBreakupModel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::binaryBreakupModel::correct()
void Foam::diameterModels::binaryBreakupModel::precompute()
{}

View File

@ -135,8 +135,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to binary breakupRate
virtual void addToBinaryBreakupRate

View File

@ -81,7 +81,7 @@ Foam::diameterModels::breakupModel::breakupModel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::breakupModel::correct()
void Foam::diameterModels::breakupModel::precompute()
{}

View File

@ -159,8 +159,8 @@ public:
return dsd_;
}
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Set total breakupRate
virtual void setBreakupRate

View File

@ -86,7 +86,7 @@ BrownianCollisions
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::coalescenceModels::BrownianCollisions::correct()
void Foam::diameterModels::coalescenceModels::BrownianCollisions::precompute()
{
const volScalarField& T = popBal_.continuousPhase().thermo().T();
const volScalarField& p = popBal_.continuousPhase().thermo().p();

View File

@ -129,8 +129,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to coalescenceRate
virtual void addToCoalescenceRate

View File

@ -87,9 +87,9 @@ DahnekeInterpolation
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::coalescenceModels::DahnekeInterpolation::correct()
void Foam::diameterModels::coalescenceModels::DahnekeInterpolation::precompute()
{
Brownian_().correct();
Brownian_().precompute();
}

View File

@ -109,8 +109,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to coalescenceRate
virtual void addToCoalescenceRate

View File

@ -113,7 +113,7 @@ PrinceBlanch
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::coalescenceModels::PrinceBlanch::correct()
void Foam::diameterModels::coalescenceModels::PrinceBlanch::precompute()
{
if (laminarShear_)
{

View File

@ -203,8 +203,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to coalescenceRate
virtual void addToCoalescenceRate

View File

@ -78,7 +78,7 @@ Foam::diameterModels::coalescenceModel::coalescenceModel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::coalescenceModel::correct()
void Foam::diameterModels::coalescenceModel::precompute()
{}

View File

@ -133,8 +133,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to coalescenceRate
virtual void addToCoalescenceRate

View File

@ -114,7 +114,7 @@ Foam::diameterModels::daughterSizeDistributionModel::nik
}
void Foam::diameterModels::daughterSizeDistributionModel::correct()
void Foam::diameterModels::daughterSizeDistributionModel::precompute()
{
if (nik_.size() == 0)
{

View File

@ -122,8 +122,8 @@ public:
//- Return contribution to sizeGroup i due to breakup in sizeGroup k
const dimensionedScalar& nik(const label i, const label k) const;
//- Correct field independent expressions
void correct();
//- Precompute field independent expressions
void precompute();
//- Calculate contribution to sizeGroup i due to breakup in sizeGroup k
virtual dimensionedScalar calcNik

View File

@ -51,46 +51,19 @@ Foam::diameterModels::driftModels::constantDrift::constantDrift
)
:
driftModel(popBal, dict),
N_
(
IOobject
(
"N",
popBal.mesh().time().timeName(),
popBal.mesh()
),
popBal.mesh(),
dimensionedScalar(inv(dimVolume), Zero)
)
rate_("rate", dimVolume/dimTime, dict)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::driftModels::constantDrift::correct()
{
N_ = Zero;
forAll(popBal_.sizeGroups(), i)
{
const sizeGroup& fi = popBal_.sizeGroups()[i];
N_ += fi*fi.phase()/fi.x();
}
}
void Foam::diameterModels::driftModels::constantDrift::addToDriftRate
(
volScalarField& driftRate,
const label i
)
{
const sizeGroup& fi = popBal_.sizeGroups()[i];
phaseModel& phase = const_cast<phaseModel&>(fi.phase());
volScalarField& rho = phase.thermoRef().rho();
driftRate += (popBal_.fluid().fvOptions()(phase, rho)&rho)/(N_*rho);
driftRate += rate_;
}

View File

@ -24,9 +24,6 @@ License
Class
Foam::diameterModels::driftModels::constantDrift
Description
Constant drift rate within all classes computed from fvOptions mass source.
SourceFiles
constant.C
@ -56,8 +53,8 @@ class constantDrift
{
// Private Data
//- Total number concentration
volScalarField N_;
//- Drift rate
dimensionedScalar rate_;
public:
@ -81,9 +78,6 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Add to driftRate
virtual void addToDriftRate
(

View File

@ -27,7 +27,8 @@ License
#include "addToRunTimeSelectionTable.H"
#include "phaseSystem.H"
#include "fvcDdt.H"
#include "fvcGrad.H"
#include "fvcDiv.H"
#include "fvcSup.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -58,7 +59,6 @@ Foam::diameterModels::driftModels::densityChangeDrift::densityChangeDrift
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::driftModels::densityChangeDrift::addToDriftRate
(
volScalarField& driftRate,
@ -66,10 +66,16 @@ void Foam::diameterModels::driftModels::densityChangeDrift::addToDriftRate
)
{
const sizeGroup& fi = popBal_.sizeGroups()[i];
volScalarField& rho = const_cast<volScalarField&>(fi.phase().rho()());
const phaseModel& phase = fi.phase();
const volScalarField& alpha = phase;
const volScalarField& rho = phase.thermo().rho();
driftRate -= (fvc::ddt(rho) + (fvc::grad(rho)&popBal_.U()))
*popBal_.sizeGroups()[i].x()/rho;
driftRate -=
fi.x()/(rho*max(alpha, phase.residualAlpha()))
*(
fvc::ddt(alpha, rho) + fvc::div(phase.alphaRhoPhi())
- fvc::Sp(fvc::ddt(alpha) + fvc::div(phase.alphaPhi()), rho)
);
}

View File

@ -80,7 +80,7 @@ Foam::diameterModels::driftModel::driftModel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::driftModel::correct()
void Foam::diameterModels::driftModel::precompute()
{}

View File

@ -148,8 +148,8 @@ public:
return dict_;
}
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to driftRate
virtual void addToDriftRate

View File

@ -89,7 +89,7 @@ Foam::diameterModels::driftModels::phaseChange::phaseChange
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::driftModels::phaseChange::correct()
void Foam::diameterModels::driftModels::phaseChange::precompute()
{
const phaseSystem& fluid = popBal_.fluid();

View File

@ -98,8 +98,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to driftRate
virtual void addToDriftRate

View File

@ -1,113 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2020 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 "constantNucleation.H"
#include "phaseSystem.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace diameterModels
{
namespace nucleationModels
{
defineTypeNameAndDebug(constantNucleation, 0);
addToRunTimeSelectionTable
(
nucleationModel,
constantNucleation,
dictionary
);
}
}
}
using Foam::constant::mathematical::pi;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::diameterModels::nucleationModels::constantNucleation::
constantNucleation
(
const populationBalanceModel& popBal,
const dictionary& dict
)
:
nucleationModel(popBal, dict),
dNuc_("nucleationDiameter", dimLength, dict),
velGroup_
(
refCast<const velocityGroup>
(
popBal.mesh().lookupObject<phaseModel>
(
IOobject::groupName
(
"alpha",
dict.lookup("velocityGroup")
)
).dPtr()()
)
)
{
if
(
dNuc_.value() < velGroup_.sizeGroups().first().dSph().value()
|| dNuc_.value() > velGroup_.sizeGroups().last().dSph().value()
)
{
FatalIOErrorInFunction(dict)
<< "Nucleation diameter " << dNuc_.value() << "m outside of range ["
<< velGroup_.sizeGroups().first().dSph().value() << ", "
<< velGroup_.sizeGroups().last().dSph().value() << "]." << nl
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
Foam::diameterModels::nucleationModels::constantNucleation::addToNucleationRate
(
volScalarField& nucleationRate,
const label i
)
{
const sizeGroup& fi = popBal_.sizeGroups()[i];
phaseModel& phase = const_cast<phaseModel&>(fi.phase());
volScalarField& rho = phase.thermoRef().rho();
nucleationRate +=
popBal_.eta(i, pi/6.0*pow3(dNuc_))
*(popBal_.fluid().fvOptions()(phase, rho)&rho)/rho/fi.x();
}
// ************************************************************************* //

View File

@ -1,107 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2020 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/>.
Class
Foam::diameterModels::nucleationModels::constantNucleation
Description
Constant nucleation rate within all classes computed from fvOptions mass
source.
SourceFiles
constant.C
\*---------------------------------------------------------------------------*/
#ifndef constantNucleation_H
#define constantNucleation_H
#include "nucleationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace diameterModels
{
namespace nucleationModels
{
/*---------------------------------------------------------------------------*\
Class constantNucleation Declaration
\*---------------------------------------------------------------------------*/
class constantNucleation
:
public nucleationModel
{
// Private Data
//- Nucleation diameter
dimensionedScalar dNuc_;
//- Velocity group in which the nucleation occurs
const velocityGroup& velGroup_;
public:
//- Runtime type information
TypeName("constant");
// Constructor
constantNucleation
(
const populationBalanceModel& popBal,
const dictionary& dict
);
//- Destructor
virtual ~constantNucleation()
{}
// Member Functions
//- Add to nucleationRate
virtual void addToNucleationRate
(
volScalarField& nucleationRate,
const label i
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace nucleationModels
} // End namespace diameterModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -80,7 +80,7 @@ Foam::diameterModels::nucleationModel::nucleationModel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::nucleationModel::correct()
void Foam::diameterModels::nucleationModel::precompute()
{}

View File

@ -149,8 +149,8 @@ public:
}
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to nucleationRate
virtual void addToNucleationRate

View File

@ -77,7 +77,7 @@ wallBoiling
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::diameterModels::nucleationModels::wallBoiling::correct()
void Foam::diameterModels::nucleationModels::wallBoiling::precompute()
{
const volScalarField& alphat =
popBal_.mesh().lookupObject<volScalarField>

View File

@ -86,8 +86,8 @@ public:
// Member Functions
//- Correct diameter independent expressions
virtual void correct();
//- Precompute diameter independent expressions
virtual void precompute();
//- Add to nucleationRate
virtual void addToNucleationRate

View File

@ -31,11 +31,8 @@ License
#include "nucleationModel.H"
#include "phaseSystem.H"
#include "surfaceTensionModel.H"
#include "fvmDdt.H"
#include "fvm.H"
#include "fvcDdt.H"
#include "fvmSup.H"
#include "fvcSup.H"
#include "fvcDiv.H"
#include "phaseCompressibleMomentumTransportModel.H"
#include "shapeModel.H"
@ -227,40 +224,35 @@ void Foam::diameterModels::populationBalanceModel::createPhasePairs()
}
void Foam::diameterModels::populationBalanceModel::correct()
void Foam::diameterModels::populationBalanceModel::precompute()
{
calcDeltas();
forAll(velocityGroups_, v)
{
velocityGroups_[v].preSolve();
}
forAll(coalescence_, model)
{
coalescence_[model].correct();
coalescence_[model].precompute();
}
forAll(breakup_, model)
{
breakup_[model].correct();
breakup_[model].precompute();
breakup_[model].dsdPtr()().correct();
breakup_[model].dsdPtr()->precompute();
}
forAll(binaryBreakup_, model)
{
binaryBreakup_[model].correct();
binaryBreakup_[model].precompute();
}
forAll(drift_, model)
{
drift_[model].correct();
drift_[model].precompute();
}
forAll(nucleation_, model)
{
nucleation_[model].correct();
nucleation_[model].precompute();
}
}
@ -705,12 +697,9 @@ void Foam::diameterModels::populationBalanceModel::sources()
phasePairIter
)
{
pDmdt_(phasePairIter())->ref() = Zero;
*pDmdt_(phasePairIter()) = Zero;
}
// Since the calculation of the rates is computationally expensive,
// they are calculated once for each sizeGroup pair and inserted into source
// terms as required
forAll(sizeGroups_, i)
{
if (coalescence_.size() != 0)
@ -794,27 +783,6 @@ void Foam::diameterModels::populationBalanceModel::sources()
}
void Foam::diameterModels::populationBalanceModel::dmdt()
{
forAll(velocityGroups_, v)
{
velocityGroup& velGroup = velocityGroups_[v];
velGroup.dmdtRef() = Zero;
forAll(sizeGroups_, i)
{
if (&sizeGroups_[i].phase() == &velGroup.phase())
{
sizeGroup& fi = sizeGroups_[i];
velGroup.dmdtRef() += fi.phase().rho()*(Su_[i] - SuSp_[i]*fi);
}
}
}
}
void Foam::diameterModels::populationBalanceModel::calcAlphas()
{
alphas_() = Zero;
@ -1266,7 +1234,7 @@ void Foam::diameterModels::populationBalanceModel::solve()
if (nCorr > 0)
{
correct();
precompute();
}
int iCorr = 0;
@ -1283,7 +1251,6 @@ void Foam::diameterModels::populationBalanceModel::solve()
if (updateSources())
{
sources();
dmdt();
}
maxInitialResidual = 0;
@ -1298,53 +1265,27 @@ void Foam::diameterModels::populationBalanceModel::solve()
fvScalarMatrix sizeGroupEqn
(
fvm::ddt(alpha, rho, fi)
+ fi.VelocityGroup().mvConvection()->fvmDiv
(
phase.alphaRhoPhi(),
fi
)
+ fvm::SuSp
(
fi.VelocityGroup().dmdt()
- (fvc::ddt(alpha, rho) + fvc::div(phase.alphaRhoPhi())),
fi
)
==
fvc::Su(Su_[i]*rho, fi)
- fvm::SuSp(SuSp_[i]*rho, fi)
+ fvc::ddt(residualAlpha*rho, fi)
- fvm::ddt(residualAlpha*rho, fi)
fvm::ddt(alpha, fi)
+ fvm::div(phase.alphaPhi(), fi)
==
Su_[i]
- fvm::SuSp(SuSp_[i], fi)
+ fluid_.fvOptions()(alpha, rho, fi)/rho
+ fvc::ddt(residualAlpha, fi)
- fvm::ddt(residualAlpha, fi)
);
sizeGroupEqn.relax();
fluid_.fvOptions().constrain(sizeGroupEqn);
maxInitialResidual = max
(
sizeGroupEqn.solve().initialResidual(),
maxInitialResidual
);
}
}
if (nCorr > 0)
{
forAll(sizeGroups_, i)
{
sizeGroups_[i].correct();
fluid_.fvOptions().correct(fi);
}
forAll(velocityGroups_, i)
{
velocityGroups_[i].postSolve();
}
}
if (velocityGroups_.size() > 1)
{
calcAlphas();
dsm_() = calcDsm();
calcVelocity();
}
volScalarField fAlpha0
@ -1364,4 +1305,16 @@ void Foam::diameterModels::populationBalanceModel::solve()
}
}
void Foam::diameterModels::populationBalanceModel::correct()
{
if (velocityGroups_.size() > 1)
{
calcAlphas();
dsm_() = calcDsm();
calcVelocity();
}
}
// ************************************************************************* //

View File

@ -296,7 +296,7 @@ private:
void createPhasePairs();
void correct();
void precompute();
void birthByCoalescence(const label j, const label k);
@ -455,6 +455,9 @@ public:
//- Solve the population balance equation
void solve();
//- Correct derived quantities
void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,6 +0,0 @@
The cases contained in this directory can be used for testing the
populationBalanceModel class which is a part of the multiphaseEulerFoam framework.
They represent single-cell setups, i.e. they solve the population balance
equation without spatial transport. The cases can also be used to study the
influence of certain parameters on the form of the size distribution, before
running a simulation with spatial transport.

View File

@ -29,14 +29,9 @@ divSchemes
{
default none;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*)" Gauss vanLeer;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(k|epsilon|omega|f).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -29,14 +29,9 @@ divSchemes
{
default none;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*)" Gauss vanLeer;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(k|epsilon|omega|f).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -29,14 +29,9 @@ divSchemes
{
default none;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*)" Gauss vanLeer;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(k|epsilon|omega|f).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -101,7 +101,10 @@ populationBalanceCoeffs
driftModels
(
constant{}
constant
{
rate 1;
}
);
nucleationModels

View File

@ -29,14 +29,9 @@ divSchemes
{
default none;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*)" Gauss vanLeer;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(k|epsilon|omega|f).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -95,7 +95,10 @@ populationBalanceCoeffs
driftModels
(
constant{}
constant
{
rate -1;
}
);
nucleationModels

View File

@ -29,14 +29,9 @@ divSchemes
{
default none;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*)" Gauss vanLeer;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(k|epsilon|omega|f).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -29,14 +29,9 @@ divSchemes
{
default none;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*,alpha.*)" Gauss vanLeer;
"div\(phir,alpha.*)" Gauss vanLeer;
"div\(phi,alpha.*)" Gauss vanLeer;
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(k|epsilon|omega|f).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -37,7 +37,8 @@ divSchemes
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(h|e|f).*\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,(h|e).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,K.*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,p\)" Gauss limitedLinear 1;

View File

@ -38,7 +38,7 @@ divSchemes
"div\(alphaRhoPhi.*,Yi\)" Gauss linearUpwind limited;
"div\(alphaRhoPhi.*,(h|e).*\)" Gauss linearUpwind limited;
"div\(alphaRhoPhi.*,f.*\)" Gauss upwind;
"div\(alphaPhi.*,f.*\)" Gauss upwind;
"div\(alphaRhoPhi.*,K.*\)" Gauss linearUpwind limited;
"div\(alphaPhi.*,p\)" Gauss linearUpwind limited;
"div\(phi.*,kappai.*\)" Gauss linearUpwind limited;

View File

@ -38,7 +38,7 @@ divSchemes
"div\(alphaRhoPhi.*,Yi\)" Gauss linearUpwind limited;
"div\(alphaRhoPhi.*,(h|e).*\)" Gauss linearUpwind limited;
"div\(alphaRhoPhi.*,f.*\)" Gauss upwind;
"div\(alphaPhi.*,f.*\)" Gauss upwind;
"div\(alphaRhoPhi.*,K.*\)" Gauss linearUpwind limited;
"div\(alphaPhi.*,p\)" Gauss linearUpwind limited;
"div\(phi.*,kappai.*\)" Gauss linearUpwind limited;

View File

@ -36,9 +36,10 @@ divSchemes
"div\(alphaRhoPhi.*,U.*\)" Gauss limitedLinearV 1;
"div\(phi.*,U.*\)" Gauss limitedLinearV 1;
"div\(alphaRhoPhi.*,(h|e|f).*\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,K.*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,p\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,(h|e).*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,f.*\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,K.*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,p\)" Gauss limitedLinear 1;
"div\(\(\(\(alpha.*\*thermo:rho.*\)*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -41,8 +41,8 @@ divSchemes
"div\(alphaRhoPhi.*,Y.*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,p\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,f.*\)" Gauss upwind;
"div\(fAlphaRhoPhi.*,kappa.*\)" Gauss linearUpwind limited;
"div\(alphaPhi.*,f.*\)" Gauss upwind;
"div\(fAlphaPhi.*,kappa.*\)" Gauss linearUpwind limited;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}

View File

@ -41,8 +41,8 @@ divSchemes
"div\(alphaRhoPhi.*,Y.*\)" Gauss limitedLinear 1;
"div\(alphaPhi.*,p\)" Gauss limitedLinear 1;
"div\(alphaRhoPhi.*,f.*\)" Gauss upwind;
"div\(fAlphaRhoPhi.*,kappa.*\)" Gauss linearUpwind limited;
"div\(alphaPhi.*,f.*\)" Gauss upwind;
"div\(fAlphaPhi.*,kappa.*\)" Gauss linearUpwind limited;
"div\(\(\(\(alpha.*\*thermo:rho.*\)\*nuEff.*\)\*dev2\(T\(grad\(U.*\)\)\)\)\)" Gauss linear;
}