From 1da3d4aa6f9572bf43d027b54830317fd9189d1c Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 21 Oct 2015 12:52:30 +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 --- .../meshes/polyMesh/globalMeshData/globalMeshData.C | 9 ++++++++- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index b36a0e95..5cf963ff 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 a8156d24..8f02d1fd 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -1478,7 +1478,11 @@ Foam::label Foam::polyMesh::findCell const cellRepresentation decompMode ) const { - if (Pstream::parRun() && decompMode == FACEDIAGTETS) + if + ( + Pstream::parRun() + && (decompMode == FACEDIAGTETS || decompMode == CELL_TETS) + ) { // Force construction of face-diagonal decomposition before testing // for zero cells. If parallel running a local domain might have zero @@ -1500,8 +1504,10 @@ Foam::label Foam::polyMesh::findCell { return cellI; } - else // point is not in the nearest cell so search all cells + else { + // point is not in the nearest cell so search all cells + for (label cellI = 0; cellI < nCells(); cellI++) { if (pointInCell(location, cellI, decompMode)) @@ -1509,6 +1515,7 @@ Foam::label Foam::polyMesh::findCell return cellI; } } + return -1; } }