diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index aad15ee459b6e01cdf6fabba08eb2fa5b8c2a4dd..e1620d72014110accb6947e5d50194b2c85f4b3c 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -22,6 +22,12 @@ numberOfSubdomains 4; //- Keep owner and neighbour on same processor for faces in zones: // preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_left_right); + + method scotch; // method hierarchical; // method simple; diff --git a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C index af47af244ff4848db0587e9db02a44f21cde5574..ffd54ac6851818258383cbae31e424dbfdbd7519 100644 --- a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C +++ b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C @@ -45,6 +45,35 @@ void domainDecomposition::distributeCells() labelHashSet sameProcFaces; + if (decompositionDict_.found("preservePatches")) + { + wordList pNames(decompositionDict_.lookup("preservePatches")); + + Info<< "Keeping owner of faces in patches " << pNames + << " on same processor. This only makes sense for cyclics." << endl; + + const polyBoundaryMesh& patches = boundaryMesh(); + + forAll(pNames, i) + { + label patchI = patches.findPatchID(pNames[i]); + + if (patchI == -1) + { + FatalErrorIn("domainDecomposition::distributeCells()") + << "Unknown preservePatch " << pNames[i] + << endl << "Valid patches are " << patches.names() + << exit(FatalError); + } + + const polyPatch& pp = patches[patchI]; + + forAll(pp, i) + { + sameProcFaces.insert(pp.start() + i); + } + } + } if (decompositionDict_.found("preserveFaceZones")) { wordList zNames(decompositionDict_.lookup("preserveFaceZones")); diff --git a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C index c38e0494ae280a4156a81a10b32c5e0b11c13a16..d5c98d52b55e931f459a7453ceabae0bf9582de1 100644 --- a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -141,9 +141,18 @@ Foam::labelList Foam::decompositionMethod::decompose const pointField& coarsePoints ) { - scalarField coarseWeights(0); + // Decompose based on agglomerated points + labelList coarseDistribution(decompose(coarsePoints)); + + // Rework back into decomposition for original mesh_ + labelList fineDistribution(fineToCoarse.size()); + + forAll(fineDistribution, i) + { + fineDistribution[i] = coarseDistribution[fineToCoarse[i]]; + } - return decompose(fineToCoarse, coarsePoints, coarseWeights); + return fineDistribution; }