surfaceFieldValue: Select processor cyclics

If a "patch" selection is made for a cyclic patch, surfaceFieldValue now
also selects faces on any associated processor cyclic patches. This
ensures that the serial and parallel operations are equivalent.
This commit is contained in:
Will Bainbridge
2022-07-28 15:05:27 +01:00
parent 107f85b275
commit d675aabccd

View File

@ -25,6 +25,7 @@ License
#include "surfaceFieldValue.H"
#include "processorFvPatch.H"
#include "processorCyclicFvPatch.H"
#include "sampledSurface.H"
#include "mergePoints.H"
#include "indirectPrimitivePatch.H"
@ -172,9 +173,9 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces()
{
const label patchid = mesh_.boundaryMesh().findPatchID(regionName_);
const label patchId = mesh_.boundaryMesh().findPatchID(regionName_);
if (patchid < 0)
if (patchId < 0)
{
FatalErrorInFunction
<< type() << " " << name() << ": "
@ -185,12 +186,30 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces()
<< exit(FatalError);
}
const fvPatch& fvp = mesh_.boundary()[patchid];
const fvPatch& fvp = mesh_.boundary()[patchId];
faceId_ = identity(fvp.size());
facePatchId_ = labelList(fvp.size(), patchid);
facePatchId_ = labelList(fvp.size(), patchId);
faceSign_ = labelList(fvp.size(), 1);
// If we have selected a cyclic, also include any associated processor
// cyclic faces
forAll(mesh_.boundary(), patchi)
{
const fvPatch& fvp = mesh_.boundary()[patchi];
if
(
isA<processorCyclicFvPatch>(fvp)
&& refCast<const processorCyclicFvPatch>(fvp).referPatchID() == patchId
)
{
faceId_.append(identity(fvp.size()));
facePatchId_.append(labelList(fvp.size(), patchi));
faceSign_.append(labelList(fvp.size(), 1));
}
}
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
}