From fdc785d671f1fbd692e1ba6299b764a0c67e004d Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Tue, 21 Jan 2014 10:59:24 +0000
Subject: [PATCH] ENH: cyclicAMI - added message if incorrect angle specified
 for rotational case

---
 .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C   | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
index e55d5f96a93..fa333246f8b 100644
--- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
+++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
@@ -186,6 +186,36 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
                     rotationAngle_ *= -1;
                 }
 
+                scalar areaError =
+                    max(errorPos, errorNeg)/(mag(area1) + ROOTVSMALL);
+
+                if (areaError > matchTolerance())
+                {
+                    WarningIn
+                    (
+                        "void Foam::cyclicAMIPolyPatch::calcTransforms"
+                        "("
+                            "const primitivePatch&, "
+                            "const pointField&, "
+                            "const vectorField&, "
+                            "const pointField&, "
+                            "const vectorField&"
+                        ")"
+                    )
+                        << "Patch areas are not consistent within "
+                        << 100*matchTolerance()
+                        << " % indicating a possible error in the specified "
+                        << "angle of rotation" << nl
+                        << "    owner patch     : " << name() << nl
+                        << "    neighbour patch : " << neighbPatch().name()
+                        << nl
+                        << "    angle           : "
+                        << radToDeg(rotationAngle_) << " deg" << nl
+                        << "    area error      : " << 100*areaError << " %"
+                        << "    match tolerance : " <<  matchTolerance()
+                        << endl;
+                }
+
                 if (debug)
                 {
                     scalar theta = radToDeg(rotationAngle_);
-- 
GitLab