Fix OLAF wake time-step detection losing precision over many time steps - #3454
Merged
andrew-platt merged 2 commits intoSep 9, 2026
Merged
Conversation
andrew-platt
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature or improvement description
OLAF wake solution degrades after tens of thousands of time steps. The problem was related to how OLAF decided if enough time had passed to shed a new wake panel. Before this fix, it compared
(t - last_wake_time)against a tolerance built from a fixed fraction of floating-point epsilon (p%DTfvw*OneMinusEpsilon, whereOneMinusEpsilon = 1 - 10000*EPSILON(1.0_DbKi)≈ 0.99999999999778).As the simulation time grows over many steps, the rounding error in
t - last_wake_timegrows too, while the epsilon-based tolerance stays fixed. Eventually the accumulated rounding error becomes bigger than the tolerance, and the check starts firing at the wrong times (sometimes skipping a wake update, sometimes doubling one up).The fix replaces this with a tolerance based on the simulation time step (
DTaero), so the tolerance stays proportional to the actual physical time discretization of the simulation instead of a fixed epsilon fraction.All the instances with
OneMinusEpsilonhave been rewritten.Related issue, if one exists
Fixes #3429
In addition,
OneMinusEpsilonwas also used inbTimeToOutput. This was also problematic and impacting the actual times to write down the output VTK files. For example, given a simulation with a time step of 0.002 s and defining in the output options:We would expect the VTK files being exported at the steps:
20.0/0.002 = 10,000
20.1/0.002 = 10,050
20.2/0.002 = 10,100
...
However, this was not the case. Before the proposed fix, the steps were not properly detected:

After the fix, the steps are properly detected:
