mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Corrections to fieldAverage
This commit is contained in:
@ -68,12 +68,6 @@ void Foam::fieldAverage::initialize()
|
|||||||
resetFields(prime2MeanScalarFields_);
|
resetFields(prime2MeanScalarFields_);
|
||||||
resetFields(prime2MeanSymmTensorFields_);
|
resetFields(prime2MeanSymmTensorFields_);
|
||||||
|
|
||||||
totalIter_.clear();
|
|
||||||
totalIter_.setSize(faItems_.size(), 1);
|
|
||||||
|
|
||||||
totalTime_.clear();
|
|
||||||
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
|
|
||||||
|
|
||||||
|
|
||||||
// Add mean fields to the field lists
|
// Add mean fields to the field lists
|
||||||
forAll(faItems_, fieldI)
|
forAll(faItems_, fieldI)
|
||||||
@ -248,6 +242,12 @@ void Foam::fieldAverage::writeAveragingProperties() const
|
|||||||
|
|
||||||
void Foam::fieldAverage::readAveragingProperties()
|
void Foam::fieldAverage::readAveragingProperties()
|
||||||
{
|
{
|
||||||
|
totalIter_.clear();
|
||||||
|
totalIter_.setSize(faItems_.size(), 1);
|
||||||
|
|
||||||
|
totalTime_.clear();
|
||||||
|
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
|
||||||
|
|
||||||
if (resetOnRestart_)
|
if (resetOnRestart_)
|
||||||
{
|
{
|
||||||
Info<< "fieldAverage: starting averaging at time "
|
Info<< "fieldAverage: starting averaging at time "
|
||||||
@ -258,7 +258,7 @@ void Foam::fieldAverage::readAveragingProperties()
|
|||||||
IOobject propsDictHeader
|
IOobject propsDictHeader
|
||||||
(
|
(
|
||||||
"fieldAveragingProperties",
|
"fieldAveragingProperties",
|
||||||
obr_.time().timeName(),
|
obr_.time().timeName(obr_.time().startTime().value()),
|
||||||
"uniform",
|
"uniform",
|
||||||
obr_,
|
obr_,
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
@ -290,6 +290,7 @@ void Foam::fieldAverage::readAveragingProperties()
|
|||||||
<< " time = " << totalTime_[fieldI] << endl;
|
<< " time = " << totalTime_[fieldI] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -358,6 +359,8 @@ void Foam::fieldAverage::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
|
initialised_ = false;
|
||||||
|
|
||||||
dict.readIfPresent("resetOnRestart", resetOnRestart_);
|
dict.readIfPresent("resetOnRestart", resetOnRestart_);
|
||||||
dict.readIfPresent("resetOnOutput", resetOnOutput_);
|
dict.readIfPresent("resetOnOutput", resetOnOutput_);
|
||||||
dict.lookup("fields") >> faItems_;
|
dict.lookup("fields") >> faItems_;
|
||||||
@ -394,6 +397,16 @@ void Foam::fieldAverage::write()
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
|
if (!initialised_)
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
|
||||||
|
// ensure first averaging works unconditionally
|
||||||
|
prevTimeIndex_ = -1;
|
||||||
|
|
||||||
|
initialised_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
calcAverages();
|
calcAverages();
|
||||||
writeAverages();
|
writeAverages();
|
||||||
writeAveragingProperties();
|
writeAveragingProperties();
|
||||||
|
|||||||
Reference in New Issue
Block a user