Skip to content
Snippets Groups Projects
Commit 3fc66cb7 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: make resetOnRestart optional for valueAverage (issue #360)

ENH: ensure averaging flags are not 'sticky' (see issue #331)
parent 9e645179
Branches
Tags
No related merge requests found
......@@ -293,13 +293,19 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
// Make certain that the values are consistent with the defaults:
initialised_ = false;
restartOnRestart_ = false;
restartOnOutput_ = false;
periodicRestart_ = false;
restartPeriod_ = GREAT;
restartTime_ = GREAT;
Info<< type() << " " << name() << ":" << nl;
dict.readIfPresent("restartOnRestart", restartOnRestart_);
dict.readIfPresent("restartOnOutput", restartOnOutput_);
dict.readIfPresent("periodicRestart", periodicRestart_);
dict.readIfPresent("restartOnOutput", restartOnOutput_);
dict.readIfPresent("periodicRestart", periodicRestart_);
dict.lookup("fields") >> faItems_;
const scalar currentTime = obr().time().value();
......@@ -331,7 +337,6 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
}
}
restartTime_ = GREAT;
if (dict.readIfPresent("restartTime", restartTime_))
{
if (currentTime > restartTime_)
......
......@@ -109,6 +109,9 @@ bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
regionFunctionObject::read(dict);
writeFile::read(dict);
// Make certain that the values are consistent with the defaults:
resetOnRestart_ = false;
dict.lookup("functionObject") >> functionObjectName_;
dict.lookup("fields") >> fieldNames_;
window_ = dict.lookupOrDefault<scalar>("window", -1);
......@@ -119,7 +122,7 @@ bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
totalTime_[i] = time_.deltaTValue();
}
resetOnRestart_ = readBool(dict.lookup("resetOnRestart"));
dict.readIfPresent("resetOnRestart", resetOnRestart_);
return true;
}
......
......@@ -55,7 +55,7 @@ Usage
log | write average data to standard output | no | yes
fields | list of fields to process | yes |
functionObject | Name of function object to retrieve data from | yes |
resetOnRestart | Reset the averaging on restart | yes |
resetOnRestart | Reset the averaging on restart | no | no |
\endtable
Output data is written to the file \<timeDir\>/valueAverage.dat
......@@ -110,7 +110,7 @@ protected:
List<scalar> totalTime_;
//- Reset the averaging process on restart
bool resetOnRestart_;
Switch resetOnRestart_;
// Protected Member Functions
......
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