ENH: reduced amount seeding in regionSplit

- now only seed boundary faces and an internal face of cell that itself
  has a blocked face.
This commit is contained in:
mattijs
2018-03-14 16:21:58 +01:00
committed by Mark Olesen
parent 520c14c136
commit e92aa8fce4

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -57,36 +57,85 @@ void Foam::regionSplit::calcNonCompactRegionSplit
// Take over blockedFaces by seeding a negative number // Take over blockedFaces by seeding a negative number
// (so is always less than the decomposition) // (so is always less than the decomposition)
label nUnblocked = 0;
forAll(faceData, facei) forAll(blockedFace, facei)
{ {
if (blockedFace.size() && blockedFace[facei]) if (blockedFace[facei])
{ {
faceData[facei] = minData(-2); faceData[facei] = minData(-2);
} }
else
{
nUnblocked++;
}
} }
// Seed unblocked faces // Seed all faces on (real) boundaries and faces on cells next to blockFace
labelList seedFaces(nUnblocked); // (since regions can only occur because of boundaries (or blocked faces))
List<minData> seedData(nUnblocked);
nUnblocked = 0; PackedBoolList isSeed(mesh().nFaces());
// Get internal or coupled faces
PackedBoolList isConnection(syncTools::getInternalOrCoupledFaces(mesh()));
forAll(faceData, facei) // 1. Seed (real) boundaries
for
(
label facei = mesh().nInternalFaces();
facei < mesh().nFaces();
facei++
)
{ {
if (blockedFace.empty() || !blockedFace[facei]) if (!isConnection[facei])
{ {
seedFaces[nUnblocked] = facei; isSeed.set(facei);
// Seed face with globally unique number
seedData[nUnblocked] = minData(globalFaces.toGlobal(facei));
nUnblocked++;
} }
} }
// 2. Seed (internal) faces on cells next to blocked (internal) faces
// (since we can't seed the blocked faces themselves)
if (blockedFace.size())
{
for (const cell& cFaces : mesh().cells())
{
bool blockedCell = false;
label connectedFacei = -1;
for (const label facei : cFaces)
{
if (blockedFace[facei])
{
blockedCell = true;
}
else if (isConnection[facei])
{
connectedFacei = facei;
}
}
if (blockedCell)
{
isSeed.set(connectedFacei); // silently ignores -1
}
}
}
List<label> seedFaces(isSeed.used());
List<minData> seedData(seedFaces.size());
// Seed face with globally unique number
forAll(seedFaces, i)
{
const label facei = seedFaces[i];
seedData[i] = minData(globalFaces.toGlobal(facei));
}
if (debug)
{
Pout<< "Seeded " << seedFaces.size()
<< " boundary and internal faces out of"
<< " total:" << mesh().nInternalFaces()
<< " boundary:" << mesh().nFaces()-mesh().nInternalFaces()
<< endl;
}
// Propagate information inwards // Propagate information inwards
FaceCellWave<minData> deltaCalc FaceCellWave<minData> deltaCalc
@ -112,7 +161,10 @@ void Foam::regionSplit::calcNonCompactRegionSplit
} }
else else
{ {
// Unvisited cell -> only possible if surrounded by blocked faces. // Unvisited cell -> only possible if surrounded by blocked faces
// since:
// - all walls become seed faces
// - all faces on cells with blocked faces become seed faces
// If so make up region from any of the faces // If so make up region from any of the faces
const cell& cFaces = mesh().cells()[celli]; const cell& cFaces = mesh().cells()[celli];
label facei = cFaces[0]; label facei = cFaces[0];
@ -343,7 +395,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::regionSplit::calcRegionSplit
// Get the wanted region labels into recvNonLocal // Get the wanted region labels into recvNonLocal
labelListList recvNonLocal(Pstream::nProcs()); labelListList recvNonLocal;
Pstream::exchange<labelList, label>(sendNonLocal, recvNonLocal); Pstream::exchange<labelList, label>(sendNonLocal, recvNonLocal);
// Now we have the wanted compact region labels that proci wants in // Now we have the wanted compact region labels that proci wants in