snappyHexMesh, createPatch: Keep all constraint patches even if zero size

This change ensures that special constraint type patches, like internal used for
load-balancing, are not deleted by snappyHexMesh or createPatch.
This commit is contained in:
Henry Weller
2022-02-10 14:47:07 +00:00
parent a82f5a6fe2
commit 989cf27554
2 changed files with 15 additions and 36 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -565,12 +565,8 @@ scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol)
void removeZeroSizedPatches(fvMesh& mesh)
{
// Remove any zero-sized ones. Assumes
// - processor patches are already only there if needed
// - all other patches are available on all processors
// - but coupled ones might still be needed, even if zero-size
// (e.g. processorCyclic)
// See also logic in createPatch.
// Remove non-constraint zero-sized patches
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
labelList oldToNew(pbm.size(), -1);
@ -579,31 +575,16 @@ void removeZeroSizedPatches(fvMesh& mesh)
{
const polyPatch& pp = pbm[patchi];
if (!isA<processorPolyPatch>(pp))
{
if
(
isA<coupledPolyPatch>(pp)
|| returnReduce(pp.size(), sumOp<label>())
)
{
// Coupled (and unknown size) or uncoupled and used
oldToNew[patchi] = newPatchi++;
}
}
}
forAll(pbm, patchi)
{
const polyPatch& pp = pbm[patchi];
if (isA<processorPolyPatch>(pp))
if
(
polyPatch::constraintType(pp.type())
|| returnReduce(pp.size(), sumOp<label>())
)
{
oldToNew[patchi] = newPatchi++;
}
}
const label nKeepPatches = newPatchi;
// Shuffle unused ones to end

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ Description
- creates new patches (from selected boundary faces). Synchronise faces
on coupled patches.
- synchronises points on coupled boundaries
- remove patches with 0 faces in them
- remove non-constraint patches with 0 faces
\*---------------------------------------------------------------------------*/
@ -115,18 +115,15 @@ void filterPatches(polyMesh& mesh, const HashSet<word>& addedPatchNames)
// Note: reduce possible since non-proc patches guaranteed in same order
if (!isA<processorPolyPatch>(pp))
{
// Add if
// - non zero size
// - or added from the createPatchDict
// - or cyclic (since referred to by other cyclic half or
// proccyclic)
// - listed in createPatchDict
// - or constraint type
// - or non zero size
if
(
addedPatchNames.found(pp.name())
|| polyPatch::constraintType(pp.type())
|| returnReduce(pp.size(), sumOp<label>()) > 0
|| isA<coupledPolyPatch>(pp)
)
{
allPatches.append
@ -148,6 +145,7 @@ void filterPatches(polyMesh& mesh, const HashSet<word>& addedPatchNames)
}
}
}
// Copy non-empty processor patches
forAll(patches, patchi)
{