From 7bc0c8b3d8fdfd4ca6f5abb365fa835fc612301a Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 4 Jul 2019 11:27:14 +0100 Subject: [PATCH 01/11] Bugfix: addes support for dealing with zero-sized patch fields (immersed boundary) --- .../finiteVolume/fvFieldDecomposerDecomposeFields.C | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/fvFieldDecomposerDecomposeFields.C b/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/fvFieldDecomposerDecomposeFields.C index 80d92197e..5611b07bd 100644 --- a/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/fvFieldDecomposerDecomposeFields.C +++ b/src/decompositionMethods/decomposeReconstruct/decomposeTools/finiteVolume/fvFieldDecomposerDecomposeFields.C @@ -158,9 +158,17 @@ fvFieldDecomposer::decomposeField const label patchStart = field.mesh().boundaryMesh()[patchI].start(); - forAll (p, i) + // Bugfix + // Special patches soch as overset and immersed boundary have + // their faces and values in a separate list; the list of + // values does not correspond to faces. Skip such patches. + // HJ, 4/Jul/2019 + if (p.size() == field.mesh().boundaryMesh()[patchI].size()) { - allFaceField[patchStart + i] = p[i]; + forAll (p, i) + { + allFaceField[patchStart + i] = p[i]; + } } } From d5030fc035ef6f9e97d3ec47cd9c8bcaf3f2f87d Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Tue, 28 May 2019 20:52:04 +0200 Subject: [PATCH 02/11] Removed temporary debug stuff 1. Writing down mesh during load balancing, 2. Left-over sleep statement, 3. Output formatting (some output wrapped around debug statements) --- .../dynamicPolyRefinementFvMesh.C | 16 +++++++++------- .../topoChangerFvMeshLoadBalance.C | 15 ++++++++++----- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C index 5a5eacf23..680e7186b 100644 --- a/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C @@ -271,13 +271,13 @@ bool Foam::dynamicPolyRefinementFvMesh::update() ( refinementSelectionPtr_->refinementCellCandidates()() ); - Pout<< "Selected " << refCandidates.size() + Info<< "Selected " << refCandidates.size() << " refinement candidates." << endl; } else { - Pout<< "Skipping refinement for this time-step..." << endl; + Info<< "Skipping refinement for this time-step..." << endl; } // Set cells to refine. Note: refinement needs to make sure that face @@ -297,13 +297,13 @@ bool Foam::dynamicPolyRefinementFvMesh::update() ( refinementSelectionPtr_->unrefinementPointCandidates()() ); - Pout<< "Selected " << unrefCandidates.size() + Info<< "Selected " << unrefCandidates.size() << " unrefinement candidates." << endl; } else { - Pout<< "Skipping unrefinement for this time-step..." << endl; + Info<< "Skipping unrefinement for this time-step..." << endl; } // Set split points to unrefine around. @@ -344,13 +344,13 @@ bool Foam::dynamicPolyRefinementFvMesh::update() // some topo changes if (sizeCellMap) { - Pout<< "Successfully performed polyhedral refinement. " + Info<< "Successfully performed polyhedral refinement. " << "Changed from " << nOldCells << " to " << sizeCellMap << " cells." << endl; } else { - Pout<< "Refinement/unrefinement not performed in this time step " + Info<< "Refinement/unrefinement not performed in this time step " << "since no cells were selected." << endl; } @@ -362,7 +362,9 @@ bool Foam::dynamicPolyRefinementFvMesh::update() // per time step curTimeIndex_ = time().timeIndex(); } - Pout<< "No refinement/unrefinement" << endl; + + Info<< "No refinement/unrefinement" << endl; + // No refinement/unrefinement at this time step. Return false return false; } diff --git a/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C b/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C index 63349bb8a..8285623ee 100644 --- a/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C +++ b/src/dynamicMesh/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMeshLoadBalance.C @@ -291,7 +291,7 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) true // Create passive processor patches ); fvMesh& procMesh = procMeshPtr(); - procMesh.write(); + // Create a field decomposer fvFieldDecomposer fieldDecomposer ( @@ -304,7 +304,11 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) if (procI != Pstream::myProcNo()) { - Pout<< "Send mesh and fields to processor " << procI << endl; + if (debug) + { + Pout<< "Send mesh and fields to processor " << procI + << endl; + } OPstream toProc ( @@ -449,8 +453,6 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) } } - sleep(2); - // Collect pieces of mesh and fields from other processors for (label procI = 0; procI < meshDecomp.nProcs(); procI++) { @@ -459,7 +461,10 @@ bool Foam::topoChangerFvMesh::loadBalance(const dictionary& decompDict) // Check if there is a mesh to send if (migratedCells[procI][Pstream::myProcNo()] > 0) { - Pout<< "Receive mesh and fields from " << procI << endl; + if (debug) + { + Pout<< "Receive mesh and fields from " << procI << endl; + } // Note: communication can be optimised. HJ, 27/Feb/2018 IPstream fromProc From 44cef61dbe0f31256e2f33c6c01d7b691a3e88ab Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Thu, 30 May 2019 15:46:02 +0200 Subject: [PATCH 03/11] Clean-up after merge (duplicate stuff) --- .../polyhedralRefinement/polyhedralRefinement.C | 9 --------- .../prismatic2DRefinement/prismatic2DRefinement.C | 9 --------- .../refinement/refinement/refinement.C | 14 -------------- 3 files changed, 32 deletions(-) diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/polyhedralRefinement/polyhedralRefinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/polyhedralRefinement/polyhedralRefinement.C index 0d5f2db57..64862038f 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/polyhedralRefinement/polyhedralRefinement.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/polyhedralRefinement/polyhedralRefinement.C @@ -2055,15 +2055,6 @@ void Foam::polyhedralRefinement::setCellsToRefine } } - // Remove all cells that would exceed the maximum refinement level - forAll (refineCell, cellI) - { - if (refineCell[cellI] && (cellLevel_[cellI] + 1 > maxRefinementLevel_)) - { - refineCell[cellI] = false; - } - } - // Make sure that the refinement is face consistent (2:1 consistency) and // point consistent (4:1 consistency) if necessary diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/prismatic2DRefinement/prismatic2DRefinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/prismatic2DRefinement/prismatic2DRefinement.C index 7fa88a836..e6e3677d5 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/prismatic2DRefinement/prismatic2DRefinement.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/prismatic2DRefinement/prismatic2DRefinement.C @@ -2614,15 +2614,6 @@ void Foam::prismatic2DRefinement::setCellsToRefine } } - // Remove all cells that exceed the maximum refinement level - forAll (refineCell, cellI) - { - if (refineCell[cellI] && (cellLevel_[cellI] + 1 > maxRefinementLevel_)) - { - refineCell[cellI] = false; - } - } - // Make sure that the refinement is face consistent (2:1 consistency) and // point consistent (4:1 consistency) if necessary diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C index 63e1dd1fe..43f709ef5 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C @@ -1333,20 +1333,6 @@ bool Foam::refinement::changeTopology() const void Foam::refinement::setRefinement(polyTopoChange& ref) const { - // Make sure that the point levels are updated across coupled patches before - // setting refinement and unrefinement. Note: not sure why the sync is not - // performed correctly if I do it in updateMesh. This is a temporary - // solution, need to investigate in detail, but I assume something is not - // updated yet in that case. VV, 31/Jan/2018. - syncTools::syncPointList - ( - mesh_, - pointLevel_, - maxEqOp