Repository navigation
Compare complete/mtkcompile array-unknown problems through symbolic indices - #5154
Merged
ChrisRackauckas merged 1 commit intoSep 14, 2026
Conversation
…mbolic indices The "Array unknowns on a `complete`d system" testsets compared the raw `u0`, `f` and `g` vectors of the `complete`d and the `mtkcompile`d problem. The order of the scalarized unknowns after `mtkcompile` is not part of the contract: once ModelingToolkitTearing is loaded it comes out reversed, and for the nonlinear system tearing solves every unknown symbolically, so `u0 === nothing`. Compare `mprob[x]`/`mprob[w]` with the `complete`d problem and index the `f`/`g` evaluations through `variable_index` instead; for the nonlinear system only the solution is comparable. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Agent-Harness: Claude Code Agent-Model: claude-fable-5-1 Agent-Session: https://claude.ai/code/session_01VorhgJYhDasyVLpGNrviga Claude-Session: https://claude.ai/code/session_01VorhgJYhDasyVLpGNrviga
This was referenced Sep 14, 2026
ChrisRackauckas
marked this pull request as ready for review
September 14, 2026 10:21
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 14, 2026
- Document the PDE solution interface shared by discretizers (#5149) - Point the docs `ModelingToolkit` source at the repository root (#5152) - Unify array-equation support behind a capability trait; fold in #5101 ODE support and MultiObjectiveOptimizationFunction (#5148) - Raise SymbolicIndexingInterface compat lower bound to 0.3.47 (#5153) - Compare `complete` and `mtkcompile` array-unknown problems through symbolic indices (#5154) 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) <noreply@anthropic.com>
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.
What changed and why
#5131 added "Array unknowns on a
completed system" testsets tolib/ModelingToolkitBase/test/{odesystem,sdesystem,nonlinearsystem}.jlthat compare thecompleted problem with themtkcompiled one by their rawu0,fandgvectors. The order of the scalarized unknowns aftermtkcompileis not guaranteed: with ModelingToolkitBase alone it happens to match, but as soon as ModelingToolkit (ModelingToolkitTearing) is loaded it comes out reversed, and for the nonlinear system tearing solves every unknown symbolically somprob.u0 === nothing. The roottests / InterfaceIandInterfaceIIjobs load ModelingToolkit before including these files, so master has been red there since the #5131 merge commit 444ccfb on Julia 1 and lts (https://github.com/SciML/ModelingToolkit.jl/actions/runs/34779646543, jobs 103789585218, 103789585230, 103789585194, 103789585183); the previous commit 8689e54 was green. Noticed on #5148.The code behaviour is correct (
mprob[x] ≈ prob[x],msol[x][end] ≈ sol[x][end], andmsol[z] ≈ sol[z]all hold), so this changes only the assertions: compare themtkcompiled problem through symbolic indexing (mprob[x],mprob[w], andf/gevaluations permuted throughvariable_index) instead of by raw position, and for the nonlinear system, where tearing leaves nothing to solve, compare only the solutions. Test-only change; no source files are touched.Verification (Julia 1.10.11,
Pkg.developof the clone root — ModelingToolkit 11.43.1, ModelingToolkitTearing 1.20.6 — withusing ModelingToolkitbefore the testset, astest/shared/mtktestset.jldoes)Before (master
444ccfb0testsets, extracted verbatim):After (this branch, same environment):
The rewritten testsets also pass with ModelingToolkitBase alone (no tearing) in the downgrade-style environment (SymbolicIndexingInterface 0.3.47, SciMLBase 3.54.0, Symbolics 7.37.0, SymbolicUtils 4.37.0, DiffEqBase 7.18.1): ODE 26/26, SDE 12/12, nonlinear 11/11.
typosand Runic (julia -m Runic --check) report nothing on the three files.Not verified
odesystem.jl/sdesystem.jl/nonlinearsystem.jlfiles or the fullInterfaceI/InterfaceIIgroups, and only on Julia 1.10.11 (CI fails on Julia 1 and lts; Julia pre passes on master, presumably because the ordering there happens to match).MethodError: no method matching symbolic_container(::ModelingToolkitBase.IndexCache)(SymbolicIndexingInterface ≤ 0.3.46); that is Raise SymbolicIndexingInterface compat lower bound to 0.3.47 #5153.🤖 Generated with Claude Code (model: claude-fable-5-1)
https://claude.ai/code/session_01VorhgJYhDasyVLpGNrviga