From 8e91b8f0fdf268206d8d1466c6c03007046cbac4 Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Fri, 11 May 2012 14:24:22 +0100
Subject: [PATCH] BUG: Corrected AMI when running in parallel

---
 .../AMIInterpolation/AMIInterpolation.C         | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
index ed40986dbb8..046adb8a2a0 100644
--- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
+++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
@@ -917,22 +917,23 @@ Foam::scalar Foam::AMIInterpolation<SourcePatch, TargetPatch>::interArea
     const primitivePatch& tgtPatch
 ) const
 {
+    const pointField& srcPoints = srcPatch.points();
+    const pointField& tgtPoints = tgtPatch.points();
+
+    // references to candidate faces
+    const face& src = srcPatch[srcFaceI];
+    const face& tgt = tgtPatch[tgtFaceI];
+
     // quick reject if either face has zero area
-    if (srcMagSf_[srcFaceI] < ROOTVSMALL || tgtMagSf_[tgtFaceI] < ROOTVSMALL)
+    // Note: do not used stored face areas for target patch
+    if ((srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgt.mag(tgtPoints) < ROOTVSMALL))
     {
         return 0.0;
     }
 
-    const pointField& srcPoints = srcPatch.points();
-    const pointField& tgtPoints = tgtPatch.points();
-
     // create intersection object
     faceAreaIntersect inter(srcPoints, tgtPoints, reverseTarget_);
 
-    // references to candidate faces
-    const face& src = srcPatch[srcFaceI];
-    const face& tgt = tgtPatch[tgtFaceI];
-
     // crude resultant norm
     vector n(-src.normal(srcPoints));
     if (reverseTarget_)
-- 
GitLab