From 605b3ff820b025bd4d29c2e21806913aa440381f Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Fri, 22 May 2015 22:38:39 +0100
Subject: [PATCH] streamFunction: Evaluate which coordinate plan the 2D
 geometry is in filter-out the normal component Resolves bug-report
 http://www.openfoam.org/mantisbt/view.php?id=1703

---
 .../streamFunction/streamFunction.C              | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
index 11874fe2ead..2c59611d316 100644
--- a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
+++ b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -61,8 +61,14 @@ int main(int argc, char *argv[])
             << exit(FatalError);
     }
 
-    const vector slabDir((Vector<label>::one - mesh.geometricD())/2);
-    scalar thickness = slabDir & mesh.bounds().span();
+    Vector<label> slabNormal((Vector<label>::one - mesh.geometricD())/2);
+    const direction slabDir
+    (
+        slabNormal
+      & Vector<label>(Vector<label>::X, Vector<label>::Y, Vector<label>::Z)
+    );
+
+    scalar thickness = vector(slabNormal) & mesh.bounds().span();
 
     const pointMesh& pMesh = pointMesh::New(mesh);
 
@@ -302,7 +308,7 @@ int main(int argc, char *argv[])
                                          vector edgeHat =
                                              points[curBPoints[pointI]]
                                              - currentBStreamPoint;
-                                         edgeHat.replace(vector::Z, 0);
+                                         edgeHat.replace(slabDir, 0);
                                          edgeHat /= mag(edgeHat);
 
                                          vector nHat = unitAreas[faceI];
@@ -410,7 +416,7 @@ int main(int argc, char *argv[])
                                          points[curPoints[pointI]]
                                        - currentStreamPoint;
 
-                                     edgeHat.replace(vector::Z, 0);
+                                     edgeHat.replace(slabDir, 0);
                                      edgeHat /= mag(edgeHat);
 
                                      vector nHat = unitAreas[faceI];
-- 
GitLab