From 14934a9bfc52cc3b918f77fab9ed2178bcfbf2e3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 14 May 2013 16:45:59 +0100 Subject: [PATCH 1/5] BUG: faceAreaPairGAMGAgglomeration: corrected face area -> weight conversion --- .../faceAreaPairGAMGAgglomeration.C | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/fvMatrices/solvers/GAMGSymSolver/GAMGAgglomerations/faceAreaPairGAMGAgglomeration/faceAreaPairGAMGAgglomeration.C b/src/finiteVolume/fvMatrices/solvers/GAMGSymSolver/GAMGAgglomerations/faceAreaPairGAMGAgglomeration/faceAreaPairGAMGAgglomeration.C index 9bfcda020c..42a35f5c1b 100644 --- a/src/finiteVolume/fvMatrices/solvers/GAMGSymSolver/GAMGAgglomerations/faceAreaPairGAMGAgglomeration/faceAreaPairGAMGAgglomeration.C +++ b/src/finiteVolume/fvMatrices/solvers/GAMGSymSolver/GAMGAgglomerations/faceAreaPairGAMGAgglomeration/faceAreaPairGAMGAgglomeration.C @@ -90,8 +90,6 @@ Foam::faceAreaPairGAMGAgglomeration::faceAreaPairGAMGAgglomeration : pairGAMGAgglomeration(mesh, controlDict) { - vectorField n(faceAreas/mag(faceAreas)); - //agglomerate(mesh, sqrt(mag(faceAreas))); agglomerate ( @@ -100,7 +98,8 @@ Foam::faceAreaPairGAMGAgglomeration::faceAreaPairGAMGAgglomeration ( cmptMultiply ( - n, + faceAreas + /sqrt(mag(faceAreas)), vector(1, 1.01, 1.02) //vector::one ) From 6d3cfe9848aba235d36735bf848452354cc6a511 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 14 May 2013 20:42:54 +0100 Subject: [PATCH 2/5] ENH: GAMGAgglomeration: enable debug printing by default --- etc/controlDict | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/controlDict b/etc/controlDict index b9c41cb3a4..fba02069de 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -135,7 +135,7 @@ DebugSwitches FDIC 0; FaceCellWave 0; GAMG 0; - GAMGAgglomeration 0; + GAMGAgglomeration 1; GAMGInterface 0; GAMGInterfaceField 0; Gamma 0; From 8009617b23ec4d96c5cc8652d73bef48a2ad9a66 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 14 May 2013 20:44:40 +0100 Subject: [PATCH 3/5] ENH: wordIOList: return columnsizes when printing table --- .../primitives/strings/word/wordIOList.C | 18 +++++++++++++++--- .../primitives/strings/word/wordIOList.H | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/primitives/strings/word/wordIOList.C b/src/OpenFOAM/primitives/strings/word/wordIOList.C index ede987af53..58456cb0ac 100644 --- a/src/OpenFOAM/primitives/strings/word/wordIOList.C +++ b/src/OpenFOAM/primitives/strings/word/wordIOList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,12 +38,17 @@ namespace Foam } -void Foam::printTable(const List& wll, Ostream& os) +void Foam::printTable +( + const List& wll, + List& columnWidth, + Ostream& os +) { if (!wll.size()) return; // Find the maximum word length for each column - List columnWidth(wll[0].size(), string::size_type(0)); + columnWidth.setSize(wll[0].size(), string::size_type(0)); forAll(columnWidth, j) { forAll(wll, i) @@ -75,4 +80,11 @@ void Foam::printTable(const List& wll, Ostream& os) } +void Foam::printTable(const List& wll, Ostream& os) +{ + List columnWidth; + printTable(wll, columnWidth, os); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/strings/word/wordIOList.H b/src/OpenFOAM/primitives/strings/word/wordIOList.H index c560a33a95..da9d5aa426 100644 --- a/src/OpenFOAM/primitives/strings/word/wordIOList.H +++ b/src/OpenFOAM/primitives/strings/word/wordIOList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ namespace Foam typedef IOList wordListIOList; // Print word list list as a table + void printTable(const List&, List&, Ostream&); void printTable(const List&, Ostream&); } From 1df4f9e8f6555b41091391b6ed26817f8ee07454 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 14 May 2013 20:48:38 +0100 Subject: [PATCH 4/5] ENH: lduPrimitiveMesh: make constructor easier --- src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C | 6 ++++-- src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C index 070edd4b69..507fc425ef 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C @@ -254,7 +254,7 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh const label nCells, labelList& l, labelList& u, - const Xfer >& primitiveInterfaces, + PtrList& primitiveInterfaces, const lduSchedule& ps, const label comm ) @@ -262,10 +262,12 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh lduAddressing(nCells), lowerAddr_(l, true), upperAddr_(u, true), - primitiveInterfaces_(primitiveInterfaces), + primitiveInterfaces_(0), patchSchedule_(ps), comm_(comm) { + primitiveInterfaces_.transfer(primitiveInterfaces); + // Create interfaces interfaces_.setSize(primitiveInterfaces_.size()); forAll(primitiveInterfaces_, i) diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H index 66c26dc37e..5bd7901c8b 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.H @@ -133,7 +133,7 @@ public: const label nCells, labelList& l, labelList& u, - const Xfer >& primitiveInterfaces, + PtrList& primitiveInterfaces, const lduSchedule& ps, const label comm ); From f3b7047a75e3dfcef4b859b2e29eba0e4a7ff55c Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 14 May 2013 20:50:33 +0100 Subject: [PATCH 5/5] ENH: procFaces: new GAMGProcAgglomeration method --- src/OpenFOAM/Make/files | 6 +- .../GAMGAgglomerateLduAddressing.C | 2 +- .../GAMGAgglomeration/GAMGAgglomeration.C | 99 +++++- .../pairGAMGAgglomeration.H | 17 +- .../procFacesGAMGProcAgglomeration.C | 333 ++++++++++++++++++ .../procFacesGAMGProcAgglomeration.H | 136 +++++++ 6 files changed, 566 insertions(+), 27 deletions(-) create mode 100644 src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.C create mode 100644 src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGProcAgglomerations/procFacesGAMGProcAgglomeration/procFacesGAMGProcAgglomeration.H diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 19a8138fe5..6d346617c1 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -331,10 +331,8 @@ eagerGAMGProcAgglomeration = $(GAMGProcAgglomerations)/eagerGAMGProcAgglomeratio $(eagerGAMGProcAgglomeration)/eagerGAMGProcAgglomeration.C noneGAMGProcAgglomeration = $(GAMGProcAgglomerations)/noneGAMGProcAgglomeration $(noneGAMGProcAgglomeration)/noneGAMGProcAgglomeration.C -/* -cellFaceRatioGAMGProcAgglomeration = $(GAMGProcAgglomerations)/cellFaceRatioGAMGProcAgglomeration -$(cellFaceRatioGAMGProcAgglomeration)/cellFaceRatioGAMGProcAgglomeration.C -*/ +procFacesGAMGProcAgglomeration = $(GAMGProcAgglomerations)/procFacesGAMGProcAgglomeration +$(procFacesGAMGProcAgglomeration)/procFacesGAMGProcAgglomeration.C meshes/lduMesh/lduMesh.C diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C index e6781ed23f..066aa39d3b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomerateLduAddressing.C @@ -351,7 +351,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing ); - if (debug) + if (debug & 2) { Pout<< "GAMGAgglomeration :" << " agglomerated level " << fineLevelIndex diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index d1551eb399..a53a5fe9ab 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -27,9 +27,9 @@ License #include "lduMesh.H" #include "lduMatrix.H" #include "Time.H" -#include "dlLibraryTable.H" #include "GAMGInterface.H" #include "GAMGProcAgglomeration.H" +#include "IOmanip.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -67,23 +67,94 @@ void Foam::GAMGAgglomeration::compactLevels(const label nCreatedLevels) procBoundaryFaceMap_.setSize(nCreatedLevels); procAgglomeratorPtr_().agglomerate(); - } - if (debug) - { - for (label levelI = 0; levelI <= size(); levelI++) + + if (debug) { - if (hasMeshLevel(levelI)) + + Info<< "GAMGAgglomeration:" << nl + << " local agglomerator : " << type() << nl + << " processor agglomerator : " + << procAgglomeratorPtr_().type() << nl + << nl; + + Info<< setw(40) << "nCells" + << setw(24) << "nInterfaces" + << setw(24) << "Ratio" << nl + << setw(8) << "Level" + << setw(8) << "nProcs" + << " " + << setw(8) << "avg" + << setw(8) << "max" + << " " + << setw(8) << "avg" + << setw(8) << "max" + << " " << setw(4) << "avg" + << " " << setw(4) << "max" + << nl + << setw(8) << "-----" + << setw(8) << "------" + << " " + << setw(8) << "---" + << setw(8) << "---" + << " " + << setw(8) << "---" + << setw(8) << "---" + << " " << setw(4) << "---" + << " " << setw(4) << "---" + << nl; + + for (label levelI = 0; levelI <= size(); levelI++) { - const lduMesh& fineMesh = meshLevel(levelI); - Pout<< "Level " << levelI << " fine mesh:"<< nl; - Pout<< fineMesh.info() << endl; - } - else - { - Pout<< "Level " << levelI << " has no fine mesh:" << nl - << endl; + label nProcs = 0; + label nCells = 0; + label nInterfaces = 0; + label nIntFaces = 0; + scalar ratio = 0.0; + + if (hasMeshLevel(levelI)) + { + nProcs = 1; + + const lduMesh& fineMesh = meshLevel(levelI); + nCells = fineMesh.lduAddr().size(); + + const lduInterfacePtrsList interfaces = + fineMesh.interfaces(); + forAll(interfaces, i) + { + if (interfaces.set(i)) + { + nInterfaces++; + nIntFaces += interfaces[i].faceCells().size(); + } + } + ratio = scalar(nIntFaces)/nCells; + } + + label totNprocs = returnReduce(nProcs, sumOp