mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: inconsistency in periodic restart for fieldAverage (issue #330)
- the interval for the next restart was not being adjusted when the file was reread, or when doing a complete simulation restart.
This commit is contained in:
@ -302,17 +302,39 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
|||||||
dict.readIfPresent("periodicRestart", periodicRestart_);
|
dict.readIfPresent("periodicRestart", periodicRestart_);
|
||||||
dict.lookup("fields") >> faItems_;
|
dict.lookup("fields") >> faItems_;
|
||||||
|
|
||||||
|
const scalar currentTime = obr().time().value();
|
||||||
|
|
||||||
if (periodicRestart_)
|
if (periodicRestart_)
|
||||||
{
|
{
|
||||||
dict.lookup("restartPeriod") >> restartPeriod_;
|
dict.lookup("restartPeriod") >> restartPeriod_;
|
||||||
Info<< " Restart period " << restartPeriod_
|
|
||||||
<< nl << endl;
|
if (restartPeriod_ > 0)
|
||||||
|
{
|
||||||
|
// Determine the appropriate interval for the next restart
|
||||||
|
periodIndex_ = 1;
|
||||||
|
while (currentTime > restartPeriod_*periodIndex_)
|
||||||
|
{
|
||||||
|
++periodIndex_;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " Restart period " << restartPeriod_
|
||||||
|
<< " - next restart at " << (restartPeriod_*periodIndex_)
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
periodicRestart_ = false;
|
||||||
|
|
||||||
|
Info<< " Restart period " << restartPeriod_
|
||||||
|
<< " - ignored"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
restartTime_ = GREAT;
|
restartTime_ = GREAT;
|
||||||
if (dict.readIfPresent("restartTime", restartTime_))
|
if (dict.readIfPresent("restartTime", restartTime_))
|
||||||
{
|
{
|
||||||
if (restartTime_ < obr_.time().value())
|
if (currentTime > restartTime_)
|
||||||
{
|
{
|
||||||
// The restart time is already in the past - ignore
|
// The restart time is already in the past - ignore
|
||||||
restartTime_ = GREAT;
|
restartTime_ = GREAT;
|
||||||
|
|||||||
Reference in New Issue
Block a user