View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004157 | OpenFOAM | Contribution | public | 2024-09-30 09:51 | 2024-09-30 22:03 |
Reporter | cgoessni | Assigned To | henry | ||
Priority | low | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0004157: functionObject startTime with adjustableRunTime causes deltaT=1e-16 for long-running simulations | ||||
Description | For long-running simulations with adjustableRunTime and adjustTimeStep true, but constant time step due to maxCo not being used, using startTime in a functionObject timeControl causes very small time steps due to round-off errors in floating point treatment (and potentially crashes). This bug is related to https://bugs.openfoam.org/view.php?id=4134, and the proposed and implemented fix there seems to not be enough to cover all cases. | ||||
Steps To Reproduce | Run the attached test case. Observations: 1.) 10800/uniform/time shows ... value 10799.9999999999982; ... as time value 2.) This seems to be causing timeToNextAction() returned from the timeControlFunctionObject to be very small, causing adjustDeltaT() in Time.C to set the time step to 1e-16 due to nSteps being zero. | ||||
Additional Information | A diff for Time.C which solves the problem for our cases is attached. It introduces a check if nSteps (converted to a label) is not zero before adjusting deltaT. | ||||
Tags | No tags attached. | ||||
|
adjustDeltaT.diff.txt (599 bytes)
diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index b7038b6..8d1e799 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -95,8 +95,8 @@ void Foam::Time::adjustDeltaT() const scalar nSteps = timeToNextAction/deltaT_; - // Ensure nStepsToNextWrite does not overflow - if (nSteps < labelMax) + // Ensure nStepsToNextWrite does not overflow and is not zero + if (nSteps < labelMax && label(nSteps) != 0) { // Allow the time-step to increase by up to 1% // to accommodate the next write time before splitting |
|
Resolved by commit f69a419a400adb667ef5639966a0058f7075d136 |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-09-30 09:51 | cgoessni | New Issue | |
2024-09-30 09:51 | cgoessni | File Added: testCaseTimeControl.tgz | |
2024-09-30 09:51 | cgoessni | File Added: adjustDeltaT.diff.txt | |
2024-09-30 22:03 | henry | Assigned To | => henry |
2024-09-30 22:03 | henry | Status | new => resolved |
2024-09-30 22:03 | henry | Resolution | open => fixed |
2024-09-30 22:03 | henry | Fixed in Version | => dev |
2024-09-30 22:03 | henry | Note Added: 0013419 |