From 5bc9d3f3f8b91616347fab110c5489af8179d227 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Tue, 28 Apr 2009 12:14:59 +0100
Subject: [PATCH] stabilise interpolation on zero area faces

---
 .../pointPatchInterpolation.C                       | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C b/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C
index f9ebc6b8ce5..16cd028f726 100644
--- a/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C
+++ b/src/finiteVolume/interpolation/volPointInterpolation/pointPatchInterpolation/pointPatchInterpolation.C
@@ -213,13 +213,12 @@ void pointPatchInterpolation::makePatchPatchWeights()
 
                 if (!isA<emptyFvPatch>(bm[patchi]) && !bm[patchi].coupled())
                 {
-                    pw[nFacesAroundPoint] =
-                        1.0/mag
-                        (
-                            pointLoc
-                          - centres.boundaryField()[patchi]
-                                [bm[patchi].patch().whichFace(curFaces[facei])]
-                        );
+                    vector d =
+                        pointLoc
+                      - centres.boundaryField()[patchi]
+                            [bm[patchi].patch().whichFace(curFaces[facei])];
+
+                    pw[nFacesAroundPoint] = 1.0/(mag(d)+VSMALL);
 
                     nFacesAroundPoint++;
                 }
-- 
GitLab