From 87c15bf1c6f9457702c2f647878b38617e703330 Mon Sep 17 00:00:00 2001 From: Will Bainbridge <http://cfd.direct> Date: Tue, 22 Aug 2017 15:28:04 +0100 Subject: [PATCH] lagrangian: Un-templated the tracking data Tracking data classes are no longer templated on the derived cloud type. The advantage of this is that they can now be passed to sub models. This should allow continuous phase data to be removed from the parcel classes. The disadvantage is that every function which once took a templated TrackData argument now needs an additional TrackCloudType argument in order to perform the necessary down-casting. --- .../preProcessing/mapFields/mapLagrangian.C | 2 +- .../mapFieldsPar/mapLagrangian.C | 2 +- .../field/nearWallFields/findCellParticle.C | 11 +- .../field/nearWallFields/findCellParticle.H | 14 +- .../field/nearWallFields/nearWallFields.C | 2 +- .../field/streamLine/streamLine.C | 2 +- .../field/streamLine/streamLineParticle.C | 12 +- .../field/streamLine/streamLineParticle.H | 22 +- .../clouds/Templates/DSMCCloud/DSMCCloud.C | 2 +- .../parcels/Templates/DSMCParcel/DSMCParcel.C | 79 ++++--- .../parcels/Templates/DSMCParcel/DSMCParcel.H | 49 ++--- src/lagrangian/basic/Cloud/Cloud.C | 15 +- src/lagrangian/basic/Cloud/Cloud.H | 10 +- src/lagrangian/basic/particle/particle.H | 133 +++++++----- .../basic/particle/particleTemplates.C | 129 +++++++----- .../Templates/CollidingCloud/CollidingCloud.C | 40 ++-- .../Templates/CollidingCloud/CollidingCloud.H | 19 +- .../Templates/KinematicCloud/KinematicCloud.C | 69 +++--- .../Templates/KinematicCloud/KinematicCloud.H | 24 ++- .../clouds/Templates/MPPICCloud/MPPICCloud.C | 41 ++-- .../clouds/Templates/MPPICCloud/MPPICCloud.H | 10 +- .../Templates/ReactingCloud/ReactingCloud.C | 5 +- .../ReactingMultiphaseCloud.C | 5 +- .../Templates/ThermoCloud/ThermoCloud.C | 5 +- .../CollidingParcel/CollidingParcel.C | 17 +- .../CollidingParcel/CollidingParcel.H | 13 +- .../KinematicParcel/KinematicParcel.C | 133 +++++++----- .../KinematicParcel/KinematicParcel.H | 67 +++--- .../KinematicParcelTrackingDataI.H | 34 ++- .../Templates/MPPICParcel/MPPICParcel.C | 25 +-- .../Templates/MPPICParcel/MPPICParcel.H | 23 +- .../MPPICParcel/MPPICParcelTrackingDataI.H | 43 ++-- .../ReactingMultiphaseParcel.C | 198 +++++++++++------- .../ReactingMultiphaseParcel.H | 44 ++-- .../Templates/ReactingParcel/ReactingParcel.C | 129 +++++++----- .../Templates/ReactingParcel/ReactingParcel.H | 41 ++-- .../ReactingParcelTrackingDataI.H | 13 +- .../Templates/ThermoParcel/ThermoParcel.C | 102 +++++---- .../Templates/ThermoParcel/ThermoParcel.H | 41 ++-- .../ThermoParcel/ThermoParcelTrackingDataI.H | 28 +-- .../InjectionModel/InjectionModel.C | 17 +- .../InjectionModel/InjectionModel.H | 19 +- .../InjectionModel/InjectionModelList.C | 19 +- .../InjectionModel/InjectionModelList.H | 19 +- .../SurfaceFilmModel/SurfaceFilmModel.C | 12 +- .../SurfaceFilmModel/SurfaceFilmModel.H | 4 +- .../molecule/molecule/molecule.C | 15 +- .../molecule/molecule/molecule.H | 10 +- .../molecule/moleculeCloud/moleculeCloud.C | 8 +- src/lagrangian/solidParticle/solidParticle.C | 13 +- src/lagrangian/solidParticle/solidParticle.H | 10 +- .../solidParticle/solidParticleCloud.C | 4 +- src/lagrangian/solidParticle/solidParticleI.H | 4 +- .../clouds/Templates/SprayCloud/SprayCloud.C | 7 +- .../Templates/SprayParcel/SprayParcel.C | 121 ++++++----- .../Templates/SprayParcel/SprayParcel.H | 44 ++-- .../meshRefinement/meshRefinementRefine.C | 4 +- .../trackedParticle/trackedParticle.C | 15 +- .../trackedParticle/trackedParticle.H | 22 +- src/sampling/sampledSet/face/faceOnlySet.C | 4 +- .../sampledSet/polyLine/polyLineSet.C | 2 - src/sampling/sampledSet/uniform/uniformSet.C | 2 - 62 files changed, 1196 insertions(+), 832 deletions(-) diff --git a/applications/utilities/preProcessing/mapFields/mapLagrangian.C b/applications/utilities/preProcessing/mapFields/mapLagrangian.C index 45cd8e4bb5b..d450795f47b 100644 --- a/applications/utilities/preProcessing/mapFields/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFields/mapLagrangian.C @@ -143,7 +143,7 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp) IDLList<passiveParticle>() ); - particle::TrackingData<passiveParticleCloud> td(targetParcels); + passiveParticle::trackingData td(targetParcels); label sourceParticleI = 0; diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C b/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C index 2f41a6eee60..2fe1df15ec6 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapLagrangian.C @@ -133,7 +133,7 @@ void mapLagrangian(const meshToMesh& interp) IDLList<passiveParticle>() ); - particle::TrackingData<passiveParticleCloud> td(targetParcels); + passiveParticle::trackingData td(targetParcels); label sourceParticleI = 0; diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C index d53a904f3b4..d2482ed697a 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.C +++ b/src/functionObjects/field/nearWallFields/findCellParticle.C @@ -95,6 +95,7 @@ Foam::findCellParticle::findCellParticle bool Foam::findCellParticle::move ( + Cloud<findCellParticle>& cloud, trackingData& td, const scalar maxTrackLen ) @@ -105,7 +106,7 @@ bool Foam::findCellParticle::move while (td.keepParticle && !td.switchProcessor && stepFraction() < 1) { const scalar f = 1 - stepFraction(); - trackToAndHitFace(f*(end_ - start_), f, td); + trackToAndHitFace(f*(end_ - start_), f, cloud, td); } if (stepFraction() == 1 || !td.keepParticle) @@ -123,6 +124,7 @@ bool Foam::findCellParticle::move bool Foam::findCellParticle::hitPatch ( const polyPatch&, + Cloud<findCellParticle>& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -136,6 +138,7 @@ bool Foam::findCellParticle::hitPatch void Foam::findCellParticle::hitWedgePatch ( const wedgePolyPatch&, + Cloud<findCellParticle>& cloud, trackingData& td ) { @@ -147,6 +150,7 @@ void Foam::findCellParticle::hitWedgePatch void Foam::findCellParticle::hitSymmetryPlanePatch ( const symmetryPlanePolyPatch&, + Cloud<findCellParticle>& cloud, trackingData& td ) { @@ -158,6 +162,7 @@ void Foam::findCellParticle::hitSymmetryPlanePatch void Foam::findCellParticle::hitSymmetryPatch ( const symmetryPolyPatch&, + Cloud<findCellParticle>& cloud, trackingData& td ) { @@ -169,6 +174,7 @@ void Foam::findCellParticle::hitSymmetryPatch void Foam::findCellParticle::hitCyclicPatch ( const cyclicPolyPatch&, + Cloud<findCellParticle>& cloud, trackingData& td ) { @@ -180,6 +186,7 @@ void Foam::findCellParticle::hitCyclicPatch void Foam::findCellParticle::hitProcessorPatch ( const processorPolyPatch&, + Cloud<findCellParticle>& cloud, trackingData& td ) { @@ -191,6 +198,7 @@ void Foam::findCellParticle::hitProcessorPatch void Foam::findCellParticle::hitWallPatch ( const wallPolyPatch& wpp, + Cloud<findCellParticle>& cloud, trackingData& td, const tetIndices& ) @@ -203,6 +211,7 @@ void Foam::findCellParticle::hitWallPatch void Foam::findCellParticle::hitPatch ( const polyPatch& wpp, + Cloud<findCellParticle>& cloud, trackingData& td ) { diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index ccc44e92388..f70eaba5471 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -80,7 +80,7 @@ public: //- Class used to pass tracking data to the trackToFace function class trackingData : - public particle::TrackingData<Cloud<findCellParticle>> + public particle::trackingData { labelListList& cellToData_; List<List<point>>& cellToEnd_; @@ -96,7 +96,7 @@ public: List<List<point>>& cellToEnd ) : - particle::TrackingData<Cloud<findCellParticle>>(cloud), + particle::trackingData(cloud), cellToData_(cellToData), cellToEnd_(cellToEnd) {} @@ -220,7 +220,7 @@ public: // Tracking //- Track all particles to their end point - bool move(trackingData&, const scalar); + bool move(Cloud<findCellParticle>&, trackingData&, const scalar); //- Overridable function to handle the particle hitting a patch @@ -228,6 +228,7 @@ public: bool hitPatch ( const polyPatch&, + Cloud<findCellParticle>&, trackingData& td, const label patchi, const scalar trackFraction, @@ -238,6 +239,7 @@ public: void hitWedgePatch ( const wedgePolyPatch&, + Cloud<findCellParticle>&, trackingData& td ); @@ -246,6 +248,7 @@ public: void hitSymmetryPlanePatch ( const symmetryPlanePolyPatch&, + Cloud<findCellParticle>&, trackingData& td ); @@ -254,6 +257,7 @@ public: void hitSymmetryPatch ( const symmetryPolyPatch&, + Cloud<findCellParticle>&, trackingData& td ); @@ -261,6 +265,7 @@ public: void hitCyclicPatch ( const cyclicPolyPatch&, + Cloud<findCellParticle>&, trackingData& td ); @@ -269,6 +274,7 @@ public: void hitProcessorPatch ( const processorPolyPatch&, + Cloud<findCellParticle>&, trackingData& td ); @@ -276,6 +282,7 @@ public: void hitWallPatch ( const wallPolyPatch&, + Cloud<findCellParticle>&, trackingData& td, const tetIndices& ); @@ -284,6 +291,7 @@ public: void hitPatch ( const polyPatch&, + Cloud<findCellParticle>&, trackingData& td ); diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index 515f22763ab..681956f30f2 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -189,7 +189,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing() } - cloud.move(td, maxTrackLen); + cloud.move(cloud, td, maxTrackLen); // Rework cell-to-globalpatchface into a map diff --git a/src/functionObjects/field/streamLine/streamLine.C b/src/functionObjects/field/streamLine/streamLine.C index 8f0bd5cc9ae..131d3ba025d 100644 --- a/src/functionObjects/field/streamLine/streamLine.C +++ b/src/functionObjects/field/streamLine/streamLine.C @@ -112,7 +112,7 @@ void Foam::functionObjects::streamLine::track() const scalar trackTime = Foam::sqrt(GREAT); // Track - particles.move(td, trackTime); + particles.move(particles, td, trackTime); } diff --git a/src/functionObjects/field/streamLine/streamLineParticle.C b/src/functionObjects/field/streamLine/streamLineParticle.C index 217ad4f1751..11e4a850aaa 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.C +++ b/src/functionObjects/field/streamLine/streamLineParticle.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "streamLineParticle.H" +#include "streamLineParticleCloud.H" #include "vectorFieldIOField.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -140,6 +141,7 @@ Foam::streamLineParticle::streamLineParticle bool Foam::streamLineParticle::move ( + streamLineParticleCloud& cloud, trackingData& td, const scalar ) @@ -198,7 +200,7 @@ bool Foam::streamLineParticle::move dt = maxDt; } - trackToAndHitFace(dt*U, 0, td); + trackToAndHitFace(dt*U, 0, cloud, td); if ( @@ -266,6 +268,7 @@ bool Foam::streamLineParticle::move bool Foam::streamLineParticle::hitPatch ( const polyPatch&, + streamLineParticleCloud& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -280,6 +283,7 @@ bool Foam::streamLineParticle::hitPatch void Foam::streamLineParticle::hitWedgePatch ( const wedgePolyPatch& pp, + streamLineParticleCloud& cloud, trackingData& td ) { @@ -291,6 +295,7 @@ void Foam::streamLineParticle::hitWedgePatch void Foam::streamLineParticle::hitSymmetryPlanePatch ( const symmetryPlanePolyPatch& pp, + streamLineParticleCloud& cloud, trackingData& td ) { @@ -302,6 +307,7 @@ void Foam::streamLineParticle::hitSymmetryPlanePatch void Foam::streamLineParticle::hitSymmetryPatch ( const symmetryPolyPatch& pp, + streamLineParticleCloud& cloud, trackingData& td ) { @@ -313,6 +319,7 @@ void Foam::streamLineParticle::hitSymmetryPatch void Foam::streamLineParticle::hitCyclicPatch ( const cyclicPolyPatch& pp, + streamLineParticleCloud& cloud, trackingData& td ) { @@ -324,6 +331,7 @@ void Foam::streamLineParticle::hitCyclicPatch void Foam::streamLineParticle::hitProcessorPatch ( const processorPolyPatch&, + streamLineParticleCloud& cloud, trackingData& td ) { @@ -335,6 +343,7 @@ void Foam::streamLineParticle::hitProcessorPatch void Foam::streamLineParticle::hitWallPatch ( const wallPolyPatch& wpp, + streamLineParticleCloud& cloud, trackingData& td, const tetIndices& ) @@ -347,6 +356,7 @@ void Foam::streamLineParticle::hitWallPatch void Foam::streamLineParticle::hitPatch ( const polyPatch& wpp, + streamLineParticleCloud& cloud, trackingData& td ) { diff --git a/src/functionObjects/field/streamLine/streamLineParticle.H b/src/functionObjects/field/streamLine/streamLineParticle.H index 42282e1790d..d8f73afec96 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.H +++ b/src/functionObjects/field/streamLine/streamLineParticle.H @@ -49,6 +49,7 @@ namespace Foam // Forward declaration of friend functions and operators class streamLineParticle; +class streamLineParticleCloud; Ostream& operator<<(Ostream&, const streamLineParticle&); @@ -64,7 +65,7 @@ public: class trackingData : - public particle::TrackingData<Cloud<streamLineParticle>> + public particle::trackingData { public: @@ -94,7 +95,7 @@ public: //- Construct from components trackingData ( - Cloud<streamLineParticle>& cloud, + streamLineParticleCloud& cloud, const PtrList<interpolation<scalar>>& vsInterp, const PtrList<interpolation<vector>>& vvInterp, const label UIndex, @@ -106,7 +107,7 @@ public: List<DynamicList<vectorList>>& allVectors ) : - particle::TrackingData<Cloud<streamLineParticle>>(cloud), + particle::trackingData(cloud), vsInterp_(vsInterp), vvInterp_(vvInterp), UIndex_(UIndex), @@ -206,13 +207,19 @@ public: // Tracking //- Track all particles to their end point - bool move(trackingData&, const scalar); + bool move + ( + streamLineParticleCloud& cloud, + trackingData&, + const scalar + ); //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions bool hitPatch ( const polyPatch&, + streamLineParticleCloud& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -223,6 +230,7 @@ public: void hitWedgePatch ( const wedgePolyPatch&, + streamLineParticleCloud& cloud, trackingData& td ); @@ -231,6 +239,7 @@ public: void hitSymmetryPlanePatch ( const symmetryPlanePolyPatch&, + streamLineParticleCloud& cloud, trackingData& td ); @@ -239,6 +248,7 @@ public: void hitSymmetryPatch ( const symmetryPolyPatch&, + streamLineParticleCloud& cloud, trackingData& td ); @@ -246,6 +256,7 @@ public: void hitCyclicPatch ( const cyclicPolyPatch&, + streamLineParticleCloud& cloud, trackingData& td ); @@ -254,6 +265,7 @@ public: void hitProcessorPatch ( const processorPolyPatch&, + streamLineParticleCloud& cloud, trackingData& td ); @@ -261,6 +273,7 @@ public: void hitWallPatch ( const wallPolyPatch&, + streamLineParticleCloud& cloud, trackingData& td, const tetIndices& ); @@ -269,6 +282,7 @@ public: void hitPatch ( const polyPatch&, + streamLineParticleCloud& cloud, trackingData& td ); diff --git a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C index 685e90ec44c..3648d6a0c25 100644 --- a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C +++ b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C @@ -952,7 +952,7 @@ void Foam::DSMCCloud<ParcelType>::evolve() this->inflowBoundary().inflow(); // Move the particles ballistically with their current velocities - Cloud<ParcelType>::move(td, mesh_.time().deltaTValue()); + Cloud<ParcelType>::move(*this, td, mesh_.time().deltaTValue()); // Update cell occupancy buildCellOccupancy(); diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C index 7df06d3b98e..202ff22abff 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C @@ -29,16 +29,21 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> -bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime) +template<class TrackCloudType> +bool Foam::DSMCParcel<ParcelType>::move +( + TrackCloudType& cloud, + trackingData& td, + const scalar trackTime +) { - typename TrackData::cloudType::parcelType& p = - static_cast<typename TrackData::cloudType::parcelType&>(*this); + typename TrackCloudType::parcelType& p = + static_cast<typename TrackCloudType::parcelType&>(*this); td.switchProcessor = false; td.keepParticle = true; - const polyMesh& mesh = td.cloud().pMesh(); + const polyMesh& mesh = cloud.pMesh(); const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); // For reduced-D cases, the velocity used to track needs to be @@ -59,7 +64,7 @@ bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime) meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking); const scalar f = 1 - p.stepFraction(); - p.trackToAndHitFace(f*trackTime*Utracking, f, td); + p.trackToAndHitFace(f*trackTime*Utracking, f, cloud, td); if (p.onBoundaryFace() && td.keepParticle) { @@ -75,11 +80,12 @@ bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime) template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> bool Foam::DSMCParcel<ParcelType>::hitPatch ( const polyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label, const scalar, const tetIndices& @@ -90,11 +96,12 @@ bool Foam::DSMCParcel<ParcelType>::hitPatch template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::DSMCParcel<ParcelType>::hitProcessorPatch ( const processorPolyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { td.switchProcessor = true; @@ -102,11 +109,12 @@ void Foam::DSMCParcel<ParcelType>::hitProcessorPatch template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::DSMCParcel<ParcelType>::hitWallPatch ( const wallPolyPatch& wpp, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const tetIndices& tetIs ) { @@ -116,9 +124,9 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch const scalar fA = mag(wpp.faceAreas()[wppLocalFace]); - const scalar deltaT = td.cloud().pMesh().time().deltaTValue(); + const scalar deltaT = cloud.pMesh().time().deltaTValue(); - const constantProperties& constProps(td.cloud().constProps(typeId_)); + const constantProperties& constProps(cloud.constProps(typeId_)); scalar m = constProps.mass(); @@ -131,19 +139,19 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch scalar invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL); - td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA; + cloud.rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA; - td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA; + cloud.rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA; - td.cloud().linearKEBF()[wppIndex][wppLocalFace] += + cloud.linearKEBF()[wppIndex][wppLocalFace] += 0.5*m*(U_ & U_)*invMagUnfA; - td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA; + cloud.internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA; - td.cloud().iDofBF()[wppIndex][wppLocalFace] += + cloud.iDofBF()[wppIndex][wppLocalFace] += constProps.internalDegreesOfFreedom()*invMagUnfA; - td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA; + cloud.momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA; // pre-interaction energy scalar preIE = 0.5*m*(U_ & U_) + Ei_; @@ -151,7 +159,7 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch // pre-interaction momentum vector preIMom = m*U_; - td.cloud().wallInteraction().correct + cloud.wallInteraction().correct ( static_cast<DSMCParcel<ParcelType> &>(*this), wpp @@ -163,19 +171,19 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL); - td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA; + cloud.rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA; - td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA; + cloud.rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA; - td.cloud().linearKEBF()[wppIndex][wppLocalFace] += + cloud.linearKEBF()[wppIndex][wppLocalFace] += 0.5*m*(U_ & U_)*invMagUnfA; - td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA; + cloud.internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA; - td.cloud().iDofBF()[wppIndex][wppLocalFace] += + cloud.iDofBF()[wppIndex][wppLocalFace] += constProps.internalDegreesOfFreedom()*invMagUnfA; - td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA; + cloud.momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA; // post-interaction energy scalar postIE = 0.5*m*(U_ & U_) + Ei_; @@ -183,20 +191,25 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch // post-interaction momentum vector postIMom = m*U_; - scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA); + scalar deltaQ = cloud.nParticle()*(preIE - postIE)/(deltaT*fA); - vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA); + vector deltaFD = cloud.nParticle()*(preIMom - postIMom)/(deltaT*fA); - td.cloud().qBF()[wppIndex][wppLocalFace] += deltaQ; + cloud.qBF()[wppIndex][wppLocalFace] += deltaQ; - td.cloud().fDBF()[wppIndex][wppLocalFace] += deltaFD; + cloud.fDBF()[wppIndex][wppLocalFace] += deltaFD; } template<class ParcelType> -template<class TrackData> -void Foam::DSMCParcel<ParcelType>::hitPatch(const polyPatch&, TrackData& td) +template<class TrackCloudType> +void Foam::DSMCParcel<ParcelType>::hitPatch +( + const polyPatch&, + TrackCloudType& cloud, + trackingData& td +) { td.keepParticle = false; } diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H index b3525cd7db4..85cb58c2858 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H @@ -125,24 +125,8 @@ public: }; - //- Class used to pass kinematic tracking data to the trackToFace function - class trackingData - : - public particle::TrackingData<DSMCCloud<DSMCParcel<ParcelType>>> - { - public: - - // Constructors - - //- Construct from components - trackingData(DSMCCloud<DSMCParcel<ParcelType>>& cloud) - : - particle::TrackingData<DSMCCloud<DSMCParcel<ParcelType>>> - ( - cloud - ) - {} - }; + //- Use base tracking data + typedef typename ParcelType::trackingData trackingData; protected: @@ -262,19 +246,25 @@ public: // Tracking //- Move the parcel - template<class TrackData> - bool move(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + bool move + ( + TrackCloudType& cloud, + trackingData& td, + const scalar trackTime + ); // Patch interactions //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions - template<class TrackData> + template<class TrackCloudType> bool hitPatch ( const polyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label patchi, const scalar trackFraction, const tetIndices& tetIs @@ -282,28 +272,31 @@ public: //- Overridable function to handle the particle hitting a // processorPatch - template<class TrackData> + template<class TrackCloudType> void hitProcessorPatch ( const processorPolyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); //- Overridable function to handle the particle hitting a wallPatch - template<class TrackData> + template<class TrackCloudType> void hitWallPatch ( const wallPolyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const tetIndices& ); //- Overridable function to handle the particle hitting a polyPatch - template<class TrackData> + template<class TrackCloudType> void hitPatch ( const polyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); //- Transform the physical properties of the particle diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index f0f7da835c4..b17c8fdbee0 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -181,8 +181,13 @@ void Foam::Cloud<ParticleType>::cloudReset(const Cloud<ParticleType>& c) template<class ParticleType> -template<class TrackData> -void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime) +template<class TrackCloudType> +void Foam::Cloud<ParticleType>::move +( + TrackCloudType& cloud, + typename ParticleType::trackingData& td, + const scalar trackTime +) { const polyBoundaryMesh& pbm = pMesh().boundaryMesh(); const globalMeshData& pData = polyMesh_.globalData(); @@ -253,7 +258,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime) ParticleType& p = pIter(); // Move the particle - bool keepParticle = p.move(td, trackTime); + bool keepParticle = p.move(cloud, td, trackTime); // If the particle is to be kept // (i.e. it hasn't passed through an inlet or outlet) @@ -282,7 +287,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime) ).neighbProcNo() ]; - p.prepareForParallelTransfer(patchi, td); + p.prepareForParallelTransfer(patchi, cloud, td); particleTransferLists[n].append(this->remove(&p)); @@ -375,7 +380,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime) label patchi = procPatches[receivePatchIndex[pI++]]; - newp.correctAfterParallelTransfer(patchi, td); + newp.correctAfterParallelTransfer(patchi, cloud, td); addParticle(newParticles.remove(&newp)); } diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index aa35eb3b478..04ef10a053e 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -253,9 +253,13 @@ public: void cloudReset(const Cloud<ParticleType>& c); //- Move the particles - // passing the TrackingData to the track function - template<class TrackData> - void move(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + void move + ( + TrackCloudType& cloud, + typename ParticleType::trackingData& td, + const scalar trackTime + ); //- Remap the cells of particles corresponding to the // mesh topology change diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index fed069bfe9c..1043bb20b47 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -106,21 +106,12 @@ class particle public: - template<class CloudType> - class TrackingData + class trackingData { - // Private data - - //- Reference to the cloud containing (this) particle - CloudType& cloud_; - - public: // Public data - typedef CloudType cloudType; - //- Flag to switch processor bool switchProcessor; @@ -129,19 +120,9 @@ public: // Constructor - TrackingData(CloudType& cloud) - : - cloud_(cloud) + template <class TrackCloudType> + trackingData(const TrackCloudType& cloud) {} - - - // Member functions - - //- Return a reference to the cloud - CloudType& cloud() - { - return cloud_; - } }; @@ -305,75 +286,105 @@ protected: // patch. Executed before other patch-hitting functions. // trackFraction is passed in to allow mesh motion to // interpolate in time to the correct face state. - template<class TrackData> + template<class TrackCloudType> bool hitPatch ( const polyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label patchi, const scalar trackFraction, const tetIndices& tetIs ); //- Overridable function to handle the particle hitting a wedgePatch - template<class TrackData> - void hitWedgePatch(const wedgePolyPatch&, TrackData& td); + template<class TrackCloudType> + void hitWedgePatch + ( + const wedgePolyPatch&, + TrackCloudType& cloud, + trackingData& td + ); //- Overridable function to handle the particle hitting a // symmetryPlanePatch - template<class TrackData> + template<class TrackCloudType> void hitSymmetryPlanePatch ( const symmetryPlanePolyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); //- Overridable function to handle the particle hitting a // symmetryPatch - template<class TrackData> - void hitSymmetryPatch(const symmetryPolyPatch&, TrackData& td); + template<class TrackCloudType> + void hitSymmetryPatch + ( + const symmetryPolyPatch&, + TrackCloudType& cloud, + trackingData& td + ); //- Overridable function to handle the particle hitting a cyclicPatch - template<class TrackData> - void hitCyclicPatch(const cyclicPolyPatch&, TrackData& td); + template<class TrackCloudType> + void hitCyclicPatch + ( + const cyclicPolyPatch&, + TrackCloudType& cloud, + trackingData& td + ); //- Overridable function to handle the particle hitting a cyclicAMIPatch - template<class TrackData> + template<class TrackCloudType> void hitCyclicAMIPatch ( const cyclicAMIPolyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const vector& direction ); //- Overridable function to handle the particle hitting a // cyclicACMIPatch - template<class TrackData> + template<class TrackCloudType> void hitCyclicACMIPatch ( const cyclicACMIPolyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const vector& direction ); //- Overridable function to handle the particle hitting a // processorPatch - template<class TrackData> - void hitProcessorPatch(const processorPolyPatch&, TrackData& td); + template<class TrackCloudType> + void hitProcessorPatch + ( + const processorPolyPatch&, + TrackCloudType& cloud, + trackingData& td + ); //- Overridable function to handle the particle hitting a wallPatch - template<class TrackData> + template<class TrackCloudType> void hitWallPatch ( const wallPolyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const tetIndices& tetIs ); //- Overridable function to handle the particle hitting a // general patch - template<class TrackData> - void hitPatch(const polyPatch&, TrackData& td); + template<class TrackCloudType> + void hitPatch + ( + const polyPatch&, + TrackCloudType& cloud, + trackingData& td + ); public: @@ -604,20 +615,22 @@ public: //- Hit the current face. If the current face is internal than this // crosses into the next cell. If it is a boundary face then this will // interact the particle with the relevant patch. - template<class TrackData> + template<class TrackCloudType> void hitFace ( const vector& direction, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); - //- Convenience function. Combines trackToFace and hitFace - template<class TrackData> + //- Convenience function. Cobines trackToFace and hitFace + template<class TrackCloudType> void trackToAndHitFace ( const vector& direction, const scalar fraction, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); //- Set the constrained components of the particle position to the @@ -650,13 +663,23 @@ public: //- Convert global addressing to the processor patch // local equivalents - template<class TrackData> - void prepareForParallelTransfer(const label patchi, TrackData& td); + template<class TrackCloudType> + void prepareForParallelTransfer + ( + const label patchi, + TrackCloudType& cloud, + trackingData& td + ); //- Convert processor patch addressing to the global equivalents // and set the celli to the face-neighbour - template<class TrackData> - void correctAfterParallelTransfer(const label patchi, TrackData& td); + template<class TrackCloudType> + void correctAfterParallelTransfer + ( + const label patchi, + TrackCloudType& cloud, + trackingData& td + ); // Interaction list referral @@ -698,12 +721,12 @@ public: // I-O //- Read the fields associated with the owner cloud - template<class CloudType> - static void readFields(CloudType& c); + template<class TrackCloudType> + static void readFields(TrackCloudType& c); //- Write the fields associated with the owner cloud - template<class CloudType> - static void writeFields(const CloudType& c); + template<class TrackCloudType> + static void writeFields(const TrackCloudType& c); //- Write particle fields as objects into the obr registry template<class CloudType> diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index 34a540c68ff..eac77b61fa4 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -37,11 +37,12 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template<class TrackData> +template<class TrackCloudType> void Foam::particle::prepareForParallelTransfer ( const label patchi, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { // Convert the face index to be local to the processor patch @@ -49,11 +50,12 @@ void Foam::particle::prepareForParallelTransfer } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::correctAfterParallelTransfer ( const label patchi, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { const coupledPolyPatch& ppp = @@ -101,8 +103,8 @@ void Foam::particle::correctAfterParallelTransfer // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class CloudType> -void Foam::particle::readFields(CloudType& c) +template<class TrackCloudType> +void Foam::particle::readFields(TrackCloudType& c) { bool valid = c.size(); @@ -120,7 +122,7 @@ void Foam::particle::readFields(CloudType& c) c.checkFieldIOobject(c, origId); label i = 0; - forAllIter(typename CloudType, c, iter) + forAllIter(typename TrackCloudType, c, iter) { particle& p = iter(); @@ -131,12 +133,12 @@ void Foam::particle::readFields(CloudType& c) } -template<class CloudType> -void Foam::particle::writeFields(const CloudType& c) +template<class TrackCloudType> +void Foam::particle::writeFields(const TrackCloudType& c) { label np = c.size(); - IOPosition<CloudType> ioP(c); + IOPosition<TrackCloudType> ioP(c); ioP.write(np > 0); IOField<label> origProc @@ -151,7 +153,7 @@ void Foam::particle::writeFields(const CloudType& c) ); label i = 0; - forAllConstIter(typename CloudType, c, iter) + forAllConstIter(typename TrackCloudType, c, iter) { origProc[i] = iter().origProc_; origId[i] = iter().origId_; @@ -181,13 +183,19 @@ void Foam::particle::writeObjects(const CloudType& c, objectRegistry& obr) } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitFace ( const vector& direction, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { + typename TrackCloudType::particleType& p = + static_cast<typename TrackCloudType::particleType&>(*this); + typename TrackCloudType::particleType::trackingData& ttd = + static_cast<typename TrackCloudType::particleType::trackingData&>(td); + if (!onFace()) { return; @@ -198,9 +206,6 @@ void Foam::particle::hitFace } else if (onBoundaryFace()) { - typename TrackData::cloudType::particleType& p = - static_cast<typename TrackData::cloudType::particleType&>(*this); - const tetIndices faceHitTetIs(celli_, tetFacei_, tetPti_); if @@ -208,7 +213,8 @@ void Foam::particle::hitFace !p.hitPatch ( mesh_.boundaryMesh()[patch()], - td, + cloud, + ttd, patch(), stepFraction(), faceHitTetIs @@ -221,28 +227,30 @@ void Foam::particle::hitFace { p.hitWedgePatch ( - static_cast<const wedgePolyPatch&>(patch), td + static_cast<const wedgePolyPatch&>(patch), cloud, ttd ); } else if (isA<symmetryPlanePolyPatch>(patch)) { p.hitSymmetryPlanePatch ( - static_cast<const symmetryPlanePolyPatch&>(patch), td + static_cast<const symmetryPlanePolyPatch&>(patch), + cloud, + ttd ); } else if (isA<symmetryPolyPatch>(patch)) { p.hitSymmetryPatch ( - static_cast<const symmetryPolyPatch&>(patch), td + static_cast<const symmetryPolyPatch&>(patch), cloud, ttd ); } else if (isA<cyclicPolyPatch>(patch)) { p.hitCyclicPatch ( - static_cast<const cyclicPolyPatch&>(patch), td + static_cast<const cyclicPolyPatch&>(patch), cloud, ttd ); } else if (isA<cyclicACMIPolyPatch>(patch)) @@ -250,7 +258,8 @@ void Foam::particle::hitFace p.hitCyclicACMIPatch ( static_cast<const cyclicACMIPolyPatch&>(patch), - td, + cloud, + ttd, direction ); } @@ -259,7 +268,8 @@ void Foam::particle::hitFace p.hitCyclicAMIPatch ( static_cast<const cyclicAMIPolyPatch&>(patch), - td, + cloud, + ttd, direction ); } @@ -267,31 +277,35 @@ void Foam::particle::hitFace { p.hitProcessorPatch ( - static_cast<const processorPolyPatch&>(patch), td + static_cast<const processorPolyPatch&>(patch), cloud, ttd ); } else if (isA<wallPolyPatch>(patch)) { p.hitWallPatch ( - static_cast<const wallPolyPatch&>(patch), td, faceHitTetIs + static_cast<const wallPolyPatch&>(patch), + cloud, + ttd, + faceHitTetIs ); } else { - p.hitPatch(patch, td); + p.hitPatch(patch, cloud, ttd); } } } } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::trackToAndHitFace ( const vector& direction, const scalar fraction, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { trackToFace(direction, fraction); @@ -301,15 +315,16 @@ void Foam::particle::trackToAndHitFace changeToMasterPatch(); } - hitFace(direction, td); + hitFace(direction, cloud, td); } -template<class TrackData> +template<class TrackCloudType> bool Foam::particle::hitPatch ( const polyPatch&, - TrackData&, + TrackCloudType&, + trackingData&, const label, const scalar, const tetIndices& @@ -319,11 +334,12 @@ bool Foam::particle::hitPatch } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitWedgePatch ( const wedgePolyPatch& wpp, - TrackData& + TrackCloudType&, + trackingData& ) { FatalErrorInFunction @@ -337,11 +353,12 @@ void Foam::particle::hitWedgePatch } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitSymmetryPlanePatch ( const symmetryPlanePolyPatch& spp, - TrackData& + TrackCloudType&, + trackingData& ) { vector nf = normal(); @@ -351,11 +368,12 @@ void Foam::particle::hitSymmetryPlanePatch } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitSymmetryPatch ( const symmetryPolyPatch& spp, - TrackData& + TrackCloudType&, + trackingData& ) { vector nf = normal(); @@ -365,11 +383,12 @@ void Foam::particle::hitSymmetryPatch } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitCyclicPatch ( const cyclicPolyPatch& cpp, - TrackData& td + TrackCloudType&, + trackingData& ) { const cyclicPolyPatch& receiveCpp = cpp.neighbPatch(); @@ -408,11 +427,12 @@ void Foam::particle::hitCyclicPatch } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitCyclicAMIPatch ( const cyclicAMIPolyPatch& cpp, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const vector& direction ) { @@ -478,11 +498,12 @@ void Foam::particle::hitCyclicAMIPatch } -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitCyclicACMIPatch ( const cyclicACMIPolyPatch& cpp, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const vector& direction ) { @@ -506,35 +527,41 @@ void Foam::particle::hitCyclicACMIPatch if (couple) { - hitCyclicAMIPatch(cpp, td, direction); + hitCyclicAMIPatch(cpp, cloud, td, direction); } else { // Move to the face associated with the non-overlap patch and redo the // face interaction. tetFacei_ = facei_ = cpp.nonOverlapPatch().start() + localFacei; - hitFace(direction, td); + hitFace(direction, cloud, td); } } -template<class TrackData> -void Foam::particle::hitProcessorPatch(const processorPolyPatch&, TrackData&) +template<class TrackCloudType> +void Foam::particle::hitProcessorPatch +( + const processorPolyPatch&, + TrackCloudType&, + trackingData& +) {} -template<class TrackData> +template<class TrackCloudType> void Foam::particle::hitWallPatch ( const wallPolyPatch&, - TrackData&, + TrackCloudType&, + trackingData&, const tetIndices& ) {} -template<class TrackData> -void Foam::particle::hitPatch(const polyPatch&, TrackData&) +template<class TrackCloudType> +void Foam::particle::hitPatch(const polyPatch&, TrackCloudType&, trackingData&) {} diff --git a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.C b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.C index 1edb13bb766..56929d0468f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.C @@ -44,28 +44,29 @@ void Foam::CollidingCloud<CloudType>::setModels() template<class CloudType> -template<class TrackData> -void Foam::CollidingCloud<CloudType>::moveCollide +template<class TrackCloudType> +void Foam::CollidingCloud<CloudType>::moveCollide ( - TrackData& td, + TrackCloudType& cloud, + typename parcelType::trackingData& td, const scalar deltaT ) { - td.part() = TrackData::tpVelocityHalfStep; - CloudType::move(td, deltaT); + td.part() = parcelType::trackingData::tpVelocityHalfStep; + CloudType::move(cloud, td, deltaT); - td.part() = TrackData::tpLinearTrack; - CloudType::move(td, deltaT); + td.part() = parcelType::trackingData::tpLinearTrack; + CloudType::move(cloud, td, deltaT); - // td.part() = TrackData::tpRotationalTrack; - // CloudType::move(td); + // td.part() = parcelType::trackingData::tpRotationalTrack; + // CloudType::move(cloud, td, deltaT); this->updateCellOccupancy(); this->collision().collide(); - td.part() = TrackData::tpVelocityHalfStep; - CloudType::move(td, deltaT); + td.part() = parcelType::trackingData::tpVelocityHalfStep; + CloudType::move(cloud, td, deltaT); } @@ -187,17 +188,20 @@ void Foam::CollidingCloud<CloudType>::evolve() { if (this->solution().canEvolve()) { - typename parcelType::template - TrackingData<CollidingCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - this->solve(td); + this->solve(*this, td); } } template<class CloudType> -template<class TrackData> -void Foam::CollidingCloud<CloudType>::motion(TrackData& td) +template<class TrackCloudType> +void Foam::CollidingCloud<CloudType>::motion +( + TrackCloudType& cloud, + typename parcelType::trackingData& td +) { // Sympletic leapfrog integration of particle forces: // + apply half deltaV with stored force @@ -219,14 +223,14 @@ void Foam::CollidingCloud<CloudType>::motion(TrackData& td) while(!(++moveCollideSubCycle).end()) { - moveCollide(td, this->db().time().deltaTValue()); + moveCollide(cloud, td, this->db().time().deltaTValue()); } moveCollideSubCycle.endSubCycle(); } else { - moveCollide(td, this->db().time().deltaTValue()); + moveCollide(cloud, td, this->db().time().deltaTValue()); } } diff --git a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.H b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.H index 25c15a10e6b..5a6cde4195c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/CollidingCloud/CollidingCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -120,8 +120,13 @@ protected: // Cloud evolution functions //- Move-collide particles - template<class TrackData> - void moveCollide(TrackData& td, const scalar deltaT); + template<class TrackCloudType> + void moveCollide + ( + TrackCloudType& cloud, + typename parcelType::trackingData& td, + const scalar deltaT + ); //- Reset state of cloud void cloudReset(CollidingCloud<CloudType>& c); @@ -227,8 +232,12 @@ public: void evolve(); //- Particle motion - template<class TrackData> - void motion(TrackData& td); + template<class TrackCloudType> + void motion + ( + TrackCloudType& cloud, + typename parcelType::trackingData& td + ); // I-O diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index aa48ff4c652..dcf2dae564a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -88,43 +88,47 @@ void Foam::KinematicCloud<CloudType>::setModels() template<class CloudType> -template<class TrackData> -void Foam::KinematicCloud<CloudType>::solve(TrackData& td) +template<class TrackCloudType> +void Foam::KinematicCloud<CloudType>::solve +( + TrackCloudType& cloud, + typename parcelType::trackingData& td +) { addProfiling(prof, "cloud::solve"); if (solution_.steadyState()) { - td.cloud().storeState(); + cloud.storeState(); - td.cloud().preEvolve(); + cloud.preEvolve(); - evolveCloud(td); + evolveCloud(cloud, td); if (solution_.coupled()) { - td.cloud().relaxSources(td.cloud().cloudCopy()); + cloud.relaxSources(cloud.cloudCopy()); } } else { - td.cloud().preEvolve(); + cloud.preEvolve(); - evolveCloud(td); + evolveCloud(cloud, td); if (solution_.coupled()) { - td.cloud().scaleSources(); + cloud.scaleSources(); } } - td.cloud().info(); + cloud.info(); - td.cloud().postEvolve(); + cloud.postEvolve(); if (solution_.steadyState()) { - td.cloud().restoreState(); + cloud.restoreState(); } } @@ -175,19 +179,23 @@ void Foam::KinematicCloud<CloudType>::updateCellOccupancy() template<class CloudType> -template<class TrackData> -void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td) +template<class TrackCloudType> +void Foam::KinematicCloud<CloudType>::evolveCloud +( + TrackCloudType& cloud, + typename parcelType::trackingData& td +) { if (solution_.coupled()) { - td.cloud().resetSourceTerms(); + cloud.resetSourceTerms(); } if (solution_.transient()) { label preInjectionSize = this->size(); - this->surfaceFilm().inject(td); + this->surfaceFilm().inject(cloud); // Update the cellOccupancy if the size of the cloud has changed // during the injection. @@ -197,23 +205,23 @@ void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td) preInjectionSize = this->size(); } - injectors_.inject(td); + injectors_.inject(cloud, td); // Assume that motion will update the cellOccupancy as necessary // before it is required. - td.cloud().motion(td); + cloud.motion(cloud, td); stochasticCollision().update(solution_.trackTime()); } else { -// this->surfaceFilm().injectSteadyState(td); +// this->surfaceFilm().injectSteadyState(cloud); - injectors_.injectSteadyState(td, solution_.trackTime()); + injectors_.injectSteadyState(cloud, td, solution_.trackTime()); - td.part() = TrackData::tpLinearTrack; - CloudType::move(td, solution_.trackTime()); + td.part() = parcelType::trackingData::tpLinearTrack; + CloudType::move(cloud, td, solution_.trackTime()); } } @@ -676,20 +684,23 @@ void Foam::KinematicCloud<CloudType>::evolve() { if (solution_.canEvolve()) { - typename parcelType::template - TrackingData<KinematicCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - solve(td); + solve(*this, td); } } template<class CloudType> -template<class TrackData> -void Foam::KinematicCloud<CloudType>::motion(TrackData& td) +template<class TrackCloudType> +void Foam::KinematicCloud<CloudType>::motion +( + TrackCloudType& cloud, + typename parcelType::trackingData& td +) { - td.part() = TrackData::tpLinearTrack; - CloudType::move(td, solution_.trackTime()); + td.part() = parcelType::trackingData::tpLinearTrack; + CloudType::move(cloud, td, solution_.trackTime()); updateCellOccupancy(); } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 10649855e31..49a1835f52c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -246,8 +246,12 @@ protected: // Cloud evolution functions //- Solve the cloud - calls all evolution functions - template<class TrackData> - void solve(TrackData& td); + template<class TrackCloudType> + void solve + ( + TrackCloudType& cloud, + typename parcelType::trackingData& td + ); //- Build the cellOccupancy void buildCellOccupancy(); @@ -257,8 +261,12 @@ protected: void updateCellOccupancy(); //- Evolve the cloud - template<class TrackData> - void evolveCloud(TrackData& td); + template<class TrackCloudType> + void evolveCloud + ( + TrackCloudType& cloud, + typename parcelType::trackingData& td + ); //- Post-evolve void postEvolve(); @@ -582,8 +590,12 @@ public: void evolve(); //- Particle motion - template<class TrackData> - void motion(TrackData& td); + template<class TrackCloudType> + void motion + ( + TrackCloudType& cloud, + typename parcelType::trackingData& td + ); //- Calculate the patch normal and velocity to interact with, // accounting for patch motion if required. diff --git a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C index b0dd2779c31..f43c38eb05f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -164,24 +164,27 @@ void Foam::MPPICCloud<CloudType>::evolve() { if (this->solution().canEvolve()) { - typename parcelType::template - TrackingData<MPPICCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - this->solve(td); + this->solve(*this, td); } } template<class CloudType> -template<class TrackData> -void Foam::MPPICCloud<CloudType>::motion(TrackData& td) +template<class TrackCloudType> +void Foam::MPPICCloud<CloudType>::motion +( + TrackCloudType& cloud, + typename parcelType::trackingData& td +) { // Kinematic // ~~~~~~~~~ // force calculation and tracking - td.part() = TrackData::tpLinearTrack; - CloudType::move(td, this->db().time().deltaTValue()); + td.part() = parcelType::trackingData::tpLinearTrack; + CloudType::move(cloud, td, this->db().time().deltaTValue()); // Preliminary @@ -198,18 +201,18 @@ void Foam::MPPICCloud<CloudType>::motion(TrackData& td) if (dampingModel_->active()) { // update averages - td.updateAverages(*this); + td.updateAverages(cloud); // memory allocation and eulerian calculations dampingModel_->cacheFields(true); // calculate the damping velocity corrections without moving the parcels - td.part() = TrackData::tpDampingNoTrack; - CloudType::move(td, this->db().time().deltaTValue()); + td.part() = parcelType::trackingData::tpDampingNoTrack; + CloudType::move(cloud, td, this->db().time().deltaTValue()); // correct the parcel positions and velocities - td.part() = TrackData::tpCorrectTrack; - CloudType::move(td, this->db().time().deltaTValue()); + td.part() = parcelType::trackingData::tpCorrectTrack; + CloudType::move(cloud, td, this->db().time().deltaTValue()); // finalise and free memory dampingModel_->cacheFields(false); @@ -222,12 +225,12 @@ void Foam::MPPICCloud<CloudType>::motion(TrackData& td) if (packingModel_->active()) { // same procedure as for damping - td.updateAverages(*this); + td.updateAverages(cloud); packingModel_->cacheFields(true); - td.part() = TrackData::tpPackingNoTrack; - CloudType::move(td, this->db().time().deltaTValue()); - td.part() = TrackData::tpCorrectTrack; - CloudType::move(td, this->db().time().deltaTValue()); + td.part() = parcelType::trackingData::tpPackingNoTrack; + CloudType::move(cloud, td, this->db().time().deltaTValue()); + td.part() = parcelType::trackingData::tpCorrectTrack; + CloudType::move(cloud, td, this->db().time().deltaTValue()); packingModel_->cacheFields(false); } @@ -238,7 +241,7 @@ void Foam::MPPICCloud<CloudType>::motion(TrackData& td) if (isotropyModel_->active()) { // update averages - td.updateAverages(*this); + td.updateAverages(cloud); // apply isotropy model isotropyModel_->calculate(); diff --git a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.H b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.H index 2c43139dc76..4021be441a7 100644 --- a/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/MPPICCloud/MPPICCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -220,8 +220,12 @@ public: void evolve(); //- Particle motion - template<class TrackData> - void motion(TrackData& td); + template<class TrackCloudType> + void motion + ( + TrackCloudType& cloud, + typename parcelType::trackingData& td + ); //- I-O diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index d88104d4641..577c150706d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -322,10 +322,9 @@ void Foam::ReactingCloud<CloudType>::evolve() { if (this->solution().canEvolve()) { - typename parcelType::template - TrackingData<ReactingCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - this->solve(td); + this->solve(*this, td); } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 032c382e4bf..746be25be37 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -245,10 +245,9 @@ void Foam::ReactingMultiphaseCloud<CloudType>::evolve() { if (this->solution().canEvolve()) { - typename parcelType::template - TrackingData<ReactingMultiphaseCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - this->solve(td); + this->solve(*this, td); } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 45f683308bb..2f1248ae2f2 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -469,10 +469,9 @@ void Foam::ThermoCloud<CloudType>::evolve() { if (this->solution().canEvolve()) { - typename parcelType::template - TrackingData<ThermoCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - this->solve(td); + this->solve(*this, td); } } diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C index 8a9500b5fe9..a2135932cdb 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C @@ -59,22 +59,23 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> bool Foam::CollidingParcel<ParcelType>::move ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar trackTime ) { - typename TrackData::cloudType::parcelType& p = - static_cast<typename TrackData::cloudType::parcelType&>(*this); + typename TrackCloudType::parcelType& p = + static_cast<typename TrackCloudType::parcelType&>(*this); td.keepParticle = true; td.switchProcessor = false; switch (td.part()) { - case TrackData::tpVelocityHalfStep: + case trackingData::tpVelocityHalfStep: { // First and last leapfrog velocity adjust part, required // before and after tracking and force calculation @@ -89,14 +90,14 @@ bool Foam::CollidingParcel<ParcelType>::move break; } - case TrackData::tpLinearTrack: + case trackingData::tpLinearTrack: { - ParcelType::move(td, trackTime); + ParcelType::move(cloud, td, trackTime); break; } - case TrackData::tpRotationalTrack: + case trackingData::tpRotationalTrack: { NotImplemented; diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H index ed405f81c1b..e6c70e58c27 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.H @@ -121,6 +121,10 @@ public: }; + //- Use base tracking data + typedef typename ParcelType::trackingData trackingData; + + protected: // Protected data @@ -295,8 +299,13 @@ public: // Tracking //- Move the parcel - template<class TrackData> - bool move(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + bool move + ( + TrackCloudType& cloud, + trackingData& td, + const scalar trackTime + ); //- Transform the physical properties of the particle // according to the given transformation tensor diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 4d842bd22c2..61335b315dc 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -38,10 +38,11 @@ Foam::label Foam::KinematicParcel<ParcelType>::maxTrackAttempts = 1; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::KinematicParcel<ParcelType>::setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) @@ -50,16 +51,16 @@ void Foam::KinematicParcel<ParcelType>::setCellValues rhoc_ = td.rhoInterp().interpolate(this->coordinates(), tetIs); - if (rhoc_ < td.cloud().constProps().rhoMin()) + if (rhoc_ < cloud.constProps().rhoMin()) { if (debug) { WarningInFunction << "Limiting observed density in cell " << celli << " to " - << td.cloud().constProps().rhoMin() << nl << endl; + << cloud.constProps().rhoMin() << nl << endl; } - rhoc_ = td.cloud().constProps().rhoMin(); + rhoc_ = cloud.constProps().rhoMin(); } Uc_ = td.UInterp().interpolate(this->coordinates(), tetIs); @@ -67,7 +68,7 @@ void Foam::KinematicParcel<ParcelType>::setCellValues muc_ = td.muInterp().interpolate(this->coordinates(), tetIs); // Apply dispersion components to carrier phase velocity - Uc_ = td.cloud().dispersion().update + Uc_ = cloud.dispersion().update ( dt, celli, @@ -80,23 +81,25 @@ void Foam::KinematicParcel<ParcelType>::setCellValues template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::KinematicParcel<ParcelType>::cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - Uc_ += td.cloud().UTrans()[celli]/massCell(celli); + Uc_ += cloud.UTrans()[celli]/massCell(celli); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::KinematicParcel<ParcelType>::calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) @@ -127,27 +130,41 @@ void Foam::KinematicParcel<ParcelType>::calc // ~~~~~~ // Calculate new particle velocity - this->U_ = calcVelocity(td, dt, celli, Re, muc_, mass0, Su, dUTrans, Spu); + this->U_ = + calcVelocity + ( + cloud, + td, + dt, + celli, + Re, + muc_, + mass0, + Su, + dUTrans, + Spu + ); // Accumulate carrier phase source terms // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (td.cloud().solution().coupled()) + if (cloud.solution().coupled()) { // Update momentum transfer - td.cloud().UTrans()[celli] += np0*dUTrans; + cloud.UTrans()[celli] += np0*dUTrans; // Update momentum transfer coefficient - td.cloud().UCoeff()[celli] += np0*Spu; + cloud.UCoeff()[celli] += np0*Spu; } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli, const scalar Re, @@ -158,11 +175,10 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity scalar& Spu ) const { - typedef typename TrackData::cloudType cloudType; - typedef typename cloudType::parcelType parcelType; - typedef typename cloudType::forceType forceType; + typedef typename TrackCloudType::parcelType parcelType; + typedef typename TrackCloudType::forceType forceType; - const forceType& forces = td.cloud().forces(); + const forceType& forces = cloud.forces(); // Momentum source due to particle forces const parcelType& p = static_cast<const parcelType&>(*this); @@ -182,7 +198,7 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity Spu = dt*Feff.Sp(); IntegrationScheme<vector>::integrationResult Ures = - td.cloud().UIntegrator().integrate(U_, dt, abp, bp); + cloud.UIntegrator().integrate(U_, dt, abp, bp); vector Unew = Ures.value(); @@ -190,7 +206,7 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity dUTrans += dt*(Feff.Sp()*(Ures.average() - Uc_) - Fcp.Su()); // Apply correction to velocity and dUTrans for reduced-D cases - const polyMesh& mesh = td.cloud().pMesh(); + const polyMesh& mesh = cloud.pMesh(); meshTools::constrainDirection(mesh, mesh.solutionD(), Unew); meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans); @@ -250,26 +266,29 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> bool Foam::KinematicParcel<ParcelType>::move ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar trackTime ) { - typename TrackData::cloudType::parcelType& p = - static_cast<typename TrackData::cloudType::parcelType&>(*this); + typename TrackCloudType::parcelType& p = + static_cast<typename TrackCloudType::parcelType&>(*this); + typename TrackCloudType::particleType::trackingData& ttd = + static_cast<typename TrackCloudType::particleType::trackingData&>(td); - td.switchProcessor = false; - td.keepParticle = true; + ttd.switchProcessor = false; + ttd.keepParticle = true; - const polyMesh& mesh = td.cloud().pMesh(); + const polyMesh& mesh = cloud.pMesh(); const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); - const cloudSolution& solution = td.cloud().solution(); + const cloudSolution& solution = cloud.solution(); const scalarField& cellLengthScale = td.cloud().cellLengthScale(); const scalar maxCo = solution.maxCo(); - while (td.keepParticle && !td.switchProcessor && p.stepFraction() < 1) + while (ttd.keepParticle && !ttd.switchProcessor && p.stepFraction() < 1) { // Apply correction to position for reduced-D cases p.constrainToMeshCentre(); @@ -312,26 +331,26 @@ bool Foam::KinematicParcel<ParcelType>::move if (dt > ROOTVSMALL) { // Update cell based properties - p.setCellValues(td, dt, celli); + p.setCellValues(cloud, ttd, dt, celli); if (solution.cellValueSourceCorrection()) { - p.cellValueSourceCorrection(td, dt, celli); + p.cellValueSourceCorrection(cloud, ttd, dt, celli); } - p.calc(td, dt, celli); + p.calc(cloud, ttd, dt, celli); } - if (p.onFace() && td.keepParticle) + if (p.onFace() && ttd.keepParticle) { - p.hitFace(s, td); + p.hitFace(s, cloud, ttd); } - if (p.onBoundaryFace() && td.keepParticle) + if (p.onBoundaryFace() && ttd.keepParticle) { if (isA<processorPolyPatch>(pbMesh[p.patch()])) { - td.switchProcessor = true; + ttd.switchProcessor = true; } } @@ -339,32 +358,33 @@ bool Foam::KinematicParcel<ParcelType>::move if (p.onFace()) { - td.cloud().functions().postFace(p, p.face(), td.keepParticle); + cloud.functions().postFace(p, p.face(), ttd.keepParticle); } - td.cloud().functions().postMove(p, celli, dt, start, td.keepParticle); + cloud.functions().postMove(p, celli, dt, start, ttd.keepParticle); } - return td.keepParticle; + return ttd.keepParticle; } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> bool Foam::KinematicParcel<ParcelType>::hitPatch ( const polyPatch& pp, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label patchi, const scalar trackFraction, const tetIndices& tetIs ) { - typename TrackData::cloudType::parcelType& p = - static_cast<typename TrackData::cloudType::parcelType&>(*this); + typename TrackCloudType::parcelType& p = + static_cast<typename TrackCloudType::parcelType&>(*this); // Invoke post-processing model - td.cloud().functions().postPatch + cloud.functions().postPatch ( p, pp, @@ -378,7 +398,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch // Skip processor patches return false; } - else if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle)) + else if (cloud.surfaceFilm().transferParcel(p, pp, td.keepParticle)) { // Surface film model consumes the interaction, i.e. all // interactions done @@ -387,7 +407,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch else { // Invoke patch interaction model - return td.cloud().patchInteraction().correct + return cloud.patchInteraction().correct ( p, pp, @@ -400,11 +420,12 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::KinematicParcel<ParcelType>::hitProcessorPatch ( const processorPolyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { td.switchProcessor = true; @@ -412,11 +433,12 @@ void Foam::KinematicParcel<ParcelType>::hitProcessorPatch template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::KinematicParcel<ParcelType>::hitWallPatch ( const wallPolyPatch& wpp, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const tetIndices& ) { @@ -425,11 +447,12 @@ void Foam::KinematicParcel<ParcelType>::hitWallPatch template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::KinematicParcel<ParcelType>::hitPatch ( const polyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ) { td.keepParticle = false; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index fbdd578e272..150064e6096 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -154,10 +154,9 @@ public: }; - template<class CloudType> - class TrackingData + class trackingData : - public ParcelType::template TrackingData<CloudType> + public ParcelType::trackingData { public: @@ -198,9 +197,10 @@ public: // Constructors //- Construct from components - inline TrackingData + template <class TrackCloudType> + inline trackingData ( - CloudType& cloud, + const TrackCloudType& cloud, trackPart part = tpLinearTrack ); @@ -283,10 +283,11 @@ protected: // Protected Member Functions //- Calculate new particle velocity - template<class TrackData> + template<class TrackCloudType> const vector calcVelocity ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, // timestep const label celli, // owner cell const scalar Re, // Reynolds number @@ -561,28 +562,31 @@ public: // Main calculation loop //- Set cell values - template<class TrackData> + template<class TrackCloudType> void setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct cell values using latest transfer information - template<class TrackData> + template<class TrackCloudType> void cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Update parcel properties over the time interval - template<class TrackData> + template<class TrackCloudType> void calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); @@ -591,19 +595,25 @@ public: // Tracking //- Move the parcel - template<class TrackData> - bool move(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + bool move + ( + TrackCloudType& cloud, + trackingData& td, + const scalar trackTime + ); // Patch interactions //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions - template<class TrackData> + template<class TrackCloudType> bool hitPatch ( const polyPatch& p, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label patchi, const scalar trackFraction, const tetIndices& tetIs @@ -611,28 +621,31 @@ public: //- Overridable function to handle the particle hitting a // processorPatch - template<class TrackData> + template<class TrackCloudType> void hitProcessorPatch ( const processorPolyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); //- Overridable function to handle the particle hitting a wallPatch - template<class TrackData> + template<class TrackCloudType> void hitWallPatch ( const wallPolyPatch&, - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const tetIndices& ); //- Overridable function to handle the particle hitting a polyPatch - template<class TrackData> + template<class TrackCloudType> void hitPatch ( const polyPatch&, - TrackData& td + TrackCloudType& cloud, + trackingData& td ); //- Transform the physical properties of the particle @@ -651,12 +664,12 @@ public: // I-O //- Read - template<class CloudType> - static void readFields(CloudType& c); + template<class TrackCloudType> + static void readFields(TrackCloudType& c); //- Write - template<class CloudType> - static void writeFields(const CloudType& c); + template<class TrackCloudType> + static void writeFields(const TrackCloudType& c); //- Write particle fields as objects into the obr registry template<class CloudType> diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H index d75c7ec8e66..bf558611ae1 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelTrackingDataI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,14 +24,14 @@ License \*---------------------------------------------------------------------------*/ template<class ParcelType> -template<class CloudType> -inline Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::TrackingData +template<class TrackCloudType> +inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData ( - CloudType& cloud, + const TrackCloudType& cloud, trackPart part ) : - ParcelType::template TrackingData<CloudType>(cloud), + ParcelType::trackingData(cloud), rhoInterp_ ( interpolation<scalar>::New @@ -62,56 +62,48 @@ inline Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::TrackingData template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::rhoInterp() const +Foam::KinematicParcel<ParcelType>::trackingData::rhoInterp() const { return rhoInterp_(); } template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::vector>& -Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::UInterp() const +Foam::KinematicParcel<ParcelType>::trackingData::UInterp() const { return UInterp_(); } template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::muInterp() const +Foam::KinematicParcel<ParcelType>::trackingData::muInterp() const { return muInterp_(); } template<class ParcelType> -template<class CloudType> inline const Foam::vector& -Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::g() const +Foam::KinematicParcel<ParcelType>::trackingData::g() const { return g_; } template<class ParcelType> -template<class CloudType> -inline typename Foam::KinematicParcel<ParcelType>::template -TrackingData<CloudType>::trackPart -Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::part() const +inline typename Foam::KinematicParcel<ParcelType>::trackingData::trackPart +Foam::KinematicParcel<ParcelType>::trackingData::part() const { return part_; } template<class ParcelType> -template<class CloudType> -inline typename Foam::KinematicParcel<ParcelType>::template -TrackingData<CloudType>::trackPart& -Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::part() +inline typename Foam::KinematicParcel<ParcelType>::trackingData::trackPart& +Foam::KinematicParcel<ParcelType>::trackingData::part() { return part_; } diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.C b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.C index f095a512fba..953df551bd4 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.C @@ -53,47 +53,48 @@ Foam::MPPICParcel<ParcelType>::MPPICParcel // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> bool Foam::MPPICParcel<ParcelType>::move ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar trackTime ) { - typename TrackData::cloudType::parcelType& p = - static_cast<typename TrackData::cloudType::parcelType&>(*this); + typename TrackCloudType::parcelType& p = + static_cast<typename TrackCloudType::parcelType&>(*this); td.switchProcessor = false; switch (td.part()) { - case TrackData::tpLinearTrack: + case trackingData::tpLinearTrack: { - ParcelType::move(td, trackTime); + ParcelType::move(cloud, td, trackTime); break; } - case TrackData::tpDampingNoTrack: + case trackingData::tpDampingNoTrack: { p.UCorrect() = - td.cloud().dampingModel().velocityCorrection(p, trackTime); + cloud.dampingModel().velocityCorrection(p, trackTime); td.keepParticle = true; td.switchProcessor = false; break; } - case TrackData::tpPackingNoTrack: + case trackingData::tpPackingNoTrack: { p.UCorrect() = - td.cloud().packingModel().velocityCorrection(p, trackTime); + cloud.packingModel().velocityCorrection(p, trackTime); td.keepParticle = true; td.switchProcessor = false; break; } - case TrackData::tpCorrectTrack: + case trackingData::tpCorrectTrack: { vector U = p.U(); @@ -103,7 +104,7 @@ bool Foam::MPPICParcel<ParcelType>::move p.U() = (1.0 - f)*p.UCorrect(); - ParcelType::move(td, trackTime); + ParcelType::move(cloud, td, trackTime); p.U() = U + (p.stepFraction() - f)*p.UCorrect(); diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H index 9bae31a577c..29ea117cecc 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcel.H @@ -82,11 +82,9 @@ public: static const std::size_t sizeofFields; - //- Tracking data - template<class CloudType> - class TrackingData + class trackingData : - public ParcelType::template TrackingData<CloudType> + public ParcelType::trackingData { public: @@ -137,15 +135,17 @@ public: //- Constructors //- Construct from components - inline TrackingData + template<class TrackCloudType> + inline trackingData ( - CloudType& cloud, + const TrackCloudType& cloud, trackPart part = tpLinearTrack ); //- Update the MPPIC averages - inline void updateAverages(CloudType& cloud); + template<class TrackCloudType> + inline void updateAverages(const TrackCloudType& cloud); //- Access @@ -290,8 +290,13 @@ public: // Tracking //- Move the parcel - template<class TrackData> - bool move(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + bool move + ( + TrackCloudType& cloud, + trackingData& td, + const scalar trackTime + ); // Friend Functions diff --git a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H index bd26b231b68..532f22ea7a2 100644 --- a/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/MPPICParcel/MPPICParcelTrackingDataI.H @@ -28,14 +28,14 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template<class ParcelType> -template<class CloudType> -inline Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::TrackingData +template<class TrackCloudType> +inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData ( - CloudType& cloud, + const TrackCloudType& cloud, trackPart part ) : - ParcelType::template TrackingData<CloudType>(cloud), + ParcelType::trackingData(cloud), volumeAverage_ ( AveragingMethod<scalar>::New @@ -139,11 +139,10 @@ inline Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::TrackingData template<class ParcelType> -template<class CloudType> -inline void -Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages +template<class TrackCloudType> +inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages ( - CloudType& cloud + const TrackCloudType& cloud ) { // zero the sums @@ -173,9 +172,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages AveragingMethod<scalar>& weightAverage = weightAveragePtr(); // averaging sums - forAllConstIter(typename CloudType, cloud, iter) + forAllConstIter(typename TrackCloudType, cloud, iter) { - const typename CloudType::parcelType& p = iter(); + const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); const scalar m = p.nParticle()*p.mass(); @@ -191,9 +190,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages uAverage_->average(massAverage_); // squared velocity deviation - forAllConstIter(typename CloudType, cloud, iter) + forAllConstIter(typename TrackCloudType, cloud, iter) { - const typename CloudType::parcelType& p = iter(); + const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); const vector u = uAverage_->interpolate(p.coordinates(), tetIs); @@ -210,9 +209,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages // sauter mean radius radiusAverage_() = volumeAverage_(); weightAverage = 0; - forAllConstIter(typename CloudType, cloud, iter) + forAllConstIter(typename TrackCloudType, cloud, iter) { - const typename CloudType::parcelType& p = iter(); + const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); weightAverage.add @@ -227,9 +226,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages // collision frequency weightAverage = 0; - forAllConstIter(typename CloudType, cloud, iter) + forAllConstIter(typename TrackCloudType, cloud, iter) { - const typename CloudType::parcelType& p = iter(); + const typename TrackCloudType::parcelType& p = iter(); const tetIndices tetIs = p.currentTetIndices(); const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs); @@ -247,20 +246,16 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages template<class ParcelType> -template<class CloudType> -inline typename Foam::MPPICParcel<ParcelType>::template -TrackingData<CloudType>::trackPart -Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::part() const +inline typename Foam::MPPICParcel<ParcelType>::trackingData::trackPart +Foam::MPPICParcel<ParcelType>::trackingData::part() const { return part_; } template<class ParcelType> -template<class CloudType> -inline typename Foam::MPPICParcel<ParcelType>::template -TrackingData<CloudType>::trackPart& -Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::part() +inline typename Foam::MPPICParcel<ParcelType>::trackingData::trackPart& +Foam::MPPICParcel<ParcelType>::trackingData::part() { return part_; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 5c65a074023..c9635e36cca 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,10 +43,11 @@ const Foam::label Foam::ReactingMultiphaseParcel<ParcelType>::SLD(2); // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar p, const scalar T, const label idG, @@ -55,17 +56,18 @@ 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]*cloud.composition().Cp(idG, YGas_, p, T) + + this->Y_[LIQ]*cloud.composition().Cp(idL, YLiquid_, p, T) + + this->Y_[SLD]*cloud.composition().Cp(idS, YSolid_, p, T); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar p, const scalar T, const label idG, @@ -74,17 +76,18 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff ) const { return - this->Y_[GAS]*td.cloud().composition().Hs(idG, YGas_, p, T) - + this->Y_[LIQ]*td.cloud().composition().Hs(idL, YLiquid_, p, T) - + this->Y_[SLD]*td.cloud().composition().Hs(idS, YSolid_, p, T); + this->Y_[GAS]*cloud.composition().Hs(idG, YGas_, p, T) + + this->Y_[LIQ]*cloud.composition().Hs(idL, YLiquid_, p, T) + + this->Y_[SLD]*cloud.composition().Hs(idS, YSolid_, p, T); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar p, const scalar T, const label idG, @@ -93,9 +96,9 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff ) const { return - this->Y_[GAS]*td.cloud().composition().L(idG, YGas_, p, T) - + this->Y_[LIQ]*td.cloud().composition().L(idL, YLiquid_, p, T) - + this->Y_[SLD]*td.cloud().composition().L(idS, YSolid_, p, T); + this->Y_[GAS]*cloud.composition().L(idG, YGas_, p, T) + + this->Y_[LIQ]*cloud.composition().L(idL, YLiquid_, p, T) + + this->Y_[SLD]*cloud.composition().L(idS, YSolid_, p, T); } @@ -136,44 +139,47 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::updateMassFractions // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingMultiphaseParcel<ParcelType>::setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - ParcelType::setCellValues(td, dt, celli); + ParcelType::setCellValues(cloud, td, dt, celli); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingMultiphaseParcel<ParcelType>::cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { // Re-use correction from reacting parcel - ParcelType::cellValueSourceCorrection(td, dt, celli); + ParcelType::cellValueSourceCorrection(cloud, td, dt, celli); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingMultiphaseParcel<ParcelType>::calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + typedef typename TrackCloudType::reactingCloudType reactingCloudType; const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); + cloud.composition(); // Define local properties at beginning of timestep // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -194,7 +200,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Calc surface values scalar Ts, rhos, mus, Prs, kappas; - this->calcSurfaceValues(td, celli, T0, Ts, rhos, mus, Prs, kappas); + this->calcSurfaceValues(cloud, td, celli, T0, Ts, rhos, mus, Prs, kappas); scalar Res = this->Re(U0, d0, rhos, mus); @@ -241,6 +247,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Calc mass and enthalpy transfer due to phase change this->calcPhaseChange ( + cloud, td, dt, celli, @@ -271,6 +278,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Calc mass and enthalpy transfer due to devolatilisation calcDevolatilisation ( + cloud, td, dt, this->age_, @@ -302,6 +310,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Calc mass and enthalpy transfer due to surface reactions calcSurfaceReactions ( + cloud, td, dt, celli, @@ -332,11 +341,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc scalar mass1 = mass0 - sum(dMassGas) - sum(dMassLiquid) - sum(dMassSolid); // Remove the particle when mass falls below minimum threshold - if (np0*mass1 < td.cloud().constProps().minParcelMass()) + if (np0*mass1 < cloud.constProps().minParcelMass()) { td.keepParticle = false; - if (td.cloud().solution().coupled()) + if (cloud.solution().coupled()) { scalar dm = np0*mass0; @@ -344,12 +353,12 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc forAll(YGas_, i) { label gid = composition.localToCarrierId(GAS, i); - td.cloud().rhoTrans(gid)[celli] += dm*YMix[GAS]*YGas_[i]; + cloud.rhoTrans(gid)[celli] += dm*YMix[GAS]*YGas_[i]; } forAll(YLiquid_, i) { label gid = composition.localToCarrierId(LIQ, i); - td.cloud().rhoTrans(gid)[celli] += dm*YMix[LIQ]*YLiquid_[i]; + cloud.rhoTrans(gid)[celli] += dm*YMix[LIQ]*YLiquid_[i]; } // No mapping between solid components and carrier phase @@ -357,15 +366,16 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc forAll(YSolid_, i) { label gid = composition.localToCarrierId(SLD, i); - td.cloud().rhoTrans(gid)[celli] += dm*YMix[SLD]*YSolid_[i]; + cloud.rhoTrans(gid)[celli] += dm*YMix[SLD]*YSolid_[i]; } */ - td.cloud().UTrans()[celli] += dm*U0; + cloud.UTrans()[celli] += dm*U0; - td.cloud().hsTrans()[celli] += dm*HsEff(td, pc, T0, idG, idL, idS); + cloud.hsTrans()[celli] += + dm*HsEff(cloud, td, pc, T0, idG, idL, idS); - td.cloud().phaseChange().addToPhaseChangeMass(np0*mass1); + cloud.phaseChange().addToPhaseChangeMass(np0*mass1); } return; @@ -374,7 +384,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc (void)updateMassFractions(mass0, dMassGas, dMassLiquid, dMassSolid); // Update particle density or diameter - if (td.cloud().constProps().constantVolume()) + if (cloud.constProps().constantVolume()) { this->rho_ = mass1/this->volume(); } @@ -384,7 +394,18 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc } // Correct surface values due to emitted species - this->correctSurfaceValues(td, celli, Ts, Cs, rhos, mus, Prs, kappas); + this->correctSurfaceValues + ( + cloud, + td, + celli, + Ts, + Cs, + rhos, + mus, + Prs, + kappas + ); Res = this->Re(U0, this->d_, rhos, mus); @@ -398,6 +419,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc this->T_ = this->calcHeatTransfer ( + cloud, td, dt, celli, @@ -411,7 +433,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc ); - this->Cp_ = CpEff(td, pc, this->T_, idG, idL, idS); + this->Cp_ = CpEff(cloud, td, pc, this->T_, idG, idL, idS); // Motion @@ -419,13 +441,25 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // Calculate new particle velocity this->U_ = - this->calcVelocity(td, dt, celli, Res, mus, mass1, Su, dUTrans, Spu); + this->calcVelocity + ( + cloud, + td, + dt, + celli, + Res, + mus, + mass1, + Su, + dUTrans, + Spu + ); // 4. Accumulate carrier phase source terms // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (td.cloud().solution().coupled()) + if (cloud.solution().coupled()) { // Transfer mass lost to carrier mass, momentum and enthalpy sources forAll(YGas_, i) @@ -433,18 +467,18 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc scalar dm = np0*dMassGas[i]; label gid = composition.localToCarrierId(GAS, i); scalar hs = composition.carrier().Hs(gid, pc, T0); - td.cloud().rhoTrans(gid)[celli] += dm; - td.cloud().UTrans()[celli] += dm*U0; - td.cloud().hsTrans()[celli] += dm*hs; + cloud.rhoTrans(gid)[celli] += dm; + cloud.UTrans()[celli] += dm*U0; + cloud.hsTrans()[celli] += dm*hs; } forAll(YLiquid_, i) { scalar dm = np0*dMassLiquid[i]; label gid = composition.localToCarrierId(LIQ, i); scalar hs = composition.carrier().Hs(gid, pc, T0); - td.cloud().rhoTrans(gid)[celli] += dm; - td.cloud().UTrans()[celli] += dm*U0; - td.cloud().hsTrans()[celli] += dm*hs; + cloud.rhoTrans(gid)[celli] += dm; + cloud.UTrans()[celli] += dm*U0; + cloud.hsTrans()[celli] += dm*hs; } // No mapping between solid components and carrier phase @@ -454,9 +488,9 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc scalar dm = np0*dMassSolid[i]; label gid = composition.localToCarrierId(SLD, i); scalar hs = composition.carrier().Hs(gid, pc, T0); - td.cloud().rhoTrans(gid)[celli] += dm; - td.cloud().UTrans()[celli] += dm*U0; - td.cloud().hsTrans()[celli] += dm*hs; + cloud.rhoTrans(gid)[celli] += dm; + cloud.UTrans()[celli] += dm*U0; + cloud.hsTrans()[celli] += dm*hs; } */ @@ -464,27 +498,27 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc { scalar dm = np0*dMassSRCarrier[i]; scalar hs = composition.carrier().Hs(i, pc, T0); - td.cloud().rhoTrans(i)[celli] += dm; - td.cloud().UTrans()[celli] += dm*U0; - td.cloud().hsTrans()[celli] += dm*hs; + cloud.rhoTrans(i)[celli] += dm; + cloud.UTrans()[celli] += dm*U0; + cloud.hsTrans()[celli] += dm*hs; } // Update momentum transfer - td.cloud().UTrans()[celli] += np0*dUTrans; - td.cloud().UCoeff()[celli] += np0*Spu; + cloud.UTrans()[celli] += np0*dUTrans; + cloud.UCoeff()[celli] += np0*Spu; // Update sensible enthalpy transfer - td.cloud().hsTrans()[celli] += np0*dhsTrans; - td.cloud().hsCoeff()[celli] += np0*Sph; + cloud.hsTrans()[celli] += np0*dhsTrans; + cloud.hsCoeff()[celli] += np0*Sph; // Update radiation fields - if (td.cloud().radiation()) + if (cloud.radiation()) { const scalar ap = this->areaP(); const scalar T4 = pow4(T0); - td.cloud().radAreaP()[celli] += dt*np0*ap; - td.cloud().radT4()[celli] += dt*np0*T4; - td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4; + cloud.radAreaP()[celli] += dt*np0*ap; + cloud.radT4()[celli] += dt*np0*T4; + cloud.radAreaPT4()[celli] += dt*np0*ap*T4; } } } @@ -493,10 +527,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const scalar age, const scalar Ts, @@ -516,29 +551,29 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation ) const { // Check that model is active - if (!td.cloud().devolatilisation().active()) + if (!cloud.devolatilisation().active()) { return; } // Initialise demand-driven constants - (void)td.cloud().constProps().TDevol(); - (void)td.cloud().constProps().LDevol(); + (void)cloud.constProps().TDevol(); + (void)cloud.constProps().LDevol(); // Check that the parcel temperature is within necessary limits for // devolatilisation to occur - if (T < td.cloud().constProps().TDevol() || canCombust == -1) + if (T < cloud.constProps().TDevol() || canCombust == -1) { return; } - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + typedef typename TrackCloudType::reactingCloudType reactingCloudType; const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); + cloud.composition(); // Total mass of volatiles evolved - td.cloud().devolatilisation().calculate + cloud.devolatilisation().calculate ( dt, age, @@ -554,15 +589,15 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation scalar dMassTot = sum(dMassDV); - td.cloud().devolatilisation().addToDevolatilisationMass + cloud.devolatilisation().addToDevolatilisationMass ( this->nParticle_*dMassTot ); - Sh -= dMassTot*td.cloud().constProps().LDevol()/dt; + Sh -= dMassTot*cloud.constProps().LDevol()/dt; // Update molar emissions - if (td.cloud().heatTransfer().BirdCorrection()) + if (cloud.heatTransfer().BirdCorrection()) { // Molar average molecular weight of carrier mix const scalar Wc = @@ -594,10 +629,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli, const scalar d, @@ -618,14 +654,14 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions ) const { // Check that model is active - if (!td.cloud().surfaceReaction().active()) + if (!cloud.surfaceReaction().active()) { return; } // Initialise demand-driven constants - (void)td.cloud().constProps().hRetentionCoeff(); - (void)td.cloud().constProps().TMax(); + (void)cloud.constProps().hRetentionCoeff(); + (void)cloud.constProps().TMax(); // Check that model is active if (canCombust != 1) @@ -635,7 +671,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions // Update surface reactions - const scalar hReaction = td.cloud().surfaceReaction().calculate + const scalar hReaction = cloud.surfaceReaction().calculate ( dt, celli, @@ -656,15 +692,15 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions dMassSRCarrier ); - td.cloud().surfaceReaction().addToSurfaceReactionMass + cloud.surfaceReaction().addToSurfaceReactionMass ( this->nParticle_ *(sum(dMassSRGas) + sum(dMassSRLiquid) + sum(dMassSRSolid)) ); - const scalar xsi = min(T/td.cloud().constProps().TMax(), 1.0); + const scalar xsi = min(T/cloud.constProps().TMax(), 1.0); const scalar coeff = - (1.0 - xsi*xsi)*td.cloud().constProps().hRetentionCoeff(); + (1.0 - xsi*xsi)*cloud.constProps().hRetentionCoeff(); Sh += coeff*hReaction/dt; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 0aaaf25a2a8..58b56b56d5b 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -128,15 +128,20 @@ public: }; + //- Use base tracking data + typedef typename ParcelType::trackingData trackingData; + + private: // Private Member Functions //- Return the mixture effective specific heat capacity - template<class TrackData> + template<class TrackCloudType> scalar CpEff ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar p, const scalar T, const label idG, @@ -145,10 +150,11 @@ private: ) const; //- Return the mixture effective sensible enthalpy - template<class TrackData> + template<class TrackCloudType> scalar HsEff ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar p, const scalar T, const label idG, @@ -157,10 +163,11 @@ private: ) const; //- Return the mixture effective latent heat - template<class TrackData> + template<class TrackCloudType> scalar LEff ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar p, const scalar T, const label idG, @@ -205,10 +212,11 @@ protected: // Protected Member Functions //- Calculate Devolatilisation - template<class TrackData> + template<class TrackCloudType> void calcDevolatilisation ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, // timestep const scalar age, // age const scalar Ts, // surface temperature @@ -228,10 +236,11 @@ protected: ) const; //- Calculate surface reactions - template<class TrackData> + template<class TrackCloudType> void calcSurfaceReactions ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, // timestep const label celli, // owner cell const scalar d, // diameter @@ -412,28 +421,31 @@ public: // Main calculation loop //- Set cell values - template<class TrackData> + template<class TrackCloudType> void setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct cell values using latest transfer information - template<class TrackData> + template<class TrackCloudType> void cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Update parcel properties over the time interval - template<class TrackData> + template<class TrackCloudType> void calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 3300c2c3e05..5cf4614cc90 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -34,10 +34,11 @@ using namespace Foam::constant::mathematical; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingParcel<ParcelType>::calcPhaseChange ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli, const scalar Re, @@ -57,10 +58,10 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange scalarField& Cs ) { - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + typedef typename TrackCloudType::reactingCloudType reactingCloudType; const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); - PhaseChangeModel<reactingCloudType>& phaseChange = td.cloud().phaseChange(); + cloud.composition(); + PhaseChangeModel<reactingCloudType>& phaseChange = cloud.phaseChange(); if (!phaseChange.active() || (YPhase < SMALL)) { @@ -115,7 +116,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange // Update molar emissions - if (td.cloud().heatTransfer().BirdCorrection()) + if (cloud.heatTransfer().BirdCorrection()) { // Average molecular weight of carrier mix - assumes perfect gas const scalar Wc = this->rhoc_*RR*this->Tc_/this->pc_; @@ -199,15 +200,16 @@ Foam::ReactingParcel<ParcelType>::ReactingParcel // * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingParcel<ParcelType>::setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - ParcelType::setCellValues(td, dt, celli); + ParcelType::setCellValues(cloud, td, dt, celli); pc_ = td.pInterp().interpolate ( @@ -215,34 +217,35 @@ void Foam::ReactingParcel<ParcelType>::setCellValues this->currentTetIndices() ); - if (pc_ < td.cloud().constProps().pMin()) + if (pc_ < cloud.constProps().pMin()) { if (debug) { WarningInFunction << "Limiting observed pressure in cell " << celli << " to " - << td.cloud().constProps().pMin() << nl << endl; + << cloud.constProps().pMin() << nl << endl; } - pc_ = td.cloud().constProps().pMin(); + pc_ = cloud.constProps().pMin(); } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { scalar addedMass = 0.0; scalar maxMassI = 0.0; - forAll(td.cloud().rhoTrans(), i) + forAll(cloud.rhoTrans(), i) { - scalar dm = td.cloud().rhoTrans(i)[celli]; + scalar dm = cloud.rhoTrans(i)[celli]; maxMassI = max(maxMassI, mag(dm)); addedMass += dm; } @@ -254,16 +257,16 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection const scalar massCell = this->massCell(celli); - this->rhoc_ += addedMass/td.cloud().pMesh().cellVolumes()[celli]; + this->rhoc_ += addedMass/cloud.pMesh().cellVolumes()[celli]; const scalar massCellNew = massCell + addedMass; - this->Uc_ = (this->Uc_*massCell + td.cloud().UTrans()[celli])/massCellNew; + this->Uc_ = (this->Uc_*massCell + cloud.UTrans()[celli])/massCellNew; scalar CpEff = 0.0; - forAll(td.cloud().rhoTrans(), i) + forAll(cloud.rhoTrans(), i) { - scalar Y = td.cloud().rhoTrans(i)[celli]/addedMass; - CpEff += Y*td.cloud().composition().carrier().Cp + scalar Y = cloud.rhoTrans(i)[celli]/addedMass; + CpEff += Y*cloud.composition().carrier().Cp ( i, this->pc_, @@ -274,27 +277,28 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection 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_ += cloud.hsTrans()[celli]/(this->Cpc_*massCellNew); - if (this->Tc_ < td.cloud().constProps().TMin()) + if (this->Tc_ < cloud.constProps().TMin()) { if (debug) { WarningInFunction << "Limiting observed temperature in cell " << celli << " to " - << td.cloud().constProps().TMin() << nl << endl; + << cloud.constProps().TMin() << nl << endl; } - this->Tc_ = td.cloud().constProps().TMin(); + this->Tc_ = cloud.constProps().TMin(); } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingParcel<ParcelType>::correctSurfaceValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label celli, const scalar T, const scalarField& Cs, @@ -305,12 +309,12 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues ) { // No correction if total concentration of emitted species is small - if (!td.cloud().heatTransfer().BirdCorrection() || (sum(Cs) < SMALL)) + if (!cloud.heatTransfer().BirdCorrection() || (sum(Cs) < SMALL)) { return; } - const SLGThermo& thermo = td.cloud().thermo(); + const SLGThermo& thermo = cloud.thermo(); // Far field carrier molar fractions scalarField Xinf(thermo.carrier().species().size()); @@ -383,17 +387,18 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ReactingParcel<ParcelType>::calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + typedef typename TrackCloudType::reactingCloudType reactingCloudType; const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); + cloud.composition(); // Define local properties at beginning of time step @@ -408,7 +413,7 @@ void Foam::ReactingParcel<ParcelType>::calc // Calc surface values scalar Ts, rhos, mus, Prs, kappas; - this->calcSurfaceValues(td, celli, T0, Ts, rhos, mus, Prs, kappas); + this->calcSurfaceValues(cloud, td, celli, T0, Ts, rhos, mus, Prs, kappas); scalar Res = this->Re(U0, d0, rhos, mus); @@ -455,6 +460,7 @@ void Foam::ReactingParcel<ParcelType>::calc // Calc mass and enthalpy transfer due to phase change calcPhaseChange ( + cloud, td, dt, celli, @@ -485,7 +491,7 @@ void Foam::ReactingParcel<ParcelType>::calc this->Cp_ = composition.Cp(0, Y_, pc_, T0); // Update particle density or diameter - if (td.cloud().constProps().constantVolume()) + if (cloud.constProps().constantVolume()) { this->rho_ = mass1/this->volume(); } @@ -495,11 +501,11 @@ void Foam::ReactingParcel<ParcelType>::calc } // Remove the particle when mass falls below minimum threshold - if (np0*mass1 < td.cloud().constProps().minParcelMass()) + if (np0*mass1 < cloud.constProps().minParcelMass()) { td.keepParticle = false; - if (td.cloud().solution().coupled()) + if (cloud.solution().coupled()) { scalar dm = np0*mass0; @@ -510,19 +516,19 @@ void Foam::ReactingParcel<ParcelType>::calc label gid = composition.localToCarrierId(0, i); scalar hs = composition.carrier().Hs(gid, pc_, T0); - td.cloud().rhoTrans(gid)[celli] += dmi; - td.cloud().hsTrans()[celli] += dmi*hs; + cloud.rhoTrans(gid)[celli] += dmi; + cloud.hsTrans()[celli] += dmi*hs; } - td.cloud().UTrans()[celli] += dm*U0; + cloud.UTrans()[celli] += dm*U0; - td.cloud().phaseChange().addToPhaseChangeMass(np0*mass1); + cloud.phaseChange().addToPhaseChangeMass(np0*mass1); } return; } // Correct surface values due to emitted species - correctSurfaceValues(td, celli, Ts, Cs, rhos, mus, Prs, kappas); + correctSurfaceValues(cloud, td, celli, Ts, Cs, rhos, mus, Prs, kappas); Res = this->Re(U0, this->d_, rhos, mus); @@ -536,6 +542,7 @@ void Foam::ReactingParcel<ParcelType>::calc this->T_ = this->calcHeatTransfer ( + cloud, td, dt, celli, @@ -556,13 +563,25 @@ void Foam::ReactingParcel<ParcelType>::calc // Calculate new particle velocity this->U_ = - this->calcVelocity(td, dt, celli, Res, mus, mass1, Su, dUTrans, Spu); + this->calcVelocity + ( + cloud, + td, + dt, + celli, + Res, + mus, + mass1, + Su, + dUTrans, + Spu + ); // 4. Accumulate carrier phase source terms // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (td.cloud().solution().coupled()) + if (cloud.solution().coupled()) { // Transfer mass lost to carrier mass, momentum and enthalpy sources forAll(dMass, i) @@ -571,27 +590,27 @@ void Foam::ReactingParcel<ParcelType>::calc label gid = composition.localToCarrierId(0, i); scalar hs = composition.carrier().Hs(gid, pc_, T0); - td.cloud().rhoTrans(gid)[celli] += dm; - td.cloud().UTrans()[celli] += dm*U0; - td.cloud().hsTrans()[celli] += dm*hs; + cloud.rhoTrans(gid)[celli] += dm; + cloud.UTrans()[celli] += dm*U0; + cloud.hsTrans()[celli] += dm*hs; } // Update momentum transfer - td.cloud().UTrans()[celli] += np0*dUTrans; - td.cloud().UCoeff()[celli] += np0*Spu; + cloud.UTrans()[celli] += np0*dUTrans; + cloud.UCoeff()[celli] += np0*Spu; // Update sensible enthalpy transfer - td.cloud().hsTrans()[celli] += np0*dhsTrans; - td.cloud().hsCoeff()[celli] += np0*Sph; + cloud.hsTrans()[celli] += np0*dhsTrans; + cloud.hsCoeff()[celli] += np0*Sph; // Update radiation fields - if (td.cloud().radiation()) + if (cloud.radiation()) { const scalar ap = this->areaP(); const scalar T4 = pow4(T0); - td.cloud().radAreaP()[celli] += dt*np0*ap; - td.cloud().radT4()[celli] += dt*np0*T4; - td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4; + cloud.radAreaP()[celli] += dt*np0*ap; + cloud.radT4()[celli] += dt*np0*T4; + cloud.radAreaPT4()[celli] += dt*np0*ap*T4; } } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 6335ca9dbd6..1561280e6b4 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -114,10 +114,9 @@ public: }; - template<class CloudType> - class TrackingData + class trackingData : - public ParcelType::template TrackingData<CloudType> + public ParcelType::trackingData { private: @@ -131,17 +130,16 @@ public: public: - typedef typename ParcelType::template TrackingData<CloudType>::trackPart - trackPart; + typedef typename ParcelType::trackingData::trackPart trackPart; // Constructors //- Construct from components - inline TrackingData + template<class TrackCloudType> + inline trackingData ( - CloudType& cloud, - trackPart part = ParcelType::template - TrackingData<CloudType>::tpLinearTrack + const TrackCloudType& cloud, + trackPart part = ParcelType::trackingData::tpLinearTrack ); @@ -175,10 +173,11 @@ protected: // Protected Member Functions //- Calculate Phase change - template<class TrackData> + template<class TrackCloudType> void calcPhaseChange ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, // timestep const label celli, // owner cell const scalar Re, // Reynolds number @@ -357,28 +356,31 @@ public: // Main calculation loop //- Set cell values - template<class TrackData> + template<class TrackCloudType> void setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct cell values using latest transfer information - template<class TrackData> + template<class TrackCloudType> void cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct surface values due to emitted species - template<class TrackData> + template<class TrackCloudType> void correctSurfaceValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label celli, const scalar T, const scalarField& Cs, @@ -389,10 +391,11 @@ public: ); //- Update parcel properties over the time interval - template<class TrackData> + template<class TrackCloudType> void calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H index 1321f2c4703..cee1de2b917 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelTrackingDataI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,14 +24,14 @@ License \*---------------------------------------------------------------------------*/ template<class ParcelType> -template<class CloudType> -inline Foam::ReactingParcel<ParcelType>::TrackingData<CloudType>::TrackingData +template<class TrackCloudType> +inline Foam::ReactingParcel<ParcelType>::trackingData::trackingData ( - CloudType& cloud, + const TrackCloudType& cloud, trackPart part ) : - ParcelType::template TrackingData<CloudType>(cloud, part), + ParcelType::trackingData(cloud, part), pInterp_ ( interpolation<scalar>::New @@ -44,9 +44,8 @@ inline Foam::ReactingParcel<ParcelType>::TrackingData<CloudType>::TrackingData template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::ReactingParcel<ParcelType>::TrackingData<CloudType>::pInterp() const +Foam::ReactingParcel<ParcelType>::trackingData::pInterp() const { return pInterp_(); } diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C index eba53b1c4d8..0a248569360 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C @@ -31,15 +31,16 @@ using namespace Foam::constant; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ThermoParcel<ParcelType>::setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - ParcelType::setCellValues(td, dt, celli); + ParcelType::setCellValues(cloud, td, dt, celli); tetIndices tetIs = this->currentTetIndices(); @@ -47,56 +48,58 @@ void Foam::ThermoParcel<ParcelType>::setCellValues Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs); - if (Tc_ < td.cloud().constProps().TMin()) + if (Tc_ < cloud.constProps().TMin()) { if (debug) { WarningInFunction << "Limiting observed temperature in cell " << celli << " to " - << td.cloud().constProps().TMin() << nl << endl; + << cloud.constProps().TMin() << nl << endl; } - Tc_ = td.cloud().constProps().TMin(); + Tc_ = cloud.constProps().TMin(); } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - this->Uc_ += td.cloud().UTrans()[celli]/this->massCell(celli); + this->Uc_ += cloud.UTrans()[celli]/this->massCell(celli); // tetIndices tetIs = this->currentTetIndices(); // Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs); const scalar CpMean = td.CpInterp().psi()[celli]; - Tc_ += td.cloud().hsTrans()[celli]/(CpMean*this->massCell(celli)); + Tc_ += cloud.hsTrans()[celli]/(CpMean*this->massCell(celli)); - if (Tc_ < td.cloud().constProps().TMin()) + if (Tc_ < cloud.constProps().TMin()) { if (debug) { WarningInFunction << "Limiting observed temperature in cell " << celli << " to " - << td.cloud().constProps().TMin() << nl << endl; + << cloud.constProps().TMin() << nl << endl; } - Tc_ = td.cloud().constProps().TMin(); + Tc_ = cloud.constProps().TMin(); } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ThermoParcel<ParcelType>::calcSurfaceValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label celli, const scalar T, scalar& Ts, @@ -109,16 +112,16 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues // Surface temperature using two thirds rule Ts = (2.0*T + Tc_)/3.0; - if (Ts < td.cloud().constProps().TMin()) + if (Ts < cloud.constProps().TMin()) { if (debug) { WarningInFunction << "Limiting parcel surface temperature to " - << td.cloud().constProps().TMin() << nl << endl; + << cloud.constProps().TMin() << nl << endl; } - Ts = td.cloud().constProps().TMin(); + Ts = cloud.constProps().TMin(); } // Assuming thermo props vary linearly with T for small d(T) @@ -136,10 +139,11 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::ThermoParcel<ParcelType>::calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) @@ -156,7 +160,7 @@ void Foam::ThermoParcel<ParcelType>::calc // Calc surface values // ~~~~~~~~~~~~~~~~~~~ scalar Ts, rhos, mus, Pr, kappas; - calcSurfaceValues(td, celli, this->T_, Ts, rhos, mus, Pr, kappas); + calcSurfaceValues(cloud, td, celli, this->T_, Ts, rhos, mus, Pr, kappas); // Reynolds number scalar Re = this->Re(this->U_, this->d_, rhos, mus); @@ -194,6 +198,7 @@ void Foam::ThermoParcel<ParcelType>::calc this->T_ = this->calcHeatTransfer ( + cloud, td, dt, celli, @@ -212,43 +217,56 @@ void Foam::ThermoParcel<ParcelType>::calc // Calculate new particle velocity this->U_ = - this->calcVelocity(td, dt, celli, Re, mus, mass0, Su, dUTrans, Spu); + this->calcVelocity + ( + cloud, + td, + dt, + celli, + Re, + mus, + mass0, + Su, + dUTrans, + Spu + ); // Accumulate carrier phase source terms // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (td.cloud().solution().coupled()) + if (cloud.solution().coupled()) { // Update momentum transfer - td.cloud().UTrans()[celli] += np0*dUTrans; + cloud.UTrans()[celli] += np0*dUTrans; // Update momentum transfer coefficient - td.cloud().UCoeff()[celli] += np0*Spu; + cloud.UCoeff()[celli] += np0*Spu; // Update sensible enthalpy transfer - td.cloud().hsTrans()[celli] += np0*dhsTrans; + cloud.hsTrans()[celli] += np0*dhsTrans; // Update sensible enthalpy coefficient - td.cloud().hsCoeff()[celli] += np0*Sph; + cloud.hsCoeff()[celli] += np0*Sph; // Update radiation fields - if (td.cloud().radiation()) + if (cloud.radiation()) { const scalar ap = this->areaP(); const scalar T4 = pow4(T0); - td.cloud().radAreaP()[celli] += dt*np0*ap; - td.cloud().radT4()[celli] += dt*np0*T4; - td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4; + cloud.radAreaP()[celli] += dt*np0*ap; + cloud.radT4()[celli] += dt*np0*T4; + cloud.radAreaPT4()[celli] += dt*np0*ap*T4; } } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli, const scalar Re, @@ -260,7 +278,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer scalar& Sph ) { - if (!td.cloud().heatTransfer().active()) + if (!cloud.heatTransfer().active()) { return T_; } @@ -269,15 +287,15 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer const scalar rho = this->rho(); // Calc heat transfer coefficient - scalar htc = td.cloud().heatTransfer().htc(d, Re, Pr, kappa, NCpW); + scalar htc = cloud.heatTransfer().htc(d, Re, Pr, kappa, NCpW); - if (mag(htc) < ROOTVSMALL && !td.cloud().radiation()) + if (mag(htc) < ROOTVSMALL && !cloud.radiation()) { return max ( T_ + dt*Sh/(this->volume(d)*rho*Cp_), - td.cloud().constProps().TMin() + cloud.constProps().TMin() ); } @@ -287,12 +305,12 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer scalar ap = Tc_ + Sh/(As*htc); const scalar bp = 6.0*htc/max(rho*d*Cp_, ROOTVSMALL); - if (td.cloud().radiation()) + if (cloud.radiation()) { tetIndices tetIs = this->currentTetIndices(); const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs); const scalar sigma = physicoChemical::sigma.value(); - const scalar epsilon = td.cloud().constProps().epsilon0(); + const scalar epsilon = cloud.constProps().epsilon0(); // Assume constant source scalar s = epsilon*(Gc/4.0 - sigma*pow4(T_)); @@ -302,7 +320,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer // Integrate to find the new parcel temperature IntegrationScheme<scalar>::integrationResult Tres = - td.cloud().TIntegrator().integrate(T_, dt, ap*bp, bp); + cloud.TIntegrator().integrate(T_, dt, ap*bp, bp); scalar Tnew = min @@ -310,9 +328,9 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer max ( Tres.value(), - td.cloud().constProps().TMin() + cloud.constProps().TMin() ), - td.cloud().constProps().TMax() + cloud.constProps().TMax() ); Sph = dt*htc*As; diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index 4129e25835d..12e3f94323f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -147,10 +147,9 @@ public: }; - template<class CloudType> - class TrackingData + class trackingData : - public ParcelType::template TrackingData<CloudType> + public ParcelType::trackingData { private: @@ -182,17 +181,16 @@ public: public: - typedef typename ParcelType::template TrackingData<CloudType>::trackPart - trackPart; + typedef typename ParcelType::trackingData::trackPart trackPart; // Constructors //- Construct from components - inline TrackingData + template <class TrackCloudType> + inline trackingData ( - CloudType& cloud, - trackPart part = ParcelType::template - TrackingData<CloudType>::tpLinearTrack + const TrackCloudType& cloud, + trackPart part = ParcelType::trackingData::tpLinearTrack ); @@ -247,10 +245,11 @@ protected: // Protected Member Functions //- Calculate new particle temperature - template<class TrackData> + template<class TrackCloudType> scalar calcHeatTransfer ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, // timestep const label celli, // owner cell const scalar Re, // Reynolds number @@ -408,28 +407,31 @@ public: // Main calculation loop //- Set cell values - template<class TrackData> + template<class TrackCloudType> void setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct cell values using latest transfer information - template<class TrackData> + template<class TrackCloudType> void cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Calculate surface thermo properties - template<class TrackData> + template<class TrackCloudType> void calcSurfaceValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label celli, const scalar T, scalar& Ts, @@ -440,10 +442,11 @@ public: ) const; //- Update parcel properties over the time interval - template<class TrackData> + template<class TrackCloudType> void calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H index 76b36470d77..73adcd177f5 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelTrackingDataI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,14 +24,14 @@ License \*---------------------------------------------------------------------------*/ template<class ParcelType> -template<class CloudType> -inline Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TrackingData +template<class TrackCloudType> +inline Foam::ThermoParcel<ParcelType>::trackingData::trackingData ( - CloudType& cloud, + const TrackCloudType& cloud, trackPart part ) : - ParcelType::template TrackingData<CloudType>(cloud, part), + ParcelType::trackingData(cloud, part), Cp_(cloud.thermo().thermo().Cp()), kappa_(cloud.thermo().thermo().kappa()), TInterp_ @@ -76,54 +76,48 @@ inline Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TrackingData template<class ParcelType> -template<class CloudType> inline const Foam::volScalarField& -Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::Cp() const +Foam::ThermoParcel<ParcelType>::trackingData::Cp() const { return Cp_; } template<class ParcelType> -template<class CloudType> inline const Foam::volScalarField& -Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::kappa() const +Foam::ThermoParcel<ParcelType>::trackingData::kappa() const { return kappa_; } template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TInterp() const +Foam::ThermoParcel<ParcelType>::trackingData::TInterp() const { return TInterp_(); } template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::CpInterp() const +Foam::ThermoParcel<ParcelType>::trackingData::CpInterp() const { return CpInterp_(); } template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::kappaInterp() const +Foam::ThermoParcel<ParcelType>::trackingData::kappaInterp() const { return kappaInterp_(); } template<class ParcelType> -template<class CloudType> inline const Foam::interpolation<Foam::scalar>& -Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::GInterp() const +Foam::ThermoParcel<ParcelType>::trackingData::GInterp() const { if (!GInterp_.valid()) { diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 16568fcc9a8..37dd01da999 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -419,8 +419,12 @@ Foam::scalar Foam::InjectionModel<CloudType>::averageParcelMass() template<class CloudType> -template<class TrackData> -void Foam::InjectionModel<CloudType>::inject(TrackData& td) +template<class TrackCloudType> +void Foam::InjectionModel<CloudType>::inject +( + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td +) { if (!this->active()) { @@ -440,7 +444,6 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td) { const scalar trackTime = this->owner().solution().trackTime(); const polyMesh& mesh = this->owner().mesh(); - typename TrackData::cloudType& cloud = td.cloud(); // Duration of injection period during this timestep const scalar deltaT = @@ -519,7 +522,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td) parcelsAdded++; massAdded += pPtr->nParticle()*pPtr->mass(); - if (pPtr->move(td, dt)) + if (pPtr->move(cloud, td, dt)) { pPtr->typeId() = injectorID_; cloud.addParticle(pPtr); @@ -546,10 +549,11 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td) template<class CloudType> -template<class TrackData> +template<class TrackCloudType> void Foam::InjectionModel<CloudType>::injectSteadyState ( - TrackData& td, + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td, const scalar trackTime ) { @@ -566,7 +570,6 @@ void Foam::InjectionModel<CloudType>::injectSteadyState } const polyMesh& mesh = this->owner().mesh(); - typename TrackData::cloudType& cloud = td.cloud(); massTotal_ = massFlowRate_.value(mesh.time().value()); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H index 409aceb3346..f2353146420 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -307,12 +307,21 @@ public: // Per-injection event functions //- Main injection loop - template<class TrackData> - void inject(TrackData& td); + template<class TrackCloudType> + void inject + ( + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td + ); //- Main injection loop - steady-state - template<class TrackData> - void injectSteadyState(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + void injectSteadyState + ( + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td, + const scalar trackTime + ); // Injection geometry diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C index 8fa0cce097a..6da37691167 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -179,27 +179,32 @@ void Foam::InjectionModelList<CloudType>::updateMesh() template<class CloudType> -template<class TrackData> -void Foam::InjectionModelList<CloudType>::inject(TrackData& td) +template<class TrackCloudType> +void Foam::InjectionModelList<CloudType>::inject +( + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td +) { forAll(*this, i) { - this->operator[](i).inject(td); + this->operator[](i).inject(cloud, td); } } template<class CloudType> -template<class TrackData> +template<class TrackCloudType> void Foam::InjectionModelList<CloudType>::injectSteadyState ( - TrackData& td, + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td, const scalar trackTime ) { forAll(*this, i) { - this->operator[](i).injectSteadyState(td, trackTime); + this->operator[](i).injectSteadyState(cloud, td, trackTime); } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H index 84e6c198919..b44e5d60710 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,12 +106,21 @@ public: // Per-injection event functions //- Main injection loop - template<class TrackData> - void inject(TrackData& td); + template<class TrackCloudType> + void inject + ( + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td + ); //- Main injection loop - steady-state - template<class TrackData> - void injectSteadyState(TrackData& td, const scalar trackTime); + template<class TrackCloudType> + void injectSteadyState + ( + TrackCloudType& cloud, + typename CloudType::parcelType::trackingData& td, + const scalar trackTime + ); // I-O diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C index eea2b1fee12..1d26bc43e9c 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.C @@ -100,8 +100,8 @@ Foam::SurfaceFilmModel<CloudType>::~SurfaceFilmModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -template<class TrackData> -void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td) +template<class TrackCloudType> +void Foam::SurfaceFilmModel<CloudType>::inject(TrackCloudType& cloud) { if (!this->active()) { @@ -159,18 +159,18 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td) new parcelType(this->owner().pMesh(), pos, celli); // Check/set new parcel thermo properties - td.cloud().setParcelThermoProperties(*pPtr, 0.0); + cloud.setParcelThermoProperties(*pPtr, 0.0); setParcelProperties(*pPtr, j); if (pPtr->nParticle() > 0.001) { // Check new parcel properties - // td.cloud().checkParcelProperties(*pPtr, 0.0, true); - td.cloud().checkParcelProperties(*pPtr, 0.0, false); + // cloud.checkParcelProperties(*pPtr, 0.0, true); + cloud.checkParcelProperties(*pPtr, 0.0, false); // Add the new parcel to the cloud - td.cloud().addParticle(pPtr); + cloud.addParticle(pPtr); nParcelsInjected_++; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H index 691bbfb97f1..fc0ce8572b7 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModel.H @@ -215,8 +215,8 @@ public: ) = 0; //- Inject parcels into the cloud - template<class TrackData> - void inject(TrackData& td); + template<class TrackCloudType> + void inject(TrackCloudType& cloud); // I-O diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C index ef11eaddaaf..8cd39579849 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C @@ -65,12 +65,17 @@ Foam::tensor Foam::molecule::rotationTensorZ(scalar phi) const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::molecule::move(molecule::trackingData& td, const scalar trackTime) +bool Foam::molecule::move +( + moleculeCloud& cloud, + trackingData& td, + const scalar trackTime +) { td.switchProcessor = false; td.keepParticle = true; - const constantProperties& constProps(td.cloud().constProps(id_)); + const constantProperties& constProps(cloud.constProps(id_)); if (td.part() == 0) { @@ -88,7 +93,7 @@ bool Foam::molecule::move(molecule::trackingData& td, const scalar trackTime) while (td.keepParticle && !td.switchProcessor && stepFraction() < 1) { const scalar f = 1 - stepFraction(); - trackToAndHitFace(f*trackTime*v_, f, td); + trackToAndHitFace(f*trackTime*v_, f, cloud, td); } } else if (td.part() == 2) @@ -233,6 +238,7 @@ void Foam::molecule::setSiteSizes(label size) bool Foam::molecule::hitPatch ( const polyPatch&, + moleculeCloud&, trackingData&, const label, const scalar, @@ -246,6 +252,7 @@ bool Foam::molecule::hitPatch void Foam::molecule::hitProcessorPatch ( const processorPolyPatch&, + moleculeCloud&, trackingData& td ) { @@ -256,6 +263,7 @@ void Foam::molecule::hitProcessorPatch void Foam::molecule::hitWallPatch ( const wallPolyPatch& wpp, + moleculeCloud& cloud, trackingData& td, const tetIndices& tetIs ) @@ -278,6 +286,7 @@ void Foam::molecule::hitWallPatch void Foam::molecule::hitPatch ( const polyPatch&, + moleculeCloud&, trackingData& td ) { diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index 5fd058d473e..36e0ecb81ff 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -164,7 +164,7 @@ public: //- Class used to pass tracking data to the trackToFace function class trackingData : - public particle::TrackingData<moleculeCloud> + public particle::trackingData { // label specifying which part of the integration algorithm is taking label part_; @@ -176,7 +176,7 @@ public: trackingData(moleculeCloud& cloud, label part) : - particle::TrackingData<moleculeCloud>(cloud), + particle::trackingData(cloud), part_(part) {} @@ -309,7 +309,7 @@ public: // Tracking - bool move(trackingData&, const scalar trackTime); + bool move(moleculeCloud&, trackingData&, const scalar trackTime); virtual void transformProperties(const tensor& T); @@ -366,6 +366,7 @@ public: bool hitPatch ( const polyPatch&, + moleculeCloud& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -376,6 +377,7 @@ public: void hitProcessorPatch ( const processorPolyPatch&, + moleculeCloud& cloud, trackingData& td ); @@ -383,6 +385,7 @@ public: void hitWallPatch ( const wallPolyPatch&, + moleculeCloud& cloud, trackingData& td, const tetIndices& ); @@ -391,6 +394,7 @@ public: void hitPatch ( const polyPatch&, + moleculeCloud& cloud, trackingData& td ); diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index 3ff6175c449..6952e7ca554 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -1119,18 +1119,18 @@ Foam::moleculeCloud::moleculeCloud void Foam::moleculeCloud::evolve() { molecule::trackingData td0(*this, 0); - Cloud<molecule>::move(td0, mesh_.time().deltaTValue()); + Cloud<molecule>::move(*this, td0, mesh_.time().deltaTValue()); molecule::trackingData td1(*this, 1); - Cloud<molecule>::move(td1, mesh_.time().deltaTValue()); + Cloud<molecule>::move(*this, td1, mesh_.time().deltaTValue()); molecule::trackingData td2(*this, 2); - Cloud<molecule>::move(td2, mesh_.time().deltaTValue()); + Cloud<molecule>::move(*this, td2, mesh_.time().deltaTValue()); calculateForce(); molecule::trackingData td3(*this, 3); - Cloud<molecule>::move(td3, mesh_.time().deltaTValue()); + Cloud<molecule>::move(*this, td3, mesh_.time().deltaTValue()); } diff --git a/src/lagrangian/solidParticle/solidParticle.C b/src/lagrangian/solidParticle/solidParticle.C index 80737165ec9..4823449c4cb 100644 --- a/src/lagrangian/solidParticle/solidParticle.C +++ b/src/lagrangian/solidParticle/solidParticle.C @@ -36,6 +36,7 @@ namespace Foam bool Foam::solidParticle::move ( + solidParticleCloud& cloud, trackingData& td, const scalar trackTime ) @@ -58,7 +59,7 @@ bool Foam::solidParticle::move const scalar sfrac = stepFraction(); const scalar f = 1 - stepFraction(); - trackToAndHitFace(f*trackTime*U_, f, td); + trackToAndHitFace(f*trackTime*U_, f, cloud, td); const scalar dt = (stepFraction() - sfrac)*trackTime; @@ -67,7 +68,7 @@ bool Foam::solidParticle::move vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs); scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs); - scalar rhop = td.cloud().rhop(); + scalar rhop = cloud.rhop(); scalar magUr = mag(Uc - U_); scalar ReFunc = 1.0; @@ -98,6 +99,7 @@ bool Foam::solidParticle::move bool Foam::solidParticle::hitPatch ( const polyPatch&, + solidParticleCloud& cloud, trackingData&, const label, const scalar, @@ -111,6 +113,7 @@ bool Foam::solidParticle::hitPatch void Foam::solidParticle::hitProcessorPatch ( const processorPolyPatch&, + solidParticleCloud& cloud, trackingData& td ) { @@ -121,6 +124,7 @@ void Foam::solidParticle::hitProcessorPatch void Foam::solidParticle::hitWallPatch ( const wallPolyPatch& wpp, + solidParticleCloud& cloud, trackingData& td, const tetIndices& tetIs ) @@ -133,16 +137,17 @@ void Foam::solidParticle::hitWallPatch if (Un > 0) { - U_ -= (1.0 + td.cloud().e())*Un*nw; + U_ -= (1.0 + cloud.e())*Un*nw; } - U_ -= td.cloud().mu()*Ut; + U_ -= cloud.mu()*Ut; } void Foam::solidParticle::hitPatch ( const polyPatch&, + solidParticleCloud& cloud, trackingData& td ) { diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index bc03cd3b2e3..b9968baf722 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -83,7 +83,7 @@ public: //- Class used to pass tracking data to the trackToFace function class trackingData : - public particle::TrackingData<solidParticleCloud> + public particle::trackingData { // Interpolators for continuous phase fields @@ -101,7 +101,7 @@ public: inline trackingData ( - solidParticleCloud& spc, + const solidParticleCloud& spc, const interpolationCellPoint<scalar>& rhoInterp, const interpolationCellPoint<vector>& UInterp, const interpolationCellPoint<scalar>& nuInterp, @@ -192,7 +192,7 @@ public: // Tracking //- Move - bool move(trackingData&, const scalar); + bool move(solidParticleCloud&, trackingData&, const scalar); // Patch interactions @@ -202,6 +202,7 @@ public: bool hitPatch ( const polyPatch&, + solidParticleCloud& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -213,6 +214,7 @@ public: void hitProcessorPatch ( const processorPolyPatch&, + solidParticleCloud& cloud, trackingData& td ); @@ -220,6 +222,7 @@ public: void hitWallPatch ( const wallPolyPatch&, + solidParticleCloud& cloud, trackingData& td, const tetIndices& ); @@ -228,6 +231,7 @@ public: void hitPatch ( const polyPatch&, + solidParticleCloud& cloud, trackingData& td ); diff --git a/src/lagrangian/solidParticle/solidParticleCloud.C b/src/lagrangian/solidParticle/solidParticleCloud.C index 9861ba3d494..2f48cb7429f 100644 --- a/src/lagrangian/solidParticle/solidParticleCloud.C +++ b/src/lagrangian/solidParticle/solidParticleCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,7 +82,7 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g) solidParticle::trackingData td(*this, rhoInterp, UInterp, nuInterp, g.value()); - Cloud<solidParticle>::move(td, mesh_.time().deltaTValue()); + Cloud<solidParticle>::move(*this, td, mesh_.time().deltaTValue()); } diff --git a/src/lagrangian/solidParticle/solidParticleI.H b/src/lagrangian/solidParticle/solidParticleI.H index a9a43591a3c..098476e76ad 100644 --- a/src/lagrangian/solidParticle/solidParticleI.H +++ b/src/lagrangian/solidParticle/solidParticleI.H @@ -27,14 +27,14 @@ License inline Foam::solidParticle::trackingData::trackingData ( - solidParticleCloud& spc, + const solidParticleCloud& spc, const interpolationCellPoint<scalar>& rhoInterp, const interpolationCellPoint<vector>& UInterp, const interpolationCellPoint<scalar>& nuInterp, const vector& g ) : - particle::TrackingData<solidParticleCloud>(spc), + particle::trackingData(spc), rhoInterp_(rhoInterp), UInterp_(UInterp), nuInterp_(nuInterp), diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C index 7a1906c4e46..cfb76f21248 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -218,10 +218,9 @@ void Foam::SprayCloud<CloudType>::evolve() { if (this->solution().canEvolve()) { - typename parcelType::template - TrackingData<SprayCloud<CloudType>> td(*this); + typename parcelType::trackingData td(*this); - this->solve(td); + this->solve(*this, td); } } diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C index 4b8b9fb9b77..ce9bb1b2b7a 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,49 +31,52 @@ License // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::SprayParcel<ParcelType>::setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - ParcelType::setCellValues(td, dt, celli); + ParcelType::setCellValues(cloud, td, dt, celli); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::SprayParcel<ParcelType>::cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - ParcelType::cellValueSourceCorrection(td, dt, celli); + ParcelType::cellValueSourceCorrection(cloud, td, dt, celli); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::SprayParcel<ParcelType>::calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + typedef typename TrackCloudType::reactingCloudType reactingCloudType; const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); + cloud.composition(); // Check if parcel belongs to liquid core if (liquidCore() > 0.5) { // Liquid core parcels should not experience coupled forces - td.cloud().forces().setCalcCoupled(false); + cloud.forces().setCalcCoupled(false); } // Get old mixture composition @@ -90,7 +93,7 @@ void Foam::SprayParcel<ParcelType>::calc } // Set the maximum temperature limit - td.cloud().constProps().setTMax(TMax); + cloud.constProps().setTMax(TMax); // Store the parcel properties this->Cp() = composition.liquids().Cp(pc0, T0, X0); @@ -100,7 +103,7 @@ void Foam::SprayParcel<ParcelType>::calc const scalar mass0 = this->mass(); mu_ = composition.liquids().mu(pc0, T0, X0); - ParcelType::calc(td, dt, celli); + ParcelType::calc(cloud,td, dt, celli); if (td.keepParticle) { @@ -127,7 +130,7 @@ void Foam::SprayParcel<ParcelType>::calc if (liquidCore() > 0.5) { - calcAtomization(td, dt, celli); + calcAtomization(cloud, td, dt, celli); // Preserve the total mass/volume by increasing the number of // particles in parcels due to breakup @@ -136,24 +139,26 @@ void Foam::SprayParcel<ParcelType>::calc } else { - calcBreakup(td, dt, celli); + calcBreakup(cloud, td, dt, celli); } } // Restore coupled forces - td.cloud().forces().setCalcCoupled(true); + cloud.forces().setCalcCoupled(true); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::SprayParcel<ParcelType>::calcAtomization ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { +<<<<<<< HEAD typedef typename TrackData::cloudType::sprayCloudType sprayCloudType; const AtomizationModel<sprayCloudType>& atomization = td.cloud().atomization(); @@ -164,9 +169,18 @@ void Foam::SprayParcel<ParcelType>::calcAtomization } typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; +======= + typedef typename TrackCloudType::reactingCloudType reactingCloudType; +>>>>>>> 4fd4fadab... lagrangian: Un-templated the tracking data const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); + cloud.composition(); +<<<<<<< HEAD +======= + typedef typename TrackCloudType::sprayCloudType sprayCloudType; + const AtomizationModel<sprayCloudType>& atomization = + cloud.atomization(); +>>>>>>> 4fd4fadab... lagrangian: Un-templated the tracking data // Average molecular weight of carrier mix - assumes perfect gas scalar Wc = this->rhoc_*RR*this->Tc()/this->pc(); @@ -176,8 +190,8 @@ void Foam::SprayParcel<ParcelType>::calcAtomization // Calculate average gas density based on average temperature scalar rhoAv = this->pc()/(R*Tav); - scalar soi = td.cloud().injectors().timeStart(); - scalar currentTime = td.cloud().db().time().value(); + scalar soi = cloud.injectors().timeStart(); + scalar currentTime = cloud.db().time().value(); const vector& pos = this->position(); const vector& injectionPos = this->position0(); @@ -186,15 +200,15 @@ void Foam::SprayParcel<ParcelType>::calcAtomization scalar Urel = mag(this->U()); scalar t0 = max(0.0, currentTime - this->age() - soi); - scalar t1 = min(t0 + dt, td.cloud().injectors().timeEnd() - soi); + scalar t1 = min(t0 + dt, cloud.injectors().timeEnd() - soi); // This should be the vol flow rate from when the parcel was injected - scalar volFlowRate = td.cloud().injectors().volumeToInject(t0, t1)/dt; + scalar volFlowRate = cloud.injectors().volumeToInject(t0, t1)/dt; scalar chi = 0.0; if (atomization.calcChi()) { - chi = this->chi(td, composition.liquids().X(this->Y())); + chi = this->chi(cloud, td, composition.liquids().X(this->Y())); } atomization.update @@ -211,46 +225,45 @@ void Foam::SprayParcel<ParcelType>::calcAtomization Urel, pos, injectionPos, - td.cloud().pAmbient(), + cloud.pAmbient(), chi, - td.cloud().rndGen() + cloud.rndGen() ); } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::SprayParcel<ParcelType>::calcBreakup ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ) { - typedef typename TrackData::cloudType cloudType; - typedef typename cloudType::parcelType parcelType; - typedef typename cloudType::forceType forceType; - typedef typename TrackData::cloudType::sprayCloudType sprayCloudType; - - BreakupModel<sprayCloudType>& breakup = td.cloud().breakup(); + auto& breakup = cloud.breakup(); if (!breakup.active()) { return; } + typedef typename TrackCloudType::parcelType parcelType; + typedef typename TrackCloudType::forceType forceType; + const parcelType& p = static_cast<const parcelType&>(*this); - const forceType& forces = td.cloud().forces(); + const forceType& forces = cloud.forces(); if (breakup.solveOscillationEq()) { - solveTABEq(td, dt); + solveTABEq(cloud, td, dt); } // Average molecular weight of carrier mix - assumes perfect gas scalar Wc = this->rhoc()*RR*this->Tc()/this->pc(); scalar R = RR/Wc; - scalar Tav = td.cloud().atomization().Taverage(this->T(), this->Tc()); + scalar Tav = cloud.atomization().Taverage(this->T(), this->Tc()); // Calculate average gas density based on average temperature scalar rhoAv = this->pc()/(R*Tav); @@ -264,7 +277,7 @@ void Foam::SprayParcel<ParcelType>::calcBreakup const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, muAv); this->tMom() = mass/(Fcp.Sp() + Fncp.Sp() + ROOTVSMALL); - const vector g = td.cloud().g().value(); + const vector g = cloud.g().value(); scalar parcelMassChild = 0.0; scalar dChild = 0.0; @@ -315,38 +328,39 @@ void Foam::SprayParcel<ParcelType>::calcBreakup child->age() = 0.0; child->liquidCore() = 0.0; child->KHindex() = 1.0; - child->y() = td.cloud().breakup().y0(); - child->yDot() = td.cloud().breakup().yDot0(); + child->y() = cloud.breakup().y0(); + child->yDot() = cloud.breakup().yDot0(); child->tc() = 0.0; child->ms() = -GREAT; child->injector() = this->injector(); child->tMom() = massChild/(Fcp.Sp() + Fncp.Sp()); child->user() = 0.0; - child->setCellValues(td, dt, celli); + child->setCellValues(cloud, td, dt, celli); - td.cloud().addParticle(child); + cloud.addParticle(child); } } template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> Foam::scalar Foam::SprayParcel<ParcelType>::chi ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalarField& X ) const { // Modifications to take account of the flash boiling on primary break-up - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + typedef typename TrackCloudType::reactingCloudType reactingCloudType; const CompositionModel<reactingCloudType>& composition = - td.cloud().composition(); + cloud.composition(); scalar chi = 0.0; scalar T0 = this->T(); scalar p0 = this->pc(); - scalar pAmb = td.cloud().pAmbient(); + scalar pAmb = cloud.pAmbient(); scalar pv = composition.liquids().pv(p0, T0, X); @@ -374,16 +388,17 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi template<class ParcelType> -template<class TrackData> +template<class TrackCloudType> void Foam::SprayParcel<ParcelType>::solveTABEq ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt ) { - const scalar& TABCmu = td.cloud().breakup().TABCmu(); - const scalar& TABtwoWeCrit = td.cloud().breakup().TABtwoWeCrit(); - const scalar& TABComega = td.cloud().breakup().TABComega(); + const scalar& TABCmu = cloud.breakup().TABCmu(); + const scalar& TABtwoWeCrit = cloud.breakup().TABtwoWeCrit(); + const scalar& TABComega = cloud.breakup().TABComega(); scalar r = 0.5*this->d(); scalar r2 = r*r; diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H index c5cd250bfef..82cf75c5c1d 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H @@ -121,6 +121,10 @@ public: }; + //- Use base tracking data + typedef typename ParcelType::trackingData trackingData; + + protected: // Protected data @@ -413,46 +417,51 @@ public: // Main calculation loop //- Set cell values - template<class TrackData> + template<class TrackCloudType> void setCellValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct parcel properties according to atomization model - template<class TrackData> + template<class TrackCloudType> void calcAtomization ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct parcel properties according to breakup model - template<class TrackData> + template<class TrackCloudType> void calcBreakup ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct cell values using latest transfer information - template<class TrackData> + template<class TrackCloudType> void cellValueSourceCorrection ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Correct surface values due to emitted species - template<class TrackData> + template<class TrackCloudType> void correctSurfaceValues ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const label celli, const scalar T, const scalarField& Cs, @@ -463,28 +472,31 @@ public: ); //- Update parcel properties over the time interval - template<class TrackData> + template<class TrackCloudType> void calc ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt, const label celli ); //- Calculate the chi-factor for flash-boiling for the // atomization model - template<class TrackData> + template<class TrackCloudType> scalar chi ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalarField& X ) const; //- Solve the TAB equation - template<class TrackData> + template<class TrackCloudType> void solveTABEq ( - TrackData& td, + TrackCloudType& cloud, + trackingData& td, const scalar dt ); diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C index 06d08740c16..a9cdcb1f16d 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinementRefine.C @@ -481,7 +481,7 @@ void Foam::meshRefinement::markFeatureCellLevel << " particles over distance " << maxTrackLen << " to find the starting cell" << endl; } - startPointCloud.move(td, maxTrackLen); + startPointCloud.move(startPointCloud, td, maxTrackLen); // Reset levels @@ -559,7 +559,7 @@ void Foam::meshRefinement::markFeatureCellLevel << " particles over distance " << maxTrackLen << " to mark cells" << endl; } - cloud.move(td, maxTrackLen); + cloud.move(cloud, td, maxTrackLen); // Make particle follow edge. forAllIter(Cloud<trackedParticle>, cloud, iter) diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C index 344aaceddd2..de27997d73d 100644 --- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C +++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.C @@ -112,6 +112,7 @@ Foam::trackedParticle::trackedParticle bool Foam::trackedParticle::move ( + Cloud<trackedParticle>& cloud, trackingData& td, const scalar trackTime ) @@ -140,7 +141,7 @@ bool Foam::trackedParticle::move const scalar f = 1 - stepFraction(); const vector s = end_ - start_; - trackToAndHitFace(f*s, f, td); + trackToAndHitFace(f*s, f, cloud, td); } } @@ -151,6 +152,7 @@ bool Foam::trackedParticle::move bool Foam::trackedParticle::hitPatch ( const polyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -164,6 +166,7 @@ bool Foam::trackedParticle::hitPatch void Foam::trackedParticle::hitWedgePatch ( const wedgePolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ) { @@ -175,6 +178,7 @@ void Foam::trackedParticle::hitWedgePatch void Foam::trackedParticle::hitSymmetryPlanePatch ( const symmetryPlanePolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ) { @@ -186,6 +190,7 @@ void Foam::trackedParticle::hitSymmetryPlanePatch void Foam::trackedParticle::hitSymmetryPatch ( const symmetryPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ) { @@ -197,6 +202,7 @@ void Foam::trackedParticle::hitSymmetryPatch void Foam::trackedParticle::hitCyclicPatch ( const cyclicPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ) { @@ -208,6 +214,7 @@ void Foam::trackedParticle::hitCyclicPatch void Foam::trackedParticle::hitCyclicAMIPatch ( const cyclicAMIPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td, const vector& ) @@ -220,6 +227,7 @@ void Foam::trackedParticle::hitCyclicAMIPatch void Foam::trackedParticle::hitProcessorPatch ( const processorPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ) { @@ -231,6 +239,7 @@ void Foam::trackedParticle::hitProcessorPatch void Foam::trackedParticle::hitWallPatch ( const wallPolyPatch& wpp, + Cloud<trackedParticle>& cloud, trackingData& td, const tetIndices& ) @@ -243,6 +252,7 @@ void Foam::trackedParticle::hitWallPatch void Foam::trackedParticle::hitPatch ( const polyPatch& wpp, + Cloud<trackedParticle>& cloud, trackingData& td ) { @@ -254,10 +264,11 @@ void Foam::trackedParticle::hitPatch void Foam::trackedParticle::correctAfterParallelTransfer ( const label patchi, + Cloud<trackedParticle>& cloud, trackingData& td ) { - particle::correctAfterParallelTransfer(patchi, td); + particle::correctAfterParallelTransfer(patchi, cloud, td); label edgeI = k(); if (edgeI != -1) diff --git a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H index 184e7f0104d..d329808baa6 100644 --- a/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H +++ b/src/mesh/snappyHexMesh/trackedParticle/trackedParticle.H @@ -90,7 +90,7 @@ public: //- Class used to pass tracking data to the trackToFace function class trackingData : - public particle::TrackingData<Cloud<trackedParticle>> + public particle::trackingData { public: @@ -108,7 +108,7 @@ public: List<PackedBoolList>& featureEdgeVisited ) : - particle::TrackingData<Cloud<trackedParticle>>(cloud), + particle::trackingData(cloud), maxLevel_(maxLevel), featureEdgeVisited_(featureEdgeVisited) {} @@ -240,7 +240,7 @@ public: // Tracking //- Track all particles to their end point - bool move(trackingData&, const scalar); + bool move(Cloud<trackedParticle>&, trackingData&, const scalar); //- Overridable function to handle the particle hitting a patch @@ -248,6 +248,7 @@ public: bool hitPatch ( const polyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td, const label patchi, const scalar trackFraction, @@ -258,6 +259,7 @@ public: void hitWedgePatch ( const wedgePolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ); @@ -266,6 +268,7 @@ public: void hitSymmetryPlanePatch ( const symmetryPlanePolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ); @@ -274,6 +277,7 @@ public: void hitSymmetryPatch ( const symmetryPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ); @@ -281,6 +285,7 @@ public: void hitCyclicPatch ( const cyclicPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ); @@ -288,6 +293,7 @@ public: void hitCyclicAMIPatch ( const cyclicAMIPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td, const vector& ); @@ -297,6 +303,7 @@ public: void hitProcessorPatch ( const processorPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ); @@ -304,6 +311,7 @@ public: void hitWallPatch ( const wallPolyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td, const tetIndices& ); @@ -312,12 +320,18 @@ public: void hitPatch ( const polyPatch&, + Cloud<trackedParticle>& cloud, trackingData& td ); //- Convert processor patch addressing to the global equivalents // and set the celli to the face-neighbour - void correctAfterParallelTransfer(const label, trackingData&); + void correctAfterParallelTransfer + ( + const label, + Cloud<trackedParticle>& cloud, + trackingData& td + ); // Ostream Operator diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index 5ce5eaf85c0..b471711ea62 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -54,7 +54,7 @@ bool Foam::faceOnlySet::trackToBoundary DynamicList<scalar>& samplingCurveDist ) const { - particle::TrackingData<passiveParticleCloud> trackData(particleCloud); + particle::trackingData td(particleCloud); point trackPt = singleParticle.position(); @@ -62,7 +62,7 @@ bool Foam::faceOnlySet::trackToBoundary { point oldPoint = trackPt; - singleParticle.trackToAndHitFace(end_ - start_, 0, trackData); + singleParticle.trackToAndHitFace(end_ - start_, 0, particleCloud, td); trackPt = singleParticle.position(); diff --git a/src/sampling/sampledSet/polyLine/polyLineSet.C b/src/sampling/sampledSet/polyLine/polyLineSet.C index 358162e7a6e..1c19c4bf5b2 100644 --- a/src/sampling/sampledSet/polyLine/polyLineSet.C +++ b/src/sampling/sampledSet/polyLine/polyLineSet.C @@ -54,8 +54,6 @@ bool Foam::polyLineSet::trackToBoundary DynamicList<scalar>& samplingCurveDist ) const { - particle::TrackingData<passiveParticleCloud> trackData(particleCloud); - while (true) { // Local geometry info diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index c09403a71cd..5dad10a9966 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -96,8 +96,6 @@ bool Foam::uniformSet::trackToBoundary point trackPt = singleParticle.position(); - particle::TrackingData<passiveParticleCloud> trackData(particleCloud); - while(true) { // Find next samplePt on/after trackPt. Update samplePt, sampleI -- GitLab