Commit d5cd67f7 authored by andy's avatar andy
Browse files

ENH: MOved Dij and penetration calcs to Kinematic Cloud

parent 8e598ca1
......@@ -462,6 +462,12 @@ public:
//- Total rotational kinetic energy in the system
inline scalar rotationalKineticEnergyOfSystem() const;
//- Penetration for percentage of the current total mass
inline scalar penetration(const scalar& prc) const;
//- Mean diameter Dij
inline scalar Dij(const label i, const label j) const;
// Fields
......
......@@ -278,6 +278,131 @@ Foam::KinematicCloud<CloudType>::rotationalKineticEnergyOfSystem() const
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij
(
const label i,
const label j
) const
{
scalar si = 0.0;
scalar sj = 0.0;
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
si += p.nParticle()*pow(p.d(), i);
sj += p.nParticle()*pow(p.d(), j);
}
reduce(si, sumOp<scalar>());
reduce(sj, sumOp<scalar>());
sj = max(sj, VSMALL);
return si/sj;
}
template<class CloudType>
inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration
(
const scalar& prc
) const
{
scalar distance = 0.0;
scalar mTot = 0.0;
label np = this->size();
// arrays containing the parcels mass and
// distance from injector in ascending order
scalarField mass(np);
scalarField dist(np);
if (np > 0)
{
label n = 0;
// first arrange the parcels in ascending order
// the first parcel is closest to its injection position
// and the last one is most far away.
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
scalar mi = p.nParticle()*p.mass();
scalar di = mag(p.position() - p.position0());
mTot += mi;
// insert at the last place
mass[n] = mi;
dist[n] = di;
label i = 0;
bool found = false;
// insert the parcel in the correct place
// and move the others
while ((i < n) && (!found))
{
if (di < dist[i])
{
found = true;
for (label j=n; j>i; j--)
{
mass[j] = mass[j-1];
dist[j] = dist[j-1];
}
mass[i] = mi;
dist[i] = di;
}
i++;
}
n++;
}
}
reduce(mTot, sumOp<scalar>());
if (np > 0)
{
scalar mLimit = prc*mTot;
scalar mOff = (1.0 - prc)*mTot;
if (np > 1)
{
// 'prc' is large enough that the parcel most far
// away will be used, no need to loop...
if (mLimit > mTot - mass[np-1])
{
distance = dist[np-1];
}
else
{
scalar mOffSum = 0.0;
label i = np;
while ((mOffSum < mOff) && (i>0))
{
i--;
mOffSum += mass[i];
}
distance =
dist[i+1]
+ (dist[i] - dist[i+1])*(mOffSum - mOff)
/mass[i+1] ;
}
}
else
{
distance = dist[0];
}
}
reduce(distance, maxOp<scalar>());
return distance;
}
template<class CloudType>
inline Foam::cachedRandom& Foam::KinematicCloud<CloudType>::rndGen()
{
......
......@@ -185,9 +185,10 @@ void Foam::SprayCloud<CloudType>::checkParcelProperties
parcel.position0() = parcel.position();
parcel.d0() = parcel.d();
parcel.y() = breakup().y0();
parcel.yDot() = breakup().yDot0();
parcel.liquidCore() = atomization().initLiquidCore();
}
......@@ -337,137 +338,12 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
}
template<class CloudType>
Foam::scalar Foam::SprayCloud<CloudType>::D
(
const label i,
const label j
) const
{
scalar si = 0.0;
scalar sj = 0.0;
forAllConstIter(typename SprayCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
si += p.nParticle()*pow(p.d(), i);
sj += p.nParticle()*pow(p.d(), j);
}
reduce(si, sumOp<scalar>());
reduce(sj, sumOp<scalar>());
sj = max(sj, VSMALL);
return si/sj;
}
template<class CloudType>
Foam::scalar Foam::SprayCloud<CloudType>::liquidPenetration
(
const scalar& prc
) const
{
scalar distance = 0.0;
scalar mTot = 0.0;
label np = this->size();
// arrays containing the parcels mass and
// distance from injector in ascending order
scalarField mass(np);
scalarField dist(np);
if (np > 0)
{
label n = 0;
// first arrange the parcels in ascending order
// the first parcel is closest to its injection position
// and the last one is most far away.
forAllConstIter(typename SprayCloud<CloudType>, *this, iter)
{
const parcelType& p = iter();
scalar mi = p.nParticle()*p.mass();
scalar di = mag(p.position() - p.position0());
mTot += mi;
// insert at the last place
mass[n] = mi;
dist[n] = di;
label i = 0;
bool found = false;
// insert the parcel in the correct place
// and move the others
while (( i < n ) && (!found))
{
if (di < dist[i])
{
found = true;
for (label j=n; j>i; j--)
{
mass[j] = mass[j-1];
dist[j] = dist[j-1];
}
mass[i] = mi;
dist[i] = di;
}
i++;
}
n++;
}
}
reduce(mTot, sumOp<scalar>());
if (np > 0)
{
scalar mLimit = prc*mTot;
scalar mOff = (1.0 - prc)*mTot;
if (np > 1)
{
// 'prc' is large enough that the parcel most far
// away will be used, no need to loop...
if (mLimit > mTot - mass[np-1])
{
distance = dist[np-1];
}
else
{
scalar mOffSum = 0.0;
label i = np;
while ((mOffSum < mOff) && (i>0))
{
i--;
mOffSum += mass[i];
}
distance =
dist[i+1]
+ (dist[i] - dist[i+1])*(mOffSum - mOff)
/mass[i+1] ;
}
}
else
{
distance = dist[0];
}
}
reduce(distance, maxOp<scalar>());
return distance;
}
template<class CloudType>
void Foam::SprayCloud<CloudType>::info() const
{
CloudType::info();
scalar d32 = 1.0e+6*D(3, 2);
scalar pen = liquidPenetration(0.95);
scalar d32 = 1.0e+6*this->Dij(3, 2);
scalar pen = this->penetration(0.95);
Info << " D32 (mu) = " << d32 << endl;
Info << " Liquid penetration 95% mass (m) = " << pen << endl;
......
......@@ -203,12 +203,6 @@ public:
// Check
//- Calculate the liquid penetration for prc % of the mass
scalar liquidPenetration(const scalar& prc) const;
//- Calculate the diameter Dij
scalar D(const label i, const label j) const;
//- Print cloud information
void info() const;
......
......@@ -38,7 +38,6 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel
ParcelType(mesh, position, cellI, tetFaceI, tetPtI),
d0_(this->d()),
position0_(position),
// liquidCore_(owner.atomization().initLiquidCore()),
liquidCore_(0.0),
KHindex_(0.0),
y_(0.0),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment