Skip to content

Unify RHS and SOLOUT user interrupts under a single idid exit path#52

Merged
ivan-pi merged 3 commits into
mainfrom
copilot/add-dassl-like-callback-ires
May 12, 2026
Merged

Unify RHS and SOLOUT user interrupts under a single idid exit path#52
ivan-pi merged 3 commits into
mainfrom
copilot/add-dassl-like-callback-ires

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

This change makes user-driven early termination behave consistently whether it originates in SOLOUT or during RHS evaluation. Both callback paths now return through the same solver status (idid = -2) while preserving the last accepted integration state.

  • Solver API

    • Extend rhs_sub with an ires in/out flag.
    • Treat ires < 0 the same as irtrn < 0 from solout: return idid = -2.
  • Core integration flow

    • Thread RHS interrupt handling through the main step logic and the internal sirk3 stage evaluation.
    • Restore the last accepted (x, y) state when an RHS interrupt occurs mid-step, so callback exits remain restart-safe and consistent with existing solout semantics.
  • Docs and call sites

    • Update README and all examples/tests to the new RHS callback signature.
    • Clarify that idid = -2 now represents a user interrupt from either callback surface.
  • Regression coverage

    • Extend ode_hmax to cover RHS-triggered interruption and assert that the solver returns the prior accepted state rather than a partially advanced trial state.

Example updated callback shape:

subroutine fun(n, y, f, ires)
  integer, intent(in) :: n
  real(wp), intent(in) :: y(n)
  real(wp), intent(inout) :: f(n)
  integer, intent(inout) :: ires

  f(1) = -y(1)
  if (should_stop(y)) ires = -1
end subroutine

Copilot AI and others added 3 commits May 12, 2026 19:59
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/4b6afe5b-daf3-4c54-a604-ea10ab860a5b

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/4b6afe5b-daf3-4c54-a604-ea10ab860a5b

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/4b6afe5b-daf3-4c54-a604-ea10ab860a5b

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
@ivan-pi ivan-pi marked this pull request as ready for review May 12, 2026 20:13
@ivan-pi ivan-pi merged commit 83da099 into main May 12, 2026
2 of 4 checks passed
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.

2 participants