BUG: subsetMesh: map instead of truncate. See #1558.

This also is to do with redistributePar:
this uses subsetMesh to generate parts to
send to different processors.
2) related to 1558: make sure not to choose 'mapped'
patches to move the processor patches into so
we can use the mapper cloning and correctly
size additional data (e.g. offsets). This should
be generalised to hold for any patch type
holding local data ...
This commit is contained in:
mattijs
2020-11-23 19:58:31 +00:00
parent f9033cbf92
commit 9c26b5ce9f
2 changed files with 70 additions and 18 deletions

View File

@ -47,6 +47,7 @@ License
#include "ListOps.H" #include "ListOps.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "cyclicACMIPolyPatch.H" #include "cyclicACMIPolyPatch.H"
#include "mappedPatchBase.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -335,7 +336,12 @@ Foam::label Foam::fvMeshDistribute::findNonEmptyPatch() const
{ {
const polyPatch& pp = patches[patchi]; const polyPatch& pp = patches[patchi];
if (!isA<emptyPolyPatch>(pp) && !isCoupledPatch(patchi)) if
(
!isA<emptyPolyPatch>(pp)
&& !isCoupledPatch(patchi)
&& !isA<mappedPatchBase>(pp)
)
{ {
nonEmptyPatchi = patchi; nonEmptyPatchi = patchi;
break; break;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd. Copyright (C) 2015-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -1055,14 +1055,37 @@ void Foam::fvMeshSubset::setCellSubset
{ {
const label newSize = boundaryPatchSizes[globalPatchMap[oldPatchi]]; const label newSize = boundaryPatchSizes[globalPatchMap[oldPatchi]];
// Clone (even if 0 size) if (oldInternalPatchID != oldPatchi)
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone {
( // Pure subset of patch faces (no internal faces added to this
fvMeshSubsetPtr_().boundaryMesh(), // patch). Can use mapping.
nNewPatches, labelList map(newSize);
newSize, for (label patchFacei = 0; patchFacei < newSize; patchFacei++)
patchStart {
).ptr(); const label facei = patchStart+patchFacei;
const label oldFacei = faceMap_[facei];
map[patchFacei] = oldPatches[oldPatchi].whichFace(oldFacei);
}
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
map,
patchStart
).ptr();
}
else
{
// Clone (even if 0 size)
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
newSize,
patchStart
).ptr();
}
patchStart += newSize; patchStart += newSize;
patchMap_[nNewPatches] = oldPatchi; // compact patchMap patchMap_[nNewPatches] = oldPatchi; // compact patchMap
@ -1115,14 +1138,37 @@ void Foam::fvMeshSubset::setCellSubset
{ {
const label newSize = boundaryPatchSizes[globalPatchMap[oldPatchi]]; const label newSize = boundaryPatchSizes[globalPatchMap[oldPatchi]];
// Patch still exists. Add it if (oldInternalPatchID != oldPatchi)
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone {
( // Pure subset of patch faces (no internal faces added to this
fvMeshSubsetPtr_().boundaryMesh(), // patch). Can use mapping.
nNewPatches, labelList map(newSize);
newSize, for (label patchFacei = 0; patchFacei < newSize; patchFacei++)
patchStart {
).ptr(); const label facei = patchStart+patchFacei;
const label oldFacei = faceMap_[facei];
map[patchFacei] = oldPatches[oldPatchi].whichFace(oldFacei);
}
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
map,
patchStart
).ptr();
}
else
{
// Patch still exists. Add it
newBoundary[nNewPatches] = oldPatches[oldPatchi].clone
(
fvMeshSubsetPtr_().boundaryMesh(),
nNewPatches,
newSize,
patchStart
).ptr();
}
//Pout<< " " << oldPatches[oldPatchi].name() << " : " //Pout<< " " << oldPatches[oldPatchi].name() << " : "
// << newSize << endl; // << newSize << endl;