ENH: partialWrite: do lagrangian fields

This commit is contained in:
mattijs 2011-07-11 11:06:32 +01:00
parent 87df037474
commit 5c0570bb88
2 changed files with 59 additions and 3 deletions

View File

@ -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;
}

View File

@ -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<IOobject>, 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);
}
}
}
}
}
}