diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C index 63cc806366..f3af8611d3 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C @@ -86,6 +86,7 @@ VoFPatchTransfer::VoFPatchTransfer wordRes patchNames; if (coeffDict_.readIfPresent("patches", patchNames)) { + // Can also use pbm.indices(), but no warnings... patchIDs_ = pbm.patchSet(patchNames).sortedToc(); Info<< " applying to " << patchIDs_.size() << " patches:" << nl; diff --git a/src/functionObjects/field/Curle/Curle.C b/src/functionObjects/field/Curle/Curle.C index 9cdcbd3c35..6b53be0723 100644 --- a/src/functionObjects/field/Curle/Curle.C +++ b/src/functionObjects/field/Curle/Curle.C @@ -63,7 +63,6 @@ Foam::functionObjects::Curle::Curle fvMeshFunctionObject(name, runTime, dict), writeFile(mesh_, name), pName_("p"), - patchSet_(), observerPositions_(), c0_(0), rawFilePtrs_(), @@ -78,6 +77,8 @@ Foam::functionObjects::Curle::Curle bool Foam::functionObjects::Curle::read(const dictionary& dict) { + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + if (!(fvMeshFunctionObject::read(dict) && writeFile::read(dict))) { return false; @@ -85,14 +86,12 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict) dict.readIfPresent("p", pName_); - patchSet_ = mesh_.boundaryMesh().patchSet(dict.get("patches")); + patchIDs_ = pbm.patchSet(dict.get("patches")).sortedToc(); - if (patchSet_.empty()) + if (patchIDs_.empty()) { WarningInFunction - << "No patches defined" - << endl; - + << "No patches defined" << endl; return false; } @@ -117,8 +116,7 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict) if (observerPositions_.empty()) { WarningInFunction - << "No observer positions defined" - << endl; + << "No observer positions defined" << endl; return false; } @@ -205,7 +203,7 @@ bool Foam::functionObjects::Curle::execute() scalarField pDash(observerPositions_.size(), 0); - for (auto patchi : patchSet_) + for (const label patchi : patchIDs_) { const scalarField& pp = pBf[patchi]; const scalarField& dpdtp = dpdtBf[patchi]; @@ -228,7 +226,7 @@ bool Foam::functionObjects::Curle::execute() if (surfaceWriterPtr_) { - if (Pstream::master()) + if (UPstream::master()) { // Time-aware, with time spliced into the output path surfaceWriterPtr_->beginTime(time_); diff --git a/src/functionObjects/field/Curle/Curle.H b/src/functionObjects/field/Curle/Curle.H index 19afa8e3de..06beac04f6 100644 --- a/src/functionObjects/field/Curle/Curle.H +++ b/src/functionObjects/field/Curle/Curle.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -124,8 +124,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef functionObjects_Curle_H -#define functionObjects_Curle_H +#ifndef Foam_functionObjects_Curle_H +#define Foam_functionObjects_Curle_H #include "fvMeshFunctionObject.H" #include "writeFile.H" @@ -163,8 +163,8 @@ class Curle //- Name of pressure field; default = p word pName_; - //- Patches to integrate forces over - labelHashSet patchSet_; + //- List of patches to process + labelList patchIDs_; //- Observer positions List observerPositions_; diff --git a/src/functionObjects/field/binField/binModels/binModel/binModel.C b/src/functionObjects/field/binField/binModels/binModel/binModel.C index fc31d3e860..e610bada7f 100644 --- a/src/functionObjects/field/binField/binModels/binModel/binModel.C +++ b/src/functionObjects/field/binField/binModels/binModel/binModel.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -122,12 +122,8 @@ Foam::binModel::binModel mesh_(mesh), decomposePatchValues_(false), cumulative_(false), - coordSysPtr_(), - nBin_(1), - patchSet_(), - fieldNames_(), - cellZoneIDs_(), - filePtrs_() + coordSysPtr_(nullptr), + nBin_(1) {} @@ -135,19 +131,23 @@ Foam::binModel::binModel bool Foam::binModel::read(const dictionary& dict) { + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + if (!functionObjects::writeFile::read(dict)) { return false; } - patchSet_ = mesh_.boundaryMesh().patchSet(dict.get("patches")); + // Can also use pbm.indices(), but no warnings... + patchIDs_ = pbm.patchSet(dict.get("patches")).sortedToc(); fieldNames_ = dict.get("fields").sortedToc(); - if (dict.found("cellZones")) + wordRes zoneNames; + if (dict.readIfPresent("cellZones", zoneNames)) { DynamicList