ENH: snappyHexMesh. Avoid excessive intermediate. Fixes #2600

This commit is contained in:
mattijs
2022-10-05 11:44:51 +01:00
parent a246a97b12
commit 34d69cad23

View File

@ -4895,6 +4895,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
); );
} }
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
( (
const label nBufferLayers, const label nBufferLayers,
@ -5087,21 +5088,58 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
labelList neiCellRegion; labelList neiCellRegion;
syncTools::swapBoundaryCellList(mesh_, cellRegion, neiCellRegion); syncTools::swapBoundaryCellList(mesh_, cellRegion, neiCellRegion);
for
( //for
label facei = mesh_.nInternalFaces(); //(
facei < mesh_.nFaces(); // label facei = mesh_.nInternalFaces();
facei++ // facei < mesh_.nFaces();
) // facei++
//)
//{
// if (!isFrozenFace[facei])
// {
// const face& f = mesh_.faces()[facei];
//
// const label ownRegion = cellRegion[faceOwner[facei]];
// const label neiRegion =
// neiCellRegion[facei-mesh_.nInternalFaces()];
//
// if (ownRegion == -1 && neiRegion != -1)
// {
// forAll(f, fp)
// {
// if (!isFrozenPoint[f[fp]])
// {
// pointBaffle[f[fp]] =
// max(defaultPatch, ownPatch[facei]);
// }
// }
// }
// }
//}
const auto& patches = mesh_.boundaryMesh();
for (const auto& pp : patches)
{ {
if (pp.coupled())
{
// Note: swapBoundaryCellList only works on cyclic&processor.
// Does not handle e.g. cyclicAMI. TBD?
// Note: we could check check our side being in the set
// since syncPointList below will push over any decision
// made by the other side.
forAll(pp, i)
{
const label facei = pp.start()+i;
if (!isFrozenFace[facei]) if (!isFrozenFace[facei])
{ {
const face& f = mesh_.faces()[facei]; const face& f = mesh_.faces()[facei];
const label ownRegion = cellRegion[faceOwner[facei]]; const label ownRegion = cellRegion[faceOwner[facei]];
const label neiRegion = const label neiRegion =
neiCellRegion[facei-mesh_.nInternalFaces()]; neiCellRegion[facei-mesh_.nInternalFaces()];
// Same logic as for internal faces
if (ownRegion == -1 && neiRegion != -1) if (ownRegion == -1 && neiRegion != -1)
{ {
forAll(f, fp) forAll(f, fp)
@ -5113,8 +5151,50 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
} }
} }
} }
else if (ownRegion != -1 && neiRegion == -1)
{
label newPatchI = neiPatch[facei];
if (newPatchI == -1)
{
newPatchI = max(defaultPatch, ownPatch[facei]);
}
forAll(f, fp)
{
if (!isFrozenPoint[f[fp]])
{
pointBaffle[f[fp]] = newPatchI;
} }
} }
}
}
}
}
else
{
forAll(pp, i)
{
const label facei = pp.start()+i;
if (!isFrozenFace[facei])
{
const face& f = mesh_.faces()[facei];
const label ownRegion = cellRegion[faceOwner[facei]];
if (ownRegion != -1)
{
forAll(f, fp)
{
if (!isFrozenPoint[f[fp]])
{
pointBaffle[f[fp]] =
max(defaultPatch, ownPatch[facei]);
}
}
}
}
}
}
}
// Sync // Sync
syncTools::syncPointList syncTools::syncPointList