diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index 4c859a885f..9787adc9d8 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -201,6 +201,11 @@ void Foam::FacePostProcessing::write() .subOrEmptyDict(surfaceFormat_) ); + if (debug) + { + writer->verbose() = true; + } + writer->open ( allPoints, @@ -212,8 +217,6 @@ void Foam::FacePostProcessing::write() writer->write("massTotal", zoneMassTotal[zoneI]); writer->write("massFlowRate", zoneMassFlowRate[zoneI]); - - writer->clear(); } } } @@ -251,12 +254,12 @@ Foam::FacePostProcessing::FacePostProcessing CloudFunctionObject(dict, owner, modelName, typeName), faceZoneIDs_(), surfaceFormat_(this->coeffDict().lookup("surfaceFormat")), - resetOnWrite_(this->coeffDict().lookup("resetOnWrite")), + resetOnWrite_(this->coeffDict().getBool("resetOnWrite")), + log_(this->coeffDict().getBool("log")), totalTime_(0.0), mass_(), massTotal_(), massFlowRate_(), - log_(this->coeffDict().lookup("log")), outputFilePtr_(), timeOld_(owner.mesh().time().value()) { @@ -333,11 +336,11 @@ Foam::FacePostProcessing::FacePostProcessing faceZoneIDs_(pff.faceZoneIDs_), surfaceFormat_(pff.surfaceFormat_), resetOnWrite_(pff.resetOnWrite_), + log_(pff.log_), totalTime_(pff.totalTime_), mass_(pff.mass_), massTotal_(pff.massTotal_), massFlowRate_(pff.massFlowRate_), - log_(pff.log_), outputFilePtr_(), timeOld_(0.0) {} diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H index a6193f9dbf..8f6ae8e762 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -61,22 +61,23 @@ class FacePostProcessing : public CloudFunctionObject { + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; + + // Private Data - // Typedefs - - //- Convenience typedef for parcel type - typedef typename CloudType::parcelType parcelType; - - //- Face zone IDs labelList faceZoneIDs_; //- Surface output format const word surfaceFormat_; - //- Flag to indicate whether data should be reset/cleared on writing - Switch resetOnWrite_; + //- Should be reset/cleared on writing? + bool resetOnWrite_; + + //- Flag to indicate whether data should be written to file + bool log_; //- Total time scalar totalTime_; @@ -90,9 +91,6 @@ class FacePostProcessing //- Mass flow rate storage List massFlowRate_; - //- Flag to indicate whether data should be written to file - Switch log_; - //- Output file pointer per zone PtrList outputFilePtr_; @@ -155,16 +153,16 @@ public: // Member Functions - // Access + // Access - //- Return const access to the reset on write flag - inline const Switch& resetOnWrite() const; + //- Should data be reset on write? + inline bool resetOnWrite() const; - // Evaluation + // Evaluation - //- Post-face hook - virtual void postFace(const parcelType& p, bool& keepParticle); + //- Post-face hook + virtual void postFace(const parcelType& p, bool& keepParticle); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessingI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessingI.H index ad20c86145..65298781c8 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessingI.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessingI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011 OpenFOAM Foundation @@ -26,8 +26,7 @@ License \*---------------------------------------------------------------------------*/ template -inline const Foam::Switch& -Foam::FacePostProcessing::resetOnWrite() const +inline bool Foam::FacePostProcessing::resetOnWrite() const { return resetOnWrite_; } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C index 6f0eaf15c5..92daa08920 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -471,6 +471,11 @@ void Foam::ParticleCollector::write() .subOrEmptyDict(surfaceFormat_) ); + if (debug) + { + writer->verbose() = true; + } + writer->open ( points_, @@ -522,7 +527,9 @@ Foam::ParticleCollector::ParticleCollector CloudFunctionObject(dict, owner, modelName, typeName), mode_(mtUnknown), parcelType_(this->coeffDict().lookupOrDefault("parcelType", -1)), - removeCollected_(this->coeffDict().lookup("removeCollected")), + removeCollected_(this->coeffDict().getBool("removeCollected")), + resetOnWrite_(this->coeffDict().getBool("resetOnWrite")), + log_(this->coeffDict().getBool("log")), points_(), faces_(), faceTris_(), @@ -535,12 +542,10 @@ Foam::ParticleCollector::ParticleCollector this->coeffDict().getBool("negateParcelsOppositeNormal") ), surfaceFormat_(this->coeffDict().lookup("surfaceFormat")), - resetOnWrite_(this->coeffDict().lookup("resetOnWrite")), totalTime_(0.0), mass_(), massTotal_(), massFlowRate_(), - log_(this->coeffDict().lookup("log")), outputFilePtr_(), timeOld_(owner.mesh().time().value()), hitFaceIDs_() @@ -608,6 +613,8 @@ Foam::ParticleCollector::ParticleCollector mode_(pc.mode_), parcelType_(pc.parcelType_), removeCollected_(pc.removeCollected_), + resetOnWrite_(pc.resetOnWrite_), + log_(pc.log_), points_(pc.points_), faces_(pc.faces_), faceTris_(pc.faceTris_), @@ -618,12 +625,10 @@ Foam::ParticleCollector::ParticleCollector normal_(pc.normal_), negateParcelsOppositeNormal_(pc.negateParcelsOppositeNormal_), surfaceFormat_(pc.surfaceFormat_), - resetOnWrite_(pc.resetOnWrite_), totalTime_(pc.totalTime_), mass_(pc.mass_), massTotal_(pc.massTotal_), massFlowRate_(pc.massFlowRate_), - log_(pc.log_), outputFilePtr_(), timeOld_(0.0), hitFaceIDs_() diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H index 5f6aaea2bf..9d1ba22783 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2012-2017 OpenFOAM Foundation @@ -97,7 +97,6 @@ SourceFiles #include "CloudFunctionObject.H" #include "cylindricalCS.H" #include "face.H" -#include "Switch.H" #include "OFstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -126,13 +125,11 @@ public: private: + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; + // Private Data - // Typedefs - - //- Convenience typedef for parcel type - typedef typename CloudType::parcelType parcelType; - //- Collector mode type modeType mode_; @@ -140,7 +137,13 @@ private: const label parcelType_; //- Flag to remove collected particles - Switch removeCollected_; + bool removeCollected_; + + //- Should data be reset/cleared on writing? + bool resetOnWrite_; + + //- Flag to indicate whether data should be written to file + bool log_; //- List of points Field points_; @@ -178,9 +181,6 @@ private: //- Surface output format const word surfaceFormat_; - //- Flag to indicate whether data should be reset/cleared on writing - Switch resetOnWrite_; - //- Total time scalar totalTime_; @@ -193,9 +193,6 @@ private: //- Mass flow rate storage List massFlowRate_; - //- Flag to indicate whether data should be written to file - Switch log_; - //- Output file pointer autoPtr outputFilePtr_; @@ -280,22 +277,22 @@ public: // Member Functions - // Access + // Access - //- Return const access to the reset on write flag - inline const Switch& resetOnWrite() const; + //- Should data be reset on write? + inline bool resetOnWrite() const; - // Evaluation + // Evaluation - //- Post-move hook - virtual void postMove - ( - parcelType& p, - const scalar dt, - const point& position0, - bool& keepParticle - ); + //- Post-move hook + virtual void postMove + ( + parcelType& p, + const scalar dt, + const point& position0, + bool& keepParticle + ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H index fa21cda1df..39f8344eb7 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2012 OpenFOAM Foundation @@ -26,8 +26,7 @@ License \*---------------------------------------------------------------------------*/ template -inline const Foam::Switch& -Foam::ParticleCollector::resetOnWrite() const +inline bool Foam::ParticleCollector::resetOnWrite() const { return resetOnWrite_; } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C index 797d391e0b..e82545d2b1 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C @@ -64,7 +64,7 @@ Foam::ParticleTracks::ParticleTracks CloudFunctionObject(dict, owner, modelName, typeName), trackInterval_(this->coeffDict().getLabel("trackInterval")), maxSamples_(this->coeffDict().getLabel("maxSamples")), - resetOnWrite_(this->coeffDict().lookup("resetOnWrite")), + resetOnWrite_(this->coeffDict().getBool("resetOnWrite")), faceHitCounter_(), cloudPtr_(nullptr) {} diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H index 7bb8d8a6c0..6d75339a1a 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -57,13 +57,11 @@ class ParticleTracks : public CloudFunctionObject { - // Private data + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; - // Typedefs - - //- Convenience typedef for parcel type - typedef typename CloudType::parcelType parcelType; + // Private Data //- Number of face-hit intervals between storing parcel data label trackInterval_; @@ -71,8 +69,8 @@ class ParticleTracks //- Maximum number of particles to store per track label maxSamples_; - //- Flag to indicate whether data should be reset/cleared on writing - Switch resetOnWrite_; + //- Should data should be reset/cleared on writing? + bool resetOnWrite_; //- Table of number of times a particle has hit a face labelPairLookup faceHitCounter_; @@ -83,7 +81,7 @@ class ParticleTracks protected: - // Protected member functions + // Protected Member Functions //- Write post-processing info void write(); @@ -124,31 +122,31 @@ public: // Member Functions - // Access + // Access - //- Return const access to the track interval - inline label trackInterval() const; + //- Return const access to the track interval + inline label trackInterval() const; - //- Return const access to the max samples - inline label maxSamples() const; + //- Return const access to the max samples + inline label maxSamples() const; - //- Return const access to the reset on write flag - inline const Switch& resetOnWrite() const; + //- Should data be reset on write? + inline bool resetOnWrite() const; - //- Return the table of number of times a particle has hit a face - inline const labelPairLookup& faceHitCounter() const; + //- Return the table of number of times a particle has hit a face + inline const labelPairLookup& faceHitCounter() const; - //- Return const access to the cloud - inline const Cloud& cloud() const; + //- Return const access to the cloud + inline const Cloud& cloud() const; - // Evaluation + // Evaluation - //- Pre-evolve hook - virtual void preEvolve(); + //- Pre-evolve hook + virtual void preEvolve(); - //- Post-face hook - virtual void postFace(const parcelType& p, bool& keepParticle); + //- Post-face hook + virtual void postFace(const parcelType& p, bool& keepParticle); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H index 74f20b5371..4b90780b29 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracksI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011 OpenFOAM Foundation @@ -44,7 +44,7 @@ inline Foam::label Foam::ParticleTracks::maxSamples() const template -inline const Foam::Switch& Foam::ParticleTracks::resetOnWrite() const +inline bool Foam::ParticleTracks::resetOnWrite() const { return resetOnWrite_; }