From 6b054eab14026feac01dbee74497411f0596bf6c Mon Sep 17 00:00:00 2001
From: Henry <Henry>
Date: Wed, 12 Jun 2013 12:55:37 +0100
Subject: [PATCH] MGridGenGAMGAgglomerate: Use sum magSf rather than mag(sum
 Sf) for face-weighting This is more consistent with the faceArea
 agglomeration and generates more reliable agglomerations.

---
 .../MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C     | 5 -----
 .../MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C   | 6 +++++-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C
index e3663315aa5..4d32bfa89f8 100644
--- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C
+++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomerate.C
@@ -30,11 +30,6 @@ Description
 #include "fvMesh.H"
 #include "syncTools.H"
 
-//extern "C"
-//{
-//#   include "mgridgen.h"
-//}
-
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
 void Foam::MGridGenGAMGAgglomeration::
diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C
index 59c45bc11b2..cc259c50384 100644
--- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C
+++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C
@@ -59,7 +59,11 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration
 
     // Start geometric agglomeration from the cell volumes and areas of the mesh
     scalarField* VPtr = const_cast<scalarField*>(&fvMesh_.cellVolumes());
-    SubField<vector> Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces());
+
+    vectorField magFaceAreas(vector::one*mag(fvMesh_.faceAreas()));
+    SubField<vector> Sf(magFaceAreas, fvMesh_.nInternalFaces());
+    //SubField<vector> Sf(fvMesh_.faceAreas(), fvMesh_.nInternalFaces());
+
     vectorField* SfPtr = const_cast<vectorField*>
     (
         &Sf.operator const vectorField&()
-- 
GitLab