From 652c473b3d6a6c7b07465553297c21cd95572ae5 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Sun, 23 Aug 2015 14:01:15 +0100 Subject: [PATCH 1/9] Removed unnecessary return statement --- .../GGIInterpolation/GGIInterpolationQuickRejectTests.C | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/foam/interpolations/GGIInterpolation/GGIInterpolationQuickRejectTests.C b/src/foam/interpolations/GGIInterpolation/GGIInterpolationQuickRejectTests.C index f7de56cba..282fa7579 100644 --- a/src/foam/interpolations/GGIInterpolation/GGIInterpolationQuickRejectTests.C +++ b/src/foam/interpolations/GGIInterpolation/GGIInterpolationQuickRejectTests.C @@ -561,8 +561,6 @@ void GGIInterpolation::findNeighboursBBOctree { result[i].transfer(candidateMasterNeighbors[i].shrink()); } - - return; } From d77d7d9b51ed0fa61124cdf978648cdbbc58c128 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Sun, 23 Aug 2015 14:03:08 +0100 Subject: [PATCH 2/9] Removed training backslash from option --- src/dynamicMesh/dynamicMesh/Make/options | 4 ++-- src/mesh/autoMesh/Make/options | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dynamicMesh/dynamicMesh/Make/options b/src/dynamicMesh/dynamicMesh/Make/options index ac77b8044..4b2f0a059 100644 --- a/src/dynamicMesh/dynamicMesh/Make/options +++ b/src/dynamicMesh/dynamicMesh/Make/options @@ -1,5 +1,5 @@ EXE_INC = \ - -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ - -lmeshTools \ + -lmeshTools diff --git a/src/mesh/autoMesh/Make/options b/src/mesh/autoMesh/Make/options index d29e43b74..39aeed778 100644 --- a/src/mesh/autoMesh/Make/options +++ b/src/mesh/autoMesh/Make/options @@ -5,7 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/edgeMesh/lnInclude LIB_LIBS = \ -ldecompositionMethods \ @@ -14,4 +14,4 @@ LIB_LIBS = \ -lfiniteVolume \ -llagrangian \ -lmeshTools \ - -ledgeMesh \ + -ledgeMesh From 97b7e710c58972de9dbc5860046fd5b034fba413 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 11:12:02 +0100 Subject: [PATCH 3/9] Report patch name instead of index in debug --- .../polyPatches/constraint/ggi/ggiPolyPatch.C | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C b/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C index 4094d663d..9f5039e00 100644 --- a/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C +++ b/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C @@ -114,7 +114,7 @@ void Foam::ggiPolyPatch::calcRemoteZoneAddressing() const if (debug) { Pout<< "ggiPolyPatch::calcRemoteZoneAddressing() const for patch " - << index() << endl; + << name() << endl; } // Once zone addressing is established, visit the opposite side and find @@ -195,7 +195,8 @@ void Foam::ggiPolyPatch::calcPatchToPatch() const if (debug) { InfoIn("void ggiPolyPatch::calcPatchToPatch() const") - << "Calculating patch to patch interpolation" << endl; + << "Calculating patch to patch interpolation for patch" + << name() << endl; } // Create interpolation for zones @@ -258,6 +259,13 @@ void Foam::ggiPolyPatch::calcReconFaceCellCentres() const << abort(FatalError); } + if (debug) + { + InfoIn("void ggiPolyPatch::calcReconFaceCellCentres() const") + << "Calculating recon centres for patch" + << name() << endl; + } + // Create neighbouring face centres using interpolation if (master()) { @@ -366,7 +374,7 @@ void Foam::ggiPolyPatch::calcSendReceive() const if (debug) { Pout<< "ggiPolyPatch::calcSendReceive() const for patch " - << index() << endl; + << name() << endl; } if (!Pstream::parRun()) From fb6f3af37f44c15a34cd47e14e261b7cfee8139c Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 11:12:10 +0100 Subject: [PATCH 4/9] Formatting --- src/foam/meshes/polyMesh/polyMesh.C | 1 - 1 file changed, 1 deletion(-) diff --git a/src/foam/meshes/polyMesh/polyMesh.C b/src/foam/meshes/polyMesh/polyMesh.C index 5346b0b7d..9925aa005 100644 --- a/src/foam/meshes/polyMesh/polyMesh.C +++ b/src/foam/meshes/polyMesh/polyMesh.C @@ -1243,7 +1243,6 @@ void Foam::polyMesh::setOldPoints const pointField& setPoints ) { - if(setPoints.size() != allPoints_.size()) { FatalErrorIn From cfd2b5a3668e3bbc46584c811ea1f778785d2e55 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 11:13:39 +0100 Subject: [PATCH 5/9] Bug fix: addressing memory leak in Block AMG --- .../BlockMatrixAgglomeration.C | 66 +++++++++++-------- .../BlockMatrixAgglomeration.H | 2 +- .../BlockMatrixCoarsening.C | 6 +- .../BlockMatrixCoarsening.H | 42 ++++++------ .../blockMatrixAgglomerations.C | 1 + .../scalarBlockMatrixAgglomeration.H | 6 +- .../tensorBlockMatrixAgglomeration.H | 8 ++- .../vectorBlockMatrixAgglomeration.H | 8 +-- .../BlockAmg/coarseBlockAmgLevel.C | 20 ++---- .../BlockAmg/coarseBlockAmgLevel.H | 8 ++- .../BlockAmg/fineBlockAmgLevel.C | 16 +---- .../BlockAmg/fineBlockAmgLevel.H | 3 +- .../BlockAmgPrecon/BlockAmgPrecon.C | 3 +- 13 files changed, 95 insertions(+), 94 deletions(-) diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C index 7ae2fa450..d77f0b2d3 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.C @@ -34,11 +34,12 @@ Author #include "BlockMatrixAgglomeration.H" #include "boolList.H" +#include "tolerancesSwitch.H" #include "coeffFields.H" #include "addToRunTimeSelectionTable.H" #include "BlockGAMGInterfaceField.H" #include "processorLduInterfaceField.H" -#include "tolerancesSwitch.H" +#include "coarseBlockAmgLevel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -397,14 +398,14 @@ Foam::BlockMatrixAgglomeration::~BlockMatrixAgglomeration() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::autoPtr > +Foam::autoPtr > Foam::BlockMatrixAgglomeration::restrictMatrix() const { if (!coarsen_) { FatalErrorIn ( - "autoPtr " + "autoPtr > " "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Requesting coarse matrix when it cannot be created" << abort(FatalError); @@ -434,8 +435,8 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr > BlockMatrixAgglomeration::" - "restrictMatrix() const" + "autoPtr >" + "BlockMatrixAgglomeration::restrictMatrix() const" ) << "agglomIndex array does not correspond to fine level. " << endl << " Size: " << agglomIndex_.size() << " number of equations: " << matrix_.lduAddr().size() @@ -609,23 +610,23 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const const_cast&>(matrix_).interfaces(); // Set the coarse interfaces and coefficients - lduInterfacePtrsList* coarseInterfacesPtr = - new lduInterfacePtrsList(interfaceSize); - lduInterfacePtrsList& coarseInterfaces = *coarseInterfacesPtr; + lduInterfacePtrsList coarseInterfaces(interfaceSize); labelListList coarseInterfaceAddr(interfaceSize); // Add the coarse level // Set the coarse ldu addressing onto the list - lduPrimitiveMesh* coarseAddrPtr = + autoPtr coarseAddrPtr + ( new lduPrimitiveMesh ( nCoarseEqns_, coarseOwner, coarseNeighbour, true - ); + ) + ); // Initialise transfer of restrict addressing on the interface forAll (interfaceFields, intI) @@ -679,7 +680,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const intI, GAMGInterface::New ( - *coarseAddrPtr, + coarseAddrPtr(), fineInterface, fineInterface.interfaceInternalField(agglomIndex_), fineInterfaceAddr[intI] @@ -702,15 +703,17 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const // Add interfaces coarseAddrPtr->addInterfaces ( - *coarseInterfacesPtr, + coarseInterfaces, coarseInterfaceAddr, matrix_.patchSchedule() ); // Set the coarse level matrix - BlockLduMatrix* coarseMatrixPtr = - new BlockLduMatrix(*coarseAddrPtr); - BlockLduMatrix& coarseMatrix = *coarseMatrixPtr; + autoPtr > coarseMatrixPtr + ( + new BlockLduMatrix(coarseAddrPtr()) + ); + BlockLduMatrix& coarseMatrix = coarseMatrixPtr(); typename BlockLduInterfaceFieldPtrsList::Type& coarseInterfaceFieldsTransfer = @@ -818,7 +821,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr" + "autoPtr >" "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of square type and upper of " << "linear type is not implemented" @@ -828,7 +831,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr" + "autoPtr >" "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of square type and upper of " << "scalar type is not implemented" @@ -839,7 +842,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr" + "autoPtr >" "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of linear type not implemented" << abort(FatalError); @@ -848,7 +851,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr" + "autoPtr >" "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of scalar type not implemented" << abort(FatalError); @@ -900,7 +903,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr" + "autoPtr >" "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of square type and upper of " << "linear type is not implemented" @@ -910,7 +913,7 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr" + "autoPtr >" "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of square type and upper of " << "scalar type is not implemented" @@ -922,8 +925,8 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr BlockMatrixAgglomeration::" - "restrictMatrix() const" + "autoPtr > " + "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of linear type not implemented" << abort(FatalError); } @@ -931,14 +934,25 @@ Foam::BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr BlockMatrixAgglomeration::" - "restrictMatrix() const" + "autoPtr > " + "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Matrix diagonal of scalar type not implemented" << abort(FatalError); } } - return autoPtr >(coarseMatrixPtr); + return autoPtr > + ( + new coarseBlockAmgLevel + ( + coarseAddrPtr, + coarseMatrixPtr, + this->dict(), + this->type(), + this->groupSize(), + this->minCoarseEqns() + ) + ); } diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H index c084077e2..6ce1df7d7 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixAgglomeration.H @@ -138,7 +138,7 @@ public: } //- Restrict matrix - virtual autoPtr > restrictMatrix() const; + virtual autoPtr > restrictMatrix() const; //- Restrict residual virtual void restrictResidual diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.C b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.C index 55edfc863..43238c4b2 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.C @@ -31,7 +31,8 @@ Class // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // template -Foam::autoPtr > Foam::BlockMatrixCoarsening::New +Foam::autoPtr > +Foam::BlockMatrixCoarsening::New ( const word& coarseningType, const BlockLduMatrix& matrix, @@ -47,7 +48,8 @@ Foam::autoPtr > Foam::BlockMatrixCoarsening > BlockMatrixCoarsening::New\n" + "autoPtr > " + "BlockMatrixCoarsening::New\n" "(\n" " const word& coarseningType,\n" " const lduMatrix& matrix,\n" diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H index f928b1cf3..1e6d94fa7 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/BlockMatrixCoarsening.H @@ -91,29 +91,25 @@ class BlockMatrixCoarsening public: - //- Runtime type information - TypeName("BlockMatrixCoarsening"); - - // KRJ: 2012-12-15: Replaced by the above function - //- Runtime type information - //virtual const word& type() const = 0; + //- Runtime type information + TypeName("BlockMatrixCoarsening"); - // Declare run-time constructor selection tables + // Declare run-time constructor selection tables - declareRunTimeSelectionTable + declareRunTimeSelectionTable + ( + autoPtr, + BlockMatrixCoarsening, + matrix, ( - autoPtr, - BlockMatrixCoarsening, - matrix, - ( - const BlockLduMatrix& matrix, - const dictionary& dict, - const label groupSize, - const label minCoarseEqns - ), - (matrix, dict, groupSize, minCoarseEqns) - ); + const BlockLduMatrix& matrix, + const dictionary& dict, + const label groupSize, + const label minCoarseEqns + ), + (matrix, dict, groupSize, minCoarseEqns) + ); // Selectors @@ -154,6 +150,12 @@ public: // Member Functions + //- Return access to dictionary + const dictionary& dict() const + { + return dict_; + } + //- Return group size label groupSize() const { @@ -170,7 +172,7 @@ public: virtual bool coarsen() const = 0; //- Restrict matrix - virtual autoPtr > restrictMatrix + virtual autoPtr > restrictMatrix () const = 0; //- Restrict residual diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/blockMatrixAgglomerations.C b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/blockMatrixAgglomerations.C index 2102d57bb..091e04e04 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/blockMatrixAgglomerations.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/blockMatrixAgglomerations.C @@ -25,6 +25,7 @@ License #include "blockMatrixAgglomerations.H" #include "blockMatrixCoarsenings.H" +#include "coarseBlockAmgLevel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/scalarBlockMatrixAgglomeration.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/scalarBlockMatrixAgglomeration.H index 9a5a62dc2..da030d2a5 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/scalarBlockMatrixAgglomeration.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/scalarBlockMatrixAgglomeration.H @@ -58,18 +58,18 @@ namespace Foam //- Restrict matrix template<> -inline autoPtr > +inline autoPtr > BlockMatrixAgglomeration::restrictMatrix() const { FatalErrorIn ( - "autoPtr > " + "autoPtr > " "BlockMatrixAgglomeration::restrictMatrix() const" ) << "Function not implemented for Type=scalar. " << endl << abort(FatalError); // Dummy return to keep compiler happy - return autoPtr >(NULL); + return autoPtr >(NULL); } diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/tensorBlockMatrixAgglomeration.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/tensorBlockMatrixAgglomeration.H index 5413de4ef..4489b710a 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/tensorBlockMatrixAgglomeration.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/tensorBlockMatrixAgglomeration.H @@ -52,18 +52,20 @@ namespace Foam //- Restrict matrix template<> -inline autoPtr > BlockMatrixAgglomeration::restrictMatrix +inline autoPtr > +BlockMatrixAgglomeration::restrictMatrix () const { FatalErrorIn ( - "autoPtr > BlockMatrixAgglomeration::" + "autoPtr > " + "BlockMatrixAgglomeration::" "restrictMatrix() const" ) << "Function not implemented for Type=tensor. " << endl << abort(FatalError); // Dummy return to keep compiler happy - return autoPtr >(NULL); + return autoPtr >(NULL); } diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/vectorBlockMatrixAgglomeration.H b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/vectorBlockMatrixAgglomeration.H index 17eb13377..e06052807 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/vectorBlockMatrixAgglomeration.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/BlockMatrixCoarsening/vectorBlockMatrixAgglomeration.H @@ -46,25 +46,25 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class BlockMatrixAgglomeration Declaration + Class BlockMatrixAgglomeration Declaration \*---------------------------------------------------------------------------*/ //- Restrict matrix template<> -inline autoPtr > +inline autoPtr > BlockMatrixAgglomeration::restrictMatrix () const { FatalErrorIn ( - "autoPtr > BlockMatrixAgglomeration::" + "autoPtr > BlockMatrixAgglomeration::" "restrictMatrix() const" ) << "Function not implemented for Type=vector. " << endl << abort(FatalError); // Dummy return to keep compiler happy - return autoPtr >(NULL); + return autoPtr >(NULL); } diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C b/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C index 6e9dd3b40..c8d291ae9 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.C @@ -47,14 +47,15 @@ Author template Foam::coarseBlockAmgLevel::coarseBlockAmgLevel ( + autoPtr addrPtr, autoPtr > matrixPtr, const dictionary& dict, const word& coarseningType, const label groupSize, - const label minCoarseEqns, - const word& smootherType + const label minCoarseEqns ) : + addrPtr_(addrPtr), matrixPtr_(matrixPtr), x_(matrixPtr_->diag().size(),pTraits::zero), b_(matrixPtr_->diag().size(),pTraits::zero), @@ -388,23 +389,12 @@ Foam::coarseBlockAmgLevel::makeNextLevel() const { if (coarseningPtr_->coarsen()) { - return autoPtr > - ( - new coarseBlockAmgLevel - ( - coarseningPtr_->restrictMatrix(), - dict(), - coarseningPtr_->type(), - coarseningPtr_->groupSize(), - coarseningPtr_->minCoarseEqns(), - smootherPtr_->type() - ) - ); + return coarseningPtr_->restrictMatrix(); } else { // Final level: cannot coarsen - return autoPtr >(); + return autoPtr >(); } } diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.H b/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.H index e356f5ff1..c7ecf3a6f 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/coarseBlockAmgLevel.H @@ -41,6 +41,7 @@ SourceFiles #include "BlockAmgLevel.H" #include "BlockLduSmoother.H" #include "BlockLduMatrix.H" +#include "lduPrimitiveMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,6 +59,9 @@ class coarseBlockAmgLevel { // Private data + //- Matrix addressing object. This also contains coupling interfaces + autoPtr addrPtr_; + //- Matrix autoPtr > matrixPtr_; @@ -100,12 +104,12 @@ public: //- Construct from components coarseBlockAmgLevel ( + autoPtr addrPtr, autoPtr > matrixPtr, const dictionary& dict, const word& coarseningType, const label groupSize, - const label minCoarseEqns, - const word& smootherType + const label minCoarseEqns ); diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.C b/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.C index a6af87e1c..0b91ee881 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.C +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.C @@ -50,8 +50,7 @@ Foam::fineBlockAmgLevel::fineBlockAmgLevel const dictionary& dict, const word& coarseningType, const label groupSize, - const label minCoarseEqns, - const word& smootherType + const label minCoarseEqns ) : matrix_(matrix), @@ -314,18 +313,7 @@ Foam::fineBlockAmgLevel::makeNextLevel() const { if (coarseningPtr_->coarsen()) { - return autoPtr > - ( - new coarseBlockAmgLevel - ( - coarseningPtr_->restrictMatrix(), - dict(), - coarseningPtr_->type(), - coarseningPtr_->groupSize(), - coarseningPtr_->minCoarseEqns(), - smootherPtr_->type() - ) - ); + return coarseningPtr_->restrictMatrix(); } else { diff --git a/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.H b/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.H index df5ab9880..b26109e0a 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.H +++ b/src/foam/matrices/blockLduMatrix/BlockAmg/fineBlockAmgLevel.H @@ -108,8 +108,7 @@ public: const dictionary& dict, const word& coarseningType, const label groupSize, - const label minCoarseEqns, - const word& smootherType + const label minCoarseEqns ); diff --git a/src/foam/matrices/blockLduMatrix/BlockLduPrecons/BlockAmgPrecon/BlockAmgPrecon.C b/src/foam/matrices/blockLduMatrix/BlockLduPrecons/BlockAmgPrecon/BlockAmgPrecon.C index 5d2609f57..c08a93feb 100644 --- a/src/foam/matrices/blockLduMatrix/BlockLduPrecons/BlockAmgPrecon/BlockAmgPrecon.C +++ b/src/foam/matrices/blockLduMatrix/BlockLduPrecons/BlockAmgPrecon/BlockAmgPrecon.C @@ -70,8 +70,7 @@ Foam::BlockAmgPrecon::BlockAmgPrecon dict, dict.lookup("coarseningType"), readLabel(dict.lookup("groupSize")), - readLabel(dict.lookup("minCoarseEqns")), - dict.lookup("smoother") + readLabel(dict.lookup("minCoarseEqns")) ) ) ) From 171fdf38f696ff97148bdde75df08faa0aca84e3 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 11:12:02 +0100 Subject: [PATCH 6/9] Report patch name instead of index in debug --- .../polyPatches/constraint/ggi/ggiPolyPatch.C | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C b/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C index 9f5039e00..23deecb82 100644 --- a/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C +++ b/src/foam/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C @@ -195,8 +195,7 @@ void Foam::ggiPolyPatch::calcPatchToPatch() const if (debug) { InfoIn("void ggiPolyPatch::calcPatchToPatch() const") - << "Calculating patch to patch interpolation for patch" - << name() << endl; + << "Calculating patch to patch interpolation" << endl; } // Create interpolation for zones @@ -259,13 +258,6 @@ void Foam::ggiPolyPatch::calcReconFaceCellCentres() const << abort(FatalError); } - if (debug) - { - InfoIn("void ggiPolyPatch::calcReconFaceCellCentres() const") - << "Calculating recon centres for patch" - << name() << endl; - } - // Create neighbouring face centres using interpolation if (master()) { @@ -374,7 +366,7 @@ void Foam::ggiPolyPatch::calcSendReceive() const if (debug) { Pout<< "ggiPolyPatch::calcSendReceive() const for patch " - << name() << endl; + << index() << endl; } if (!Pstream::parRun()) From 2c88222c95be0815d0fe5349beb004f94131b720 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 15:49:13 +0100 Subject: [PATCH 7/9] Update points using setOldPoints to avoid geometrical update --- .../linearValveFvMesh/linearValveFvMesh.C | 58 ++++++++++++++----- .../linearValveLayersFvMesh.C | 16 +++-- .../mixerFvMesh/mixerFvMesh.C | 9 ++- .../movingBodyTopoFvMesh.C | 8 ++- .../multiMixerFvMesh/multiMixerFvMesh.C | 5 +- .../multiTopoBodyFvMesh/multiTopoBodyFvMesh.C | 4 +- 6 files changed, 74 insertions(+), 26 deletions(-) diff --git a/src/dynamicMesh/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C index fc1d48b96..c3ae1e99a 100644 --- a/src/dynamicMesh/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C @@ -363,26 +363,52 @@ bool Foam::linearValveFvMesh::update() Info << "Moving points post slider attach" << endl; - if (topoChangeMap3->morphing()) + bool localMorphing3 = topoChangeMap3->morphing(); + bool globalMorphing3 = localMorphing3; + + reduce(globalMorphing3, orOp()); + + if (globalMorphing3) { - msPtr_->updateMesh(topoChangeMap3()); - - if (debug) - { - Info << "Moving points post slider attach" << endl; - } - pointField newPoints = allPoints(); - pointField mappedOldPointsNew(newPoints.size()); - mappedOldPointsNew.map(oldPointsNew, topoChangeMap3->pointMap()); + if (localMorphing3) + { + msPtr_->updateMesh(topoChangeMap3()); - // Solve the correct mesh motion to make sure motion fluxes - // are solved for and not mapped - movePoints(mappedOldPointsNew); - resetMotion(); - setV0(); - movePoints(newPoints); + pointField mappedOldPointsNew(newPoints.size()); + + mappedOldPointsNew.map + ( + oldPointsNew, + topoChangeMap3->pointMap() + ); + + // Solve the correct mesh motion to make sure motion fluxes + // are solved for and not mapped + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(mappedOldPointsNew); + + resetMotion(); + setV0(); + + fvMesh::movePoints(newPoints); + } + else + { + // No local topological change. Execute double motion for + // sync with topological changes + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(oldPointsNew); + + resetMotion(); + setV0(); + + // Set new point motion + fvMesh::movePoints(newPoints); + } } } diff --git a/src/dynamicMesh/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C index 96c68072d..77d65d147 100644 --- a/src/dynamicMesh/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C @@ -532,12 +532,16 @@ bool Foam::linearValveLayersFvMesh::update() if (localMorphing2) { Info << "Topology change; executing pre-motion" << endl; - movePoints(topoChangeMap2->preMotionPoints()); + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(topoChangeMap2->preMotionPoints()); newPoints = topoChangeMap2->preMotionPoints(); } else { - movePoints(newPoints); + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(newPoints); } setV0(); @@ -589,7 +593,9 @@ bool Foam::linearValveLayersFvMesh::update() // Solve the correct mesh motion to make sure motion fluxes // are solved for and not mapped - movePoints(mappedOldPointsNew); + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(mappedOldPointsNew); resetMotion(); setV0(); @@ -601,7 +607,9 @@ bool Foam::linearValveLayersFvMesh::update() { // No local topological change. Execute double motion for // sync with topological changes - movePoints(oldPointsNew); + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(oldPointsNew); resetMotion(); setV0(); diff --git a/src/dynamicMesh/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C index fdfa15ef4..a720f80b2 100644 --- a/src/dynamicMesh/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C @@ -477,7 +477,9 @@ bool Foam::mixerFvMesh::update() pointField mappedOldPointsNew(allPoints().size()); mappedOldPointsNew.map(oldPointsNew, topoChangeMap->pointMap()); - movePoints(mappedOldPointsNew); + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(mappedOldPointsNew); resetMotion(); setV0(); @@ -488,7 +490,10 @@ bool Foam::mixerFvMesh::update() else { pointField newPoints = allPoints(); - movePoints(oldPointsNew); + + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(oldPointsNew); resetMotion(); setV0(); diff --git a/src/dynamicMesh/topoChangerFvMesh/movingBodyTopoFvMesh/movingBodyTopoFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/movingBodyTopoFvMesh/movingBodyTopoFvMesh.C index 0dd388e74..18bbaa85c 100644 --- a/src/dynamicMesh/topoChangerFvMesh/movingBodyTopoFvMesh/movingBodyTopoFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/movingBodyTopoFvMesh/movingBodyTopoFvMesh.C @@ -276,7 +276,9 @@ bool Foam::movingBodyTopoFvMesh::update() // pointField mappedOldPointsNew(allPoints().size()); // mappedOldPointsNew.map(oldPointsNew, topoChangeMap->pointMap()); -// movePoints(mappedOldPointsNew); +// // Note: using setOldPoints instead of movePoints. +// // HJ, 23/Aug/2015 +// setOldPoints(mappedOldPointsNew); // resetMotion(); // setV0(); @@ -286,7 +288,9 @@ bool Foam::movingBodyTopoFvMesh::update() // else // { // // No change, use old points -// movePoints(oldPointsNew); +// // Note: using setOldPoints instead of movePoints. +// // HJ, 23/Aug/2015 +// setOldPoints(oldPointsNew); // resetMotion(); // setV0(); // } diff --git a/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/multiMixerFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/multiMixerFvMesh.C index 3cc6f44ed..cd16d0d3c 100644 --- a/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/multiMixerFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/multiMixerFvMesh.C @@ -284,7 +284,10 @@ bool Foam::multiMixerFvMesh::update() pointField mappedOldPointsNew(allPoints().size()); mappedOldPointsNew.map(oldPointsNew, topoChangeMap->pointMap()); - movePoints(mappedOldPointsNew); + // Note: using setOldPoints instead of movePoints. + // HJ, 23/Aug/2015 + setOldPoints(mappedOldPointsNew); + resetMotion(); setV0(); diff --git a/src/dynamicMesh/topoChangerFvMesh/multiTopoBodyFvMesh/multiTopoBodyFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/multiTopoBodyFvMesh/multiTopoBodyFvMesh.C index c3ac7ae81..f931abf6f 100644 --- a/src/dynamicMesh/topoChangerFvMesh/multiTopoBodyFvMesh/multiTopoBodyFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/multiTopoBodyFvMesh/multiTopoBodyFvMesh.C @@ -236,7 +236,9 @@ bool Foam::multiTopoBodyFvMesh::update() // pointField mappedOldPointsNew(allPoints().size()); // mappedOldPointsNew.map(oldPointsNew, topoChangeMap->pointMap()); -// movePoints(mappedOldPointsNew); +// // Note: using setOldPoints instead of movePoints. +// // HJ, 23/Aug/2015 +// setOldPoints(mappedOldPointsNew); // resetMotion(); // setV0(); From 09f80c123fda0be16fdb1bfe9d8cd8ae5ab38fef Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 15:49:29 +0100 Subject: [PATCH 8/9] Formatting --- applications/solvers/multiphase/interFoam/UEqn.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/interFoam/UEqn.H b/applications/solvers/multiphase/interFoam/UEqn.H index 528e0aaaf..85972af16 100644 --- a/applications/solvers/multiphase/interFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/UEqn.H @@ -28,7 +28,7 @@ fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) - ghf*fvc::snGrad(rho) - fvc::snGrad(pd) - ) * mesh.magSf() + )*mesh.magSf() ) ); } From eecdea4535308e689a62f6881725be4f9917c7f4 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 25 Aug 2015 15:49:54 +0100 Subject: [PATCH 9/9] Formatting --- .../fvPatchFields/fvPatchField/fvPatchField.H | 1 - src/lduSolvers/amg/amgPolicy/amgPolicy.H | 28 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 8a07d865d..60c5fbae5 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -110,7 +110,6 @@ public: typedef fvPatch Patch; - //- Runtime type information TypeName("fvPatchField"); diff --git a/src/lduSolvers/amg/amgPolicy/amgPolicy.H b/src/lduSolvers/amg/amgPolicy/amgPolicy.H index 679aaab59..a87e4e971 100644 --- a/src/lduSolvers/amg/amgPolicy/amgPolicy.H +++ b/src/lduSolvers/amg/amgPolicy/amgPolicy.H @@ -77,24 +77,24 @@ class amgPolicy public: - //- Runtime type information - virtual const word& type() const = 0; + //- Runtime type information + virtual const word& type() const = 0; - // Declare run-time constructor selection tables + // Declare run-time constructor selection tables - declareRunTimeSelectionTable + declareRunTimeSelectionTable + ( + autoPtr, + amgPolicy, + matrix, ( - autoPtr, - amgPolicy, - matrix, - ( - const lduMatrix& matrix, - const label groupSize, - const label minCoarseEqns - ), - (matrix, groupSize, minCoarseEqns) - ); + const lduMatrix& matrix, + const label groupSize, + const label minCoarseEqns + ), + (matrix, groupSize, minCoarseEqns) + ); // Selectors