diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index c42bdc1c9aa8360aab93cfc6b1f1b64a07c779a3..c5b5c45135200492a8344b91a9df40ab35e28b72 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -28,8 +28,8 @@ numberOfSubdomains 2; // connected with a point, edge or face on the same processor. // (just having face connected cells might not guarantee a balanced // decomposition) -// The processor can be explicitly provided or -1 to have -// decompositionMethod choose. +// The processor can be -1 (the decompositionMethod chooses the processor +// for a good load balance) or explicitly provided (upsets balance). //singleProcessorFaceZones ((f0 -1)); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C index 0d40f8b232abe4127f4535a6e243c93b88c8b6ff..e8b6997bc49097099a065825f8d6de42ee5e3474 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionDistribute.C @@ -108,13 +108,11 @@ void Foam::domainDecomposition::distributeCells() // Specified processor for owner and neighbour of faces Map<label> specifiedProcessorFaces; + List<Tuple2<word, label> > zNameAndProcs; if (decompositionDict_.found("singleProcessorFaceZones")) { - List<Tuple2<word, label> > zNameAndProcs - ( - decompositionDict_.lookup("singleProcessorFaceZones") - ); + decompositionDict_.lookup("singleProcessorFaceZones") >> zNameAndProcs; const faceZoneMesh& fZones = faceZones(); @@ -332,23 +330,47 @@ void Foam::domainDecomposition::distributeCells() ); - // For specifiedProcessorFaces rework the cellToProc. Note that - // this makes the decomposition unbalanced. + // For specifiedProcessorFaces rework the cellToProc to enforce + // all on one processor since we can't guarantee that the input + // to regionSplit was a single region. + // E.g. faceZone 'a' with the cells split into two regions + // by a notch formed by two walls + // + // \ / + // \ / + // ---a----+-----a----- + // + // + // Note that reworking the cellToProc might make the decomposition + // unbalanced. if (specifiedProcessorFaces.size()) { - labelList procMap(identity(cellToProc_.size())); + const faceZoneMesh& fZones = faceZones(); - forAllConstIter(Map<label>, specifiedProcessorFaces, iter) + forAll(zNameAndProcs, i) { - label faceI = iter.key(); - label wantedProcI = iter(); + label zoneI = fZones.findZoneID(zNameAndProcs[i].first()); + const faceZone& fz = fZones[zoneI]; - if (wantedProcI != -1) + if (fz.size()) { - cellToProc_[faceOwner()[faceI]] = wantedProcI; - if (isInternalFace(faceI)) + label procI = zNameAndProcs[i].second(); + if (procI == -1) { - cellToProc_[faceNeighbour()[faceI]] = wantedProcI; + // If no processor specified use the one from the + // 0th element + procI = cellToProc_[faceOwner()[fz[0]]]; + } + + forAll(fz, fzI) + { + label faceI = fz[fzI]; + + cellToProc_[faceOwner()[faceI]] = procI; + if (isInternalFace(faceI)) + { + cellToProc_[faceNeighbour()[faceI]] = procI; + } } } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index a98019a5f531a69835f5ef701fd73c97cb70a292..ca7155704d10ba81522681a8d644ee249f7de1a1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -244,10 +244,10 @@ void Foam::coupledPolyPatch::calcTransformTensors if (Cf.size() == 0) { - // Dummy geometry. + // Dummy geometry. Assume non-separated, parallel. separation_.setSize(0); - forwardT_ = I; - reverseT_ = I; + forwardT_.clear(); + reverseT_.clear(); collocated_.setSize(0); } else