mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: decomposePar: constrained decomposition - enforce single processor
This commit is contained in:
@ -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));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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 (isInternalFace(faceI))
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user