mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: fieldAverage - protect against numerical error when determining the next periodic restart
This commit is contained in:
@ -136,10 +136,16 @@ void Foam::functionObjects::fieldAverage::calcAverages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool doRestart = false;
|
bool doRestart = false;
|
||||||
if (periodicRestart_ && currentTime > restartPeriod_*periodIndex_)
|
if (periodicRestart_)
|
||||||
{
|
{
|
||||||
doRestart = true;
|
const scalar deltaT = obr().time().deltaTValue();
|
||||||
periodIndex_++;
|
const scalar nextTime = restartPeriod_*periodIndex_ + 0.5*deltaT;
|
||||||
|
|
||||||
|
if (currentTime > nextTime)
|
||||||
|
{
|
||||||
|
doRestart = true;
|
||||||
|
++periodIndex_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTime >= restartTime_)
|
if (currentTime >= restartTime_)
|
||||||
|
|||||||
Reference in New Issue
Block a user