From 2eb2de5f8ee95cdab35078624d741310313f2eba Mon Sep 17 00:00:00 2001 From: Kutalmis Bercin Date: Thu, 19 Jan 2023 11:21:29 +0000 Subject: [PATCH] ENH: ParticlePostProcessing: refactor PatchPostProcessing function object - enable 'faceZones' support. - enable 'writeFile' support to better control file output. - rename 'PatchPostProcessing' as 'ParticlePostProcessing' for better clarity. - fix #1808 --- .../include/makeParcelCloudFunctionObjects.H | 4 +- .../makeReactingParcelCloudFunctionObjects.H | 4 +- .../makeThermoParcelCloudFunctionObjects.H | 4 +- .../ParticlePostProcessing.C | 269 ++++++++++++++++++ .../ParticlePostProcessing.H | 226 +++++++++++++++ .../PatchPostProcessing/PatchPostProcessing.C | 216 -------------- .../PatchPostProcessing/PatchPostProcessing.H | 171 ----------- .../PatchPostProcessingI.H | 42 --- .../constant/reactingCloud1Properties | 4 +- .../filter/constant/reactingCloud1Properties | 4 +- .../constant/reactingCloud1Properties | 4 +- .../constant/reactingCloud1Properties | 4 +- .../constant/reactingCloud1Properties | 4 +- .../filter/constant/reactingCloud1Properties | 4 +- 14 files changed, 513 insertions(+), 447 deletions(-) create mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.C create mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.H delete mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C delete mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H delete mode 100644 src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessingI.H diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index f2fc385cb6..137e3ecb34 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H @@ -39,9 +39,9 @@ License #include "ParticleTrap.H" #include "ParticleZoneInfo.H" #include "ParticleHistogram.H" +#include "ParticlePostProcessing.H" #include "PatchCollisionDensity.H" #include "PatchInteractionFields.H" -#include "PatchPostProcessing.H" #include "RemoveParcels.H" #include "VoidFraction.H" #include "KinematicReynoldsNumber.H" @@ -61,9 +61,9 @@ License makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(ParticleZoneInfo, CloudType); \ makeCloudFunctionObjectType(ParticleHistogram, CloudType); \ + makeCloudFunctionObjectType(ParticlePostProcessing, CloudType); \ makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \ makeCloudFunctionObjectType(PatchInteractionFields, CloudType); \ - makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(RemoveParcels, CloudType); \ makeCloudFunctionObjectType(VoidFraction, CloudType); \ makeCloudFunctionObjectType(KinematicReynoldsNumber, CloudType); \ diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H index e620ceb4c1..30bfada4de 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingParcelCloudFunctionObjects.H @@ -39,9 +39,9 @@ License #include "ParticleTrap.H" #include "ParticleZoneInfo.H" #include "ParticleHistogram.H" +#include "ParticlePostProcessing.H" #include "PatchCollisionDensity.H" #include "PatchInteractionFields.H" -#include "PatchPostProcessing.H" #include "RemoveParcels.H" #include "VoidFraction.H" #include "NusseltNumber.H" @@ -64,9 +64,9 @@ License makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(ParticleZoneInfo, CloudType); \ makeCloudFunctionObjectType(ParticleHistogram, CloudType); \ + makeCloudFunctionObjectType(ParticlePostProcessing, CloudType); \ makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \ makeCloudFunctionObjectType(PatchInteractionFields, CloudType); \ - makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(RemoveParcels, CloudType); \ makeCloudFunctionObjectType(VoidFraction, CloudType); \ makeCloudFunctionObjectType(NusseltNumber, CloudType); \ diff --git a/src/lagrangian/intermediate/parcels/include/makeThermoParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeThermoParcelCloudFunctionObjects.H index 4a8a37f4fc..f43ae83b60 100644 --- a/src/lagrangian/intermediate/parcels/include/makeThermoParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeThermoParcelCloudFunctionObjects.H @@ -38,9 +38,9 @@ License #include "ParticleTrap.H" #include "ParticleZoneInfo.H" #include "ParticleHistogram.H" +#include "ParticlePostProcessing.H" #include "PatchCollisionDensity.H" #include "PatchInteractionFields.H" -#include "PatchPostProcessing.H" #include "RemoveParcels.H" #include "VoidFraction.H" #include "NusseltNumber.H" @@ -62,9 +62,9 @@ License makeCloudFunctionObjectType(ParticleTrap, CloudType); \ makeCloudFunctionObjectType(ParticleZoneInfo, CloudType); \ makeCloudFunctionObjectType(ParticleHistogram, CloudType); \ + makeCloudFunctionObjectType(ParticlePostProcessing, CloudType); \ makeCloudFunctionObjectType(PatchCollisionDensity, CloudType); \ makeCloudFunctionObjectType(PatchInteractionFields, CloudType); \ - makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \ makeCloudFunctionObjectType(RemoveParcels, CloudType); \ makeCloudFunctionObjectType(VoidFraction, CloudType); \ makeCloudFunctionObjectType(NusseltNumber, CloudType); \ diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.C new file mode 100644 index 0000000000..32175a1fee --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.C @@ -0,0 +1,269 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2019-2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ParticlePostProcessing.H" +#include "Pstream.H" +#include "stringListOps.H" +#include "ListOps.H" +#include "ListListOps.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::ParticlePostProcessing::writeFileHeader(Ostream& os) const +{ + this->writeCommented(os, "Time"); + os << ' ' << "currentProc"; + + if (!header_.empty()) + { + os << ' ' << header_; + } + + os << endl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ParticlePostProcessing::ParticlePostProcessing +( + const dictionary& dict, + CloudType& owner, + const word& modelName +) +: + CloudFunctionObject(dict, owner, modelName, typeName), + functionObjects::writeFile + ( + owner, + this->localPath(), + typeName + ), + collector_(this->coeffDict(), owner.mesh()), + maxStoredParcels_(this->coeffDict().getScalar("maxStoredParcels")), + header_(), + fields_(), + times_(), + data_() +{ + writeFile::read(this->coeffDict()); + + this->coeffDict().readIfPresent("fields", fields_); + + if (maxStoredParcels_ <= 0) + { + FatalIOErrorInFunction(this->coeffDict()) + << "maxStoredParcels = " << maxStoredParcels_ + << ", cannot be equal to or less than zero" + << exit(FatalIOError); + } + + const label sz = collector_.size(); + times_.resize(sz); + data_.resize(sz); +} + + +template +Foam::ParticlePostProcessing::ParticlePostProcessing +( + const ParticlePostProcessing& ppp +) +: + CloudFunctionObject(ppp), + writeFile(ppp), + collector_(ppp.collector_), + maxStoredParcels_(ppp.maxStoredParcels_), + header_(ppp.header_), + fields_(ppp.fields_), + times_(ppp.times_), + data_(ppp.data_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::ParticlePostProcessing::postPatch +( + const parcelType& p, + const polyPatch& pp, + bool& +) +{ + if (!collector_.isPatch()) + { + return; + } + + const label patchi = pp.index(); + const label localPatchi = collector_.IDs().find(patchi); + + if (header_.empty()) + { + OStringStream data; + p.writeProperties(data, fields_, " ", true); + header_ = data.str(); + } + + if (localPatchi != -1 && data_[localPatchi].size() < maxStoredParcels_) + { + times_[localPatchi].append(this->owner().time().value()); + + OStringStream data; + data<< Pstream::myProcNo(); + p.writeProperties(data, fields_, " ", false); + + data_[localPatchi].append(data.str()); + } +} + + +template +void Foam::ParticlePostProcessing::postFace +( + const parcelType& p, + bool& +) +{ + if (collector_.isPatch()) + { + return; + } + + const labelList& IDs = collector_.IDs(); + const List& BBs = collector_.BBs(); + const faceZoneMesh& fzm = this->owner().mesh().faceZones(); + + if (header_.empty()) + { + OStringStream data; + p.writeProperties(data, fields_, " ", true); + header_ = data.str(); + } + + forAll(IDs, i) + { + if (!BBs[i].contains(p.position())) + { + // Quick reject if the particle is not in the face zone bound box + continue; + } + + const label zonei = IDs[i]; + const label localFacei = fzm[zonei].find(p.face()); + + if (localFacei != -1 && data_[localFacei].size() < maxStoredParcels_) + { + times_[i].append(this->owner().time().value()); + + OStringStream data; + data<< Pstream::myProcNo(); + p.writeProperties(data, fields_, " ", false); + + data_[i].append(data.str()); + } + } +} + + +template +void Foam::ParticlePostProcessing::write() +{ + const wordList& names = collector_.names(); + + forAll(names, i) + { + List procTimes(Pstream::nProcs()); + procTimes[Pstream::myProcNo()] = times_[i]; + Pstream::gatherList(procTimes); + + List> procData(Pstream::nProcs()); + procData[Pstream::myProcNo()] = data_[i]; + Pstream::gatherList(procData); + + Pstream::combineReduce + ( + header_, + [](string& x, const string& y) + { + if (y.size() > x.size()) + { + x = y; + } + } + ); + + if (Pstream::master()) + { + List globalData; + globalData = ListListOps::combine> + ( + procData, + accessOp>() + ); + + scalarList globalTimes; + globalTimes = ListListOps::combine + ( + procTimes, + accessOp() + ); + + if (this->writeToFile()) + { + autoPtr osPtr = this->newFileAtTime + ( + names[i], + this->owner().time().value() + ); + OFstream& os = osPtr.ref(); + + writeFileHeader(os); + + const labelList indices(sortedOrder(globalTimes)); + forAll(globalTimes, j) + { + const label datai = indices[j]; + + os << globalTimes[datai] << tab + << globalData[datai].c_str() + << nl; + } + } + } + + times_[i].clearStorage(); + data_[i].clearStorage(); + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.H new file mode 100644 index 0000000000..20150c5210 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticlePostProcessing/ParticlePostProcessing.H @@ -0,0 +1,226 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2019-2023 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ParticlePostProcessing + +Description + Writes out various standard Lagrangian data elements of + particles hitting on a given list of patches or face zones. + + Operands: + \table + Operand | Type | Location + input | - | - + output file | dat | \/postProcessing/\/\/\ + output field | - | - + \endtable + + The output file contains columns depending on the \c fields entry. + +Usage + Minimal example by using + \c constant/reactingCloud1Properties.cloudFunctions: + \verbatim + ParticlePostProcessing1 + { + // Mandatory entries + type particlePostProcessing; + maxStoredParcels ; + + // Optional entries + fields (); + + // Conditional entries + + // Option-1 + patches (); + + // Option-2 + faceZones (); + + // Inherited entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: particlePostProcessing | word | yes | - + maxStoredParcels | Maximum number of parcels to process | label | yes | - + fields | Names of standard Lagrangian fields | wordRes | no | all + patches | Names of operand patches | wordRes | choice | - + faceZones | Names of operand face zones | wordRes | choice | - + \endtable + + The inherited entries are elaborated in: + - \link CloudFunctionObject.H \endlink + - \link writeFile.H \endlink + +Note + - The underlying type of \c maxStoredParcels is set as a scalar for I/O. + - Empty files indicate that no particles hit selected surfaces. + +SourceFiles + ParticlePostProcessing.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_ParticlePostProcessing_H +#define Foam_ParticlePostProcessing_H + +#include "CloudFunctionObject.H" +#include "writeFile.H" +#include "cloudFunctionObjectTools.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ParticlePostProcessing Declaration +\*---------------------------------------------------------------------------*/ + +template +class ParticlePostProcessing +: + public CloudFunctionObject, + public functionObjects::writeFile +{ + // Private Data + + // Typedefs + + //- Convenience typedef for parcel type + typedef typename CloudType::particleType parcelType; + + //- Collector surfaces + cloudFunctionObjectTools::collector collector_; + + //- Maximum number of parcels to store - set as a scalar for I/O + scalar maxStoredParcels_; + + //- Field header + string header_; + + //- Field name filters + wordRes fields_; + + //- List of times for each data record + List> times_; + + //- List of output data per surface + List> data_; + + + // Private Member Functions + + //- Write output file header + void writeFileHeader(Ostream& os) const; + + +public: + + //- Runtime type information + TypeName("particlePostProcessing"); + + + // Constructors + + //- Construct from dictionary + ParticlePostProcessing + ( + const dictionary& dict, + CloudType& owner, + const word& modelName + ); + + //- Copy construct + ParticlePostProcessing(const ParticlePostProcessing& ppp); + + //- No copy assignment + void operator=(const ParticlePostProcessing&) = delete; + + //- Construct and return a clone + virtual autoPtr> clone() const + { + return autoPtr> + ( + new ParticlePostProcessing(*this) + ); + } + + + //- Destructor + virtual ~ParticlePostProcessing() = default; + + + // Member Functions + + // Access + + //- Return maximum number of parcels to store per surface + label maxStoredParcels() const noexcept { return maxStoredParcels_; } + + + // Evaluation + + //- Post-patch hook + virtual void postPatch + ( + const parcelType& p, + const polyPatch& pp, + bool& keepParticle + ); + + //- Post-face hook + virtual void postFace(const parcelType& p, bool& keepParticle); + + + // I-O + + //- Write post-processing info + virtual void write(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "ParticlePostProcessing.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C deleted file mode 100644 index c5310ac0e5..0000000000 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C +++ /dev/null @@ -1,216 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "PatchPostProcessing.H" -#include "Pstream.H" -#include "stringListOps.H" -#include "ListOps.H" -#include "ListListOps.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -Foam::label Foam::PatchPostProcessing::applyToPatch -( - const label globalPatchi -) const -{ - return patchIDs_.find(globalPatchi); -} - - -// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * // - -template -void Foam::PatchPostProcessing::write() -{ - forAll(patchData_, i) - { - List> procTimes(Pstream::nProcs()); - procTimes[Pstream::myProcNo()] = times_[i]; - Pstream::gatherList(procTimes); - - List> procData(Pstream::nProcs()); - procData[Pstream::myProcNo()] = patchData_[i]; - Pstream::gatherList(procData); - - if (Pstream::master()) - { - const fvMesh& mesh = this->owner().mesh(); - - // Create directory if it doesn't exist - mkDir(this->writeTimeDir()); - - const word& patchName = mesh.boundaryMesh()[patchIDs_[i]].name(); - - OFstream patchOutFile - ( - this->writeTimeDir()/patchName + ".post", - IOstreamOption::ASCII, - mesh.time().writeCompression() - ); - - List globalData; - globalData = ListListOps::combine> - ( - procData, - accessOp>() - ); - - List globalTimes; - globalTimes = ListListOps::combine> - ( - procTimes, - accessOp>() - ); - - labelList indices(sortedOrder(globalTimes)); - - string header("# Time currentProc " + header_); - patchOutFile<< header.c_str() << nl; - - forAll(globalTimes, i) - { - label dataI = indices[i]; - - patchOutFile - << globalTimes[dataI] << ' ' - << globalData[dataI].c_str() - << nl; - } - } - - patchData_[i].clearStorage(); - times_[i].clearStorage(); - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::PatchPostProcessing::PatchPostProcessing -( - const dictionary& dict, - CloudType& owner, - const word& modelName -) -: - CloudFunctionObject(dict, owner, modelName, typeName), - maxStoredParcels_(this->coeffDict().getScalar("maxStoredParcels")), - fields_(), - patchIDs_(), - times_(), - patchData_(), - header_() -{ - // The "fields" filter is optional - this->coeffDict().readIfPresent("fields", fields_); - - // The "patches" are required - const wordRes patchMatcher(this->coeffDict().lookup("patches")); - - patchIDs_ = patchMatcher.matching(owner.mesh().boundaryMesh().names()); - - if (patchIDs_.empty()) - { - WarningInFunction - << "No matching patches found: " - << flatOutput(patchMatcher) << nl; - } - - if (debug) - { - Info<< "Post-process fields " - << flatOutput(fields_) << nl; - - Info<< "On patches ("; - - for (const label patchi : patchIDs_) - { - Info<< ' ' << owner.mesh().boundaryMesh()[patchi].name(); - } - - Info<< " )" << nl; - } - - patchData_.setSize(patchIDs_.size()); - times_.setSize(patchIDs_.size()); -} - - -template -Foam::PatchPostProcessing::PatchPostProcessing -( - const PatchPostProcessing& ppm -) -: - CloudFunctionObject(ppm), - maxStoredParcels_(ppm.maxStoredParcels_), - fields_(ppm.fields_), - patchIDs_(ppm.patchIDs_), - times_(ppm.times_), - patchData_(ppm.patchData_), - header_(ppm.header_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::PatchPostProcessing::postPatch -( - const parcelType& p, - const polyPatch& pp, - bool& -) -{ - const label patchi = pp.index(); - const label localPatchi = applyToPatch(patchi); - - if (header_.empty()) - { - OStringStream data; - p.writeProperties(data, fields_, " ", true); - header_ = data.str(); - } - - if (localPatchi != -1 && patchData_[localPatchi].size() < maxStoredParcels_) - { - times_[localPatchi].append(this->owner().time().value()); - - OStringStream data; - data<< Pstream::myProcNo(); - p.writeProperties(data, fields_, " ", false); - - patchData_[localPatchi].append(data.str()); - } -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H deleted file mode 100644 index 4e1f6c4eb7..0000000000 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H +++ /dev/null @@ -1,171 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::PatchPostProcessing - -Group - grpLagrangianIntermediateFunctionObjects - -Description - Standard post-processing - -SourceFiles - PatchPostProcessing.C - -\*---------------------------------------------------------------------------*/ - -#ifndef PatchPostProcessing_H -#define PatchPostProcessing_H - -#include "CloudFunctionObject.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class PatchPostProcessing Declaration -\*---------------------------------------------------------------------------*/ - -template -class PatchPostProcessing -: - public CloudFunctionObject -{ - // Private data - - typedef typename CloudType::particleType parcelType; - - //- Maximum number of parcels to store - set as a scalar for I/O - scalar maxStoredParcels_; - - //- Field name filters - wordRes fields_; - - //- List of patch indices to post-process - labelList patchIDs_; - - //- List of time for each data record - List> times_; - - //- List of output data per patch - List> patchData_; - - //- Field header - string header_; - - - // Private Member Functions - - //- Returns local patchi if patch is in patchIds_ list - label applyToPatch(const label globalPatchi) const; - - -protected: - - // Protected Member Functions - - //- Write post-processing info - void write(); - - -public: - - //- Runtime type information - TypeName("patchPostProcessing"); - - - // Constructors - - //- Construct from dictionary - PatchPostProcessing - ( - const dictionary& dict, - CloudType& owner, - const word& modelName - ); - - //- Construct copy - PatchPostProcessing(const PatchPostProcessing& ppm); - - //- Construct and return a clone - virtual autoPtr> clone() const - { - return autoPtr> - ( - new PatchPostProcessing(*this) - ); - } - - - //- Destructor - virtual ~PatchPostProcessing() = default; - - - // Member Functions - - // Access - - //- Return maximum number of parcels to store per patch - inline label maxStoredParcels() const; - - //- Return const mapping from local to global patch ids - inline const labelList& patchIDs() const; - - - // Evaluation - - //- Post-patch hook - virtual void postPatch - ( - const parcelType& p, - const polyPatch& pp, - bool& keepParticle - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "PatchPostProcessingI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "PatchPostProcessing.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessingI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessingI.H deleted file mode 100644 index 936ac0f6b4..0000000000 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessingI.H +++ /dev/null @@ -1,42 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -template -Foam::label Foam::PatchPostProcessing::maxStoredParcels() const -{ - return maxStoredParcels_; -} - - -template -const Foam::labelList& Foam::PatchPostProcessing::patchIDs() const -{ - return patchIDs_; -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/airRecirculationRoom/transient/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/airRecirculationRoom/transient/constant/reactingCloud1Properties index 9dfedc27c4..7046b1e6bf 100644 --- a/tutorials/lagrangian/reactingParcelFoam/airRecirculationRoom/transient/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/airRecirculationRoom/transient/constant/reactingCloud1Properties @@ -564,9 +564,9 @@ in this ways the particles hitting the patches will be classified in the followi maxStoredParcels 100000000; } - patchPostProcessing1 + particlePostProcessing1 { - type patchPostProcessing; + type particlePostProcessing; fields (position origId d); maxStoredParcels 100000000; patches diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties index 569edc4ee5..109fe2bcb9 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties @@ -181,9 +181,9 @@ cloudFunctions maxStoredParcels 20; } - patchPostProcessing1 + particlePostProcessing1 { - type patchPostProcessing; + type particlePostProcessing; fields (position "U.*" d T nParticle); maxStoredParcels 20; patches diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index 9b942452b6..78a56cb859 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -175,9 +175,9 @@ subModels cloudFunctions { - patchPostProcessing1 + particlePostProcessing1 { - type patchPostProcessing; + type particlePostProcessing; maxStoredParcels 100; patches ( outlet ); } diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/reactingCloud1Properties index 45cf1123fc..187b44cdf3 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/reactingCloud1Properties @@ -177,9 +177,9 @@ subModels cloudFunctions { - patchPostProcessing1 + particlePostProcessing1 { - type patchPostProcessing; + type particlePostProcessing; maxStoredParcels 100; patches ( outlet ); } diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index cb7f07b827..eaf32c6253 100644 --- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -177,9 +177,9 @@ subModels cloudFunctions { - patchPostProcessing1 + particlePostProcessing1 { - type patchPostProcessing; + type particlePostProcessing; maxStoredParcels 100; patches ( outlet ); } diff --git a/tutorials/mesh/parallel/filter/constant/reactingCloud1Properties b/tutorials/mesh/parallel/filter/constant/reactingCloud1Properties index 0d4984003a..3de4532bc9 100644 --- a/tutorials/mesh/parallel/filter/constant/reactingCloud1Properties +++ b/tutorials/mesh/parallel/filter/constant/reactingCloud1Properties @@ -158,9 +158,9 @@ subModels cloudFunctions { - patchPostProcessing1 + particlePostProcessing1 { - type patchPostProcessing; + type particlePostProcessing; maxStoredParcels 20; patches (