multiphaseEulerFoam: populationBalance: Revised algebraic operations
Field algebra has been optimised by careful ordering to minimise the number of expensive operations; e.g., changing a/b/c to a/(b*c) in order to minimise the number of divisions. Some minor consistency improvements have also been made throughout population balance. Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
This commit is contained in:
@ -184,8 +184,8 @@ Foam::diameterModels::shapeModels::fractal::dColl() const
|
||||
volScalarField& dColl = tDColl.ref();
|
||||
|
||||
dColl =
|
||||
6.0/kappa_
|
||||
*pow(sizeGroup_.x()*pow3(kappa_)/(36.0*pi*alphaC_), 1.0/Df_);
|
||||
6/kappa_
|
||||
*pow(sizeGroup_.x()*pow3(kappa_)/(36*pi*alphaC_), 1/Df_);
|
||||
|
||||
return tDColl;
|
||||
}
|
||||
@ -230,8 +230,8 @@ void Foam::diameterModels::shapeModels::fractal::correct()
|
||||
kappa_ =
|
||||
min
|
||||
(
|
||||
max(kappa_, 6.0/sizeGroup_.dSph()),
|
||||
6.0/popBal.sizeGroups().first().dSph()
|
||||
max(kappa_, 6/sizeGroup_.dSph()),
|
||||
6/popBal.sizeGroups().first().dSph()
|
||||
);
|
||||
|
||||
kappa_.correctBoundaryConditions();
|
||||
@ -283,7 +283,7 @@ void Foam::diameterModels::shapeModels::fractal::addDrift
|
||||
fu.shapeModelPtr()()
|
||||
);
|
||||
|
||||
volScalarField dp(6.0/sourceKappa);
|
||||
volScalarField dp(6/sourceKappa);
|
||||
const volScalarField a(sourceKappa*fu.x());
|
||||
const dimensionedScalar dv(sizeGroup_.x() - fu.x());
|
||||
|
||||
@ -292,18 +292,18 @@ void Foam::diameterModels::shapeModels::fractal::addDrift
|
||||
(2.0/3.0)*dv
|
||||
*(
|
||||
sourceKappa
|
||||
+ sourceShape.Df_*(1.0/sourceShape.d() - 1.0/dp)
|
||||
+ sourceShape.Df_*(1/sourceShape.d() - 1/dp)
|
||||
)
|
||||
);
|
||||
|
||||
dp += 6.0*(dv*a - fu.x()*da1)/sqr(a);
|
||||
dp += 6*(dv*a - fu.x()*da1)/sqr(a);
|
||||
|
||||
const volScalarField np(6.0*sizeGroup_.x()/pi/pow3(dp));
|
||||
const volScalarField dc(dp*pow(np/alphaC_, 1.0/Df_));
|
||||
const volScalarField np(6*sizeGroup_.x()/pi/pow3(dp));
|
||||
const volScalarField dc(dp*pow(np/alphaC_, 1/Df_));
|
||||
|
||||
const volScalarField da2
|
||||
(
|
||||
dv*(4.0/dp + 2.0*Df_/3.0*(1.0/dc - 1.0/dp))
|
||||
dv*(4/dp + 2*Df_/3*(1/dc - 1/dp))
|
||||
);
|
||||
|
||||
Su_ += (a + 0.5*da1 + 0.5*da2)/sizeGroup_.x()*Su;
|
||||
|
||||
@ -82,7 +82,7 @@ Foam::diameterModels::shapeModels::sinteringModels::KochFriedlander::tau() const
|
||||
(
|
||||
"tau",
|
||||
fractal_.SizeGroup().mesh(),
|
||||
dimensionedScalar(dimTime, 0.0)
|
||||
dimensionedScalar(dimTime, Zero)
|
||||
)
|
||||
);
|
||||
|
||||
@ -120,7 +120,7 @@ Foam::diameterModels::shapeModels::sinteringModels::KochFriedlander::R() const
|
||||
fi.mesh()
|
||||
),
|
||||
fi.mesh(),
|
||||
dimensionedScalar(inv(dimTime), 0)
|
||||
dimensionedScalar(inv(dimTime), Zero)
|
||||
);
|
||||
|
||||
volScalarField::Internal tau(this->tau());
|
||||
@ -130,7 +130,7 @@ Foam::diameterModels::shapeModels::sinteringModels::KochFriedlander::R() const
|
||||
R[celli] = fi[celli]*alpha[celli]/tau[celli];
|
||||
}
|
||||
|
||||
return fvm::Sp(R, kappai) - 6.0/fi.dSph()*R;
|
||||
return fvm::Sp(R, kappai) - 6/fi.dSph()*R;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -79,7 +79,7 @@ Foam::diameterModels::shapeModels::spherical::a() const
|
||||
(
|
||||
"a",
|
||||
sizeGroup_.mesh(),
|
||||
6.0/sizeGroup_.dSph()*sizeGroup_.x()
|
||||
6/sizeGroup_.dSph()*sizeGroup_.x()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ Foam::diameterModels::sizeGroup::sizeGroup
|
||||
phase_(phase),
|
||||
velocityGroup_(velocityGroup),
|
||||
dSph_("dSph", dimLength, dict),
|
||||
x_("x", pi/6.0*pow3(dSph_)),
|
||||
x_("x", pi/6*pow3(dSph_)),
|
||||
value_(dict.lookup<scalar>("value"))
|
||||
{
|
||||
// Adjust refValue at mixedFvPatchField boundaries
|
||||
|
||||
@ -64,7 +64,7 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::velocityGroup::dsm() const
|
||||
invDsm += fi.a()*fi/fi.x();
|
||||
}
|
||||
|
||||
return 6.0/tInvDsm;
|
||||
return 6/tInvDsm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -102,9 +102,9 @@ addToBinaryBreakupRate
|
||||
binaryBreakupRate +=
|
||||
0.5*pow(fj.dSph()/L, 5.0/3.0)
|
||||
*exp(-sqrt(2.0)/pow3(fj.dSph()/L))
|
||||
*6.0/pow(pi, 1.5)/pow3(fi.dSph()/L)
|
||||
*6/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 + erf(1.5*log(pow(2.0, 1.0/15.0)*fj.dSph()/L)), small)
|
||||
/(T*pow3(L));
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ Foam::diameterModels::binaryBreakupModels::LuoSvendsen::addToBinaryBreakupRate
|
||||
|
||||
const volScalarField b
|
||||
(
|
||||
12.0*cf*popBal_.sigmaWithContinuousPhase(fi.phase())
|
||||
12*cf*popBal_.sigmaWithContinuousPhase(fi.phase())
|
||||
/(
|
||||
beta_*continuousPhase.rho()*pow(fj.dSph(), 5.0/3.0)
|
||||
*pow(popBal_.continuousTurbulence().epsilon(), 2.0/3.0)
|
||||
@ -191,12 +191,12 @@ Foam::diameterModels::binaryBreakupModels::LuoSvendsen::addToBinaryBreakupRate
|
||||
|
||||
const volScalarField tMin(b/pow(xiMin, 11.0/3.0));
|
||||
|
||||
volScalarField integral(3.0/(11.0*pow(b, 8.0/11.0)));
|
||||
volScalarField integral(3/(11*pow(b, 8.0/11.0)));
|
||||
|
||||
forAll(integral, celli)
|
||||
{
|
||||
integral[celli] *=
|
||||
2.0*pow(b[celli], 3.0/11.0)*tgamma(5.0/11.0)
|
||||
2*pow(b[celli], 3.0/11.0)*tgamma(5.0/11.0)
|
||||
*(
|
||||
gammaUpperReg5by11_->value(b[celli])
|
||||
- gammaUpperReg5by11_->value(tMin[celli])
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,7 +74,7 @@ addToBinaryBreakupRate
|
||||
const sizeGroup& fj = popBal_.sizeGroups()[j];
|
||||
|
||||
binaryBreakupRate.primitiveFieldRef() +=
|
||||
pow(fj.x().value(), power_)*2.0/fj.x().value();
|
||||
pow(fj.x().value(), power_)*2/fj.x().value();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -95,11 +95,11 @@ addToCoalescenceRate
|
||||
);
|
||||
|
||||
coalescenceRate +=
|
||||
pi/4.0*sqr(fi.dSph() + fj.dSph())*min(uChar, uCrit_)
|
||||
pi/4*sqr(fi.dSph() + fj.dSph())*min(uChar, uCrit_)
|
||||
*exp
|
||||
(
|
||||
- sqr(cbrt(alphaMax_)
|
||||
/cbrt(max(popBal_.alphas(), fi.phase().residualAlpha())) - 1.0)
|
||||
/cbrt(max(popBal_.alphas(), fi.phase().residualAlpha())) - 1)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ Luo
|
||||
:
|
||||
coalescenceModel(popBal, dict),
|
||||
beta_(dimensionedScalar::lookupOrDefault("beta", dict, dimless, 2.05)),
|
||||
C1_(dimensionedScalar::lookupOrDefault("C1", dict, dimless, 1.0))
|
||||
C1_(dimensionedScalar::lookupOrDefault("C1", dict, dimless, 1))
|
||||
{}
|
||||
|
||||
|
||||
@ -102,18 +102,18 @@ addToCoalescenceRate
|
||||
(
|
||||
sqrt(beta_)
|
||||
*cbrt(popBal_.continuousTurbulence().epsilon()*fi.dSph())
|
||||
*sqrt(1.0 + pow(xi, -2.0/3.0))
|
||||
*sqrt(1 + pow(xi, -2.0/3.0))
|
||||
);
|
||||
|
||||
coalescenceRate +=
|
||||
pi/4.0*sqr(fi.dSph() + fj.dSph())*uij
|
||||
pi/4*sqr(fi.dSph() + fj.dSph())*uij
|
||||
*exp
|
||||
(
|
||||
- C1_
|
||||
*sqrt(0.75*(1.0 + sqr(xi))*(1.0 + pow3(xi)))
|
||||
*sqrt(0.75*(1 + sqr(xi))*(1 + pow3(xi)))
|
||||
/(
|
||||
sqrt(fi.phase().rho()/continuousPhase.rho()
|
||||
+ vm.Cvm())*pow3(1.0 + xi)
|
||||
+ vm.Cvm())*pow3(1 + xi)
|
||||
)
|
||||
*sqrt
|
||||
(
|
||||
|
||||
@ -115,7 +115,7 @@ LaakkonenDaughterSizeDistribution::calcNik
|
||||
|
||||
if (k == 0)
|
||||
{
|
||||
return 1.0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@ -85,7 +85,7 @@ Foam::diameterModels::daughterSizeDistributionModels::uniformBinary::calcNik
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
return 1.0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (sizeGroups[i+1].x() - xi)/(xk - x0);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -139,7 +139,7 @@ Foam::diameterModels::nucleationModels::reactionDriven::addToNucleationRate
|
||||
velGroup_.phase().name() == pair_.first() ? +1 : -1;
|
||||
|
||||
nucleationRate +=
|
||||
popBal_.eta(i, pi/6.0*pow3(dNuc_))*dmidtfSign*dmidtf/rho/fi.x();
|
||||
popBal_.eta(i, pi/6*pow3(dNuc_))*dmidtfSign*dmidtf/rho/fi.x();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ Foam::diameterModels::nucleationModels::wallBoiling::addToNucleationRate
|
||||
|
||||
const labelList& faceCells = alphatw.patch().faceCells();
|
||||
|
||||
dimensionedScalar unitLength("unitLength", dimLength, 1.0);
|
||||
dimensionedScalar unitLength("unitLength", dimLength, 1);
|
||||
|
||||
forAll(alphatw, facei)
|
||||
{
|
||||
|
||||
@ -88,9 +88,9 @@ void Foam::diameterModels::populationBalanceModel::registerSizeGroups
|
||||
{
|
||||
if
|
||||
(
|
||||
sizeGroups_.size() != 0
|
||||
sizeGroups().size() != 0
|
||||
&&
|
||||
group.x().value() <= sizeGroups_.last().x().value()
|
||||
group.x().value() <= sizeGroups().last().x().value()
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -99,53 +99,44 @@ void Foam::diameterModels::populationBalanceModel::registerSizeGroups
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
sizeGroups_.resize(sizeGroups_.size() + 1);
|
||||
sizeGroups_.set(sizeGroups_.size() - 1, &group);
|
||||
sizeGroups_.resize(sizeGroups().size() + 1);
|
||||
sizeGroups_.set(sizeGroups().size() - 1, &group);
|
||||
|
||||
// Grid generation over property space
|
||||
if (sizeGroups_.size() == 1)
|
||||
if (sizeGroups().size() == 1)
|
||||
{
|
||||
// Set the first sizeGroup boundary to the representative value of
|
||||
// the first sizeGroup
|
||||
v_.append
|
||||
(
|
||||
new dimensionedScalar
|
||||
(
|
||||
"v",
|
||||
sizeGroups_.last().x()
|
||||
sizeGroups().last().x()
|
||||
)
|
||||
);
|
||||
|
||||
// Set the last sizeGroup boundary to the representative size of the
|
||||
// last sizeGroup
|
||||
v_.append
|
||||
(
|
||||
new dimensionedScalar
|
||||
(
|
||||
"v",
|
||||
sizeGroups_.last().x()
|
||||
sizeGroups().last().x()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Overwrite the next-to-last sizeGroup boundary to lie halfway between
|
||||
// the last two sizeGroups
|
||||
v_.last() =
|
||||
0.5
|
||||
*(
|
||||
sizeGroups_[sizeGroups_.size()-2].x()
|
||||
+ sizeGroups_.last().x()
|
||||
sizeGroups()[sizeGroups().size()-2].x()
|
||||
+ sizeGroups().last().x()
|
||||
);
|
||||
|
||||
// Set the last sizeGroup boundary to the representative size of the
|
||||
// last sizeGroup
|
||||
v_.append
|
||||
(
|
||||
new dimensionedScalar
|
||||
(
|
||||
"v",
|
||||
sizeGroups_.last().x()
|
||||
sizeGroups().last().x()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -228,21 +219,21 @@ void Foam::diameterModels::populationBalanceModel::precompute()
|
||||
{
|
||||
calcDeltas();
|
||||
|
||||
forAll(coalescence_, model)
|
||||
forAll(coalescenceModels_, model)
|
||||
{
|
||||
coalescence_[model].precompute();
|
||||
coalescenceModels_[model].precompute();
|
||||
}
|
||||
|
||||
forAll(breakup_, model)
|
||||
forAll(breakupModels_, model)
|
||||
{
|
||||
breakup_[model].precompute();
|
||||
breakupModels_[model].precompute();
|
||||
|
||||
breakup_[model].dsdPtr()->precompute();
|
||||
breakupModels_[model].dsdPtr()->precompute();
|
||||
}
|
||||
|
||||
forAll(binaryBreakup_, model)
|
||||
forAll(binaryBreakupModels_, model)
|
||||
{
|
||||
binaryBreakup_[model].precompute();
|
||||
binaryBreakupModels_[model].precompute();
|
||||
}
|
||||
|
||||
forAll(drift_, model)
|
||||
@ -264,35 +255,31 @@ birthByCoalescence
|
||||
const label k
|
||||
)
|
||||
{
|
||||
const sizeGroup& fj = sizeGroups_[j];
|
||||
const sizeGroup& fk = sizeGroups_[k];
|
||||
const sizeGroup& fj = sizeGroups()[j];
|
||||
const sizeGroup& fk = sizeGroups()[k];
|
||||
|
||||
dimensionedScalar Eta;
|
||||
dimensionedScalar v = fj.x() + fk.x();
|
||||
|
||||
for (label i = j; i < sizeGroups_.size(); i++)
|
||||
for (label i = j; i < sizeGroups().size(); i++)
|
||||
{
|
||||
// Calculate fraction for intra-interval events
|
||||
Eta = eta(i, v);
|
||||
|
||||
if (Eta.value() == 0) continue;
|
||||
|
||||
const sizeGroup& fi = sizeGroups_[i];
|
||||
const sizeGroup& fi = sizeGroups()[i];
|
||||
|
||||
// Avoid double counting of events
|
||||
if (j == k)
|
||||
{
|
||||
Sui_ =
|
||||
0.5*fi.x()*coalescenceRate_()*Eta
|
||||
*fj*fj.phase()/fj.x()
|
||||
*fk*fk.phase()/fk.x();
|
||||
0.5*fi.x()/(fj.x()*fk.x())*Eta
|
||||
*coalescenceRate_()*fj*fj.phase()*fk*fk.phase();
|
||||
}
|
||||
else
|
||||
{
|
||||
Sui_ =
|
||||
fi.x()*coalescenceRate_()*Eta
|
||||
*fj*fj.phase()/fj.x()
|
||||
*fk*fk.phase()/fk.x();
|
||||
fi.x()/(fj.x()*fk.x())*Eta
|
||||
*coalescenceRate_()*fj*fj.phase()*fk*fk.phase();
|
||||
}
|
||||
|
||||
Su_[i] += Sui_;
|
||||
@ -310,7 +297,7 @@ birthByCoalescence
|
||||
Pair<word>::compare(pDmdt_.find(pairij).key(), pairij)
|
||||
);
|
||||
|
||||
*pDmdt_[pairij] += dmdtSign*fj.x()/v*Sui_*fi.phase().rho();
|
||||
*pDmdt_[pairij] += dmdtSign*fj.x()/v*Sui_*fj.phase().rho();
|
||||
}
|
||||
|
||||
const phasePairKey pairik
|
||||
@ -326,7 +313,7 @@ birthByCoalescence
|
||||
Pair<word>::compare(pDmdt_.find(pairik).key(), pairik)
|
||||
);
|
||||
|
||||
*pDmdt_[pairik] += dmdtSign*fk.x()/v*Sui_*fi.phase().rho();
|
||||
*pDmdt_[pairik] += dmdtSign*fk.x()/v*Sui_*fk.phase().rho();
|
||||
}
|
||||
|
||||
sizeGroups_[i].shapeModelPtr()->addCoalescence(Sui_, fj, fk);
|
||||
@ -341,8 +328,8 @@ deathByCoalescence
|
||||
const label j
|
||||
)
|
||||
{
|
||||
const sizeGroup& fi = sizeGroups_[i];
|
||||
const sizeGroup& fj = sizeGroups_[j];
|
||||
const sizeGroup& fi = sizeGroups()[i];
|
||||
const sizeGroup& fj = sizeGroups()[j];
|
||||
|
||||
Sp_[i] += coalescenceRate_()*fi.phase()*fj*fj.phase()/fj.x();
|
||||
|
||||
@ -360,15 +347,15 @@ birthByBreakup
|
||||
const label model
|
||||
)
|
||||
{
|
||||
const sizeGroup& fk = sizeGroups_[k];
|
||||
const sizeGroup& fk = sizeGroups()[k];
|
||||
|
||||
for (label i = 0; i <= k; i++)
|
||||
{
|
||||
const sizeGroup& fi = sizeGroups_[i];
|
||||
const sizeGroup& fi = sizeGroups()[i];
|
||||
|
||||
Sui_ =
|
||||
fi.x()*breakupRate_()*breakup_[model].dsdPtr()().nik(i, k)
|
||||
*fk*fk.phase()/fk.x();
|
||||
fi.x()*breakupModels_[model].dsdPtr()().nik(i, k)/fk.x()
|
||||
*breakupRate_()*fk*fk.phase();
|
||||
|
||||
Su_[i] += Sui_;
|
||||
|
||||
@ -385,7 +372,7 @@ birthByBreakup
|
||||
Pair<word>::compare(pDmdt_.find(pair).key(), pair)
|
||||
);
|
||||
|
||||
*pDmdt_[pair] += dmdtSign*Sui_*fi.phase().rho();
|
||||
*pDmdt_[pair] += dmdtSign*Sui_*fk.phase().rho();
|
||||
}
|
||||
|
||||
sizeGroups_[i].shapeModelPtr()->addBreakup(Sui_, fk);
|
||||
@ -395,20 +382,20 @@ birthByBreakup
|
||||
|
||||
void Foam::diameterModels::populationBalanceModel::deathByBreakup(const label i)
|
||||
{
|
||||
const sizeGroup& fi = sizeGroups_[i];
|
||||
|
||||
Sp_[i] += breakupRate_()*fi.phase();
|
||||
Sp_[i] += breakupRate_()*sizeGroups()[i].phase();
|
||||
}
|
||||
|
||||
|
||||
void Foam::diameterModels::populationBalanceModel::calcDeltas()
|
||||
{
|
||||
forAll(sizeGroups_, i)
|
||||
forAll(sizeGroups(), i)
|
||||
{
|
||||
if (delta_[i].empty())
|
||||
{
|
||||
for (label j = 0; j <= sizeGroups_.size() - 1; j++)
|
||||
for (label j = 0; j <= sizeGroups().size() - 1; j++)
|
||||
{
|
||||
const sizeGroup& fj = sizeGroups()[j];
|
||||
|
||||
delta_[i].append
|
||||
(
|
||||
new dimensionedScalar
|
||||
@ -421,14 +408,14 @@ void Foam::diameterModels::populationBalanceModel::calcDeltas()
|
||||
|
||||
if
|
||||
(
|
||||
v_[i].value() < 0.5*sizeGroups_[j].x().value()
|
||||
v_[i].value() < 0.5*fj.x().value()
|
||||
&&
|
||||
0.5*sizeGroups_[j].x().value() < v_[i+1].value()
|
||||
0.5*fj.x().value() < v_[i+1].value()
|
||||
)
|
||||
{
|
||||
delta_[i][j] = mag(0.5*sizeGroups_[j].x() - v_[i]);
|
||||
delta_[i][j] = mag(0.5*fj.x() - v_[i]);
|
||||
}
|
||||
else if (0.5*sizeGroups_[j].x().value() <= v_[i].value())
|
||||
else if (0.5*fj.x().value() <= v_[i].value())
|
||||
{
|
||||
delta_[i][j].value() = 0;
|
||||
}
|
||||
@ -445,10 +432,12 @@ birthByBinaryBreakup
|
||||
const label j
|
||||
)
|
||||
{
|
||||
const sizeGroup& fj = sizeGroups_[j];
|
||||
const sizeGroup& fi = sizeGroups_[i];
|
||||
const sizeGroup& fi = sizeGroups()[i];
|
||||
const sizeGroup& fj = sizeGroups()[j];
|
||||
|
||||
Sui_ = fi.x()*binaryBreakupRate_()*delta_[i][j]*fj*fj.phase()/fj.x();
|
||||
const volScalarField Su(binaryBreakupRate_()*fj*fj.phase());
|
||||
|
||||
Sui_ = fi.x()*delta_[i][j]/fj.x()*Su;
|
||||
|
||||
Su_[i] += Sui_;
|
||||
|
||||
@ -467,7 +456,7 @@ birthByBinaryBreakup
|
||||
Pair<word>::compare(pDmdt_.find(pairij).key(), pairij)
|
||||
);
|
||||
|
||||
*pDmdt_[pairij] += dmdtSign*Sui_*fi.phase().rho();
|
||||
*pDmdt_[pairij] += dmdtSign*Sui_*fj.phase().rho();
|
||||
}
|
||||
|
||||
dimensionedScalar Eta;
|
||||
@ -475,18 +464,15 @@ birthByBinaryBreakup
|
||||
|
||||
for (label k = 0; k <= j; k++)
|
||||
{
|
||||
// Calculate fraction for intra-interval events
|
||||
Eta = eta(k, v);
|
||||
|
||||
if (Eta.value() == 0) continue;
|
||||
|
||||
const sizeGroup& fk = sizeGroups_[k];
|
||||
const sizeGroup& fk = sizeGroups()[k];
|
||||
|
||||
volScalarField& Suk = Sui_;
|
||||
|
||||
Suk =
|
||||
sizeGroups_[k].x()*binaryBreakupRate_()*delta_[i][j]*Eta
|
||||
*fj*fj.phase()/fj.x();
|
||||
Suk = fk.x()*delta_[i][j]*Eta/fj.x()*Su;
|
||||
|
||||
Su_[k] += Suk;
|
||||
|
||||
@ -507,10 +493,10 @@ birthByBinaryBreakup
|
||||
)
|
||||
);
|
||||
|
||||
*pDmdt_[pairkj] += dmdtSign*Suk*fi.phase().rho();
|
||||
*pDmdt_[pairkj] += dmdtSign*Suk*fj.phase().rho();
|
||||
}
|
||||
|
||||
sizeGroups_[i].shapeModelPtr()->addBreakup(Suk, fj);
|
||||
sizeGroups_[k].shapeModelPtr()->addBreakup(Suk, fj);
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,9 +508,7 @@ deathByBinaryBreakup
|
||||
const label i
|
||||
)
|
||||
{
|
||||
const volScalarField& alphai = sizeGroups_[i].phase();
|
||||
|
||||
Sp_[i] += alphai*binaryBreakupRate_()*delta_[j][i];
|
||||
Sp_[i] += sizeGroups()[i].phase()*binaryBreakupRate_()*delta_[j][i];
|
||||
}
|
||||
|
||||
|
||||
@ -621,11 +605,11 @@ nucleation
|
||||
nucleationModel& model
|
||||
)
|
||||
{
|
||||
const sizeGroup& fi = sizeGroups_[i];
|
||||
const sizeGroup& fi = sizeGroups()[i];
|
||||
|
||||
model.addToNucleationRate(nucleationRate_(), i);
|
||||
|
||||
Sui_ = sizeGroups_[i].x()*nucleationRate_();
|
||||
Sui_ = fi.x()*nucleationRate_();
|
||||
|
||||
Su_[i] += Sui_;
|
||||
|
||||
@ -635,7 +619,7 @@ nucleation
|
||||
|
||||
void Foam::diameterModels::populationBalanceModel::sources()
|
||||
{
|
||||
forAll(sizeGroups_, i)
|
||||
forAll(sizeGroups(), i)
|
||||
{
|
||||
sizeGroups_[i].shapeModelPtr()->reset();
|
||||
Su_[i] = Zero;
|
||||
@ -654,15 +638,15 @@ void Foam::diameterModels::populationBalanceModel::sources()
|
||||
|
||||
forAll(sizeGroups_, i)
|
||||
{
|
||||
if (coalescence_.size() != 0)
|
||||
if (coalescenceModels_.size() != 0)
|
||||
{
|
||||
for (label j = 0; j <= i; j++)
|
||||
{
|
||||
coalescenceRate_() = Zero;
|
||||
|
||||
forAll(coalescence_, model)
|
||||
forAll(coalescenceModels_, model)
|
||||
{
|
||||
coalescence_[model].addToCoalescenceRate
|
||||
coalescenceModels_[model].addToCoalescenceRate
|
||||
(
|
||||
coalescenceRate_(),
|
||||
i,
|
||||
@ -676,11 +660,11 @@ void Foam::diameterModels::populationBalanceModel::sources()
|
||||
}
|
||||
}
|
||||
|
||||
if (breakup_.size() != 0)
|
||||
if (breakupModels_.size() != 0)
|
||||
{
|
||||
forAll(breakup_, model)
|
||||
forAll(breakupModels_, model)
|
||||
{
|
||||
breakup_[model].setBreakupRate(breakupRate_(), i);
|
||||
breakupModels_[model].setBreakupRate(breakupRate_(), i);
|
||||
|
||||
birthByBreakup(i, model);
|
||||
|
||||
@ -688,7 +672,7 @@ void Foam::diameterModels::populationBalanceModel::sources()
|
||||
}
|
||||
}
|
||||
|
||||
if (binaryBreakup_.size() != 0)
|
||||
if (binaryBreakupModels_.size() != 0)
|
||||
{
|
||||
label j = 0;
|
||||
|
||||
@ -696,9 +680,9 @@ void Foam::diameterModels::populationBalanceModel::sources()
|
||||
{
|
||||
binaryBreakupRate_() = Zero;
|
||||
|
||||
forAll(binaryBreakup_, model)
|
||||
forAll(binaryBreakupModels_, model)
|
||||
{
|
||||
binaryBreakup_[model].addToBinaryBreakupRate
|
||||
binaryBreakupModels_[model].addToBinaryBreakupRate
|
||||
(
|
||||
binaryBreakupRate_(),
|
||||
j,
|
||||
@ -770,7 +754,7 @@ Foam::diameterModels::populationBalanceModel::calcDsm()
|
||||
invDsm += max(phase, phase.residualAlpha())/(phase.d()*alphas_());
|
||||
}
|
||||
|
||||
return 1.0/tInvDsm;
|
||||
return 1/tInvDsm;
|
||||
}
|
||||
|
||||
|
||||
@ -847,19 +831,19 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
|
||||
mesh_,
|
||||
dimensionedScalar(inv(dimTime), Zero)
|
||||
),
|
||||
coalescence_
|
||||
coalescenceModels_
|
||||
(
|
||||
dict_.lookup("coalescenceModels"),
|
||||
coalescenceModel::iNew(*this)
|
||||
),
|
||||
coalescenceRate_(),
|
||||
breakup_
|
||||
breakupModels_
|
||||
(
|
||||
dict_.lookup("breakupModels"),
|
||||
breakupModel::iNew(*this)
|
||||
),
|
||||
breakupRate_(),
|
||||
binaryBreakup_
|
||||
binaryBreakupModels_
|
||||
(
|
||||
dict_.lookup("binaryBreakupModels"),
|
||||
binaryBreakupModel::iNew(*this)
|
||||
@ -886,7 +870,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
|
||||
|
||||
this->createPhasePairs();
|
||||
|
||||
if (sizeGroups_.size() < 3)
|
||||
if (sizeGroups().size() < 3)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "The populationBalance " << name_
|
||||
@ -895,7 +879,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
|
||||
}
|
||||
|
||||
|
||||
if (coalescence_.size() != 0)
|
||||
if (coalescenceModels_.size() != 0)
|
||||
{
|
||||
coalescenceRate_.set
|
||||
(
|
||||
@ -913,7 +897,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
|
||||
);
|
||||
}
|
||||
|
||||
if (breakup_.size() != 0)
|
||||
if (breakupModels_.size() != 0)
|
||||
{
|
||||
breakupRate_.set
|
||||
(
|
||||
@ -931,7 +915,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
|
||||
);
|
||||
}
|
||||
|
||||
if (binaryBreakup_.size() != 0)
|
||||
if (binaryBreakupModels_.size() != 0)
|
||||
{
|
||||
binaryBreakupRate_.set
|
||||
(
|
||||
@ -1078,17 +1062,17 @@ Foam::diameterModels::populationBalanceModel::eta
|
||||
const dimensionedScalar& v
|
||||
) const
|
||||
{
|
||||
const dimensionedScalar& x0 = sizeGroups_[0].x();
|
||||
const dimensionedScalar& xi = sizeGroups_[i].x();
|
||||
const dimensionedScalar& xm = sizeGroups_.last().x();
|
||||
const dimensionedScalar& x0 = sizeGroups()[0].x();
|
||||
const dimensionedScalar& xi = sizeGroups()[i].x();
|
||||
const dimensionedScalar& xm = sizeGroups().last().x();
|
||||
dimensionedScalar lowerBoundary(x0);
|
||||
dimensionedScalar upperBoundary(xm);
|
||||
|
||||
if (i != 0) lowerBoundary = sizeGroups_[i-1].x();
|
||||
if (i != 0) lowerBoundary = sizeGroups()[i-1].x();
|
||||
|
||||
if (i != sizeGroups_.size() - 1) upperBoundary = sizeGroups_[i+1].x();
|
||||
if (i != sizeGroups().size() - 1) upperBoundary = sizeGroups()[i+1].x();
|
||||
|
||||
if ((i == 0 && v < x0) || (i == sizeGroups_.size() - 1 && v > xm))
|
||||
if ((i == 0 && v < x0) || (i == sizeGroups().size() - 1 && v > xm))
|
||||
{
|
||||
return v/xi;
|
||||
}
|
||||
@ -1098,7 +1082,7 @@ Foam::diameterModels::populationBalanceModel::eta
|
||||
}
|
||||
else if (v.value() == xi.value())
|
||||
{
|
||||
return 1.0;
|
||||
return 1;
|
||||
}
|
||||
else if (v > xi)
|
||||
{
|
||||
@ -1175,7 +1159,7 @@ void Foam::diameterModels::populationBalanceModel::solve()
|
||||
|
||||
maxInitialResidual = 0;
|
||||
|
||||
forAll(sizeGroups_, i)
|
||||
forAll(sizeGroups(), i)
|
||||
{
|
||||
sizeGroup& fi = sizeGroups_[i];
|
||||
const phaseModel& phase = fi.phase();
|
||||
@ -1210,12 +1194,12 @@ void Foam::diameterModels::populationBalanceModel::solve()
|
||||
|
||||
volScalarField fAlpha0
|
||||
(
|
||||
sizeGroups_.first()*sizeGroups_.first().phase()
|
||||
sizeGroups().first()*sizeGroups().first().phase()
|
||||
);
|
||||
|
||||
volScalarField fAlphaN
|
||||
(
|
||||
sizeGroups_.last()*sizeGroups_.last().phase()
|
||||
sizeGroups().last()*sizeGroups().last().phase()
|
||||
);
|
||||
|
||||
Info<< this->name() << " sizeGroup phase fraction first, last = "
|
||||
|
||||
@ -53,7 +53,7 @@ Description
|
||||
\verbatim
|
||||
Coalescence and breakup term formulation:
|
||||
Kumar, S., & Ramkrishna, D. (1996).
|
||||
On the solution of population balance equations by discretisation-I. A
|
||||
On the solution of population balance equations by discretization-I. A
|
||||
fixed pivot technique.
|
||||
Chemical Engineering Science, 51(8), 1311-1332.
|
||||
\endverbatim
|
||||
@ -240,19 +240,19 @@ private:
|
||||
volScalarField Sui_;
|
||||
|
||||
//- Coalescence models
|
||||
PtrList<coalescenceModel> coalescence_;
|
||||
PtrList<coalescenceModel> coalescenceModels_;
|
||||
|
||||
//- Coalescence rate
|
||||
autoPtr<volScalarField> coalescenceRate_;
|
||||
|
||||
//- BreakupModels
|
||||
PtrList<breakupModel> breakup_;
|
||||
//- Breakup models
|
||||
PtrList<breakupModel> breakupModels_;
|
||||
|
||||
//- Breakup rate
|
||||
autoPtr<volScalarField> breakupRate_;
|
||||
|
||||
//- Binary breakup models
|
||||
PtrList<binaryBreakupModel> binaryBreakup_;
|
||||
PtrList<binaryBreakupModel> binaryBreakupModels_;
|
||||
|
||||
//- Binary breakup rate
|
||||
autoPtr<volScalarField> binaryBreakupRate_;
|
||||
@ -420,9 +420,6 @@ public:
|
||||
// belong to this populationBalance
|
||||
inline bool isVelocityGroupPair(const phasePair& pair) const;
|
||||
|
||||
//- Return the sizeGroup boundaries
|
||||
inline const PtrList<dimensionedScalar>& v() const;
|
||||
|
||||
//- Return total void of phases belonging to this populationBalance
|
||||
inline const volScalarField& alphas() const;
|
||||
|
||||
|
||||
@ -123,13 +123,6 @@ inline bool Foam::diameterModels::populationBalanceModel::isVelocityGroupPair
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::PtrList<Foam::dimensionedScalar>&
|
||||
Foam::diameterModels::populationBalanceModel::v() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::volScalarField&
|
||||
Foam::diameterModels::populationBalanceModel::alphas() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user