From 6cf815181733b657f3c316f69d4c4b0dc0e2eeb5 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 13 Oct 2020 15:48:15 +0200 Subject: [PATCH] ENH: support surfaceFieldValue on multiple faceZones or patches (#1874) - additional "names" entry to specify a word/regex list of selections For example, { type patch; name inlets; names ("inlet_[0-9].*" inlet); } - if "names" exists AND contains a literal (non-regex) that can be used as a suitable value for "name", the "name" entry becomes optional. For example, { type patch; names ("inlet_[0-9].*" inlet); // inferred name = inlet } - reduce some overhead in surfaceFieldValue TUT: surfaceFieldValue on patches : reactingParcelFoam/verticalChannel --- .../surfaceFieldValue/surfaceFieldValue.C | 397 ++++++++++++------ .../surfaceFieldValue/surfaceFieldValue.H | 67 +-- .../reactingParcelFoam/verticalChannel/Allrun | 7 +- .../verticalChannel/Allrun-parallel | 16 + .../verticalChannel/system/controlDict | 22 +- .../verticalChannel/system/decomposeParDict | 30 ++ .../verticalChannel/system/controlDict | 2 +- 7 files changed, 374 insertions(+), 167 deletions(-) create mode 100755 tutorials/lagrangian/reactingParcelFoam/verticalChannel/Allrun-parallel create mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/decomposeParDict diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index 1d7cd88a29..5f429e1214 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -32,7 +32,7 @@ License #include "coupledPolyPatch.H" #include "sampledSurface.H" #include "mergePoints.H" -#include "indirectPrimitivePatch.H" +#include "uindirectPrimitivePatch.H" #include "PatchTools.H" #include "addToRunTimeSelectionTable.H" @@ -130,115 +130,225 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::obr() const void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces() { - const label zoneId = mesh_.faceZones().findZoneID(regionName_); + // Indices for all matches, already sorted + const labelList zoneIds + ( + mesh_.faceZones().indices(selectionNames_) + ); - if (zoneId < 0) + // Total number of faces selected + label numFaces = 0; + for (const label zoneId : zoneIds) { - FatalErrorInFunction - << type() << " " << name() << ": " - << regionTypeNames_[regionType_] << '(' << regionName_ << "):" << nl - << " Unknown face zone name: " << regionName_ - << ". Valid face zones are: " << mesh_.faceZones().names() - << nl << exit(FatalError); + numFaces += mesh_.faceZones()[zoneId].size(); } - const faceZone& fZone = mesh_.faceZones()[zoneId]; - - DynamicList