From 41eeaaede49fa4f2537692ce083d8e9caef1a2b0 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Tue, 6 Sep 2016 12:56:54 +0100
Subject: [PATCH] algebraicPairGAMGAgglomeration: agglomerate based on the
 maximum of the upper and lower coefficients Patch provided by Mattijs
 Janssens Resolves bug-report http://bugs.openfoam.org/view.php?id=2234

---
 .../algebraicPairGAMGAgglomeration.C                | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C
index 30770e2d320..6d769f4099e 100644
--- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C
+++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/algebraicPairGAMGAgglomeration/algebraicPairGAMGAgglomeration.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -52,7 +52,16 @@ Foam::algebraicPairGAMGAgglomeration::algebraicPairGAMGAgglomeration
 :
     pairGAMGAgglomeration(matrix.mesh(), controlDict)
 {
-    agglomerate(matrix.mesh(), mag(matrix.upper()));
+    const lduMesh& mesh = matrix.mesh();
+
+    if (matrix.hasLower())
+    {
+        agglomerate(mesh, max(mag(matrix.upper()), mag(matrix.lower())));
+    }
+    else
+    {
+        agglomerate(mesh, mag(matrix.upper()));
+    }
 }
 
 
-- 
GitLab