Skip to content

Conversation

@patrick-kidger
Copy link
Owner

No description provided.

alessandrofasse and others added 24 commits August 15, 2025 23:04
* Use 100 ULP's to clip timesteps close to t1

* test that t1-t0 > 100 ULP's

* revert testing as t1 is traced

* remove unnecessary pyright ignores
When: dt is clipped to dtmin, and we wish to continue solver (force_dtmin=True)

Calculating if a step should be kept from:
prev_dt = t1 - t0  (next_t1 = next_t0 + dt (in previous step))
keep_step = keep_step | (prev_dt <= self.dtmin)

can result in float error for high t0 where prev_dt is never <= self.dtmin, and further steps are never accepted -> infinite loop

Fix: add a keep_next_step: bool flag to controller_state, and track when we are, and continue to be, at dtmin
this solution makes sure that dt is reset to the desired dtmin value if the previous step was at dtmin and dt is unchanged (factor=1)

if we do not reset dt then the recalculation of prev_dt = t1 - t0 will keep accumulating float precision errors with potential to drift away from the desired dtmin until a step that warrant a relaxation of step size (factor>1)

these errors are likely to be minor, but i believe this is the intended behaviour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants