diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 652c9070f6..02cbae1f5c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -34,6 +34,76 @@ License #include "PatchInteractionModel.H" #include "PostProcessingModel.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::KinematicCloud::preEvolve() +{ + this->dispersion().cacheFields(true); + forces_.cacheFields(true); +} + + +template +void Foam::KinematicCloud::evolveCloud() +{ + autoPtr > rhoInterpolator = + interpolation::New + ( + interpolationSchemes_, + rho_ + ); + + autoPtr > UInterpolator = + interpolation::New + ( + interpolationSchemes_, + U_ + ); + + autoPtr > muInterpolator = + interpolation::New + ( + interpolationSchemes_, + mu_ + ); + + typename ParcelType::trackData td + ( + *this, + constProps_, + rhoInterpolator(), + UInterpolator(), + muInterpolator(), + g_.value() + ); + + this->injection().inject(td); + + if (coupled_) + { + resetSourceTerms(); + } + + Cloud::move(td); +} + + +template +void Foam::KinematicCloud::postEvolve() +{ + if (debug) + { + this->writePositions(); + } + + this->dispersion().cacheFields(false); + forces_.cacheFields(false); + + this->postProcessing().post(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -62,6 +132,7 @@ Foam::KinematicCloud::KinematicCloud ) ), constProps_(particleProperties_), + active_(particleProperties_.lookup("active")), parcelTypeId_(readLabel(particleProperties_.lookup("parcelTypeId"))), coupled_(particleProperties_.lookup("coupled")), cellValueSourceCorrection_ @@ -179,75 +250,17 @@ void Foam::KinematicCloud::resetSourceTerms() } -template -void Foam::KinematicCloud::preEvolve() -{ - this->dispersion().cacheFields(true); - forces_.cacheFields(true); -} - - -template -void Foam::KinematicCloud::postEvolve() -{ - if (debug) - { - this->writePositions(); - } - - this->dispersion().cacheFields(false); - forces_.cacheFields(false); - - this->postProcessing().post(); -} - - template void Foam::KinematicCloud::evolve() { - preEvolve(); - - autoPtr > rhoInterpolator = - interpolation::New - ( - interpolationSchemes_, - rho_ - ); - - autoPtr > UInterpolator = - interpolation::New - ( - interpolationSchemes_, - U_ - ); - - autoPtr > muInterpolator = - interpolation::New - ( - interpolationSchemes_, - mu_ - ); - - typename ParcelType::trackData td - ( - *this, - constProps_, - rhoInterpolator(), - UInterpolator(), - muInterpolator(), - g_.value() - ); - - this->injection().inject(td); - - if (coupled_) + if (active_) { - resetSourceTerms(); + preEvolve(); + + evolveCloud(); + + postEvolve(); } - - Cloud::move(td); - - postEvolve(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 4d5295b08d..3bd89a61a3 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -109,6 +109,9 @@ protected: //- Parcel constant properties typename ParcelType::constantProperties constProps_; + //- Cloud active flag + const Switch active_; + //- Parcel type id - used to flag the type of parcels issued by this // cloud const label parcelTypeId_; @@ -189,6 +192,9 @@ protected: //- Pre-evolve void preEvolve(); + //- Evolve the cloud + void evolveCloud(); + //- Post-evolve void postEvolve(); @@ -223,9 +229,6 @@ public: // References to the mesh and databases - //- Return the parcel type id - inline label parcelTypeId() const; - //- Return refernce to the mesh inline const fvMesh& mesh() const; @@ -237,14 +240,22 @@ public: constProps() const; - //- Return coupled flag - inline const Switch coupled() const; + // Cloud data - //- Return cell value correction flag - inline const Switch cellValueSourceCorrection() const; + //- Return the active flag + inline const Switch active() const; - //- Return refernce to the random object - inline Random& rndGen(); + //- Return the parcel type id + inline label parcelTypeId() const; + + //- Return coupled flag + inline const Switch coupled() const; + + //- Return cell value correction flag + inline const Switch cellValueSourceCorrection() const; + + //- Return refernce to the random object + inline Random& rndGen(); // References to the carrier gas fields diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 1f48632d15..e65ed15741 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -58,6 +58,13 @@ Foam::KinematicCloud::constProps() const } +template +inline const Foam::Switch Foam::KinematicCloud::active() const +{ + return active_; +} + + template inline const Foam::Switch Foam::KinematicCloud::coupled() const { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 6f4b4bc763..210a589902 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -58,6 +58,87 @@ void Foam::ReactingCloud::checkSuppliedComposition } +template +void Foam::ReactingCloud::preEvolve() +{ + ThermoCloud::preEvolve(); +} + + +template +void Foam::ReactingCloud::evolveCloud() +{ + const volScalarField& T = this->carrierThermo().T(); + const volScalarField cp = this->carrierThermo().Cp(); + const volScalarField& p = this->carrierThermo().p(); + + autoPtr > rhoInterp = interpolation::New + ( + this->interpolationSchemes(), + this->rho() + ); + + autoPtr > UInterp = interpolation::New + ( + this->interpolationSchemes(), + this->U() + ); + + autoPtr > muInterp = interpolation::New + ( + this->interpolationSchemes(), + this->mu() + ); + + autoPtr > TInterp = interpolation::New + ( + this->interpolationSchemes(), + T + ); + + autoPtr > cpInterp = interpolation::New + ( + this->interpolationSchemes(), + cp + ); + + autoPtr > pInterp = interpolation::New + ( + this->interpolationSchemes(), + p + ); + + typename ParcelType::trackData td + ( + *this, + constProps_, + rhoInterp(), + UInterp(), + muInterp(), + TInterp(), + cpInterp(), + pInterp(), + this->g().value() + ); + + this->injection().inject(td); + + if (this->coupled()) + { + resetSourceTerms(); + } + + Cloud::move(td); +} + + +template +void Foam::ReactingCloud::postEvolve() +{ + ThermoCloud::postEvolve(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -181,88 +262,17 @@ void Foam::ReactingCloud::resetSourceTerms() } -template -void Foam::ReactingCloud::preEvolve() -{ - ThermoCloud::preEvolve(); -} - - -template -void Foam::ReactingCloud::postEvolve() -{ - ThermoCloud::postEvolve(); -} - - template void Foam::ReactingCloud::evolve() { - preEvolve(); - - const volScalarField& T = this->carrierThermo().T(); - const volScalarField cp = this->carrierThermo().Cp(); - const volScalarField& p = this->carrierThermo().p(); - - autoPtr > rhoInterp = interpolation::New - ( - this->interpolationSchemes(), - this->rho() - ); - - autoPtr > UInterp = interpolation::New - ( - this->interpolationSchemes(), - this->U() - ); - - autoPtr > muInterp = interpolation::New - ( - this->interpolationSchemes(), - this->mu() - ); - - autoPtr > TInterp = interpolation::New - ( - this->interpolationSchemes(), - T - ); - - autoPtr > cpInterp = interpolation::New - ( - this->interpolationSchemes(), - cp - ); - - autoPtr > pInterp = interpolation::New - ( - this->interpolationSchemes(), - p - ); - - typename ParcelType::trackData td - ( - *this, - constProps_, - rhoInterp(), - UInterp(), - muInterp(), - TInterp(), - cpInterp(), - pInterp(), - this->g().value() - ); - - this->injection().inject(td); - - if (this->coupled()) + if (this->active()) { - resetSourceTerms(); + preEvolve(); + + evolveCloud(); + + postEvolve(); } - - Cloud::move(td); - - postEvolve(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 23f579649a..fe9ca29aee 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -137,6 +137,9 @@ protected: //- Pre-evolve void preEvolve(); + //- Evolve the cloud + void evolveCloud(); + //- Post-evolve void postEvolve(); diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index e81aa2ee8d..b783cb2b08 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -29,6 +29,89 @@ License #include "DevolatilisationModel.H" #include "SurfaceReactionModel.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::ReactingMultiphaseCloud::preEvolve() +{ + ReactingCloud::preEvolve(); +} + + +template +void Foam::ReactingMultiphaseCloud::evolveCloud() +{ + const volScalarField& T = this->carrierThermo().T(); + const volScalarField cp = this->carrierThermo().Cp(); + const volScalarField& p = this->carrierThermo().p(); + + autoPtr > rhoInterp = interpolation::New + ( + this->interpolationSchemes(), + this->rho() + ); + + autoPtr > UInterp = interpolation::New + ( + this->interpolationSchemes(), + this->U() + ); + + autoPtr > muInterp = interpolation::New + ( + this->interpolationSchemes(), + this->mu() + ); + + autoPtr > TInterp = interpolation::New + ( + this->interpolationSchemes(), + T + ); + + autoPtr > cpInterp = interpolation::New + ( + this->interpolationSchemes(), + cp + ); + + autoPtr > pInterp = interpolation::New + ( + this->interpolationSchemes(), + p + ); + + typename ParcelType::trackData td + ( + *this, + constProps_, + rhoInterp(), + UInterp(), + muInterp(), + TInterp(), + cpInterp(), + pInterp(), + this->g().value() + ); + + this->injection().inject(td); + + if (this->coupled()) + { + resetSourceTerms(); + } + + Cloud::move(td); +} + + +template +void Foam::ReactingMultiphaseCloud::postEvolve() +{ + ReactingCloud::postEvolve(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -135,88 +218,17 @@ void Foam::ReactingMultiphaseCloud::resetSourceTerms() } -template -void Foam::ReactingMultiphaseCloud::preEvolve() -{ - ReactingCloud::preEvolve(); -} - - -template -void Foam::ReactingMultiphaseCloud::postEvolve() -{ - ReactingCloud::postEvolve(); -} - - template void Foam::ReactingMultiphaseCloud::evolve() { - preEvolve(); - - const volScalarField& T = this->carrierThermo().T(); - const volScalarField cp = this->carrierThermo().Cp(); - const volScalarField& p = this->carrierThermo().p(); - - autoPtr > rhoInterp = interpolation::New - ( - this->interpolationSchemes(), - this->rho() - ); - - autoPtr > UInterp = interpolation::New - ( - this->interpolationSchemes(), - this->U() - ); - - autoPtr > muInterp = interpolation::New - ( - this->interpolationSchemes(), - this->mu() - ); - - autoPtr > TInterp = interpolation::New - ( - this->interpolationSchemes(), - T - ); - - autoPtr > cpInterp = interpolation::New - ( - this->interpolationSchemes(), - cp - ); - - autoPtr > pInterp = interpolation::New - ( - this->interpolationSchemes(), - p - ); - - typename ParcelType::trackData td - ( - *this, - constProps_, - rhoInterp(), - UInterp(), - muInterp(), - TInterp(), - cpInterp(), - pInterp(), - this->g().value() - ); - - this->injection().inject(td); - - if (this->coupled()) + if (this->active()) { - resetSourceTerms(); + preEvolve(); + + evolveCloud(); + + postEvolve(); } - - Cloud::move(td); - - postEvolve(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 61dcdf6679..d3cf593678 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -119,6 +119,9 @@ protected: //- Pre-evolve void preEvolve(); + //- Evolve the cloud + void evolveCloud(); + //- Post-evolve void postEvolve(); diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 28fa0b20e7..0d12d286b9 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -30,6 +30,81 @@ License #include "HeatTransferModel.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::ThermoCloud::preEvolve() +{ + KinematicCloud::preEvolve(); +} + + +template +void Foam::ThermoCloud::evolveCloud() +{ + const volScalarField& T = carrierThermo_.T(); + const volScalarField cp = carrierThermo_.Cp(); + + autoPtr > rhoInterp = interpolation::New + ( + this->interpolationSchemes(), + this->rho() + ); + + autoPtr > UInterp = interpolation::New + ( + this->interpolationSchemes(), + this->U() + ); + + autoPtr > muInterp = interpolation::New + ( + this->interpolationSchemes(), + this->mu() + ); + + autoPtr > TInterp = interpolation::New + ( + this->interpolationSchemes(), + T + ); + + autoPtr > cpInterp = interpolation::New + ( + this->interpolationSchemes(), + cp + ); + + typename ParcelType::trackData td + ( + *this, + constProps_, + rhoInterp(), + UInterp(), + muInterp(), + TInterp(), + cpInterp(), + this->g().value() + ); + + this->injection().inject(td); + + if (this->coupled()) + { + resetSourceTerms(); + } + + Cloud::move(td); +} + + +template +void Foam::ThermoCloud::postEvolve() +{ + KinematicCloud::postEvolve(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -149,80 +224,17 @@ void Foam::ThermoCloud::resetSourceTerms() } -template -void Foam::ThermoCloud::preEvolve() -{ - KinematicCloud::preEvolve(); -} - - -template -void Foam::ThermoCloud::postEvolve() -{ - KinematicCloud::postEvolve(); -} - - template void Foam::ThermoCloud::evolve() { - preEvolve(); - - const volScalarField& T = carrierThermo_.T(); - const volScalarField cp = carrierThermo_.Cp(); - - autoPtr > rhoInterp = interpolation::New - ( - this->interpolationSchemes(), - this->rho() - ); - - autoPtr > UInterp = interpolation::New - ( - this->interpolationSchemes(), - this->U() - ); - - autoPtr > muInterp = interpolation::New - ( - this->interpolationSchemes(), - this->mu() - ); - - autoPtr > TInterp = interpolation::New - ( - this->interpolationSchemes(), - T - ); - - autoPtr > cpInterp = interpolation::New - ( - this->interpolationSchemes(), - cp - ); - - typename ParcelType::trackData td - ( - *this, - constProps_, - rhoInterp(), - UInterp(), - muInterp(), - TInterp(), - cpInterp(), - this->g().value() - ); - - this->injection().inject(td); - - if (this->coupled()) + if (this->active()) { - resetSourceTerms(); + preEvolve(); + + evolveCloud(); + + postEvolve(); } - - Cloud::move(td); - - postEvolve(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index 793a563f5b..c0e2d5864a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -125,6 +125,9 @@ protected: //- Pre-evolve void preEvolve(); + //- Evolve the cloud + void evolveCloud(); + //- Post-evolve void postEvolve();