BUG: decomposePar: constrained decomposition - enforce single processor

This commit is contained in:
mattijs
2011-08-26 12:21:06 +01:00
parent c3be8e1a45
commit 95a2ed3f1f
2 changed files with 38 additions and 16 deletions

View File

@ -28,8 +28,8 @@ numberOfSubdomains 2;
// connected with a point, edge or face on the same processor. // connected with a point, edge or face on the same processor.
// (just having face connected cells might not guarantee a balanced // (just having face connected cells might not guarantee a balanced
// decomposition) // decomposition)
// The processor can be explicitly provided or -1 to have // The processor can be -1 (the decompositionMethod chooses the processor
// decompositionMethod choose. // for a good load balance) or explicitly provided (upsets balance).
//singleProcessorFaceZones ((f0 -1)); //singleProcessorFaceZones ((f0 -1));

View File

@ -108,13 +108,11 @@ void Foam::domainDecomposition::distributeCells()
// Specified processor for owner and neighbour of faces // Specified processor for owner and neighbour of faces
Map<label> specifiedProcessorFaces; Map<label> specifiedProcessorFaces;
List<Tuple2<word, label> > zNameAndProcs;
if (decompositionDict_.found("singleProcessorFaceZones")) if (decompositionDict_.found("singleProcessorFaceZones"))
{ {
List<Tuple2<word, label> > zNameAndProcs decompositionDict_.lookup("singleProcessorFaceZones") >> zNameAndProcs;
(
decompositionDict_.lookup("singleProcessorFaceZones")
);
const faceZoneMesh& fZones = faceZones(); const faceZoneMesh& fZones = faceZones();
@ -332,23 +330,47 @@ void Foam::domainDecomposition::distributeCells()
); );
// For specifiedProcessorFaces rework the cellToProc. Note that // For specifiedProcessorFaces rework the cellToProc to enforce
// this makes the decomposition unbalanced. // 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()) 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 zoneI = fZones.findZoneID(zNameAndProcs[i].first());
label wantedProcI = iter(); const faceZone& fz = fZones[zoneI];
if (wantedProcI != -1) if (fz.size())
{ {
cellToProc_[faceOwner()[faceI]] = wantedProcI; label procI = zNameAndProcs[i].second();
if (procI == -1)
{
// 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)) if (isInternalFace(faceI))
{ {
cellToProc_[faceNeighbour()[faceI]] = wantedProcI; cellToProc_[faceNeighbour()[faceI]] = procI;
}
} }
} }
} }