Added a resetOnOutput switch to fieldAverage to allow the averaging to be only of the preceding writeInterval for transient cases.

This commit is contained in:
graham
2009-03-11 12:27:51 +00:00
parent 3a73f3d1aa
commit ded140c2e8
2 changed files with 21 additions and 0 deletions

View File

@ -308,6 +308,7 @@ Foam::fieldAverage::fieldAverage
active_(true),
prevTimeIndex_(-1),
cleanRestart_(false),
resetOnOutput_(false),
faItems_(),
meanScalarFields_(),
meanVectorFields_(),
@ -355,6 +356,7 @@ void Foam::fieldAverage::read(const dictionary& dict)
if (active_)
{
dict.readIfPresent("cleanRestart", cleanRestart_);
dict.readIfPresent("resetOnOutput", resetOnOutput_);
dict.lookup("fields") >> faItems_;
initialize();
@ -387,6 +389,17 @@ void Foam::fieldAverage::write()
calcAverages();
writeAverages();
writeAveragingProperties();
if (resetOnOutput_)
{
Info<< "fieldAverage: restarting averaging at time "
<< obr_.time().timeName() << nl << endl;
initialize();
// ensure first averaging works unconditionally
prevTimeIndex_ = -1;
}
}
}

View File

@ -41,6 +41,11 @@ Description
// averaging info if available
cleanRestart true;
// Whether to reset the averaged fields after they have been written.
// Used to average over only the preceding write interval for transient
// cases.
resetOnOutput true;
// Fields to be averaged. runTime modifiable!
fields
(
@ -132,6 +137,9 @@ protected:
//- Clean restart flag
Switch cleanRestart_;
//- resetOnOutput flag
Switch resetOnOutput_;
//- List of field average items, describing what averages to be
// calculated and output
List<fieldAverageItem> faItems_;