View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0003669||OpenFOAM||Bug||public||2021-04-29 15:33||2021-04-30 12:23|
|Fixed in Version||dev|
|Summary||0003669: Regression in Time.C, first write time is wrong if not starting from 0 and not a restart|
We stumbled to odd behavior of sometimes not getting time directories as output if the starting folder was not 0 and it was not a normal restart, ie. no uniform/time file present which would contain the original beginTime.
Managed to bisect it to this commit:
I think the problem is that beginTime_ is first initialized to 0 and setWriteInterval is called in readDict using this beginTime. Later on beginTime is set properly as
beginTime_ = timeDict.lookupOrDefault("beginTime", startTime_); to be equal to non-zero startTime. But after this restart() is not true, so the writeTimeIndex_ is not updated and the invalid value set in readDict remains. Thus the first write will be "value()-0", which can be quite a big value if value is large.
|Steps To Reproduce||Take cavity tutorial, change:|
startTime 0->2 (and rename the 0-folder to 2)
First write will be 4.1, not 2.1 as it should
|Tags||No tags attached.|
||Shall I revert the commit?|
No, I think the commit is mostly fine. It is just that the logic regarding the very first writeTimeIndex_ calculation is slightly changed which breaks this one type of startup. I can perhaps provide a patch, but it is too late for today.
It should be enough to just always update writeTimeIndex_ with beginTime=startTime if no other beginTime was found. I wonder is for instance the check for restart() in line 272 necessary? If the check would be removed, I think it would fix this issue. But not sure if it would break something else.
||Resolved by commit 6d7703bfa3467767faa3202a2d7b07cfd6bffde4|
|2021-04-29 15:33||tniemi||New Issue|
|2021-04-29 15:48||henry||Note Added: 0012009|
|2021-04-29 16:58||tniemi||Note Added: 0012010|
|2021-04-30 12:23||henry||Assigned To||=> henry|
|2021-04-30 12:23||henry||Status||new => resolved|
|2021-04-30 12:23||henry||Resolution||open => fixed|
|2021-04-30 12:23||henry||Fixed in Version||=> dev|
|2021-04-30 12:23||henry||Note Added: 0012011|