mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: updated initialisation for fieldAverage function object - mantis #841
This commit is contained in:
@ -311,6 +311,7 @@ Foam::fieldAverage::fieldAverage
|
|||||||
prevTimeIndex_(-1),
|
prevTimeIndex_(-1),
|
||||||
resetOnRestart_(false),
|
resetOnRestart_(false),
|
||||||
resetOnOutput_(false),
|
resetOnOutput_(false),
|
||||||
|
initialised_(false),
|
||||||
faItems_(),
|
faItems_(),
|
||||||
meanScalarFields_(),
|
meanScalarFields_(),
|
||||||
meanVectorFields_(),
|
meanVectorFields_(),
|
||||||
@ -361,11 +362,7 @@ void Foam::fieldAverage::read(const dictionary& dict)
|
|||||||
dict.readIfPresent("resetOnOutput", resetOnOutput_);
|
dict.readIfPresent("resetOnOutput", resetOnOutput_);
|
||||||
dict.lookup("fields") >> faItems_;
|
dict.lookup("fields") >> faItems_;
|
||||||
|
|
||||||
initialize();
|
|
||||||
readAveragingProperties();
|
readAveragingProperties();
|
||||||
|
|
||||||
// ensure first averaging works unconditionally
|
|
||||||
prevTimeIndex_ = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,6 +371,16 @@ void Foam::fieldAverage::execute()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
|
if (!initialised_)
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
|
||||||
|
// ensure first averaging works unconditionally
|
||||||
|
prevTimeIndex_ = -1;
|
||||||
|
|
||||||
|
initialised_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
calcAverages();
|
calcAverages();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,6 +171,9 @@ protected:
|
|||||||
//- Reset the averaging process on output flag
|
//- Reset the averaging process on output flag
|
||||||
Switch resetOnOutput_;
|
Switch resetOnOutput_;
|
||||||
|
|
||||||
|
//- Initialised flag
|
||||||
|
bool initialised_;
|
||||||
|
|
||||||
//- List of field average items, describing what averages to be
|
//- List of field average items, describing what averages to be
|
||||||
// calculated and output
|
// calculated and output
|
||||||
List<fieldAverageItem> faItems_;
|
List<fieldAverageItem> faItems_;
|
||||||
|
|||||||
Reference in New Issue
Block a user