STYLE: provide number of unreachable blocked cells

- in debug, also report the first 10 cell ids

- format header documentation
This commit is contained in:
Mark Olesen
2018-04-05 16:41:52 +02:00
parent 12157acf07
commit 6b8f037333
2 changed files with 77 additions and 33 deletions

View File

@ -35,9 +35,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(regionSplit, 0); defineTypeNameAndDebug(regionSplit, 0);
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -66,21 +64,20 @@ void Foam::regionSplit::calcNonCompactRegionSplit
} }
} }
// Seed all faces on (real) boundaries and faces on cells next to blockFace // Seed all faces on (real) boundaries and cell faces next to blockFace,
// (since regions can only occur because of boundaries (or blocked faces)) // since regions can only occur because of boundaries (or blocked faces)
PackedBoolList isSeed(mesh().nFaces()); PackedBoolList isSeed(mesh().nFaces());
// Get internal or coupled faces // Get internal or coupled faces
PackedBoolList isConnection(syncTools::getInternalOrCoupledFaces(mesh())); PackedBoolList isConnection(syncTools::getInternalOrCoupledFaces(mesh()));
// 1. Seed (real) boundaries // 1. Seed (real) boundaries
for for
( (
label facei = mesh().nInternalFaces(); label facei = mesh().nInternalFaces();
facei < mesh().nFaces(); facei < mesh().nFaces();
facei++ ++facei
) )
{ {
if (!isConnection[facei]) if (!isConnection[facei])
@ -94,6 +91,10 @@ void Foam::regionSplit::calcNonCompactRegionSplit
if (blockedFace.size()) if (blockedFace.size())
{ {
label nBlockedCells = 0;
label celli = 0;
for (const cell& cFaces : mesh().cells()) for (const cell& cFaces : mesh().cells())
{ {
bool blockedCell = false; bool blockedCell = false;
@ -113,9 +114,35 @@ void Foam::regionSplit::calcNonCompactRegionSplit
if (blockedCell) if (blockedCell)
{ {
isSeed.set(connectedFacei); // silently ignores -1 if (connectedFacei < 0)
{
++nBlockedCells;
if (debug && nBlockedCells <= 10)
{
// Report a few, but not all
WarningInFunction
<< "Cell " << celli << " has all faces blocked."
<< endl;
} }
} }
else
{
isSeed.set(connectedFacei);
}
}
++celli;
}
reduce(nBlockedCells, sumOp<label>());
if (nBlockedCells)
{
Info<< "Detected " << nBlockedCells << " from "
<< returnReduce(mesh().nCells(), sumOp<label>())
<< " cells with all faces blocked." << nl;
}
} }
List<label> seedFaces(isSeed.used()); List<label> seedFaces(isSeed.used());
@ -246,15 +273,15 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
label globalRegion; label globalRegion;
Map<label>::const_iterator fnd = globalToCompact.find(region); const auto fnd = globalToCompact.cfind(region);
if (fnd == globalToCompact.end()) if (fnd.found())
{ {
globalRegion = globalRegions.toGlobal(globalToCompact.size()); globalRegion = *fnd;
globalToCompact.insert(region, globalRegion);
} }
else else
{ {
globalRegion = fnd(); globalRegion = globalRegions.toGlobal(globalToCompact.size());
globalToCompact.insert(region, globalRegion);
} }
cellRegion[celli] = globalRegion; cellRegion[celli] = globalRegion;
} }
@ -454,9 +481,9 @@ Foam::regionSplit::regionSplit(const polyMesh& mesh, const bool doGlobalRegions)
{ {
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
( (
doGlobalRegions, //do global regions doGlobalRegions,
boolList(0, false), //blockedFaces boolList(), // No blockedFace
List<labelPair>(0), //explicitConnections, List<labelPair>(), // No explicitConnections
*this *this
); );
} }
@ -475,8 +502,8 @@ Foam::regionSplit::regionSplit
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
( (
doGlobalRegions, doGlobalRegions,
blockedFace, //blockedFaces blockedFace,
List<labelPair>(0), //explicitConnections, List<labelPair>(), // No explicitConnections
*this *this
); );
} }
@ -496,8 +523,8 @@ Foam::regionSplit::regionSplit
globalNumberingPtr_ = calcRegionSplit globalNumberingPtr_ = calcRegionSplit
( (
doGlobalRegions, doGlobalRegions,
blockedFace, //blockedFaces blockedFace,
explicitConnections, //explicitConnections, explicitConnections,
*this *this
); );
} }

