multiphaseEulerFoam: populationBalance: Store coalescence and breakup pair indexing

Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
This commit is contained in:
Will Bainbridge
2021-06-08 09:03:33 +01:00
parent 3f9435fb18
commit bc844c383c
3 changed files with 138 additions and 107 deletions

View File

@ -217,8 +217,6 @@ void Foam::diameterModels::populationBalanceModel::createPhasePairs()
void Foam::diameterModels::populationBalanceModel::precompute()
{
calcDeltas();
forAll(coalescenceModels_, model)
{
coalescenceModels_[model].precompute();
@ -248,8 +246,7 @@ void Foam::diameterModels::populationBalanceModel::precompute()
}
void Foam::diameterModels::populationBalanceModel::
birthByCoalescence
void Foam::diameterModels::populationBalanceModel::birthByCoalescence
(
const label j,
const label k
@ -321,8 +318,7 @@ birthByCoalescence
}
void Foam::diameterModels::populationBalanceModel::
deathByCoalescence
void Foam::diameterModels::populationBalanceModel::deathByCoalescence
(
const label i,
const label j
@ -340,8 +336,7 @@ deathByCoalescence
}
void Foam::diameterModels::populationBalanceModel::
birthByBreakup
void Foam::diameterModels::populationBalanceModel::birthByBreakup
(
const label k,
const label model
@ -425,8 +420,7 @@ void Foam::diameterModels::populationBalanceModel::calcDeltas()
}
void Foam::diameterModels::populationBalanceModel::
birthByBinaryBreakup
void Foam::diameterModels::populationBalanceModel::birthByBinaryBreakup
(
const label i,
const label j
@ -501,8 +495,7 @@ birthByBinaryBreakup
}
void Foam::diameterModels::populationBalanceModel::
deathByBinaryBreakup
void Foam::diameterModels::populationBalanceModel::deathByBinaryBreakup
(
const label j,
const label i
@ -598,8 +591,7 @@ void Foam::diameterModels::populationBalanceModel::drift
}
void Foam::diameterModels::populationBalanceModel::
nucleation
void Foam::diameterModels::populationBalanceModel::nucleation
(
const label i,
nucleationModel& model
@ -636,84 +628,73 @@ void Foam::diameterModels::populationBalanceModel::sources()
*pDmdt_(phasePairIter()) = Zero;
}
forAll(sizeGroups_, i)
forAll(coalescencePairs_, coalescencePairi)
{
if (coalescenceModels_.size() != 0)
label i = coalescencePairs_[coalescencePairi].first();
label j = coalescencePairs_[coalescencePairi].second();
coalescenceRate_() = Zero;
forAll(coalescenceModels_, model)
{
for (label j = 0; j <= i; j++)
{
coalescenceRate_() = Zero;
forAll(coalescenceModels_, model)
{
coalescenceModels_[model].addToCoalescenceRate
(
coalescenceRate_(),
i,
j
);
}
birthByCoalescence(i, j);
deathByCoalescence(i, j);
}
coalescenceModels_[model].addToCoalescenceRate
(
coalescenceRate_(),
i,
j
);
}
if (breakupModels_.size() != 0)
birthByCoalescence(i, j);
deathByCoalescence(i, j);
}
forAll(binaryBreakupPairs_, binaryBreakupPairi)
{
label i = binaryBreakupPairs_[binaryBreakupPairi].first();
label j = binaryBreakupPairs_[binaryBreakupPairi].second();
binaryBreakupRate_() = Zero;
forAll(binaryBreakupModels_, model)
{
forAll(breakupModels_, model)
{
breakupModels_[model].setBreakupRate(breakupRate_(), i);
birthByBreakup(i, model);
deathByBreakup(i);
}
binaryBreakupModels_[model].addToBinaryBreakupRate
(
binaryBreakupRate_(),
j,
i
);
}
if (binaryBreakupModels_.size() != 0)
birthByBinaryBreakup(j, i);
deathByBinaryBreakup(j, i);
}
forAll(sizeGroups(), i)
{
forAll(breakupModels_, model)
{
label j = 0;
breakupModels_[model].setBreakupRate(breakupRate_(), i);
while (delta_[j][i].value() != 0)
{
binaryBreakupRate_() = Zero;
birthByBreakup(i, model);
forAll(binaryBreakupModels_, model)
{
binaryBreakupModels_[model].addToBinaryBreakupRate
(
binaryBreakupRate_(),
j,
i
);
}
birthByBinaryBreakup(j, i);
deathByBinaryBreakup(j, i);
j++;
}
deathByBreakup(i);
}
if (drift_.size() != 0)
forAll(drift_, model)
{
forAll(drift_, model)
{
driftRate_() = Zero;
drift(i, drift_[model]);
}
driftRate_() = Zero;
drift(i, drift_[model]);
}
if (nucleation_.size() != 0)
forAll(nucleation_, model)
{
forAll(nucleation_, model)
{
nucleationRate_() = Zero;
nucleation(i, nucleation_[model]);
}
nucleationRate_() = Zero;
nucleation(i, nucleation_[model]);
}
}
}
@ -837,6 +818,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
coalescenceModel::iNew(*this)
),
coalescenceRate_(),
coalescencePairs_(),
breakupModels_
(
dict_.lookup("breakupModels"),
@ -849,6 +831,7 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
binaryBreakupModel::iNew(*this)
),
binaryBreakupRate_(),
binaryBreakupPairs_(),
drift_
(
dict_.lookup("driftModels"),
@ -895,6 +878,14 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
dimensionedScalar(dimVolume/dimTime, Zero)
)
);
forAll(sizeGroups(), i)
{
for (label j = 0; j <= i; j++)
{
coalescencePairs_.append(labelPair(i, j));
}
}
}
if (breakupModels_.size() != 0)
@ -936,6 +927,19 @@ Foam::diameterModels::populationBalanceModel::populationBalanceModel
)
)
);
calcDeltas();
forAll(sizeGroups(), i)
{
label j = 0;
while (delta_[j][i].value() != 0)
{
binaryBreakupPairs_.append(labelPair(i, j));
j++;
}
}
}
if (drift_.size() != 0)

