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