From d675aabccd9d367f24a4126909d42e27db80e00f Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 28 Jul 2022 15:05:27 +0100 Subject: [PATCH] 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. --- .../surfaceFieldValue/surfaceFieldValue.C | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index d0645cd42b..0eef0910a7 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -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(fvp) + && refCast(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