From dc10cfd68642a08dd7531db0ced7d06b73e222ad Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 23 Aug 2017 15:14:32 +0100 Subject: [PATCH] lagrangian: Removed duplicate data from method arguments A lot of methods were taking argument data which could be referenced or generated from the parcel class at little or no additional cost. This was confusing and generated the possibility of inconsistent data states. --- .../field/nearWallFields/findCellParticle.C | 44 +++++--- .../field/nearWallFields/findCellParticle.H | 32 +++--- .../field/streamLine/streamLineParticle.C | 44 +++++--- .../field/streamLine/streamLineParticle.H | 34 +++--- .../parcels/Templates/DSMCParcel/DSMCParcel.C | 21 +--- .../parcels/Templates/DSMCParcel/DSMCParcel.H | 15 +-- src/lagrangian/basic/Cloud/Cloud.C | 60 +---------- src/lagrangian/basic/Cloud/Cloud.H | 35 +----- src/lagrangian/basic/Cloud/CloudIO.C | 1 - src/lagrangian/basic/particle/particle.H | 18 +--- src/lagrangian/basic/particle/particleI.H | 2 +- .../basic/particle/particleTemplates.C | 37 ++----- .../Templates/CollidingCloud/CollidingCloud.C | 7 -- .../Templates/CollidingCloud/CollidingCloud.H | 7 -- .../Templates/KinematicCloud/KinematicCloud.C | 7 -- .../Templates/KinematicCloud/KinematicCloud.H | 4 - .../KinematicParcel/KinematicParcel.C | 101 +++++------------- .../KinematicParcel/KinematicParcel.H | 25 +---- .../ReactingMultiphaseParcel.C | 96 ++++++----------- .../ReactingMultiphaseParcel.H | 10 +- .../Templates/ReactingParcel/ReactingParcel.C | 85 ++++++--------- .../Templates/ReactingParcel/ReactingParcel.H | 11 +- .../Templates/ThermoParcel/ThermoParcel.C | 58 ++++------ .../Templates/ThermoParcel/ThermoParcel.H | 11 +- .../CloudFunctionObject/CloudFunctionObject.C | 4 - .../CloudFunctionObject/CloudFunctionObject.H | 6 +- .../CloudFunctionObjectList.C | 25 ++--- .../CloudFunctionObjectList.H | 6 +- .../FacePostProcessing/FacePostProcessing.C | 11 +- .../FacePostProcessing/FacePostProcessing.H | 9 +- .../ParticleCollector/ParticleCollector.C | 1 - .../ParticleCollector/ParticleCollector.H | 3 +- .../ParticleErosion/ParticleErosion.C | 2 - .../ParticleErosion/ParticleErosion.H | 4 +- .../ParticleTracks/ParticleTracks.C | 9 +- .../ParticleTracks/ParticleTracks.H | 9 +- .../ParticleTrap/ParticleTrap.C | 7 +- .../ParticleTrap/ParticleTrap.H | 3 +- .../PatchPostProcessing/PatchPostProcessing.C | 4 +- .../PatchPostProcessing/PatchPostProcessing.H | 4 +- .../VoidFraction/VoidFraction.C | 5 +- .../VoidFraction/VoidFraction.H | 3 +- .../PairCollision/PairCollision.C | 30 ------ .../LocalInteraction/LocalInteraction.C | 4 +- .../LocalInteraction/LocalInteraction.H | 6 +- .../MultiInteraction/MultiInteraction.C | 8 +- .../MultiInteraction/MultiInteraction.H | 6 +- .../NoInteraction/NoInteraction.C | 6 +- .../NoInteraction/NoInteraction.H | 6 +- .../PatchInteractionModel.H | 4 +- .../PatchInteractionModel/Rebound/Rebound.C | 4 +- .../PatchInteractionModel/Rebound/Rebound.H | 6 +- .../StandardWallInteraction.C | 4 +- .../StandardWallInteraction.H | 6 +- .../molecule/molecule/molecule.C | 21 +--- .../molecule/molecule/molecule.H | 14 +-- src/lagrangian/solidParticle/solidParticle.C | 21 +--- src/lagrangian/solidParticle/solidParticle.H | 14 +-- .../solidParticle/solidParticleCloud.C | 6 -- .../solidParticle/solidParticleCloud.H | 4 +- .../Templates/SprayParcel/SprayParcel.C | 27 ++--- .../Templates/SprayParcel/SprayParcel.H | 16 +-- .../trackedParticle/trackedParticle.C | 31 +++--- .../trackedParticle/trackedParticle.H | 23 ++-- 64 files changed, 328 insertions(+), 819 deletions(-) diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C index 19726169e3..6490a9579a 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.C +++ b/src/functionObjects/field/nearWallFields/findCellParticle.C @@ -130,10 +130,7 @@ bool Foam::findCellParticle::hitPatch ( const polyPatch&, Cloud& cloud, - trackingData& td, - const label patchi, - const scalar trackFraction, - const tetIndices& tetIs + trackingData& td ) { return false; @@ -188,6 +185,32 @@ void Foam::findCellParticle::hitCyclicPatch } +void Foam::findCellParticle::hitCyclicAMIPatch +( + const cyclicAMIPolyPatch&, + Cloud& cloud, + trackingData& td, + const vector& +) +{ + // Remove particle + td.keepParticle = false; +} + + +void Foam::findCellParticle::hitCyclicACMIPatch +( + const cyclicACMIPolyPatch&, + Cloud& cloud, + trackingData& td, + const vector& +) +{ + // Remove particle + td.keepParticle = false; +} + + void Foam::findCellParticle::hitProcessorPatch ( const processorPolyPatch&, @@ -204,19 +227,6 @@ void Foam::findCellParticle::hitWallPatch ( const wallPolyPatch& wpp, Cloud& cloud, - trackingData& td, - const tetIndices& -) -{ - // Remove particle - td.keepParticle = false; -} - - -void Foam::findCellParticle::hitPatch -( - const polyPatch& wpp, - Cloud& cloud, trackingData& td ) { diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index 7c2f205dea..8cac809ab5 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -229,10 +229,7 @@ public: ( const polyPatch&, Cloud&, - trackingData& td, - const label patchi, - const scalar trackFraction, - const tetIndices& tetIs + trackingData& td ); //- Overridable function to handle the particle hitting a wedge @@ -269,6 +266,24 @@ public: trackingData& td ); + //- Overridable function to handle the particle hitting a cyclicAMI + void hitCyclicAMIPatch + ( + const cyclicAMIPolyPatch&, + Cloud& cloud, + trackingData& td, + const vector& + ); + + //- Overridable function to handle the particle hitting a cyclicACMI + void hitCyclicACMIPatch + ( + const cyclicACMIPolyPatch&, + Cloud& cloud, + trackingData& td, + const vector& + ); + //- Overridable function to handle the particle hitting a //- processorPatch void hitProcessorPatch @@ -283,15 +298,6 @@ public: ( const wallPolyPatch&, Cloud&, - trackingData& td, - const tetIndices& - ); - - //- Overridable function to handle the particle hitting a polyPatch - void hitPatch - ( - const polyPatch&, - Cloud&, trackingData& td ); diff --git a/src/functionObjects/field/streamLine/streamLineParticle.C b/src/functionObjects/field/streamLine/streamLineParticle.C index a15615b3a8..385538e139 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.C +++ b/src/functionObjects/field/streamLine/streamLineParticle.C @@ -274,10 +274,7 @@ bool Foam::streamLineParticle::hitPatch ( const polyPatch&, streamLineParticleCloud& cloud, - trackingData& td, - const label patchi, - const scalar trackFraction, - const tetIndices& tetIs + trackingData& td ) { // Disable generic patch interaction @@ -333,6 +330,32 @@ void Foam::streamLineParticle::hitCyclicPatch } +void Foam::streamLineParticle::hitCyclicAMIPatch +( + const cyclicAMIPolyPatch&, + streamLineParticleCloud& cloud, + trackingData& td, + const vector& +) +{ + // Remove particle + td.keepParticle = false; +} + + +void Foam::streamLineParticle::hitCyclicACMIPatch +( + const cyclicACMIPolyPatch&, + streamLineParticleCloud& cloud, + trackingData& td, + const vector& +) +{ + // Remove particle + td.keepParticle = false; +} + + void Foam::streamLineParticle::hitProcessorPatch ( const processorPolyPatch&, @@ -349,19 +372,6 @@ void Foam::streamLineParticle::hitWallPatch ( const wallPolyPatch& wpp, streamLineParticleCloud& cloud, - trackingData& td, - const tetIndices& -) -{ - // Remove particle - td.keepParticle = false; -} - - -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 d8f73afec9..0fe31679b1 100644 --- a/src/functionObjects/field/streamLine/streamLineParticle.H +++ b/src/functionObjects/field/streamLine/streamLineParticle.H @@ -220,10 +220,7 @@ public: ( const polyPatch&, streamLineParticleCloud& cloud, - trackingData& td, - const label patchi, - const scalar trackFraction, - const tetIndices& tetIs + trackingData& td ); //- Overridable function to handle the particle hitting a wedge @@ -260,6 +257,26 @@ public: trackingData& td ); + //- Overridable function to handle the particle hitting a + // cyclicAMIPatch + void hitCyclicAMIPatch + ( + const cyclicAMIPolyPatch&, + streamLineParticleCloud& cloud, + trackingData& td, + const vector& direction + ); + + //- Overridable function to handle the particle hitting a + // cyclicACMIPatch + void hitCyclicACMIPatch + ( + const cyclicACMIPolyPatch&, + streamLineParticleCloud& cloud, + trackingData& td, + const vector& direction + ); + //- Overridable function to handle the particle hitting a //- processorPatch void hitProcessorPatch @@ -274,15 +291,6 @@ public: ( const wallPolyPatch&, streamLineParticleCloud& cloud, - trackingData& td, - const tetIndices& - ); - - //- Overridable function to handle the particle hitting a polyPatch - void hitPatch - ( - const polyPatch&, - streamLineParticleCloud& cloud, trackingData& td ); diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C index 202ff22abf..6e21609853 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C @@ -85,10 +85,7 @@ bool Foam::DSMCParcel::hitPatch ( const polyPatch&, TrackCloudType& cloud, - trackingData& td, - const label, - const scalar, - const tetIndices& + trackingData& td ) { return false; @@ -114,8 +111,7 @@ void Foam::DSMCParcel::hitWallPatch ( const wallPolyPatch& wpp, TrackCloudType& cloud, - trackingData& td, - const tetIndices& tetIs + trackingData& td ) { label wppIndex = wpp.index(); @@ -202,19 +198,6 @@ void Foam::DSMCParcel::hitWallPatch } -template -template -void Foam::DSMCParcel::hitPatch -( - const polyPatch&, - TrackCloudType& cloud, - trackingData& td -) -{ - td.keepParticle = false; -} - - template void Foam::DSMCParcel::transformProperties(const tensor& T) { diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H index 3fe83c4b60..b96e785af8 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H @@ -266,10 +266,7 @@ public: ( const polyPatch&, TrackCloudType& cloud, - trackingData& td, - const label patchi, - const scalar trackFraction, - const tetIndices& tetIs + trackingData& td ); //- Overridable function to handle the particle hitting a @@ -288,16 +285,6 @@ public: ( const wallPolyPatch&, TrackCloudType& cloud, - trackingData& td, - const tetIndices& - ); - - //- Overridable function to handle the particle hitting a polyPatch - template - void hitPatch - ( - const polyPatch&, - TrackCloudType& cloud, trackingData& td ); diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 394a38fb10..05d1b58aed 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -64,32 +64,6 @@ void Foam::Cloud::checkPatches() const } -template -void Foam::Cloud::calcCellWallFaces() const -{ - cellWallFacesPtr_.reset(new PackedBoolList(pMesh().nCells(), false)); - - PackedBoolList& cellWallFaces = cellWallFacesPtr_(); - - const polyBoundaryMesh& patches = polyMesh_.boundaryMesh(); - - forAll(patches, patchi) - { - if (isA(patches[patchi])) - { - const polyPatch& patch = patches[patchi]; - - const labelList& pFaceCells = patch.faceCells(); - - forAll(pFaceCells, pFCI) - { - cellWallFaces[pFaceCells[pFCI]] = true; - } - } - } -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -104,8 +78,6 @@ Foam::Cloud::Cloud IDLList(), polyMesh_(pMesh), labels_(), - nTrackingRescues_(), - cellWallFacesPtr_(), globalPositionsPtr_() { checkPatches(); @@ -124,19 +96,6 @@ Foam::Cloud::Cloud // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -const Foam::PackedBoolList& Foam::Cloud::cellHasWallFaces() -const -{ - if (!cellWallFacesPtr_.valid()) - { - calcCellWallFaces(); - } - - return cellWallFacesPtr_(); -} - - template void Foam::Cloud::addParticle(ParticleType* pPtr) { @@ -195,9 +154,6 @@ void Foam::Cloud::move // Which patches are processor patches const labelList& procPatches = pData.processorPatches(); - // Indexing of patches into the procPatches list - const labelList& procPatchIndices = pData.processorPatchIndices(); - // Indexing of equivalent patch on neighbour processor into the // procPatches list on the neighbour const labelList& procPatchNeighbours = pData.processorPatchNeighbours(); @@ -219,10 +175,6 @@ void Foam::Cloud::move pIter().stepFraction() = 0; } - // Reset nTrackingRescues - nTrackingRescues_ = 0; - - // List of lists of particles to be transfered for all of the // neighbour processors List> particleTransferLists @@ -271,7 +223,7 @@ void Foam::Cloud::move ( !Pstream::parRun() || !p.onBoundaryFace() - || procPatchIndices[p.patch()] < 0 + || procPatchNeighbours[p.patch()] < 0 ) { FatalErrorInFunction @@ -390,16 +342,6 @@ void Foam::Cloud::move } } } - - if (cloud::debug) - { - reduce(nTrackingRescues_, sumOp