Skip to content

Add callback-driven step rejection/retry for physical constraint handling in stiff3 - #34

Draft
ivan-pi with Copilot wants to merge 7 commits into
mainfrom
copilot/add-ode-integrator-guidance-mode
Draft

Add callback-driven step rejection/retry for physical constraint handling in stiff3#34
ivan-pi with Copilot wants to merge 7 commits into
mainfrom
copilot/add-ode-integrator-guidance-mode

Conversation

Copilot AI commented May 9, 2026

Copy link
Copy Markdown
Contributor

stiff3 previously let solout either continue or abort integration, but had no way to mark an accepted step as physically invalid (e.g., positivity violation) and retry with a smaller step. This PR adds a DASSL-like communication path so callers can reject accepted steps and drive the integrator toward physically admissible states.

  • Callback contract extension (irtrn)

    • irtrn = 0: keep accepted step (unchanged)
    • irtrn = -1: reject accepted step and retry with reduced step size
    • irtrn < -1: interrupt integration (existing behavior)
  • Core integrator retry/backtracking flow

    • On irtrn = -1, the solver now:
      • rolls back to the previous accepted state (x, y, cached RHS/Jacobian context),
      • halves the step size,
      • retries the same step attempt.
    • Adds bounded retry safeguards:
      • per-step maximum physical rejections,
      • minimum-step cutoff tied to integration scale to avoid pathological micro-stepping.
  • Documentation and regression coverage

    • README now documents the solout return-code semantics.
    • Added a focused regression test covering:
      • successful one-time reject/retry recovery,
      • repeated rejection path stopping with rollback semantics.
subroutine out(nr, xold, x, y, iha, qa, irtrn)
  ! Reject step if solution violates a physical bound:
  if (any(y < 0.0_wp)) then
    irtrn = -1   ! rollback + halve step + retry
  end if
end subroutine

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 9, 2026 that may be closed by this pull request
Copilot AI and others added 6 commits May 9, 2026 08:00
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/51809c26-e83e-4103-89a1-179085fde8ef

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/51809c26-e83e-4103-89a1-179085fde8ef

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/51809c26-e83e-4103-89a1-179085fde8ef

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ivan-pi/stiff3/sessions/51809c26-e83e-4103-89a1-179085fde8ef

Co-authored-by: ivan-pi <21085643+ivan-pi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add mode for guiding ODE integrator to physical values Add callback-driven step rejection/retry for physical constraint handling in stiff3 May 9, 2026
Copilot AI requested a review from ivan-pi May 9, 2026 08:04
Copilot finished work on behalf of ivan-pi May 9, 2026 08:04
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.

Unphysical step communication

2 participants