diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index d59f4dbc9bd1c853f2e72f8b30279658b2b5f262..cca5d3db162a1a4336461c8d7a1568072b027bd5 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -34,39 +34,6 @@ License #include "PostProcessingModel.H" #include "WallInteractionModel.H" - -// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // - -template<class ParcelType> -void Foam::KinematicCloud<ParcelType>::addNewParcel -( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt -) -{ - ParcelType* pPtr = new ParcelType - ( - *this, - position, - cellId, - parcelTypeId_, - nParticles, - d, - U, - constProps_ - ); - - scalar continuousDt = this->db().time().deltaT().value(); - pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt; - - addParticle(pPtr); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class ParcelType> @@ -181,6 +148,24 @@ Foam::KinematicCloud<ParcelType>::~KinematicCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class ParcelType> +void Foam::KinematicCloud<ParcelType>::checkParcelProperties +( + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + if (!fullyDescribed) + { + pPtr->rho() = constProps_.rho0(); + } + + scalar carrierDt = this->db().time().deltaT().value(); + pPtr->stepFraction() = (carrierDt - lagrangianDt)/carrierDt; +} + + template<class ParcelType> void Foam::KinematicCloud<ParcelType>::resetSourceTerms() { diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index c25324fa1c8ee4341e5661e0a6be02d870afe75f..cc18841e7005d037e1273f88547126b3347950cd 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -87,7 +87,18 @@ class KinematicCloud public Cloud<ParcelType>, public kinematicCloud { - // Private data + // Private Member Functions + + //- Disallow default bitwise copy construct + KinematicCloud(const KinematicCloud&); + + //- Disallow default bitwise assignment + void operator=(const KinematicCloud&); + + +protected: + + // Protected data //- References to the mesh and time databases const fvMesh& mesh_; @@ -173,15 +184,6 @@ class KinematicCloud DimensionedField<vector, volMesh> UTrans_; - // Private Member Functions - - //- Disallow default bitwise copy construct - KinematicCloud(const KinematicCloud&); - - //- Disallow default bitwise assignment - void operator=(const KinematicCloud&); - - public: // Constructors @@ -350,15 +352,12 @@ public: // Cloud evolution functions - //- Add new parcel - void addNewParcel + //- Check parcel properties + void checkParcelProperties ( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed ); //- Reset the spray source terms diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 2c8c8cc1ee58946b4fd9b7d6f97ddea87c0868b1..cd1fdca7e99577abb71557d1a5e1311e153cdbb3 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -32,33 +32,29 @@ License // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // template<class ParcelType> -void Foam::ReactingCloud<ParcelType>::addNewParcel +void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition ( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt + const scalarField& YSupplied, + const scalarField& Y, + const word& YName ) { - ParcelType* pPtr = new ParcelType - ( - *this, - position, - cellId, - this->parcelTypeId(), - nParticles, - d, - U, - composition().YMixture0(), - constProps_ - ); - - scalar continuousDt = this->db().time().deltaT().value(); - pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt; - - addParticle(pPtr); + if (YSupplied.size() != Y.size()) + { + FatalErrorIn + ( + "ReactingCloud<ParcelType>::checkSuppliedComposition" + "(" + "const scalarField&, " + "const scalarField&, " + "const word&" + ")" + ) << YName << " supplied, but size is not compatible with " + << "parcel composition: " << nl << " " + << YName << "(" << YSupplied.size() << ") vs required composition " + << YName << "(" << Y.size() << ")" << nl + << abort(FatalError); + } } @@ -135,6 +131,40 @@ Foam::ReactingCloud<ParcelType>::~ReactingCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class ParcelType> +void Foam::ReactingCloud<ParcelType>::checkParcelProperties +( + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + ThermoCloud<ParcelType>::checkParcelProperties + ( + pPtr, + lagrangianDt, + fullyDescribed + ); + + if (!fullyDescribed) + { + pPtr->Y() = composition().YMixture0(); + } + else + { + checkSuppliedComposition + ( + pPtr->Y(), + composition().YMixture0(), + "YMixture" + ); + } + + // derived information - store initial mass + pPtr->mass0() = pPtr->mass(); +} + + template<class ParcelType> void Foam::ReactingCloud<ParcelType>::resetSourceTerms() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 5bd879f97b9812ad6bb5e89d19c0a630714de2db..9b78fbb5ad561cc6ada618dd840b01d1f8b3cf4e 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -72,7 +72,18 @@ class ReactingCloud public ThermoCloud<ParcelType>, public reactingCloud { - // Private data + // Private Member Functions + + //- Disallow default bitwise copy construct + ReactingCloud(const ReactingCloud&); + + //- Disallow default bitwise assignment + void operator=(const ReactingCloud&); + + +protected: + + // Protected data //- Parcel constant properties typename ParcelType::constantProperties constProps_; @@ -107,13 +118,17 @@ class ReactingCloud scalar dMassPhaseChange_; - // Private Member Functions + // Protected Member Functions - //- Disallow default bitwise copy construct - ReactingCloud(const ReactingCloud&); + // New parcel helper functions - //- Disallow default bitwise assignment - void operator=(const ReactingCloud&); + //- Check that size of a composition field is valid + void checkSuppliedComposition + ( + const scalarField& YSupplied, + const scalarField& Y, + const word& YName + ); public: @@ -201,15 +216,12 @@ public: // Cloud evolution functions - //- Add new parcel - void addNewParcel + //- Check parcel properties + void checkParcelProperties ( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed ); //- Reset the spray source terms diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 82c8e5daa87321a6f7757dc64e95e5bd06f8c04a..241dfaa65a59b6028282abe60d5ceff1e6e75436 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -29,46 +29,6 @@ License #include "DevolatilisationModel.H" #include "SurfaceReactionModel.H" -// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // - -template<class ParcelType> -void Foam::ReactingMultiphaseCloud<ParcelType>::addNewParcel -( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt -) -{ - label idGas = this->composition().idGas(); - label idLiquid = this->composition().idLiquid(); - label idSolid = this->composition().idSolid(); - - ParcelType* pPtr = new ParcelType - ( - *this, - position, - cellId, - this->parcelTypeId(), - nParticles, - d, - U, - this->composition().YMixture0(), - this->composition().Y0(idGas), - this->composition().Y0(idLiquid), - this->composition().Y0(idSolid), - constProps_ - ); - - scalar continuousDt = this->db().time().deltaT().value(); - pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt; - - addParticle(pPtr); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class ParcelType> @@ -114,6 +74,55 @@ Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class ParcelType> +void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties +( + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + ReactingCloud<ParcelType>::checkParcelProperties + ( + pPtr, + lagrangianDt, + fullyDescribed + ); + + label idGas = this->composition().idGas(); + label idLiquid = this->composition().idLiquid(); + label idSolid = this->composition().idSolid(); + + if (!fullyDescribed) + { + pPtr->YGas() = this->composition().Y0(idGas); + pPtr->YLiquid() = this->composition().Y0(idLiquid); + pPtr->YSolid() = this->composition().Y0(idSolid); + } + else + { + this->checkSuppliedComposition + ( + pPtr->YGas(), + this->composition().Y0(idGas), + "YGas" + ); + this->checkSuppliedComposition + ( + pPtr->YLiquid(), + this->composition().Y0(idLiquid), + "YLiquid" + ); + this->checkSuppliedComposition + ( + pPtr->YSolid(), + this->composition().Y0(idSolid), + "YSolid" + ); + } +} + + template<class ParcelType> void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 47ca1de7b4892c29df1f69d65c299b3f40f4884e..7d3bb60207f5503734c760e68bdb48c01c2441fd 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -68,7 +68,18 @@ class ReactingMultiphaseCloud public ReactingCloud<ParcelType>, public reactingMultiphaseCloud { - // Private data + // Private Member Functions + + //- Disallow default bitwise copy construct + ReactingMultiphaseCloud(const ReactingMultiphaseCloud&); + + //- Disallow default bitwise assignment + void operator=(const ReactingMultiphaseCloud&); + + +protected: + + // Protected data //- Parcel constant properties typename ParcelType::constantProperties constProps_; @@ -101,15 +112,6 @@ class ReactingMultiphaseCloud scalar dMassSurfaceReaction_; - // Private Member Functions - - //- Disallow default bitwise copy construct - ReactingMultiphaseCloud(const ReactingMultiphaseCloud&); - - //- Disallow default bitwise assignment - void operator=(const ReactingMultiphaseCloud&); - - public: // Constructors @@ -174,15 +176,12 @@ public: // Cloud evolution functions - //- Add new parcel - void addNewParcel + //- Check parcel properties + void checkParcelProperties ( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed ); //- Reset the spray source terms diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index c7d43318e2817f0773e74b20c4fee542971f25b5..bdde1bbdfe49458f4da209d2c138fa0ee55eeec8 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -30,38 +30,6 @@ License #include "HeatTransferModel.H" -// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // - -template<class ParcelType> -void Foam::ThermoCloud<ParcelType>::addNewParcel -( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt -) -{ - ParcelType* pPtr = new ParcelType - ( - *this, - position, - cellId, - this->parcelTypeId(), - nParticles, - d, - U, - constProps_ - ); - - scalar continuousDt = this->db().time().deltaT().value(); - pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt; - - addParticle(pPtr); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class ParcelType> @@ -142,6 +110,29 @@ Foam::ThermoCloud<ParcelType>::~ThermoCloud() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class ParcelType> +void Foam::ThermoCloud<ParcelType>::checkParcelProperties +( + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + KinematicCloud<ParcelType>::checkParcelProperties + ( + pPtr, + lagrangianDt, + fullyDescribed + ); + + if (!fullyDescribed) + { + pPtr->T() = constProps_.T0(); + pPtr->cp() = constProps_.cp0(); + } +} + + template<class ParcelType> void Foam::ThermoCloud<ParcelType>::resetSourceTerms() { diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index df3321d1a7b8658b5278a6a6d159de4695fedb73..2660060baf293834643a999008081ecbbd7bc0e3 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -46,7 +46,6 @@ SourceFiles #include "KinematicCloud.H" #include "thermoCloud.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -67,7 +66,18 @@ class ThermoCloud public KinematicCloud<ParcelType>, public thermoCloud { - // Private data + // Private Member Functions + + //- Disallow default bitwise copy construct + ThermoCloud(const ThermoCloud&); + + //- Disallow default bitwise assignment + void operator=(const ThermoCloud&); + + +protected: + + // Protected data //- Thermo parcel constant properties typename ParcelType::constantProperties constProps_; @@ -110,15 +120,6 @@ class ThermoCloud DimensionedField<scalar, volMesh> hcTrans_; - // Private Member Functions - - //- Disallow default bitwise copy construct - ThermoCloud(const ThermoCloud&); - - //- Disallow default bitwise assignment - void operator=(const ThermoCloud&); - - public: // Constructors @@ -216,15 +217,12 @@ public: // Cloud evolution functions - //- Add new parcel - void addNewParcel + //- Check parcel properties + void checkParcelProperties ( - const vector& position, - const label cellId, - const scalar d, - const vector& U, - const scalar nParticles, - const scalar lagrangianDt + ParcelType* pPtr, + const scalar lagrangianDt, + const bool fullyDescribed ); //- Reset the spray source terms