diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C index 03f6355870b2b89e37940ad64b89bb0f48d1e1d7..920c78228682b85f6bcfbf1143e77eb5a85667b2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.C @@ -26,6 +26,7 @@ License #include "AMIMethod.H" #include "meshTools.H" #include "mapDistribute.H" +#include "unitConversion.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -262,6 +263,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces ) const { const labelList& nbrFaces = patch.faceFaces()[faceI]; + const pointField& tgtPoints = patch.points(); // filter out faces already visited from src face neighbours forAll(nbrFaces, i) @@ -291,7 +293,17 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces if (valid) { - faceIDs.append(nbrFaceI); + const face& myn = patch[faceI]; + const face& nbrn = patch[nbrFaceI]; + const vector& nbrNormal = nbrn.normal(tgtPoints); + const vector& mynNormal = myn.normal(tgtPoints); + + scalar cosI = nbrNormal & mynNormal; + + if (cosI > Foam::cos(degToRad(89.0))) + { + faceIDs.append(nbrFaceI); + } } } } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C index 6aea34e945827dbce24cc272e9dba3c811cac77f..820d3f22fcbf69142e69732d49503bdf75a2b854 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -68,7 +68,7 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace scalar area = interArea(srcFaceI, tgtFaceI); // store when intersection area > 0 - if (area > 0) + if (area/this->srcMagSf_[srcFaceI] > faceAreaIntersect::tolerance()) { srcAddr[srcFaceI].append(tgtFaceI); srcWght[srcFaceI].append(area); @@ -228,10 +228,10 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea // quick reject if either face has zero area // Note: do not used stored face areas for target patch + const scalar tgtMag = tgt.mag(tgtPoints); if ( - (this->srcMagSf_[srcFaceI] < ROOTVSMALL) - || (tgt.mag(tgtPoints) < ROOTVSMALL) + (this->srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgtMag < ROOTVSMALL) ) { return 0.0; @@ -242,13 +242,14 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea // crude resultant norm vector n(-src.normal(srcPoints)); + n /= mag(n); if (this->reverseTarget_) { - n -= tgt.normal(tgtPoints); + n -= tgt.normal(tgtPoints)/tgtMag; } else { - n += tgt.normal(tgtPoints); + n += tgt.normal(tgtPoints)/tgtMag; } n *= 0.5;