Skip to content

Commit

Permalink
surfaceFieldValue: Select processor cyclics
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Will Bainbridge committed Jul 28, 2022
1 parent 107f85b commit d675aab
Showing 1 changed file with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ License

#include "surfaceFieldValue.H"
#include "processorFvPatch.H"
#include "processorCyclicFvPatch.H"
#include "sampledSurface.H"
#include "mergePoints.H"
#include "indirectPrimitivePatch.H"
Expand Down Expand Up @@ -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() << ": "
Expand All @@ -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>());
}

Expand Down

0 comments on commit d675aab

Please sign in to comment.