From 6a177418a0a2dc1d9c1edbd9a69353c0ebf675b6 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Mar 2012 12:27:50 +0000 Subject: [PATCH 01/10] ENH: Added output of front/rear lift coeffs to forceCoeffs function object --- .../functionObjects/forces/forceCoeffs/forceCoeffs.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 3ce1fd2f11..d01d17e986 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -137,9 +137,11 @@ void Foam::forceCoeffs::write() if (log_) { Info<< "forceCoeffs output:" << nl - << " Cd = " << Cd << nl - << " Cl = " << Cl << nl - << " Cm = " << Cm << nl + << " Cm = " << Cm << nl + << " Cd = " << Cd << nl + << " Cl = " << Cl << nl + << " Cl(f) = " << Cl/2.0 - Cm << nl + << " Cl(r) = " << Cl/2.0 + Cm << nl << endl; } } From 3fd792b2aee39e79d426691f700b16a44be0f7e6 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Mar 2012 15:12:42 +0000 Subject: [PATCH 02/10] ENH: Removed unnecessary #include --- src/combustionModels/psiCombustionModel/psiCombustionModels.C | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/combustionModels/psiCombustionModel/psiCombustionModels.C b/src/combustionModels/psiCombustionModel/psiCombustionModels.C index 925dd612cd..e8d96e9b63 100644 --- a/src/combustionModels/psiCombustionModel/psiCombustionModels.C +++ b/src/combustionModels/psiCombustionModel/psiCombustionModels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,9 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "makeCombustionTypes.H" - #include "psiCombustionModel.H" -#include "PaSR.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From c24b218f8e75ce2a3093d0ff4da758284011029d Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Mar 2012 17:29:44 +0000 Subject: [PATCH 03/10] BUG: Removed non-existent massInjected() function --- src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H | 3 --- .../clouds/Templates/KinematicCloud/KinematicCloud.H | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H index 7526271e45..5f0730b299 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H @@ -424,9 +424,6 @@ public: // Check - //- Total mass injected - inline scalar massInjected() const; - //- Total mass in system inline scalar massInSystem() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index fd32ff790c..798bccd97d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -456,9 +456,6 @@ public: // Check - //- Total mass injected - inline scalar massInjected() const; - //- Total mass in system inline scalar massInSystem() const; From b23142935fd0442d2641eee58e481678ac8cac00 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Mar 2012 17:41:31 +0000 Subject: [PATCH 04/10] STYLE: Updated copyright year --- src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H | 2 +- .../clouds/Templates/KinematicCloud/KinematicCloud.H | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H index 5f0730b299..423bd87160 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 798bccd97d..8ac910e301 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From 657d7d6d85061f8c999a4f1a22fc61cb01642610 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Mar 2012 17:47:41 +0000 Subject: [PATCH 05/10] ENH: Added virtual functions to base kinematicCloud API --- .../kinematicCloud/kinematicCloud.H | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H index 3f5bd469d1..7f72eae98f 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,6 +68,50 @@ public: kinematicCloud(); + // Member functions + + // Check + + //- Number of parcels + virtual label nParcels() const = 0; + + //- Total mass in system + virtual scalar massInSystem() const = 0; + + //- Total linear momentum of the system + virtual vector linearMomentumOfSystem() const = 0; + + //- Total linear kinetic energy in the system + virtual scalar linearKineticEnergyOfSystem() const = 0; + + //- Total rotational kinetic energy in the system + virtual scalar rotationalKineticEnergyOfSystem() const = 0; + + //- Penetration for percentage of the current total mass +// virtual scalar penetration(const scalar& prc) const = 0; + + //- Mean diameter Dij + virtual scalar Dij(const label i, const label j) const = 0; + + //- Max diameter + virtual scalar Dmax() const = 0; + + + // Fields + + //- Return the particle volume fraction field + // Note: for particles belonging to this cloud only + virtual const tmp theta() const = 0; + + //- Return the particle mass fraction field + // Note: for particles belonging to this cloud only + virtual const tmp alpha() const = 0; + + //- Return the particle effective density field + // Note: for particles belonging to this cloud only + virtual const tmp rhoEff() const = 0; + + //- Destructor virtual ~kinematicCloud(); }; From 346ad0eba8a402a47228d797a3badf8119499da2 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 15 Mar 2012 09:20:42 +0000 Subject: [PATCH 06/10] ENH: Used writeEntryIfDifferent in write function for advective BC --- .../derived/advective/advectiveFvPatchField.C | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 5a81174d84..8de92629c1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -304,21 +304,13 @@ void Foam::advectiveFvPatchField::write(Ostream& os) const { fvPatchField::write(os); - if (phiName_ != "phi") - { - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - } - if (rhoName_ != "rho") - { - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; - } + this->template writeEntryIfDifferent(os, "phi", "phi", phiName_); + this->template writeEntryIfDifferent(os, "rho", "rho", rhoName_); if (lInf_ > SMALL) { - os.writeKeyword("fieldInf") << fieldInf_ - << token::END_STATEMENT << nl; - os.writeKeyword("lInf") << lInf_ - << token::END_STATEMENT << nl; + os.writeKeyword("fieldInf") << fieldInf_ << token::END_STATEMENT << nl; + os.writeKeyword("lInf") << lInf_ << token::END_STATEMENT << nl; } this->writeEntry("value", os); From e887b572e92ad2b5fd22209baca132c0755b150d Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 15 Mar 2012 10:03:46 +0000 Subject: [PATCH 07/10] ENH: better treatment of lInf in advective BC --- .../derived/advective/advectiveFvPatchField.C | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 8de92629c1..5764676b2a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -45,7 +45,7 @@ Foam::advectiveFvPatchField::advectiveFvPatchField phiName_("phi"), rhoName_("rho"), fieldInf_(pTraits::zero), - lInf_(0.0) + lInf_(-GREAT) { this->refValue() = pTraits::zero; this->refGrad() = pTraits::zero; @@ -82,7 +82,7 @@ Foam::advectiveFvPatchField::advectiveFvPatchField phiName_(dict.lookupOrDefault("phi", "phi")), rhoName_(dict.lookupOrDefault("rho", "rho")), fieldInf_(pTraits::zero), - lInf_(0.0) + lInf_(-GREAT) { if (dict.found("value")) { @@ -110,9 +110,13 @@ Foam::advectiveFvPatchField::advectiveFvPatchField ( "advectiveFvPatchField::" "advectiveFvPatchField" - "(const fvPatch&, const Field&, const dictionary&)", + "(" + "const fvPatch&, " + "const DimensionedField&, " + "const dictionary&" + ")", dict - ) << "unphysical lInf specified (lInf < 0)\n" + ) << "unphysical lInf specified (lInf < 0)" << nl << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() @@ -217,7 +221,7 @@ void Foam::advectiveFvPatchField::updateCoeffs() // Non-reflecting outflow boundary // If lInf_ defined setup relaxation to the value fieldInf_. - if (lInf_ > SMALL) + if (lInf_ > 0) { // Calculate the field relaxation coefficient k (See notes) const scalarField k(w*deltaT/lInf_); @@ -248,12 +252,10 @@ void Foam::advectiveFvPatchField::updateCoeffs() } else { - FatalErrorIn - ( - "advectiveFvPatchField::updateCoeffs()" - ) << " Unsupported temporal differencing scheme : " - << ddtScheme - << "\n on patch " << this->patch().name() + FatalErrorIn("advectiveFvPatchField::updateCoeffs()") + << " Unsupported temporal differencing scheme : " + << ddtScheme << nl + << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); @@ -307,7 +309,7 @@ void Foam::advectiveFvPatchField::write(Ostream& os) const this->template writeEntryIfDifferent(os, "phi", "phi", phiName_); this->template writeEntryIfDifferent(os, "rho", "rho", rhoName_); - if (lInf_ > SMALL) + if (lInf_ > 0) { os.writeKeyword("fieldInf") << fieldInf_ << token::END_STATEMENT << nl; os.writeKeyword("lInf") << lInf_ << token::END_STATEMENT << nl; From 4c6d6a5731021d502faf510e70bea44a2cfc8272 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 15 Mar 2012 10:05:41 +0000 Subject: [PATCH 08/10] ENH: Updates to the kinematic cloud API --- .../clouds/Templates/KinematicCloud/KinematicCloud.H | 3 +++ .../clouds/Templates/KinematicCloud/KinematicCloudI.H | 9 ++++++++- .../clouds/baseClasses/kinematicCloud/kinematicCloud.H | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 8ac910e301..7225347e60 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -456,6 +456,9 @@ public: // Check + //- Total number of parcels + inline label nParcels() const; + //- Total mass in system inline scalar massInSystem() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 94b95168a5..ab0e7ed940 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -227,6 +227,13 @@ Foam::KinematicCloud::UIntegrator() const } +template +inline Foam::label Foam::KinematicCloud::nParcels() const +{ + return this->size(); +} + + template inline Foam::scalar Foam::KinematicCloud::massInSystem() const { diff --git a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H index 7f72eae98f..01c80c16e2 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H @@ -36,6 +36,7 @@ SourceFiles #define kinematicCloud_H #include "typeInfo.H" +#include "volFieldsFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 0a21d025309ca7a4e95936f95de773fa6edc8156 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 15 Mar 2012 13:15:55 +0000 Subject: [PATCH 09/10] ENH: Added new cloudInfo function object --- src/postProcessing/functionObjects/Allwmake | 3 +- .../functionObjects/cloud/Make/files | 4 + .../functionObjects/cloud/Make/options | 9 + .../cloud/cloudInfo/IOcloudInfo.H | 49 +++++ .../cloud/cloudInfo/cloudInfo.C | 183 ++++++++++++++++++ .../cloud/cloudInfo/cloudInfo.H | 157 +++++++++++++++ .../cloud/cloudInfo/cloudInfoFunctionObject.C | 42 ++++ .../cloud/cloudInfo/cloudInfoFunctionObject.H | 54 ++++++ .../cloud/cloudInfo/postProcessingDict | 31 +++ 9 files changed, 531 insertions(+), 1 deletion(-) create mode 100644 src/postProcessing/functionObjects/cloud/Make/files create mode 100644 src/postProcessing/functionObjects/cloud/Make/options create mode 100644 src/postProcessing/functionObjects/cloud/cloudInfo/IOcloudInfo.H create mode 100644 src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C create mode 100644 src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H create mode 100644 src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfoFunctionObject.C create mode 100644 src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfoFunctionObject.H create mode 100644 src/postProcessing/functionObjects/cloud/cloudInfo/postProcessingDict diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index e62cdf86c7..343d2bafc4 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -3,11 +3,12 @@ cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} set -x +wmake $makeType cloud wmake $makeType field wmake $makeType forces wmake $makeType IO -wmake $makeType utilities wmake $makeType jobControl wmake $makeType systemCall +wmake $makeType utilities # ----------------------------------------------------------------- end-of-file diff --git a/src/postProcessing/functionObjects/cloud/Make/files b/src/postProcessing/functionObjects/cloud/Make/files new file mode 100644 index 0000000000..e8515a0937 --- /dev/null +++ b/src/postProcessing/functionObjects/cloud/Make/files @@ -0,0 +1,4 @@ +cloudInfo/cloudInfo.C +cloudInfo/cloudInfoFunctionObject.C + +LIB = $(FOAM_LIBBIN)/libcloudFunctionObjects diff --git a/src/postProcessing/functionObjects/cloud/Make/options b/src/postProcessing/functionObjects/cloud/Make/options new file mode 100644 index 0000000000..7699961acc --- /dev/null +++ b/src/postProcessing/functionObjects/cloud/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -llagrangian \ + -llagrangianIntermediate diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/IOcloudInfo.H b/src/postProcessing/functionObjects/cloud/cloudInfo/IOcloudInfo.H new file mode 100644 index 0000000000..6e0eda072a --- /dev/null +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/IOcloudInfo.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . + +Typedef + Foam::IOcloudInfo + +Description + Instance of the generic IOOutputFilter for cloudInfo. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcloudInfo_H +#define IOcloudInfo_H + +#include "cloudInfo.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter IOcloudInfo; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C new file mode 100644 index 0000000000..6c5c6c5af4 --- /dev/null +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C @@ -0,0 +1,183 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +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 "cloudInfo.H" +#include "dictionary.H" +#include "kinematicCloud.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::cloudInfo, 0); + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void Foam::cloudInfo::makeFiles() +{ + if (debug) + { + Info<< "Creating cloudInfo output files." << endl; + } + + outputFilePtr_.clear(); + outputFilePtr_.setSize(cloudSet_.size()); + + if (Pstream::master()) + { + label i = 0; + forAllConstIter(wordHashSet, cloudSet_, iter) + { + const word& cloudName = iter.key(); + fileName cloudInfoDir(obr_.time().path()); + word timeName = Foam::name(obr_.time().startTime().value()); + + if (Pstream::parRun()) + { + // Put in undecomposed case (Note: gives problems for + // distributed data running) + cloudInfoDir = cloudInfoDir/".."/name_/timeName; + } + else + { + cloudInfoDir = cloudInfoDir/name_/timeName; + } + + // Create directory if does not exist + mkDir(cloudInfoDir); + + // Open new files at start up + outputFilePtr_.set + ( + i, + new OFstream(cloudInfoDir/(cloudName + ".dat")) + ); + + // Add headers + outputFilePtr_[i] + << "# Time" << tab << "nParcels" << tab << "mass" << endl; + + i++; + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cloudInfo::cloudInfo +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + cloudSet_(), + outputFilePtr_() +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cloudInfo::~cloudInfo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::cloudInfo::read(const dictionary& dict) +{ + if (active_) + { + cloudSet_.insert(wordList(dict.lookup("clouds"))); + + Info<< type() << ": "; + if (cloudSet_.size()) + { + Info<< "applying to clouds:" << nl; + forAllConstIter(wordHashSet, cloudSet_, iter) + { + Info<< " " << iter.key() << nl; + } + Info<< endl; + + makeFiles(); + } + else + { + Info<< "no clouds to be processed" << nl << endl; + } + } +} + + +void Foam::cloudInfo::execute() +{ + // Do nothing +} + + +void Foam::cloudInfo::end() +{ + // Do nothing +} + + +void Foam::cloudInfo::write() +{ + if (active_) + { + label i = 0; + forAllConstIter(wordHashSet, cloudSet_, iter) + { + const word& cloudName = iter.key(); + + const kinematicCloud& cloud = + obr_.lookupObject(cloudName); + + label nParcels = returnReduce(cloud.nParcels(), sumOp