BUG: processorLOD: handle 0 cells. Fixes #2421

This commit is contained in:
mattijs
2022-03-23 10:31:35 +00:00
parent ea2bf0414d
commit 2ee0757364
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -148,7 +148,7 @@ void Foam::processorLODs::box::setRefineFlags
labelList& procRefineFlags = refineFlags[proci];
procRefineFlags.setSize(remoteSrcBoxes.size(), FIXED);
if (scalar(nTgtObjects)/scalar(nObjects) < 0.1)
if (nObjects == 0 || scalar(nTgtObjects)/scalar(nObjects) < 0.1)
{
// Sending less than 10% of objects of this type
// - shortcut by sending all

View File

@ -124,7 +124,9 @@ Foam::autoPtr<Foam::mapDistribute> Foam::meshToMesh::calcProcMap
// (possibly remote) cells from the tgt mesh such that they
// (together) cover all of the src mesh
const label nGlobalSrcCells = src.globalData().nTotalCells();
const label cellsPerBox = max(1, 0.001*nGlobalSrcCells);
// Note: minimum content has to be > 1 since otherwise
// would keep on splitting. 16 is fairly random choice.
const label cellsPerBox = max(16, 0.001*nGlobalSrcCells);
typename processorLODs::cellBox boxLOD
(
src.cells(),