From 08318727549b8f895fb975532abcaea8f86a635d Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Tue, 13 May 2014 17:23:53 +0100
Subject: [PATCH] ENH: rotorDiskSource - limit angle of attack to -pi to pi

---
 .../sources/derived/rotorDiskSource/rotorDiskSource.C     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C
index f565a397d27..b568b6b89da 100644
--- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C
+++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C
@@ -566,6 +566,14 @@ void Foam::fv::rotorDiskSource::calculate
 
             // effective angle of attack
             scalar alphaEff = alphaGeom - atan2(-Uc.z(), Uc.y());
+            if (alphaEff > mathematical::pi)
+            {
+                alphaEff -= mathematical::twoPi;
+            }
+            if (alphaEff < -mathematical::pi)
+            {
+                alphaEff += mathematical::twoPi;
+            }
 
             AOAmin = min(AOAmin, alphaEff);
             AOAmax = max(AOAmax, alphaEff);
-- 
GitLab