Commit ded140c2 authored by graham's avatar graham
Browse files

Added a resetOnOutput switch to fieldAverage to allow the averaging to be only...

Added a resetOnOutput switch to fieldAverage to allow the averaging to be only of the preceding writeInterval for transient cases.
parent 3a73f3d1
......@@ -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;
}
}
}
......
......@@ -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_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment