diff --git a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C index 656c58128f..9099c5c519 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduPrimitiveMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019,2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -324,7 +324,31 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh lowerAddr_(l, reuse), upperAddr_(u, reuse), comm_(comm) -{} +{ + if (debug && lowerAddr_.size()) + { + if (max(lowerAddr_) >= nCells || min(lowerAddr_) < 0) + { + FatalErrorInFunction << "Illegal lower addressing." + << " nCells:" << nCells + << " max(lower):" << max(lowerAddr_) + << " min(lower):" << min(lowerAddr_) + << exit(FatalError); + } + } + if (debug && upperAddr_.size()) + { + if (max(upperAddr_) >= nCells || min(upperAddr_) < 0) + { + FatalErrorInFunction << "Illegal upper addressing." + << " nCells:" << nCells + << " max(upper):" << max(upperAddr_) + << " min(upper):" << min(upperAddr_) + << exit(FatalError); + } + } +} + void Foam::lduPrimitiveMesh::addInterfaces ( @@ -374,6 +398,30 @@ Foam::lduPrimitiveMesh::lduPrimitiveMesh patchSchedule_(ps), comm_(comm) { + if (debug && lowerAddr_.size()) + { + if (max(lowerAddr_) >= nCells || min(lowerAddr_) < 0) + { + FatalErrorInFunction << "Illegal lower addressing." + << " nCells:" << nCells + << " max(lower):" << max(lowerAddr_) + << " min(lower):" << min(lowerAddr_) + << exit(FatalError); + } + } + if (debug && upperAddr_.size()) + { + if (max(upperAddr_) >= nCells || min(upperAddr_) < 0) + { + FatalErrorInFunction << "Illegal upper addressing." + << " nCells:" << nCells + << " max(upper):" << max(upperAddr_) + << " min(upper):" << min(upperAddr_) + << exit(FatalError); + } + } + + primitiveInterfaces_.transfer(primitiveInterfaces); // Create interfaces diff --git a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C index 3c811ef202..d656d640bc 100644 --- a/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C +++ b/src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C @@ -401,7 +401,7 @@ void Foam::radiation::viewFactor::initialise() ( new lduPrimitiveMesh ( - rays_.size(), + globalFaceFaces_().size(), //rays_.size(), lower, upper, allInterfacesPtr,