diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 257f2af21a9d9632fdc561fc9f25cdb7f1a46cf0..ffe1f09631471a82d42072887224ffc5d5313dbf 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -29,17 +29,20 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template <class CloudType> -bool Foam::LocalInteraction<CloudType>::applyToPatch(const polyPatch& pp) const +Foam::label Foam::LocalInteraction<CloudType>::applyToPatch +( + const label globalPatchI +) const { forAll(patchIds_, patchI) { - if (patchIds_[patchI] == pp.index()) + if (patchIds_[patchI] == globalPatchI) { - return true; + return patchI; } } - return false; + return -1; } @@ -75,7 +78,11 @@ Foam::LocalInteraction<CloudType>::LocalInteraction DynamicList<word> badWalls; forAll(bMesh, patchI) { - if (isA<wallPolyPatch>(bMesh[patchI]) && !applyToPatch(bMesh[patchI])) + if + ( + isA<wallPolyPatch>(bMesh[patchI]) + && applyToPatch(bMesh[patchI].index()) < 0 + ) { badWalls.append(bMesh[patchI].name()); } @@ -115,7 +122,9 @@ bool Foam::LocalInteraction<CloudType>::correct vector& U ) const { - if (applyToPatch(pp)) + label patchI = applyToPatch(pp.index()); + + if (patchI >= 0) { vector nw = pp.faceAreas()[pp.whichFace(faceId)]; nw /= mag(nw); @@ -125,10 +134,10 @@ bool Foam::LocalInteraction<CloudType>::correct if (Un > 0) { - U -= (1.0 + patchData_[pp.index()].e())*Un*nw; + U -= (1.0 + patchData_[patchI].e())*Un*nw; } - U -= patchData_[pp.index()].mu()*Ut; + U -= patchData_[patchI].mu()*Ut; return true; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H index a53d6398efb22b488f37cd34c98736061d1a39b9..49d36e9c6d82eab8c15e1aeef2d5b0ed6fa58446 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H @@ -132,8 +132,8 @@ class LocalInteraction // Private member functions - //- Returns true if patch is in patchIds_ list - bool applyToPatch(const polyPatch& pp) const; + //- Returns local patchI if patch is in patchIds_ list + label applyToPatch(const label globalPatchI) const;