View File

@ -154,6 +154,7 @@ SourceFiles
#include "pimpleControl.H"
#include "phaseDynamicMomentumTransportModel.H"
#include "HashPtrTable.H"
#include "Pair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -245,6 +246,9 @@ private:
//- Coalescence rate
autoPtr<volScalarField> coalescenceRate_;
//- Coalescence relevant size group pairs
List<labelPair> coalescencePairs_;
//- Breakup models
PtrList<breakupModel> breakupModels_;
@ -257,6 +261,9 @@ private:
//- Binary breakup rate
autoPtr<volScalarField> binaryBreakupRate_;
//- Binary breakup relevant size group pairs
List<labelPair> binaryBreakupPairs_;
//- Drift models
PtrList<driftModel> drift_;
@ -410,15 +417,17 @@ public:
//- Return the sizeGroups belonging to this populationBalance
inline const UPtrList<sizeGroup>& sizeGroups() const;
//- Return implicit source terms
inline const volScalarField& Sp(const label i) const;
//- Return list of unordered phasePairs in this populationBalance
inline const phasePairTable& phasePairs() const;
//- Returns true if both phases are velocity groups and
// belong to this populationBalance
inline bool isVelocityGroupPair(const phasePair& pair) const;
//- Return implicit source terms
inline const volScalarField& Sp(const label i) const;
//- Return coalescence relevant size group pairs
inline const List<labelPair>& coalescencePairs() const;
//- Return binary breakup relevant size group pairs
inline const List<labelPair>& binaryBreakupPairs() const;
//- Return total void of phases belonging to this populationBalance
inline const volScalarField& alphas() const;
@ -426,6 +435,10 @@ public:
//- Return average velocity
inline const volVectorField& U() const;
//- Returns true if both phases are velocity groups and
// belong to this populationBalance
inline bool isVelocityGroupPair(const phasePair& pair) const;
//- Return allocation coefficient
const dimensionedScalar eta
(

View File

@ -84,13 +84,6 @@ Foam::diameterModels::populationBalanceModel::sizeGroups() const
}
inline const Foam::volScalarField&
Foam::diameterModels::populationBalanceModel::Sp(const label i) const
{
return Sp_[i];
}
inline const Foam::diameterModels::populationBalanceModel::phasePairTable&
Foam::diameterModels::populationBalanceModel::phasePairs() const
{
@ -98,28 +91,24 @@ Foam::diameterModels::populationBalanceModel::phasePairs() const
}
inline bool Foam::diameterModels::populationBalanceModel::isVelocityGroupPair
(
const phasePair& pair
) const
inline const Foam::volScalarField&
Foam::diameterModels::populationBalanceModel::Sp(const label i) const
{
if
(
isA<velocityGroup>(pair.phase1().dPtr()())
&&
isA<velocityGroup>(pair.phase2().dPtr()())
)
{
const velocityGroup& velGroup1 =
refCast<const velocityGroup>(pair.phase1().dPtr()());
return Sp_[i];
}
const velocityGroup& velGroup2 =
refCast<const velocityGroup>(pair.phase2().dPtr()());
return velGroup1.popBalName() == velGroup2.popBalName();
}
inline const Foam::List<Foam::Pair<Foam::label>>&
Foam::diameterModels::populationBalanceModel::coalescencePairs() const
{
return coalescencePairs_;
}
return false;
inline const Foam::List<Foam::Pair<Foam::label>>&
Foam::diameterModels::populationBalanceModel::binaryBreakupPairs() const
{
return binaryBreakupPairs_;
}
@ -151,4 +140,29 @@ Foam::diameterModels::populationBalanceModel::U() const
}
inline bool Foam::diameterModels::populationBalanceModel::isVelocityGroupPair
(
const phasePair& pair
) const
{
if
(
isA<velocityGroup>(pair.phase1().dPtr()())
&&
isA<velocityGroup>(pair.phase2().dPtr()())
)
{
const velocityGroup& velGroup1 =
refCast<const velocityGroup>(pair.phase1().dPtr()());
const velocityGroup& velGroup2 =
refCast<const velocityGroup>(pair.phase2().dPtr()());
return velGroup1.popBalName() == velGroup2.popBalName();
}
return false;
}
// ************************************************************************* //