Repository navigation
discontinuity: D14, a screen of every step so that a pair of crossings inside one step is found, and its three cases (#2071) - #2154
Merged
Conversation
… rate law, an SBML piecewise and an SBML event band_window is a harmonic oscillator about m = 2 whose X runs through the band (1.985, 2.015) twice a period where it is fastest, a window of 0.03 each time and 10 over the run, while Y grows at k inside the band. band_window_sbml writes the band as an SBML piecewise, and band_window_event as an SBML event that adds 1 to N as each window opens. Each is judged against a closed form, band_oscillator in _closed_forms.py: the windows' edges by the arcsine, with their derivatives in every parameter by the dual numbers. Finite differences and the branchwise integration check it. On main, CVODES's steps at rtol 1e-6 and 1e-8 often outrun a window, which then opens and closes inside one step, and the run loses it with no warning. band_window loses 7 of its 10 windows at rtol 1e-6 and 6 at 1e-8. The SBML piecewise keeps only 0 to 3 of the 10, and the event fires 5 times of 10 at rtol 1e-6. The marks name #2055 and, for the event, #2056: 54 marks with the compiled twins. The 15 flip-table entries come from 480 draws on main 4d590ea (FLIPS_2071). Signed-off-by: Bill Hlavacek <hlavacek@lanl.gov>
… crossings inside one step is found D14 is the integrator contract's decision for a residual that crosses its surface and crosses back inside one CVODES step, where the root finder reads the same side at both ends. The maintainer took (a) on 2026-12-04. After every step, every root of #1922's table is read at places inside the step on CVODES's interpolant: a state switch's residual, a boolean condition and an event's trigger alike. A crossing found there is located and restarted at as any other. A window narrower than the readings' spacing, or shallower than the bar a reading must clear, is conceded. The options not taken are listed with their costs: a bound on the step near a surface, the loss conceded, and a refusal by name. G3 gains D14's paragraph, today's look and window screen, and the band cases. G12 lists the SBML forms for the loaders, and D11 (a)'s roots on t are now screened too. The case table and "What no case checks yet" are updated. In the tolerance table, the look's constants and kScreenSpan now go in phase 3. The readings' number, spacing and bar join the numbers the contract leaves to the table. Signed-off-by: Bill Hlavacek <hlavacek@lanl.gov>
…ach earlier section's are Signed-off-by: Bill Hlavacek <hlavacek@lanl.gov>
…e second band row's 9 windows The contract's count of compiled twins was that of #2046, 5,685 in 70 cases. It now also gives 5,745 in 73 since #2071, and says that each of the band cases' 60 twins passes on as many of the 480 draws as its interpreter point. D14's suite timing covers the 75 state-switch cases the suite had before #2071. The band row X0 = 2.5, V0 = 2.6 has 9 windows before t = 30, not 10, which the row's comment and the judge's reason now say. The docstring of _flipgen.py names the section of #2071. Signed-off-by: Bill Hlavacek <hlavacek@lanl.gov>
…381582864 (Linux x86_64): 21,907 rows, the 223 new ones added, all 54 new marks non-PASS and every other new row PASS, no existing row's outcome or subclass changed Signed-off-by: Bill Hlavacek <hlavacek@lanl.gov>
Merged
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.
Fixes #2071
This is #1781's phase 1.4. It takes decision D14 of the integrator contract,
which asks what phase 3's engine owes when a residual crosses its surface and
crosses back inside one CVODES step. In that case the root finder reads the same
side at both of the step's ends and never sees the pair. The maintainer took
option (a) on 2026-12-04: after every step, every root is read at places inside
the step on CVODES's interpolant, and a crossing found there is located and
restarted at as any other. That covers a state switch's residual, a boolean
condition and an event's trigger alike. A window narrower than the readings'
spacing, or shallower than the bar a reading must clear, is conceded.
The cases.
_cases/pair.pyaddsband_window,band_window_sbmlandband_window_event. Each is a harmonic oscillator about m = 2 whose X runsthrough a band 0.03 wide twice a period, where X is fastest: 10 windows over the
run, while Y grows inside the band. The three are the band written as a
.netrate law, as an SBML piecewise, and as an SBML event that counts each window's
opening. The reference is a closed form with every parameter's derivative
(
band_oscillator), checked by finite differences and by the branchwiseintegration.
What main does. At rtol 1e-6 and 1e-8, CVODES's steps here often outrun a
window, and the run loses it with no warning:
.netrate law (Y's windows kept, of 10)Today's look reads inside a step only where the step takes a quarter of what is
left to the next stop. The window screen reads only the last step of each batch,
and only where it takes 1/64. Both read only a state switch's signed residual,
never a boolean condition or an event's trigger. The
marks name #2055 and, for the event, #2056: 54 marks with the compiled twins.
The 15 new flip-table entries come from 480 draws on main 4d590ea. They include
the rtol 1e-10 points, which lose two windows on about two thirds of their draws.
What D14 costs, measured. I measured it on a build of main that runs today's
screen on every step and every residual. That build is not in this PR.
take 1.13 times as long. 81
periodic_clockrows that fail today pass, and norow gets worse.
and 2.56 times at most.
long, and 3.89 times at most. No model among the 1,266 that run hides a pair in
one step.
band_window: it keeps all 10 windows at every rtol.The contract lists the options not taken and why. A bound on the step that no
window fits inside costs 464 to 2,841 steps a period, where CVODES takes 140 to
490. Conceding the loss leaves a silent wrong answer. A refusal needs the same
readings as the screen.
The docs.
G12's loaders, a note on D11 (a), "What no case checks yet" and the case table.
kScreenSpannow go in phase 3,and the readings' number, spacing and bar join the numbers the contract leaves
to the table.
Review
By an AI model: Claude Fable 5.2 at its default effort, 2 rounds. Round 1 was a whole-branch review by a fresh reviewer, blind, of the whole diff from main. Round 2 was the same reviewer on the fix commits. Round 2 found nothing. Commits after the last round: aee36ea, the nightly baseline from this PR's own run, which changes only
parity_checks/nightly/baselines/discontinuity.json. a17d63e's message was also reworded after the last round, because a line starting with "#" had been read as a comment.band_oscillatoragainst an independent root-finding reference and central differences on all three rows and all seven columns. It also recounted the cases, rows, marks, flip entries, the case table and the tolerance table's tallies, re-ran 17 suite points on today's build, and checked the docs' account of the look and the window screen againstsrc/cvode_simulator.cpp. Its findings:kind_2071had no test, where every earlier section's rule has one. It now has one, which fails on 5 breaks I made and 12 of the reviewer's 16 mutants; the other 4 change no outcome.Left alone
EVENT_JUDGEis 5e3 so that dX/dw at t = 30 (745 times its tolerance at rtol 1e-12) clears the near-miss band. It still tells a lost firing (1e5 times or more) from a pass, but it also judges X and V five times more loosely than the default. Its reason says so.diffrax_state, which the same paragraph covers under the JAX path.Testing
parity_checks/tests/(discontinuity),python/tests/test_discontinuity_slice.pyand
python/tests/test_tolerance_table_ratchet.py: 1,512 passed and 162expected failures. The new slice points fail on main where marked.
parameter rows in both of its forms, and against the branchwise integration on
three. The event's count is checked against its windows' openings.
--no-verify, because the pre-push hook made a fresh venv in the worktree with no pytest-xdist. I ran the tests that read the docs (test_docs_api_examples.py, the ratchet,test_skip_audit.pyand the slice: 584 passed) and the discontinuity tests above. CI's Python legs are the full-suite check.(47381582864, Linux x86_64)
over the committed baseline, as the nightly README says to. Before copying, I checked
that the run has the suite's 21,907 rows, that none of the old 21,684 rows changed its
outcome or subclass, that all 54 new marks fail (DIFF), and that the other 169 new rows
pass.
test_discontinuity_format.pypasses with it (28 passed).