Add tstops support via LSODA's tcrit mechanism#78
Merged
ChrisRackauckas merged 5 commits intoMar 25, 2026
Conversation
Use itask=4/5 with opt.tcrit to prevent the solver from stepping past user-specified tstops times. This enables correct handling of discontinuities in the RHS without requiring callbacks. - Merge tstops into integration targets, track save points separately - Gate saves on save_everystep || is_save_point - Fall back to non-tcrit itask after all tstops are passed - Add tests for tstops with saveat, save_everystep, 2D problems, boundary filtering, and discontinuous RHS accuracy Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When tcrit is set to a tstop target, the solver is guaranteed not to overstep it, so use a simpler loop without overstep/interpolation handling. The overstep path is only needed for saveat-only targets between tstops (itask=5 can still overshoot those). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Always include T (end time) in tstops so the solver never steps past it. This eliminates the "don't overstep the last timestep" hack and always uses itask=4/5 with tcrit. - Split the else branch (already past target) for tstops vs saveat: tstop targets just save (already there), saveat targets interpolate. - Accept d_discontinuities kwarg and merge into tstops. Remove d_discontinuities from warnlist since it is now supported. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Direct mapping: dtmin → opt.hmin, dtmax → opt.hmax. Removed dtmin/dtmax from warnlist. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
actions/checkout v2→v4, setup-julia v1→v2, actions/cache v1→v4, codecov-action v1→v4. The v1 cache action was causing immediate CI failures. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ChrisRackauckas
approved these changes
Mar 25, 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.
Summary
tstopserror with actual support using LSODA's built-intcritmechanism (itask=4/5)tstopsinto integration targets while tracking which times are save points, sotstopscontrols solver stepping without affecting outputHow it works
The LSODA C library supports
itask=4(integrate to tout, don't step pasttcrit) anditask=5(one step, don't step pasttcrit). This PR leverages these modes to implementtstops:tstopstimes are merged withsaveattimes into a combined list of integration targetssave_settracks which targets should produce output (onlysaveattimes)opt.tcritis set to the next upcoming tstopsave_everystep || is_save_pointTest plan
tstopswithsaveatproduces correct save timeststopswithsave_everystep=trueincludes tstop times in outputsave_everystep+saveat+tstops🤖 Generated with Claude Code