From 5c0570bb888e60864c6921e10fb65e9fffa7a527 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 11 Jul 2011 11:06:32 +0100 Subject: [PATCH] ENH: partialWrite: do lagrangian fields --- .../functionObjects/IO/controlDict | 13 ++++- .../IO/partialWrite/partialWrite.C | 49 ++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/postProcessing/functionObjects/IO/controlDict b/src/postProcessing/functionObjects/IO/controlDict index 11ecd9b106..d0fa908273 100644 --- a/src/postProcessing/functionObjects/IO/controlDict +++ b/src/postProcessing/functionObjects/IO/controlDict @@ -14,6 +14,10 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// So we get a decent warning if we have multiple functionObject entries +// with the same name. +#inputMode error; + application icoFoam; startFrom startTime; @@ -56,11 +60,16 @@ functions // Where to load it from functionObjectLibs ("libIOFunctionObjects.so"); + // Optional mesh region to operate on. Only one partialWrite per + // region allowed. + region wallFilmRegion; + // Execute upon outputTime outputControl outputTime; - // Objects to write every outputTime - objectNames (p); + // Objects (fields or lagrangian fields in any of the clouds) + // to write every outputTime + objectNames (p positions nParticle); // Write as normal every writeInterval'th outputTime. writeInterval 3; } diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C index 1ea7ae253d..431c1febd9 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C @@ -28,6 +28,7 @@ License #include "Time.H" #include "IOobjectList.H" #include "polyMesh.H" +#include "cloud.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -132,7 +133,12 @@ void Foam::partialWrite::write() IOobjectList objects(obr_, obr_.time().timeName()); - forAllConstIter(HashPtrTable, objects, iter) + if (debug) + { + Pout<< "For region:" << obr_.name() << endl; + } + + forAllConstIter(IOobjectList, objects, iter) { if (!objectNames_.found(iter()->name())) { @@ -147,6 +153,47 @@ void Foam::partialWrite::write() rm(f); } } + + // Do the lagrangian files as well. + fileNameList cloudDirs + ( + readDir + ( + obr_.time().timePath()/dbDir/cloud::prefix, + fileName::DIRECTORY + ) + ); + forAll(cloudDirs, i) + { + if (debug) + { + Pout<< "For cloud:" << cloudDirs[i] << endl; + } + + IOobjectList sprayObjs + ( + obr_, + obr_.time().timeName(), + cloud::prefix/cloudDirs[i] + ); + forAllConstIter(IOobjectList, sprayObjs, iter) + { + if (!objectNames_.found(iter()->name())) + { + const fileName f = + obr_.time().timePath() + /dbDir + /cloud::prefix + /cloudDirs[i] + /iter()->name(); + if (debug) + { + Pout<< " rm " << f << endl; + } + rm(f); + } + } + } } } }