Commit 490f1ca5 authored by andy's avatar andy
Browse files

ENH: Split parcel initialisation into 2 parts around injection

parent 556ae647
......@@ -499,7 +499,7 @@ bool Foam::KinematicCloud<CloudType>::hasWallImpactDistance() const
template<class CloudType>
void Foam::KinematicCloud<CloudType>::checkParcelProperties
void Foam::KinematicCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
......@@ -510,7 +510,17 @@ void Foam::KinematicCloud<CloudType>::checkParcelProperties
{
parcel.rho() = constProps_.rho0();
}
}
template<class CloudType>
void Foam::KinematicCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
const scalar carrierDt = mesh_.time().deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
parcel.typeId() = constProps_.parcelTypeId();
......
......@@ -486,6 +486,14 @@ public:
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Check parcel properties
void checkParcelProperties
(
......
......@@ -224,22 +224,18 @@ Foam::ReactingCloud<CloudType>::~ReactingCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ReactingCloud<CloudType>::checkParcelProperties
void Foam::ReactingCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties
(
parcel,
lagrangianDt,
fullyDescribed
);
CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed);
if (!fullyDescribed)
{
parcel.pc() = this->thermo().thermo().p()[parcel.cell()];
parcel.Y() = composition().YMixture0();
}
else
......@@ -257,6 +253,18 @@ void Foam::ReactingCloud<CloudType>::checkParcelProperties
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::storeState()
{
......
......@@ -267,6 +267,14 @@ public:
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Check parcel properties
void checkParcelProperties
(
......
......@@ -155,19 +155,14 @@ Foam::ReactingMultiphaseCloud<CloudType>::~ReactingMultiphaseCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::checkParcelProperties
void Foam::ReactingMultiphaseCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties
(
parcel,
lagrangianDt,
fullyDescribed
);
CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed);
label idGas = this->composition().idGas();
label idLiquid = this->composition().idLiquid();
......@@ -203,6 +198,18 @@ void Foam::ReactingMultiphaseCloud<CloudType>::checkParcelProperties
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::storeState()
{
......
......@@ -240,6 +240,14 @@ public:
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Check parcel properties
void checkParcelProperties
(
......
......@@ -234,14 +234,14 @@ Foam::ThermoCloud<CloudType>::~ThermoCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ThermoCloud<CloudType>::checkParcelProperties
void Foam::ThermoCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed);
if (!fullyDescribed)
{
......@@ -251,6 +251,18 @@ void Foam::ThermoCloud<CloudType>::checkParcelProperties
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
}
template<class CloudType>
void Foam::ThermoCloud<CloudType>::storeState()
{
......
......@@ -281,6 +281,14 @@ public:
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Check parcel properties
void checkParcelProperties
(
......
......@@ -530,6 +530,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
const scalar time = this->owner().db().time().value();
const scalar trackTime = this->owner().solution().trackTime();
const polyMesh& mesh = this->owner().mesh();
typename TrackData::cloudType& cloud = td.cloud();
// Prepare for next time step
label parcelsAdded = 0;
......@@ -592,11 +593,14 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
);
// Check/set new parcel properties
td.cloud().checkParcelProperties(*pPtr, dt, fullyDescribed());
cloud.setParcelThermoProperties(*pPtr, dt, fullyDescribed());
// Assign new parcel properties in injection model
setProperties(parcelI, newParcels, timeInj, *pPtr);
// Check/set new parcel properties
cloud.checkParcelProperties(*pPtr, dt, fullyDescribed());
// Apply correction to velocity for 2-D cases
meshTools::constrainDirection
(
......@@ -647,6 +651,7 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
}
const polyMesh& mesh = this->owner().mesh();
typename TrackData::cloudType& cloud = td.cloud();
// Reset counters
time0_ = 0.0;
......@@ -696,12 +701,15 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
tetPtI
);
// Check new parcel properties
td.cloud().checkParcelProperties(*pPtr, 0.0, fullyDescribed());
// Check/set new parcel properties
cloud.setParcelThermoProperties(*pPtr, 0.0, fullyDescribed());
// Assign new parcel properties in injection model
setProperties(parcelI, newParcels, 0.0, *pPtr);
// Check/set new parcel properties
cloud.checkParcelProperties(*pPtr, 0.0, fullyDescribed());
// Apply correction to velocity for 2-D cases
meshTools::constrainDirection
(
......
......@@ -158,28 +158,38 @@ Foam::SprayCloud<CloudType>::~SprayCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::SprayCloud<CloudType>::checkParcelProperties
void Foam::SprayCloud<CloudType>::setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties
(
parcel,
lagrangianDt,
fullyDescribed
);
CloudType::setParcelThermoProperties(parcel, lagrangianDt, fullyDescribed);
const liquidMixtureProperties& liqMix = this->composition().liquids();
if (!fullyDescribed)
{
const liquidMixtureProperties& liqMix = this->composition().liquids();
const scalarField& Y(parcel.Y());
scalarField X(liqMix.X(Y));
// override rho and Cp from constantProperties
parcel.Cp() = liqMix.Cp(parcel.pc(), parcel.T(), X);
parcel.rho() = liqMix.rho(parcel.pc(), parcel.T(), X);
}
}
const scalarField& Y(parcel.Y());
scalarField X(liqMix.X(Y));
// override rho and Cp from constantProperties
parcel.Cp() = liqMix.Cp(parcel.pc(), parcel.T(), X);
parcel.rho() = liqMix.rho(parcel.pc(), parcel.T(), X);
template<class CloudType>
void Foam::SprayCloud<CloudType>::checkParcelProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed);
// store the injection position and initial drop size
parcel.position0() = parcel.position();
......
......@@ -209,6 +209,14 @@ public:
// Cloud evolution functions
//- Set parcel thermo properties
void setParcelThermoProperties
(
parcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Check parcel properties
void checkParcelProperties
(
......
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