View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004225 | OpenFOAM | Bug | public | 2025-03-11 13:55 | 2025-03-13 05:19 |
Reporter | cgoessni | Assigned To | |||
Priority | low | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | dev | ||||
Summary | 0004225: Simulation stops before endTime even when writeControl is adjustableRunTime and adjustTimeStep is true | ||||
Description | Under certain conditions, simulation stops before endTime is reached even when writeControl is adjustableRunTime and adjustTimeStep is true. | ||||
Steps To Reproduce | In kivaTest, run: foamDictionary -entry endTime -set "-170.03" system/controlDict foamDictionary -entry deltaT -set 0.01 system/controlDict foamDictionary -entry writeControl -set adjustableRunTime system/controlDict foamDictionary -entry adjustTimeStep -set yes system/controlDict foamDictionary -entry maxCo -set 1 system/controlDict foamDictionary -entry maxDeltaT -set 0.05 system/controlDict ./Allrun Expected behaviour: simulation runs until -170.03 (inclusive) Observed behaviour: simulation runs until -170.05 (see log file, or files in postProcessing folder) | ||||
Additional Information | In Time.C, we have the following condition: bool Foam::Time::running() const { return value() < (endTime_ - 0.5*deltaT_); } which - in userTime - is, for the above case: value() = -170.05 endTime_ = -170.03 deltaT_ = 0.05 which leads to return -170.05 < (-170.03 - 0.05/2 = -170.075) which yields false although there would still be one time step required with deltaT = 0.02. This leads to pimple.run(runTime) being false in the foamRun main time loop. | ||||
Tags | No tags attached. | ||||
|
In general I'd recommend avoiding negative values even though it is possible in userTime. You can get burned by some edge cases in function objects and third party libraries (if ever used). I'd prefer to execute mapping to negative CA values as a post-processing step if required. |
|
This is independent from the negative times, this happens with all of our engine cases which start and end with a positive CA / time. |
|
This is now a kivaTest with positive start and end time. It should stop at 550.02 CAD, but stops pre-maturely at 550 CAD. In my initial calculation, I have a small typo, this should read as: return -170.05 < (-170.03 - 0.05/2 = -170.055) which would still be false, though. |