Skip to content

incorporate time/stab filter for larger steps in FBDF - #3878

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
KeshavVenkatesh:fbdf-time-filter
Sep 7, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
KeshavVenkatesh:fbdf-time-filter

Conversation

@KeshavVenkatesh

Copy link
Copy Markdown
Contributor

Checklist

This is my first attempt to incorporate the time/stab filter to fbdf methods.

@KeshavVenkatesh

KeshavVenkatesh commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Test 1: Exp decay u'=-u, t=[0,10], exact=exp(-10), accuracy-limited

Algorithm tol steps nf err err/tol avg_dt retcode


FBDF 1e-04 48 55 1.027e-05 0.10 2.083e-01 Success
FBDF+TF 1e-04 32 130 8.585e-05 0.86 3.125e-01 Success
MOOSE234 1e-04 3 10 3.039e-01 3039.39 3.333e+00 Success
✓ TF larger steps: 48→32 steps, avg_dt 0.20833333333333334→0.3125 (1.5x)

FBDF 1e-06 84 122 7.760e-08 0.08 1.190e-01 Success
FBDF+TF 1e-06 68 142 1.292e-07 0.13 1.471e-01 Success
MOOSE234 1e-06 65 344 4.517e-06 4.52 1.538e-01 Success
✓ TF larger steps: 84→68 steps, avg_dt 0.11904761904761904→0.14705882352941177 (1.2352941176470589x)

FBDF 1e-08 188 201 8.130e-11 0.01 5.319e-02 Success
FBDF+TF 1e-08 159 247 4.113e-10 0.04 6.289e-02 Success
MOOSE234 1e-08 263 1809 1.373e-07 13.73 3.802e-02 Success
✓ TF larger steps: 188→159 steps, avg_dt 0.05319148936170213→0.06289308176100629 (1.1823899371069182x)

FBDF 1e-10 423 538 5.210e-11 0.52 2.364e-02 Success
FBDF+TF 1e-10 377 497 1.102e-11 0.11 2.653e-02 Success
MOOSE234 1e-10 897 6853 2.372e-09 23.72 1.115e-02 Success
✓ TF larger steps: 423→377 steps, avg_dt 0.02364066193853428→0.026525198938992044 (1.1220159151193634x)

@KeshavVenkatesh

Copy link
Copy Markdown
Contributor Author
plot_fbdf_exp_err_vs_steps

@KeshavVenkatesh

Copy link
Copy Markdown
Contributor Author

@ChrisRackauckas : Could you please review this PR?

1 similar comment
@KeshavVenkatesh

Copy link
Copy Markdown
Contributor Author

@ChrisRackauckas : Could you please review this PR?

@ChrisRackauckas
ChrisRackauckas merged commit 3ec4193 into SciML:master Sep 7, 2026
125 of 136 checks passed
@ChrisRackauckas

Copy link
Copy Markdown
Member

I'm fixing this up, it was an accidental merge.

ChrisRackauckas added a commit that referenced this pull request Sep 8, 2026
* Add the FBDF time filter helpers and their cache workspace

The time/stab filter merged in #3878 called `backdiff`, `bdf_and_filt_coeff`
and `bdf3stab_coeff`, none of which existed, so `FBDF(time_filter = true)`
threw and JET's typo pass flagged the undefined globals. Add them in in-place
form, together with the small divided-difference and step-ratio kernels the
filter needs, and preallocate their time/coefficient buffers on both FBDF
caches so the filter does not allocate per step.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor
Agent-Model: claude-opus-5-thinking-high
Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish
Co-authored-by: Cursor <[email protected]>

* Enable the FBDF time filter for in-place problems

The filter was only wired into the out-of-place `perform_step!`, so
`FBDF(time_filter = true)` silently fell back to plain FBDF for in-place
problems. Lift both paths into `_fbdf_time_filter`/`_fbdf_time_filter!` with
the same candidate selection, reusing the `u₀`/`terk_tmp`/`terkp1_tmp`
scratch that is already dead by the time the error estimates are in, so the
in-place path stays allocation free.

The in-place step derives `fsallast` from the converged Newton condition
rather than calling `f`, which is only valid at the nonlinear solution, so
the filter now evaluates `f` itself whenever it moves `u`, and reuses that
evaluation for its own residual-based error estimate. The order-4 candidate
is skipped at `k == max_order` so the filter cannot emit a solution above
the requested order, and the residual estimate falls back to halving the
lower-order one under a mass matrix, where the identity it relies on does
not hold. The out-of-place error estimates need no pre-filter copy since
nothing between the solve and the filter mutates `u`.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor
Agent-Model: claude-opus-5-thinking-high
Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish
Co-authored-by: Cursor <[email protected]>

* Cover the FBDF time filter from the Core test group

`fbdf_filter_accuracy.jl` was a benchmarking script that nothing ran, so it
could not catch the missing helpers. Replace it with a test that exercises
both the in-place and out-of-place filter paths on smooth, stiff and mass
matrix problems, and pins the opt-in default by checking that
`time_filter = false` reproduces plain `FBDF()` exactly.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor
Agent-Model: claude-opus-5-thinking-high
Agent-Session: local OrdinaryDiffEq fbdf-time-filter-finish
Co-authored-by: Cursor <[email protected]>

* Correct FBDF filter weights, candidate control, and restart history

Derive the order-raising correction from the actual fixed-coefficient solve
on unequal steps. Keep each candidate's state, derivative, error estimate,
and reported order together, preserve BDF3-Stab at max_order=3, and use the
selected order in step-size control. Repair filtered fixed-step history,
restart bookkeeping, and dense output. Reject unsupported mass-matrix
filtering explicitly and document the numerical and performance limits.

The original PR fails 42 of the 70 primary regression assertions. The fixed
implementation passes all 314 targeted assertions, including irregular-grid
local convergence, candidate control, dense output, callbacks, and restarts.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl

* Use the owning module for public solver APIs in filter tests

Qualify the Core controller and interpolation functions through their public
owner. The aliases resolve to identical function objects; all 314 targeted
assertions still pass.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: local transcript /home/crackauc/.codex/sessions/2026/09/08/rollout-2026-09-08T04-52-13-01a08037-c26f-7662-aece-ff6e2be97b48.jsonl

---------

Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Codex <[email protected]>
ChrisRackauckas added a commit that referenced this pull request Sep 11, 2026
- Precompile SDE solves through specialization levels (#4467)
- Add 32-bit InterfaceI CI lane via test_groups.toml (#4480)
- incorporate time/stab filter for larger steps in FBDF (#3878)
- Keep 32-bit CI lane hard-failing. (#4482)
- Correct and validate FBDF time and stability filters (#4484)
- Keep DAE init from overwriting uprev during callback truncation (#4486)
- DiffEqBase: Int64 interp_points range length for 32-bit (#4487)
- Release OrdinaryDiffEqBDF 2.4.7 (#4490)
- Unify companion global error estimators into GlobalErrorEstimation (#4492)
- Add adjoint-based global error control as a SciMLSensitivity extension (#3953)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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