fieldAverage: Made restart work with mesh topology change and NCC

This commit is contained in:
Will Bainbridge
2022-11-01 10:41:20 +00:00
parent 6e4f192281
commit 65b7f62857
2 changed files with 3 additions and 13 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -123,8 +123,6 @@ void Foam::functionObjects::fieldAverage::initialise()
// ensure first averaging works unconditionally // ensure first averaging works unconditionally
prevTimeIndex_ = -1; prevTimeIndex_ = -1;
initialised_ = true;
} }
@ -142,11 +140,6 @@ void Foam::functionObjects::fieldAverage::restart()
void Foam::functionObjects::fieldAverage::calcAverages() void Foam::functionObjects::fieldAverage::calcAverages()
{ {
if (!initialised_)
{
initialise();
}
const label currentTimeIndex = obr_.time().timeIndex(); const label currentTimeIndex = obr_.time().timeIndex();
const scalar currentTime = obr_.time().value(); const scalar currentTime = obr_.time().value();
@ -306,7 +299,6 @@ Foam::functionObjects::fieldAverage::fieldAverage
restartOnOutput_(false), restartOnOutput_(false),
periodicRestart_(false), periodicRestart_(false),
restartPeriod_(great), restartPeriod_(great),
initialised_(false),
base_(baseType::iter), base_(baseType::iter),
window_(-1.0), window_(-1.0),
windowName_(""), windowName_(""),
@ -331,7 +323,6 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
{ {
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
initialised_ = false;
Log << type() << " " << name() << ":" << nl; Log << type() << " " << name() << ":" << nl;
@ -361,6 +352,8 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
readAveragingProperties(); readAveragingProperties();
initialise();
Log << endl; Log << endl;
return true; return true;

View File

@ -157,9 +157,6 @@ protected:
//- Restart period //- Restart period
scalar restartPeriod_; scalar restartPeriod_;
//- Initialised flag
bool initialised_;
//- Averaging base type names //- Averaging base type names
static const NamedEnum<baseType, 2> baseTypeNames_; static const NamedEnum<baseType, 2> baseTypeNames_;