diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C index 95f61428d2..761ca5b447 100644 --- a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C +++ b/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C @@ -115,22 +115,26 @@ bool Foam::trackedParticle::move(trackedParticle::trackData& td) } -void Foam::trackedParticle::hitPatch +bool Foam::trackedParticle::hitPatch ( const polyPatch&, trackedParticle::trackData& td, const label patchI ) -{} +{ + return false; +} -void Foam::trackedParticle::hitPatch +bool Foam::trackedParticle::hitPatch ( const polyPatch&, int&, const label ) -{} +{ + return false; +} void Foam::trackedParticle::hitWedgePatch diff --git a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H b/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H index 039b93a5c0..3e2d12a1d2 100644 --- a/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H +++ b/src/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H @@ -171,13 +171,13 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions - void hitPatch + bool hitPatch ( const polyPatch&, trackedParticle::trackData& td, const label patchI ); - void hitPatch + bool hitPatch ( const polyPatch&, int&, diff --git a/src/lagrangian/basic/Particle/Particle.C b/src/lagrangian/basic/Particle/Particle.C index 1136da9842..ea53ec3ee4 100644 --- a/src/lagrangian/basic/Particle/Particle.C +++ b/src/lagrangian/basic/Particle/Particle.C @@ -339,46 +339,47 @@ Foam::scalar Foam::Particle::trackToFace label patchi = patch(facei_); const polyPatch& patch = mesh.boundaryMesh()[patchi]; - p.hitPatch(patch, td, patchi); - - if (isA(patch)) + if (!p.hitPatch(patch, td, patchi)) { - p.hitWedgePatch - ( - static_cast(patch), td - ); - } - else if (isA(patch)) - { - p.hitSymmetryPatch - ( - static_cast(patch), td - ); - } - else if (isA(patch)) - { - p.hitCyclicPatch - ( - static_cast(patch), td - ); - } - else if (isA(patch)) - { - p.hitProcessorPatch - ( - static_cast(patch), td - ); - } - else if (isA(patch)) - { - p.hitWallPatch - ( - static_cast(patch), td - ); - } - else - { - p.hitPatch(patch, td); + if (isA(patch)) + { + p.hitWedgePatch + ( + static_cast(patch), td + ); + } + else if (isA(patch)) + { + p.hitSymmetryPatch + ( + static_cast(patch), td + ); + } + else if (isA(patch)) + { + p.hitCyclicPatch + ( + static_cast(patch), td + ); + } + else if (isA(patch)) + { + p.hitProcessorPatch + ( + static_cast(patch), td + ); + } + else if (isA(patch)) + { + p.hitWallPatch + ( + static_cast(patch), td + ); + } + else + { + p.hitPatch(patch, td); + } } } } @@ -426,13 +427,15 @@ void Foam::Particle::transformProperties(const vector&) template template -void Foam::Particle::hitPatch +bool Foam::Particle::hitPatch ( const polyPatch&, TrackData&, const label ) -{} +{ + return false; +} template diff --git a/src/lagrangian/basic/Particle/Particle.H b/src/lagrangian/basic/Particle/Particle.H index 07e8d6e335..4d1a8b9be8 100644 --- a/src/lagrangian/basic/Particle/Particle.H +++ b/src/lagrangian/basic/Particle/Particle.H @@ -171,7 +171,7 @@ protected: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions template - void hitPatch + bool hitPatch ( const polyPatch&, TrackData& td, diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C index 079f92333e..0c43cf1534 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C @@ -61,15 +61,9 @@ bool Foam::DsmcParcel::move if (p.onBoundary() && td.keepParticle) { - if (p.face() > -1) + if (isType(pbMesh[p.patch(p.face())])) { - if - ( - isType(pbMesh[p.patch(p.face())]) - ) - { - td.switchProcessor = true; - } + td.switchProcessor = true; } } } @@ -80,13 +74,15 @@ bool Foam::DsmcParcel::move template template -void Foam::DsmcParcel::hitPatch +bool Foam::DsmcParcel::hitPatch ( const polyPatch&, TrackData& td, const label patchI ) -{} +{ + return false; +} template diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H index 9bef41391b..17b2877b44 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H @@ -242,7 +242,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions template - void hitPatch + bool hitPatch ( const polyPatch&, TrackData& td, diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 2d707f2e15..e119b2cb93 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -253,28 +253,30 @@ bool Foam::KinematicParcel::move(TrackData& td) template template -void Foam::KinematicParcel::hitPatch +bool Foam::KinematicParcel::hitPatch ( const polyPatch& pp, TrackData& td, const label patchI ) { - td.cloud().patchInteraction().correct(pp, this->face(), U_); - ParcelType& p = static_cast(*this); td.cloud().postProcessing().postPatch(p, patchI); + + return td.cloud().patchInteraction().correct(pp, this->face(), U_); } template -void Foam::KinematicParcel::hitPatch +bool Foam::KinematicParcel::hitPatch ( const polyPatch& pp, int& td, const label patchI ) -{} +{ + return false; +} template diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index c551ecec9f..3c8aed11f6 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -430,7 +430,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions template - void hitPatch + bool hitPatch ( const polyPatch& p, TrackData& td, @@ -440,7 +440,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions without trackData - void hitPatch + bool hitPatch ( const polyPatch& p, int& td, diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index efc5b33f05..62acbf16b3 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -108,7 +108,7 @@ bool Foam::LocalInteraction::active() const template -void Foam::LocalInteraction::correct +bool Foam::LocalInteraction::correct ( const polyPatch& pp, const label faceId, @@ -129,7 +129,11 @@ void Foam::LocalInteraction::correct } U -= patchData_[pp.index()].mu()*Ut; + + return true; } + + return false; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H index 928110f07d..6a6521f402 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H @@ -159,7 +159,8 @@ public: bool active() const; //- Apply velocity correction - virtual void correct + // Returns true if particle remains in same cell + virtual bool correct ( const polyPatch& pp, const label faceId, diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H index cffca1e286..49e6f5fc05 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/PatchInteractionModel/PatchInteractionModel.H @@ -125,7 +125,8 @@ public: virtual bool active() const = 0; //- Apply velocity correction - virtual void correct + // Returns true if particle remains in same cell + virtual bool correct ( const polyPatch& pp, const label faceId, diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C index dd22ba5006..cd5fb516f7 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.C @@ -57,7 +57,7 @@ bool Foam::Rebound::active() const template -void Foam::Rebound::correct +bool Foam::Rebound::correct ( const polyPatch& pp, const label faceId, @@ -76,6 +76,8 @@ void Foam::Rebound::correct } U -= Ut; + + return true; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H index 2e12050e54..5d47dc5bcc 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/Rebound/Rebound.H @@ -77,7 +77,8 @@ public: bool active() const; //- Apply velocity correction - virtual void correct + // Returns true if particle remains in same cell + virtual bool correct ( const polyPatch& pp, const label faceId, diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C index 64cfdec75b..b63df3c039 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C @@ -58,7 +58,7 @@ bool Foam::StandardWallInteraction::active() const template -void Foam::StandardWallInteraction::correct +bool Foam::StandardWallInteraction::correct ( const polyPatch& pp, const label faceId, @@ -79,7 +79,11 @@ void Foam::StandardWallInteraction::correct } U -= mu_*Ut; + + return true; } + + return false; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H index 6d529dcd77..80b1a38b6f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.H @@ -79,7 +79,8 @@ public: bool active() const; //- Apply velocity correction - virtual void correct + // Returns true if particle remains in same cell + virtual bool correct ( const polyPatch& pp, const label faceId, diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C index c24e4f4601..bc9c502ffb 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C @@ -241,22 +241,26 @@ void Foam::molecule::setSiteSizes(label size) } -void Foam::molecule::hitPatch +bool Foam::molecule::hitPatch ( const polyPatch&, molecule::trackData&, const label ) -{} +{ + return false; +} -void Foam::molecule::hitPatch +bool Foam::molecule::hitPatch ( const polyPatch&, int&, const label ) -{} +{ + return false; +} void Foam::molecule::hitProcessorPatch diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index cad7dadf17..0ee16f461f 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -312,7 +312,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions - void hitPatch + bool hitPatch ( const polyPatch&, molecule::trackData& td, @@ -321,7 +321,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions without trackData - void hitPatch + bool hitPatch ( const polyPatch& p, int& td, diff --git a/src/lagrangian/solidParticle/solidParticle.C b/src/lagrangian/solidParticle/solidParticle.C index 4760afd833..e77b9cf8a2 100644 --- a/src/lagrangian/solidParticle/solidParticle.C +++ b/src/lagrangian/solidParticle/solidParticle.C @@ -84,12 +84,9 @@ bool Foam::solidParticle::move(solidParticle::trackData& td) if (onBoundary() && td.keepParticle) { - if (face() > -1) + if (isType(pbMesh[patch(face())])) { - if (isType(pbMesh[patch(face())])) - { - td.switchProcessor = true; - } + td.switchProcessor = true; } } } @@ -98,22 +95,26 @@ bool Foam::solidParticle::move(solidParticle::trackData& td) } -void Foam::solidParticle::hitPatch +bool Foam::solidParticle::hitPatch ( const polyPatch&, solidParticle::trackData&, const label ) -{} +{ + return false; +} -void Foam::solidParticle::hitPatch +bool Foam::solidParticle::hitPatch ( const polyPatch&, int&, const label ) -{} +{ + return false; +} void Foam::solidParticle::hitProcessorPatch diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index 4d20aeb3c9..4847970f2f 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -173,7 +173,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions - void hitPatch + bool hitPatch ( const polyPatch&, solidParticle::trackData& td, @@ -182,7 +182,7 @@ public: //- Overridable function to handle the particle hitting a patch // Executed before other patch-hitting functions without trackData - void hitPatch + bool hitPatch ( const polyPatch& p, int& td,