From d95fc106b6837dea9ec9f2b0c2bc5c2b8892a6ab Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 21 Oct 2015 12:47:02 +0100 Subject: [PATCH] polyMesh: Ensure parallel consistency in findCell by ensuring tetBasePtIs is called on all processors, even for those with 0 cells. Also use unique communicator for globalMeshData to avoid data transfer interference. Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1792 --- .../polyMesh/globalMeshData/globalMeshData.C | 9 ++++++++- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 16 ++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index b36a0e9579..5cf963fff3 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -2748,7 +2748,12 @@ void Foam::globalMeshData::updateMesh() // *** Temporary hack to avoid problems with overlapping communication // *** between these reductions and the calculation of deltaCoeffs - label comm = UPstream::worldComm + 1; + label comm = UPstream::allocateCommunicator + ( + UPstream::worldComm, + identity(UPstream::nProcs()), + true + ); // Total number of faces. nTotalFaces_ = returnReduce @@ -2785,6 +2790,8 @@ void Foam::globalMeshData::updateMesh() comm ); + UPstream::freeCommunicator(comm); + if (debug) { Pout<< "globalMeshData : nTotalPoints_:" << nTotalPoints_ << endl; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 4b8012b71d..67ae5db9b3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -1478,12 +1478,11 @@ Foam::label Foam::polyMesh::findCell const cellDecomposition decompMode ) const { - if (nCells() == 0) - { - return -1; - } - - if (Pstream::parRun() && decompMode == FACE_DIAG_TRIS) + if + ( + Pstream::parRun() + && (decompMode == FACE_DIAG_TRIS || decompMode == CELL_TETS) + ) { // Force construction of face-diagonal decomposition before testing // for zero cells. @@ -1494,6 +1493,11 @@ Foam::label Foam::polyMesh::findCell (void)tetBasePtIs(); } + if (nCells() == 0) + { + return -1; + } + if (decompMode == CELL_TETS) { // Advanced search method utilizing an octree