Commit 4f8d26c0 authored by andy's avatar andy
Browse files

ENH: Further updates to new spray library

parent 8d50450b
......@@ -26,7 +26,7 @@ License
#include "SprayCloud.H"
#include "AtomizationModel.H"
#include "BreakupModel.H"
#include "CollisionModel.H"
#include "StochasticCollisionModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
......@@ -51,9 +51,9 @@ void Foam::SprayCloud<CloudType>::setModels()
).ptr()
);
collisionModel_.reset
stochasticCollisionModel_.reset
(
CollisionModel<SprayCloud<CloudType> >::New
StochasticCollisionModel<SprayCloud<CloudType> >::New
(
this->subModelProperties(),
*this
......@@ -72,7 +72,7 @@ void Foam::SprayCloud<CloudType>::cloudReset
atomizationModel_.reset(c.atomizationModel_.ptr());
breakupModel_.reset(c.breakupModel_.ptr());
collisionModel_.reset(c.collisionModel_.ptr());
stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr());
}
......@@ -92,47 +92,23 @@ Foam::SprayCloud<CloudType>::SprayCloud
CloudType(cloudName, rho, U, g, thermo, false),
sprayCloud(),
cloudCopyPtr_(NULL),
averageParcelMass_(this->injection().averageParcelMass()),
atomizationModel_
(
AtomizationModel<SprayCloud<CloudType> >::New
(
this->particleProperties(),
*this
)
),
breakupModel_
(
BreakupModel<SprayCloud<CloudType> >::New
(
this->particleProperties(),
*this
)
),
collisionModel_
(
CollisionModel<SprayCloud<CloudType> >::New
(
this->particleProperties(),
*this
)
)
averageParcelMass_(0.0),
atomizationModel_(NULL),
breakupModel_(NULL),
stochasticCollisionModel_(NULL)
{
if (this->solution().active())
{
setModels();
averageParcelMass_ = this->injection().averageParcelMass();
if (readFields)
{
parcelType::readFields(*this, this->composition());
}
}
if (this->solution().resetSourcesOnStartup())
{
resetSourceTerms();
}
Info << " Average parcel mass: " << averageParcelMass_ << endl;
}
......@@ -150,7 +126,7 @@ Foam::SprayCloud<CloudType>::SprayCloud
averageParcelMass_(c.averageParcelMass_),
atomizationModel_(c.atomizationModel_->clone()),
breakupModel_(c.breakupModel_->clone()),
collisionModel_(c.collisionModel_->clone())
stochasticCollisionModel_(c.stochasticCollisionModel_->clone())
{}
......@@ -168,7 +144,7 @@ Foam::SprayCloud<CloudType>::SprayCloud
averageParcelMass_(0.0),
atomizationModel_(NULL),
breakupModel_(NULL),
collisionModel_(NULL)
stochasticCollisionModel_(NULL)
{}
......@@ -257,9 +233,10 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
this->updateCellOccupancy();
if (collision().active())
if (stochasticCollision().active())
{
const liquidMixtureProperties& liqMix = this->composition().liquids();
label i = 0;
forAllIter(typename SprayCloud<CloudType>, *this, iter)
{
......@@ -270,17 +247,17 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
{
parcelType& p = iter();
scalar Vi = this->mesh().V()[p.cell()];
scalarField X1(this->composition().liquids().X(p.Y()));
scalar sigma1 = this->composition().liquids().sigma(p.pc(), p.T(), X1);
scalarField X1(liqMix.X(p.Y()));
scalar sigma1 = liqMix.sigma(p.pc(), p.T(), X1);
scalar mp = p.mass()*p.nParticle();
parcelType& q = jter();
scalar Vj = this->mesh().V()[q.cell()];
scalarField X2(this->composition().liquids().X(q.Y()));
scalar sigma2 = this->composition().liquids().sigma(q.pc(), q.T(), X2);
scalarField X2(liqMix.X(q.Y()));
scalar sigma2 = liqMix.sigma(q.pc(), q.T(), X2);
scalar mq = q.mass()*q.nParticle();
bool updateProperties = collision().update
bool updateProperties = stochasticCollision().update
(
dt,
this->rndGen(),
......@@ -314,18 +291,26 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
{
if (mp > VSMALL)
{
scalarField Xp(this->composition().liquids().X(p.Y()));
p.rho() = this->composition().liquids().rho(p.pc(), p.T(), Xp);
p.Cp() = this->composition().liquids().Cp(p.pc(), p.T(), Xp);
scalar rhs = 6.0*mp/(p.nParticle()*p.rho()*constant::mathematical::pi);
p.d() = pow(rhs, 1.0/3.0);
scalarField Xp(liqMix.X(p.Y()));
p.rho() = liqMix.rho(p.pc(), p.T(), Xp);
p.Cp() = liqMix.Cp(p.pc(), p.T(), Xp);
p.d() =
cbrt
(
6.0*mp
/(
p.nParticle()
*p.rho()
*constant::mathematical::pi
)
);
}
if (mq > VSMALL)
{
scalarField Xq(this->composition().liquids().X(q.Y()));
q.rho() = this->composition().liquids().rho(q.pc(), q.T(), Xq);
q.Cp() = this->composition().liquids().Cp(q.pc(), q.T(), Xq);
scalarField Xq(liqMix.X(q.Y()));
q.rho() = liqMix.rho(q.pc(), q.T(), Xq);
q.Cp() = liqMix.Cp(q.pc(), q.T(), Xq);
scalar rhs = 6.0*mq/(q.nParticle()*q.rho()*constant::mathematical::pi);
q.d() = pow(rhs, 1.0/3.0);
}
......
......@@ -47,7 +47,7 @@ template<class CloudType>
class BreakupModel;
template<class CloudType>
class CollisionModel;
class StochasticCollisionModel;
/*---------------------------------------------------------------------------*\
Class SprayCloud Declaration
......@@ -107,7 +107,8 @@ protected:
autoPtr<BreakupModel<SprayCloud<CloudType> > > breakupModel_;
//- Collision model
autoPtr<CollisionModel<SprayCloud<CloudType> > > collisionModel_;
autoPtr<StochasticCollisionModel<SprayCloud<CloudType> > >
stochasticCollisionModel_;
// Protected Member Functions
......@@ -196,8 +197,8 @@ public:
breakup() const;
//- Return const-access to the breakup model
inline const CollisionModel<SprayCloud<CloudType> >&
collision() const;
inline const StochasticCollisionModel<SprayCloud<CloudType> >&
stochasticCollision() const;
// Check
......@@ -228,9 +229,6 @@ public:
//- Reset the current cloud to the previously stored state
void restoreState();
//- Reset the spray source terms
void resetSourceTerms();
//- Evolve the spray (inject, move)
void evolve();
//- Particle motion
......
......@@ -50,10 +50,10 @@ Foam::SprayCloud<CloudType>::breakup() const
template<class CloudType>
inline const Foam::CollisionModel<Foam::SprayCloud<CloudType> >&
Foam::SprayCloud<CloudType>::collision() const
inline const Foam::StochasticCollisionModel<Foam::SprayCloud<CloudType> >&
Foam::SprayCloud<CloudType>::stochasticCollision() const
{
return collisionModel_;
return stochasticCollisionModel_;
}
......
......@@ -210,6 +210,13 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
typedef typename TrackData::cloudType cloudType;
typedef typename cloudType::parcelType parcelType;
typedef typename cloudType::forceType forceType;
const parcelType& p = static_cast<const parcelType&>(*this);
const forceType& forces = td.cloud().forces();
if (td.cloud().breakup().solveOscillationEq())
{
solveTABEq(td, dt);
......@@ -233,11 +240,12 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
scalar muAv = this->muc();
vector Urel = this->U() - this->Uc();
scalar Urmag = mag(Urel);
scalar As = this->areaS(this->d());
scalar Re = rhoAv*Urmag*this->d()/muAv;
scalar Re = this->Re(this->U(), this->d(), rhoAv, muAv);
scalar utc = td.cloud().drag().utc(Re, this->d(), muAv) + ROOTVSMALL;
scalar tMom = 1.0/(As*utc);
const scalar mass = p.mass();
const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, muAv);
const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, muAv);
scalar tMom = 1.0/(Fcp.Sp() + Fncp.Sp());
const vector g = td.cloud().g().value();
......@@ -273,17 +281,20 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
)
)
{
scalar As = this->areaS(dChild);
scalar Re = rhoAv*Urmag*dChild/muAv;
scalar utc = td.cloud().drag().utc(Re, dChild, muAv) + ROOTVSMALL;
this->mass0() -= massChild;
// Add child parcel as copy of parent
SprayParcel<ParcelType>* child = new SprayParcel<ParcelType>(*this);
scalar massDrop = rho*constant::mathematical::pi*pow(dChild, 3.0)/6.0;
child->mass0() = massChild;
child->d() = dChild;
child->nParticle() = massChild/massDrop;
child->nParticle() = massChild/rho*this->volume(dChild);
const forceSuSp Fcp =
forces.calcCoupled(*child, dt, massChild, Re, muAv);
const forceSuSp Fncp =
forces.calcNonCoupled(*child, dt, massChild, Re, muAv);
child->liquidCore() = 0.0;
child->KHindex() = 1.0;
child->y() = td.cloud().breakup().y0();
......@@ -291,7 +302,7 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
child->tc() = -GREAT;
child->ms() = 0.0;
child->injector() = this->injector();
child->tMom() = 1.0/(As*utc);
child->tMom() = 1.0/(Fcp.Sp() + Fncp.Sp());
child->user() = 0.0;
child->setCellValues(td, dt, cellI);
......@@ -322,7 +333,7 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi
scalar p0 = this->pc();
scalar pAmb = td.cloud().pAmbient();
scalar pv = composition.liquids().sigma(p0, T0, X);
scalar pv = composition.liquids().pv(p0, T0, X);
forAll(composition.liquids(), i)
{
......@@ -377,16 +388,16 @@ void Foam::SprayParcel<ParcelType>::solveTABEq
const scalar& TABWeCrit = td.cloud().breakup().TABWeCrit();
const scalar& TABComega = td.cloud().breakup().TABComega();
scalar r = 0.5*this->d_;
scalar r = 0.5*this->d();
scalar r2 = r*r;
scalar r3 = r*r2;
const scalarField& Y(this->Y());
scalarField X(composition.liquids().X(Y));
scalar rho = composition.liquids().rho(this->pc_, this->T(), X);
scalar mu = composition.liquids().mu(this->pc_, this->T(), X);
scalar sigma = composition.liquids().sigma(this->pc_, this->T(), X);
scalar rho = composition.liquids().rho(this->pc(), this->T(), X);
scalar mu = composition.liquids().mu(this->pc(), this->T(), X);
scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X);
// inverse of characteristic viscous damping time
scalar rtd = 0.5*TABCmu*mu/(rho*r2);
......@@ -397,11 +408,8 @@ void Foam::SprayParcel<ParcelType>::solveTABEq
if(omega2 > 0)
{
scalar omega = sqrt(omega2);
scalar rhoc = this->rhoc_; //spray_.rho()[p.cell()];
scalar We = rhoc*pow(mag(this->Uc_ - this->U()), 2.0)*r/sigma;
//scalar We = p.We(Ug, rhog, sigma);
scalar Wetmp = We/TABWeCrit;
scalar rhoc = this->rhoc();
scalar Wetmp = this->We(this->U(), r, rhoc, sigma)/TABWeCrit;
scalar y1 = this->y() - Wetmp;
scalar y2 = this->yDot()/omega;
......@@ -434,13 +442,32 @@ void Foam::SprayParcel<ParcelType>::solveTABEq
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class ParcelType>
Foam::SprayParcel<ParcelType>::SprayParcel(const SprayParcel<ParcelType>& p)
:
ParcelType(p),
d0_(p.d0_),
position0_(p.position0_),
liquidCore_(p.liquidCore_),
KHindex_(p.KHindex_),
y_(p.y_),
yDot_(p.yDot_),
tc_(p.tc_),
ms_(p.ms_),
injector_(p.injector_),
tMom_(p.tMom_),
user_(p.user_)
{}
template <class ParcelType>
Foam::SprayParcel<ParcelType>::SprayParcel
(
const SprayParcel<ParcelType>& p
const SprayParcel<ParcelType>& p,
const polyMesh& mesh
)
:
ParcelType(p),
ParcelType(p, mesh),
d0_(p.d0_),
position0_(p.position0_),
liquidCore_(p.liquidCore_),
......
......@@ -39,6 +39,7 @@ License
// Reacting
#include "makeReactingParcelCompositionModels.H"
#include "makeReactingParcelPhaseChangeModels.H"
#include "makeReactingParcelSurfaceFilmModels.H"
// Spray
#include "makeSprayParcelAtomizationModels.H"
......@@ -63,11 +64,12 @@ namespace Foam
// Reacting sub-models
makeReactingParcelCompositionModels(basicSprayCloud);
makeReactingParcelPhaseChangeModels(basicSprayCloud);
makeReactingParcelSurfaceFilmModels(basicSprayCloud);
// Spray sub-models
makeSprayParcelAtomizationModels(basicSprayCloud);
makeSprayParcelBreakupModels(basicSprayCloud);
// makeSprayParcelCollisionModels(basicSprayCloud);
makeSprayParcelCollisionModels(basicSprayCloud);
};
......
......@@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "NoCollision.H"
#include "NoStochasticCollision.H"
#include "ORourkeCollision.H"
#include "TrajectoryCollision.H"
......@@ -36,10 +36,10 @@ License
#define makeSprayParcelCollisionModels(CloudType) \
\
makeCollisionModel(CloudType); \
makeCollisionModelType(NoCollision, CloudType); \
makeCollisionModelType(ORourkeCollision, CloudType); \
makeCollisionModelType(TrajectoryCollision, CloudType);
makeStochasticCollisionModel(CloudType); \
makeStochasticCollisionModelType(NoStochasticCollision, CloudType); \
makeStochasticCollisionModelType(ORourkeCollision, CloudType); \
makeStochasticCollisionModelType(TrajectoryCollision, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -57,6 +57,13 @@ Foam::NoAtomization<CloudType>::~NoAtomization()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::NoAtomization<CloudType>::active() const
{
return false;
}
template<class CloudType>
Foam::scalar Foam::NoAtomization<CloudType>::initLiquidCore() const
{
......
......@@ -77,6 +77,9 @@ public:
// Member Functions
//- Flag to indicate whether model activates atomization model
virtual bool active() const;
//- Initial value of liquidCore
virtual scalar initLiquidCore() const;
......
......@@ -77,12 +77,14 @@ Foam::BreakupModel<CloudType>::BreakupModel
{
if (solveOscillationEq_)
{
const dictionary TABcoeffsDict(this->coeffDict().subDict("TABCoeffs"));
y0_ = readScalar(TABcoeffsDict.lookup("y0"));
yDot0_ = readScalar(TABcoeffsDict.lookup("yDot0"));
TABComega_ = readScalar(TABcoeffsDict.lookup("Comega"));
TABCmu_ = readScalar(TABcoeffsDict.lookup("Cmu"));
TABWeCrit_ = readScalar(TABcoeffsDict.lookup("WeCrit"));
const dictionary TABcoeffsDict(dict.subDict("TABCoeffs"));
y0_ = TABcoeffsDict.template lookupOrDefault<scalar>("y0", 0.0);
yDot0_ = TABcoeffsDict.template lookupOrDefault<scalar>("yDot0", 0.0);
TABComega_ =
TABcoeffsDict.template lookupOrDefault<scalar>("Comega", 8.0);
TABCmu_ = TABcoeffsDict.template lookupOrDefault<scalar>("Cmu", 10.0);
TABWeCrit_ =
TABcoeffsDict.template lookupOrDefault<scalar>("WeCrit", 12.0);
}
}
......
......@@ -35,12 +35,22 @@ Foam::ETAB<CloudType>::ETAB
)
:
BreakupModel<CloudType>(dict, owner, typeName),
Cmu_(readScalar(this->coeffDict().lookup("Cmu"))),
Comega_(readScalar(this->coeffDict().lookup("Comega"))),
k1_(readScalar(this->coeffDict().lookup("k1"))),
k2_(readScalar(this->coeffDict().lookup("k2"))),
WeCrit_(readScalar(this->coeffDict().lookup("WeCrit"))),
WeTransition_(readScalar(this->coeffDict().lookup("WeTransition"))),
Cmu_(this->coeffDict().template lookupOrDefault<scalar>("Cmu", 10.0)),
Comega_(this->coeffDict().template lookupOrDefault<scalar>("Comega", 8.0)),
k1_(this->coeffDict().template lookupOrDefault<scalar>("k1", 0.2)),
k2_(this->coeffDict().template lookupOrDefault<scalar>("k2", 0.2)),
WeCrit_
(
this->coeffDict().template lookupOrDefault<scalar>("WeCrit", 12.0)
),
WeTransition_
(
this->coeffDict().template lookupOrDefault<scalar>
(
"WeTransition",
100.0
)
),
AWe_(0.0)
{
scalar k21 = k2_/k1_;
......
......@@ -55,6 +55,13 @@ Foam::NoBreakup<CloudType>::~NoBreakup()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::NoBreakup<CloudType>::active() const
{
return false;
}
template<class CloudType>
bool Foam::NoBreakup<CloudType>::update
(
......
......@@ -77,6 +77,9 @@ public:
// Member Functions
//- Flag to indicate whether model activates break-up model
virtual bool active() const;
//- update the parcel properties
virtual bool update
(
......
......@@ -35,11 +35,18 @@ Foam::ReitzKHRT<CloudType>::ReitzKHRT
)
:
BreakupModel<CloudType>(dict, owner, typeName),
b0_(readScalar(this->coeffDict().lookup("B0"))),
b1_(readScalar(this->coeffDict().lookup("B1"))),
cTau_(readScalar(this->coeffDict().lookup("Ctau"))),
cRT_(readScalar(this->coeffDict().lookup("CRT"))),
msLimit_(readScalar(this->coeffDict().lookup("msLimit"))),
b0_(this->coeffDict().template lookupOrDefault<scalar>("B0", 0.61)),
b1_(this->coeffDict().template lookupOrDefault<scalar>("B1", 40.0)),
cTau_(this->coeffDict().template lookupOrDefault<scalar>("Ctau", 1.0)),
cRT_(this->coeffDict().template lookupOrDefault<scalar>("CRT", 0.1)),
msLimit_
(
this->coeffDict().template lookupOrDefault<scalar>
(
"msLimit",
0.03
)
),
weberLimit_(readScalar(this->coeffDict().lookup("WeberLimit")))
{}
......
......@@ -23,39 +23,49 @@ License
\*---------------------------------------------------------------------------*/
#include "NoCollision.H"
#include "NoStochasticCollision.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::NoCollision<CloudType>::NoCollision
Foam::NoStochasticCollision<CloudType>::NoStochasticCollision
(
const dictionary& dict,
CloudType& owner
)
:
CollisionModel<CloudType>(owner)
StochasticCollisionModel<CloudType>(owner)
{}
template<class CloudType>
Foam::NoCollision<CloudType>::NoCollision(const NoCollision<CloudType>& cm)
Foam::NoStochasticCollision<CloudType>::NoStochasticCollision
(
const NoStochasticCollision<CloudType>& cm
)
:
CollisionModel<CloudType>(cm)
StochasticCollisionModel<CloudType>(cm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::NoCollision<CloudType>::~NoCollision()
Foam::NoStochasticCollision<CloudType>::~NoStochasticCollision()
{}