View File

@ -31,6 +31,7 @@ Description
Say 6 cells, 3 processors, with single baffle on proc1. Say 6 cells, 3 processors, with single baffle on proc1.
\verbatim
baffle baffle
| |
+---+---+---+---+---+---+ +---+---+---+---+---+---+
@ -38,8 +39,11 @@ Description
+---+---+---+---+---+---+ +---+---+---+---+---+---+
proc0 | proc1 | proc2 proc0 | proc1 | proc2
\endverbatim
\verbatim
1: determine local regions (uncoupled) 1: determine local regions (uncoupled)
+---+---+---+---+---+---+ +---+---+---+---+---+---+
@ -47,45 +51,58 @@ Description
+---+---+---+---+---+---+ +---+---+---+---+---+---+
proc0 | proc1 | proc2 proc0 | proc1 | proc2
\endverbatim
2: make global 2: make global
\verbatim
+---+---+---+---+---+---+ +---+---+---+---+---+---+
| 0 | 0 | 1 | 2 | 3 | 3 | | 0 | 0 | 1 | 2 | 3 | 3 |
+---+---+---+---+---+---+ +---+---+---+---+---+---+
proc0 | proc1 | proc2 proc0 | proc1 | proc2
\endverbatim
3: merge connected across procs 3: merge connected across procs
\verbatim
+---+---+---+---+---+---+ +---+---+---+---+---+---+
| 0 | 0 | 0 | 2 | 2 | 2 | | 0 | 0 | 0 | 2 | 2 | 2 |
+---+---+---+---+---+---+ +---+---+---+---+---+---+
proc0 | proc1 | proc2 proc0 | proc1 | proc2
\endverbatim
4. determine locally owner regions. determine compact numbering for the 4. determine locally owner regions.
local regions and send these to all processors that need them:
proc0 uses regions: Determine compact numbering for the local regions and send these to
all processors that need them:
- proc0 uses regions:
- 0 which is local to it. - 0 which is local to it.
proc1 uses regions - proc1 uses regions
- 0 which originates from proc0 - 0 which originates from proc0
- 2 which is local to it - 2 which is local to it
proc2 uses regions - proc2 uses regions
- 2 which originates from proc1 - 2 which originates from proc1
So proc1 needs to get the compact number for region 0 from proc0 and proc2 So proc1 needs to get the compact number for region 0 from proc0 and proc2
needs to get the compact number for region 2 from proc1: needs to get the compact number for region 2 from proc1:
\verbatim
+---+---+---+---+---+---+ +---+---+---+---+---+---+
| 0 | 0 | 0 | 1 | 1 | 1 | | 0 | 0 | 0 | 1 | 1 | 1 |
+---+---+---+---+---+---+ +---+---+---+---+---+---+
proc0 | proc1 | proc2 proc0 | proc1 | proc2
\endverbatim
Can optionally keep all regions local to the processor. Can optionally keep all regions local to the processor.
@ -164,7 +181,7 @@ public:
); );
//- Construct from mesh and whether face is blocked //- Construct from mesh and whether face is blocked
// NOTE: blockedFace has to be consistent across coupled faces! // \note blockedFace has to be consistent across coupled faces!
regionSplit regionSplit
( (
const polyMesh&, const polyMesh&,
@ -172,9 +189,9 @@ public:
const bool doGlobalRegions = Pstream::parRun() const bool doGlobalRegions = Pstream::parRun()
); );
//- Construct from mesh and whether face is blocked. Additional explicit //- Construct from mesh and whether face is blocked.
// connections between normal boundary faces. // Additional explicit connections between normal boundary faces.
// NOTE: blockedFace has to be consistent across coupled faces! // \note blockedFace has to be consistent across coupled faces!
regionSplit regionSplit
( (
const polyMesh&, const polyMesh&,