Skip to content

Keep POD-DEIM ROMs array-based for v1 - #178

Merged
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:mor-v1-array
Sep 6, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:mor-v1-array

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Ignore this PR until reviewed by @ChrisRackauckas.

The previous implementation kept the full-order MethodOfLines solve array-based but returned scalar reduced dynamics and one reconstruction equation per full-order state. This replaces the high-level reduction with one array dynamics equation and one array reconstruction per source field, stores the full lift as an array parameter, and prepares the package for v1.0.0.

The system and DAE entry points now share this path. Offline reduction substitutes eliminated algebraic variables with full_equations, evaluates nonlinear training snapshots without generating full-order scalar functions, preserves parameter defaults, and uses the DAE problem's actual training parameters and times. The ROM is a fresh System with consistent projected initial state and derivative values; the examples construct array-form DAEProblems.

This supersedes #177 and builds on the array representation explored in #174 and addresses the review at #177 (comment).

Compilation evidence

For fixed POD/DEIM dimensions, field count, forcing expression count, and nonlinear stencil size, the generated ROM graph is independent of the full-order grid. The structural regression checks equation/observable counts and tree sizes across two MethodOfLines grids. The checked-in benchmark/array_compilation.jl separately measures offline reduction, problem construction, first RHS evaluation, and first reconstruction.

Fresh Julia 1.12.7 processes, two POD/DEIM modes, one array field with pointwise cubic dynamics:

Full states Dynamics arrays Reconstruction arrays Construction compiler time RHS compiler time Reconstruction compiler time
32 1 1 5.867 s 0.329 s 0.213 s
128 1 1 6.008 s 0.411 s 0.212 s
512 1 1 6.000 s 0.328 s 0.359 s
2048 1 1 5.980 s 0.391 s 0.241 s

These are compiler counters from @timed, excluding package loading. Offline time increased from 18.16 to 20.55 seconds across those sizes. Offline reduction, problem construction, lift storage, and full-field evaluation are not claimed to be O(1).

Failing before / passing after

The same test/array_structure.jl was copied into an unchanged checkout of 3ef906c and run with the same dependency versions:

TMPDIR="$PWD/../validation/tmp" /home/crackauc/.juliaup/bin/julia +1.12 --check-bounds=yes --depwarn=yes --warn-overwrite=yes --startup-file=no --project=../validation/before-env ../ModelOrderReduction.jl/test/array_structure.jl
Expression: length(equations(rom)) == 1
Evaluated: 2 == 1
Expression: length(observed(rom)) == 1
Evaluated: 4 == 1
parameter defaults: Error During Test
UndefVarError: `α` not defined in `Symbolics`
Test Summary:         | Pass  Fail  Error  Total
array ROM regressions |    3     2      1      6

Local verification

TMPDIR="$PWD/../validation/tmp" GROUP=Core /home/crackauc/.juliaup/bin/julia +1.12 --project -e 'using Pkg; Pkg.test()'
Core/DataReduction.jl   | 15  15
Core/array_structure.jl |  6   6
Core/deim.jl            | 44  44
Core/interface.jl       | 30  30
Core/utils.jl           | 11  11
Testing ModelOrderReduction tests passed

106/106 passed, including all six assertions in the same regression file used above.

TMPDIR="$PWD/../validation/tmp" GROUP=QA /home/crackauc/.juliaup/bin/julia +1.12 --project -e 'using Pkg; Pkg.test()'
QA/jet_tests.jl |  5   5
QA/qa.jl        | 21  21
Testing ModelOrderReduction tests passed
TMPDIR="$PWD/../validation/tmp" GKSwstype=100 timeout 3600 /home/crackauc/.juliaup/bin/julia +1.12 --check-bounds=yes --depwarn=yes --warn-overwrite=yes --startup-file=no --project=docs docs/make.jl

Full Documenter build, doctests, executed tutorial, rendering, and link checks passed; recorded exit status 0. Local deployment was skipped by Documenter.

Repository-wide Runic --check ., typos, and git diff --check all exited 0.

All 10 PR validation checks passed for commit 2455dd6, including release/LTS/prerelease tests, QA, downgrade tests, and documentation. Test matrix: https://github.com/SciML/ModelOrderReduction.jl/actions/runs/33962122865.

MethodOfLines integration and release dependency

MethodOfLines 1.3.0 requests each grid point's observed function separately when packaging PDE solutions. The companion fix, SciML/MethodOfLines.jl#676, requests one array evaluator per field. Ship v1 with that fix released and raise the MethodOfLines compatibility floor when its release is available. Until then, use the two branches together for automatic PDE reconstruction; explicit whole-array evaluation already has the measured behavior above.

The final combined checkouts pass all 106 MOR Core assertions. The companion passes 18 solution-interface tests and 21 QA checks, including a regression that fails on unmodified MethodOfLines master (12/26 observed requests instead of 2) and passes after (2 requests on both grids).

With the two branches, actual PDE reconstruction in fresh Julia processes compiled in 6.802 s for 32 intervals and 5.725 s for 512 intervals, with two POD/DEIM modes and three saved times. The measurement includes PDE field packaging and interpolation construction; it excludes package loading, discretization, offline reduction, and problem construction. The full reproducer and timings are in the companion PR.

Scope and review decisions

  • The v1 representation uses array-form DAEProblem code generation. Scalarizing the returned system forfeits this compilation property. The low-level matrix-projection overload remains available.
  • The DAE must become an explicit first-order ODE after algebraic elimination. This is not a general descriptor-DAE projection algorithm.
  • Differential states use the POD lift. Eliminated algebraic states use a least-squares fit to training snapshots; reconstructed boundary constraints are approximate. The numerical tests cover a matrix DEIM RHS oracle, a parameterized nonautonomous trajectory, multidimensional ordering, and FitzHugh–Nagumo field reconstruction.
  • Direct symbolic-array reconstruction uses the public SymbolicIndexingInterface.observed function. A separate convenience-indexing bug was reduced to a ModelingToolkit-only reproducer and reported at Array observed state is misclassified as parameter-only by getu ModelingToolkit.jl#5072. PDE metadata-based field retrieval is tested.
  • SciMLBase is added as a runtime dependency; its MIT license matches this package’s MIT license. Julia LTS/prerelease and downgrade configurations were not run locally; remote checks cover those configurations. One early baseline run and one development run were killed by a signal, with no assertion result; the focused baseline reproduction and final validation are reported above.

Links

🤖 Generated with Codex CLI 0.153.4 (model: gpt-6-astra; local session: 01a070dd-d97a-7180-9b71-095f2a5f5489). Transcript: /home/crackauc/.codex/sessions/2026/09/05/rollout-2026-09-05T05-19-42-01a070dd-d97a-7180-9b71-095f2a5f5489.jsonl.

Return array dynamics and field reconstruction from both high-level entry points.
Evaluate training snapshots and consistent initial derivatives offline, retain the
training parameter point, and substitute eliminated algebraic variables before
projection. Add numerical and graph-size regressions and a compilation benchmark.

Document the offline complexity boundary and fitted algebraic reconstruction.
Track the independent array-indexing issue at
SciML/ModelingToolkit.jl#5072.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: /home/crackauc/.codex/sessions/2026/09/05/rollout-2026-09-05T05-19-42-01a070dd-d97a-7180-9b71-095f2a5f5489.jsonl
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 6, 2026 06:23
@ChrisRackauckas
ChrisRackauckas merged commit 22950b5 into SciML:main Sep 6, 2026
10 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.

3 participants