Skip to content

Give the reduced system its own time span - #181

Merged
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:feat/rom-carries-tspan
Sep 7, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:feat/rom-carries-tspan

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until reviewed by @ChrisRackauckas.

Blocked on ModelingToolkit 11.42.0 being released. The compat floor here is ModelingToolkit = "11.42", which does not exist yet, so CI cannot resolve until SciML/ModelingToolkit.jl#5091 merges and MTK is released. Everything below was verified locally against that branch.

Closes the ModelOrderReduction half of #29.

The reduced system now carries its own time span, so a problem can be built from it without repeating one:

deim_sys = deim(full_prob, sol, pod_dim)
deim_prob = DAEProblem(deim_sys, nothing; build_initializeprob = false)   # was: ..., full_prob.tspan

Where the span comes from

  • The problem method takes prob.tspan. That is the interval the reduction was actually trained on, so it is the honest default for the reduced model.
  • The system method takes get_tspan(sys), inheriting whatever the source system carries.
  • A source with no time span yields a reduced system with no time span, rather than a fabricated interval. Passing one explicitly still overrides.

The README and the FitzHugh-Nagumo tutorial drop the now-redundant full_prob.tspan argument.

Background

System gained a tspan field in SciML/ModelingToolkit.jl#5085, released as ModelingToolkitBase v1.69.0 (JuliaRegistries/General#167382, merged 10:01Z today). Every time-dependent problem constructor defaults to it. The floor here is MTK 11.42 rather than 11.41 because MTK 11.41 floors ModelingToolkitBase = "1.64", so an 11.41 user can resolve MTKBase 1.68 and not have the field at all; PR 5091 raises that floor to 1.69.

Verification

Julia 1.12.7, against local checkouts of ModelingToolkitBase 1.69.0 and the ModelingToolkit 5091 branch.

=== deim exit 0 (252s)
training parameters and nonautonomous nonlinearities |    4      4   3.1s
ODEProblem sources and scalar code generation        |    9      9  19.0s
nonautonomous linear terms                           |    5      5   3.1s
the reduced system carries a tspan                   |    8      8   2.9s
=== array_structure exit 0 (35s)
array ROM regressions                                |   15     15  24.5s
=== full_order exit 0 (27s)
separate_terms                                       |   15     15   7.1s
FullOrderModel                                       |   17     17   7.6s

Behaviour of the four cases, measured directly:

ROM tspan from problem: (0.0, 0.5)
DAEProblem without tspan: (0.0, 0.5)
solve: Success
relative error: 3.477844813759253e-7
ROM tspan from system:  (0.0, 0.5)
DAEProblem without tspan: (0.0, 0.5)
ROM tspan when source has none: nothing
explicit tspan still works: (0.0, 1.0)

The full Documenter build, with the tutorial now omitting the time span, exits 0.

Runic --check ., typos, and git diff --check all exit 0.

Not verified

  • GROUP=QA was not re-run; this PR adds no public name and changes no import.
  • Julia LTS and prerelease, and the downgrade configuration, were not run locally. Note the downgrade job will resolve ModelingToolkit at its floor, which is the whole point of moving the floor to 11.42.
  • CI on this PR cannot pass until MTK 11.42.0 is registered, as described at the top.

Review notes

  • Taking prob.tspan for the problem method is a judgement call. The alternative is the source system's own span, which for a MethodOfLines discretization is the PDE's t domain and usually identical. I went with the problem because that is the interval the snapshots came from, and because a user who solved a sub-interval probably wants the reduced model to describe that sub-interval.
  • The test compat in test/Project.toml moves to 11.42 as well, so the test environment cannot silently resolve an older MTK that lacks the field.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H5RuLDtEazwTKPkNbPeZVu

Inherit a time span from the source: prob.tspan for the problem method,
which is the interval the reduction was trained on, and get_tspan(sys)
for the system method. A problem can then be built from the reduced
system without repeating one, and the README and tutorial no longer do.
A source without a time span still yields a reduced system without one.

Requires the tspan field on ModelingToolkit.System, so the compat floor
moves to ModelingToolkit 11.42.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.263
Agent-Model: claude-opus-5
Agent-Session: https://claude.ai/code/session_01H5RuLDtEazwTKPkNbPeZVu
Claude-Session: https://claude.ai/code/session_01H5RuLDtEazwTKPkNbPeZVu
Comment thread AGENTS.md Resolved
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 7, 2026 11:08
@ChrisRackauckas
ChrisRackauckas merged commit d84ab37 into SciML:main Sep 7, 2026
4 of 6 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