Commit 8f1fe51b authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Cleaned-up construction of cloud trackData

STYLE: Refactored cp -> Cp
parent 6c7f869d
......@@ -154,36 +154,7 @@ void Foam::KinematicCloud<ParcelType>::updateCellOccupancy()
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::evolveCloud()
{
autoPtr<interpolation<scalar> > rhoInterpolator =
interpolation<scalar>::New
(
solution_.interpolationSchemes(),
rho_
);
autoPtr<interpolation<vector> > UInterpolator =
interpolation<vector>::New
(
solution_.interpolationSchemes(),
U_
);
autoPtr<interpolation<scalar> > muInterpolator =
interpolation<scalar>::New
(
solution_.interpolationSchemes(),
mu_
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterpolator(),
UInterpolator(),
muInterpolator(),
g_.value()
);
typename ParcelType::trackData td(*this);
label preInjectionSize = this->size();
......
......@@ -214,13 +214,13 @@ protected:
// References to the carrier gas fields
//- Density
//- Density [kg/m3]
const volScalarField& rho_;
//- Velocity
//- Velocity [m/s]
const volVectorField& U_;
//- Dynamic viscosity
//- Dynamic viscosity [Pa.s]
const volScalarField& mu_;
......
......@@ -67,58 +67,15 @@ void Foam::ReactingCloud<ParcelType>::preEvolve()
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::evolveCloud()
{
const volScalarField& T = this->thermo().thermo().T();
const volScalarField cp = this->thermo().thermo().Cp();
const volScalarField& p = this->thermo().thermo().p();
const volScalarField Cp = this->thermo().thermo().Cp();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
autoPtr<interpolation<scalar> > CpInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
this->rho()
Cp
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->solution().interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
cp
);
autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
p
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
pInterp(),
this->g().value()
);
typename ParcelType::trackData td(*this, CpInterp());
label preInjectionSize = this->size();
......
......@@ -40,58 +40,15 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::preEvolve()
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud()
{
const volScalarField& T = this->thermo().thermo().T();
const volScalarField cp = this->thermo().thermo().Cp();
const volScalarField& p = this->thermo().thermo().p();
const volScalarField Cp = this->thermo().thermo().Cp();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
autoPtr<interpolation<scalar> > CpInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
this->rho()
Cp
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->solution().interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
cp
);
autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
p
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
pInterp(),
this->g().value()
);
typename ParcelType::trackData td(*this, CpInterp());
label preInjectionSize = this->size();
......
......@@ -41,50 +41,15 @@ void Foam::ThermoCloud<ParcelType>::preEvolve()
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::evolveCloud()
{
const volScalarField& T = thermo_.thermo().T();
const volScalarField cp = thermo_.thermo().Cp();
const volScalarField Cp = thermo_.thermo().Cp();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
autoPtr<interpolation<scalar> > CpInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
this->rho()
Cp
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->solution().interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->solution().interpolationSchemes(),
cp
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
this->g().value()
);
typename ParcelType::trackData td(*this, CpInterp());
label preInjectionSize = this->size();
......@@ -154,6 +119,8 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
thermoCloud(),
constProps_(this->particleProperties()),
thermo_(thermo),
T_(thermo.thermo().T()),
p_(thermo.thermo().p()),
heatTransferModel_
(
HeatTransferModel<ThermoCloud<ParcelType> >::New
......@@ -220,7 +187,7 @@ void Foam::ThermoCloud<ParcelType>::checkParcelProperties
if (!fullyDescribed)
{
parcel.T() = constProps_.T0();
parcel.cp() = constProps_.cp0();
parcel.Cp() = constProps_.Cp0();
}
}
......
......@@ -85,6 +85,12 @@ protected:
//- SLG thermodynamics package
const SLGThermo& thermo_;
//- Temperature [K]
const volScalarField& T_;
//- Pressure [Pa]
const volScalarField& p_;
// References to the cloud sub-models
......@@ -163,6 +169,12 @@ public:
//- Return const access to thermo package
inline const SLGThermo& thermo() const;
//- Return const access to the carrier temperature field
inline const volScalarField& T() const;
//- Return const access to the carrier prressure field
inline const volScalarField& p() const;
// Sub-models
......
......@@ -44,6 +44,20 @@ inline const Foam::SLGThermo& Foam::ThermoCloud<ParcelType>::thermo() const
}
template<class ParcelType>
inline const Foam::volScalarField& Foam::ThermoCloud<ParcelType>::T() const
{
return T_;
}
template<class ParcelType>
inline const Foam::volScalarField& Foam::ThermoCloud<ParcelType>::p() const
{
return p_;
}
template<class ParcelType>
inline const Foam::HeatTransferModel<Foam::ThermoCloud<ParcelType> >&
Foam::ThermoCloud<ParcelType>::heatTransfer() const
......
......@@ -175,13 +175,14 @@ public:
// Interpolators for continuous phase fields
//- Density interpolator
const interpolation<scalar>& rhoInterp_;
autoPtr<interpolation<scalar> > rhoInterp_;
//- Velocity interpolator
const interpolation<vector>& UInterp_;
autoPtr<interpolation<vector> > UInterp_;
//- Dynamic viscosity interpolator
const interpolation<scalar>& muInterp_;
autoPtr<interpolation<scalar> > muInterp_;
//- Local gravitational or other body-force acceleration
const vector& g_;
......@@ -199,11 +200,6 @@ public:
inline trackData
(
KinematicCloud<ParcelType>& cloud,
const constantProperties& constProps,
const interpolation<scalar>& rhoInterp,
const interpolation<vector>& UInterp,
const interpolation<scalar>& muInterp,
const vector& g,
trackPart part = tpLinearTrack
);
......
......@@ -49,21 +49,37 @@ template <class ParcelType>
inline Foam::KinematicParcel<ParcelType>::trackData::trackData
(
KinematicCloud<ParcelType>& cloud,
const constantProperties& constProps,
const interpolation<scalar>& rhoInterp,
const interpolation<vector>& UInterp,
const interpolation<scalar>& muInterp,
const vector& g,
trackPart part
)
:
Particle<ParcelType>::trackData(cloud),
cloud_(cloud),
constProps_(constProps),
rhoInterp_(rhoInterp),
UInterp_(UInterp),
muInterp_(muInterp),
g_(g),
constProps_(cloud.constProps()),
rhoInterp_
(
interpolation<scalar>::New
(
cloud.solution().interpolationSchemes(),
cloud.rho()
)
),
UInterp_
(
interpolation<vector>::New
(
cloud.solution().interpolationSchemes(),
cloud.U()
)
),
muInterp_
(
interpolation<scalar>::New
(
cloud.solution().interpolationSchemes(),
cloud.mu()
)
),
g_(cloud.g().value()),
part_(part)
{}
......@@ -219,7 +235,7 @@ template<class ParcelType>
inline const Foam::interpolation<Foam::scalar>&
Foam::KinematicParcel<ParcelType>::trackData::rhoInterp() const
{
return rhoInterp_;
return rhoInterp_();
}
......@@ -227,7 +243,7 @@ template <class ParcelType>
inline const Foam::interpolation<Foam::vector>&
Foam::KinematicParcel<ParcelType>::trackData::UInterp() const
{
return UInterp_;
return UInterp_();
}
......@@ -235,7 +251,7 @@ template<class ParcelType>
inline const Foam::interpolation<Foam::scalar>&
Foam::KinematicParcel<ParcelType>::trackData::muInterp() const
{
return muInterp_;
return muInterp_();
}
......@@ -248,8 +264,7 @@ Foam::KinematicParcel<ParcelType>::trackData::g() const
template<class ParcelType>
inline
typename Foam::KinematicParcel<ParcelType>::trackData::trackPart
inline typename Foam::KinematicParcel<ParcelType>::trackData::trackPart
Foam::KinematicParcel<ParcelType>::trackData::part() const
{
return part_;
......@@ -257,8 +272,7 @@ Foam::KinematicParcel<ParcelType>::trackData::part() const
template<class ParcelType>
inline
typename Foam::KinematicParcel<ParcelType>::trackData::trackPart&
inline typename Foam::KinematicParcel<ParcelType>::trackData::trackPart&
Foam::KinematicParcel<ParcelType>::trackData::part()
{
return part_;
......@@ -497,16 +511,14 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::mass() const
template <class ParcelType>
inline Foam::scalar
Foam::KinematicParcel<ParcelType>::momentOfInertia() const
inline Foam::scalar Foam::KinematicParcel<ParcelType>::momentOfInertia() const
{
return 0.1*mass()*sqr(d_);
}
template <class ParcelType>
inline Foam::vector
Foam::KinematicParcel<ParcelType>::omega() const
inline Foam::vector Foam::KinematicParcel<ParcelType>::omega() const
{
return angularMomentum_/momentOfInertia();
}
......@@ -520,8 +532,7 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::volume() const
template <class ParcelType>
inline Foam::scalar
Foam::KinematicParcel<ParcelType>::volume(const scalar d)
inline Foam::scalar Foam::KinematicParcel<ParcelType>::volume(const scalar d)
{
return pi/6.0*pow3(d);
}
......@@ -535,8 +546,7 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::areaP() const
template <class ParcelType>
inline Foam::scalar
Foam::KinematicParcel<ParcelType>::areaP(const scalar d)
inline Foam::scalar Foam::KinematicParcel<ParcelType>::areaP(const scalar d)
{
return 0.25*areaS(d);
}
......@@ -550,16 +560,14 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::areaS() const
template <class ParcelType>
inline Foam::scalar
Foam::KinematicParcel<ParcelType>::areaS(const scalar d)
inline Foam::scalar Foam::KinematicParcel<ParcelType>::areaS(const scalar d)
{
return pi*d*d;
}
template <class ParcelType>
inline Foam::scalar
Foam::KinematicParcel<ParcelType>::Re
inline Foam::scalar Foam::KinematicParcel<ParcelType>::Re
(
const vector& U,
const scalar d,
......
......@@ -44,7 +44,7 @@ const Foam::label Foam::ReactingMultiphaseParcel<ParcelType>::SLD(2);
template<class ParcelType>
template<class TrackData>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::cpEff
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff
(
TrackData& td,
const scalar p,
......@@ -55,9 +55,9 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::cpEff
) const
{
return
this->Y_[GAS]*td.cloud().composition().cp(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().cp(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().cp(idS, YSolid_, p, T);
this->Y_[GAS]*td.cloud().composition().Cp(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().Cp(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().Cp(idS, YSolid_, p, T);
}
......@@ -164,19 +164,19 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::cellValueSourceCorrection
scalar massCellNew = massCell + addedMass;
this->Uc_ += td.cloud().UTrans()[cellI]/massCellNew;
scalar cpEff = 0;
scalar CpEff = 0;
if (addedMass > ROOTVSMALL)
{
forAll(td.cloud().rhoTrans(), i)
{
scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass;
cpEff += Y*td.cloud().thermo().carrier().Cp(i, this->Tc_);
CpEff += Y*td.cloud().thermo().carrier().Cp(i, this->Tc_);
}
}
const scalar cpc = td.cpInterp().psi()[cellI];
this->cpc_ = (massCell*cpc + addedMass*cpEff)/massCellNew;
const scalar Cpc = td.CpInterp().psi()[cellI];
this->Cpc_ = (massCell*Cpc + addedMass*CpEff)/massCellNew;
this->Tc_ += td.cloud().hsTrans()[cellI]/(this->cpc_*massCellNew);
this->Tc_ += td.cloud().hsTrans()[cellI]/(this->Cpc_*massCellNew);
}
......@@ -196,7 +196,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
const vector& U0 = this->U_;
const scalar rho0 = this->rho_;
const scalar T0 = this->T_;
const scalar cp0 = this->cp_;
const scalar Cp0 = this->Cp_;
const scalar mass0 = this->mass();
const scalar pc = this->pc_;
......@@ -367,7 +367,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
d0,
rho0,
T0,
cp0,
Cp0,
NCpW,
Sh,
dhsTrans
......@@ -466,7 +466,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
else
{
this->cp_ = cpEff(td, pc, T1, idG, idL, idS);
this->Cp_ = CpEff(td, pc, T1, idG, idL, idS);
this->T_ = T1;
this->U_ = U1;
......
......@@ -127,15 +127,10 @@ public:
inline trackData
(
ReactingMultiphaseCloud<ParcelType>& cloud,
const constantProperties& constProps,
const interpolation<scalar>& rhoInterp,
const interpolation<vector>& UInterp,
const interpolation<scalar>& muInterp,
const interpolation<scalar>& TInterp,
const interpolation<scalar>& CpInterp,
const interpolation<scalar>& pInterp,
const vector& g
);
typename ReactingParcel<ParcelType>::trackData::trackPart
part = ReactingParcel<ParcelType>::trackData::tpLinearTrack
);
// Member functions
......@@ -154,7 +149,7 @@ private: