Repository navigation
Safeguard steady-state steps during fast transient growth - #211
Merged
Merged
Conversation
jc-macdonald
force-pushed
the
fix/209-steady-state-safeguards
branch
from
October 14, 2026 00:06
11891d8 to
5aa8ba5
Compare
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.
steady_statepreviously accepted every candidate and reduced the next pseudo-time step during fast transient growth. The #209 reproduction either exhausted its iteration budget or diverged after entering negative compartments. Reject non-finite or excessively growing candidates, retain the previous state, and halve the step; accepted transient growth now holds the step.Adds optional
nonnegative=Trueor a boolean mask. Infeasible candidates, including the final Newton correction, are rejected without clipping conserved totals or evaluating the RHS outside the guarded domain. Singular NumPy solves use the same rejection path, and acceptance remains array-valued under JAXjit/vmap.With non-negativity enabled, the three reproduction cases reach their analytic endemic equilibria in 66, 30, and 33 attempts, with relative invariant drift below 2e-16. Signs remain unrestricted by default, and rejected attempts count toward the iteration budget.
Algorithm research favored safeguarded pseudo-transient continuation for this coupled, namespace-portable solver. Brent/bisection require a scalar sign-changing bracket, while the existing curvature utilities generate spatial grids. The guide links the primary SciPy documentation, projected PTC research, and PETSc timestep-verification documentation.
Closes #209.
Validation:
jit/vmap, residual-growth and non-finite rejection, singular-step recovery, selected bound masks, guarded RHS evaluation, and the final Newton correction.