Skip to content

Do not tear large linear blocks of stationary systems - #5352

Merged
AayushSabharwal merged 7 commits into
SciML:masterfrom
xtalax-droid:forge/stationary-linear-tearing
Nov 6, 2026
Merged

AayushSabharwal merged 7 commits into
SciML:masterfrom
xtalax-droid:forge/stationary-linear-tearing

Conversation

@xtalax-droid

Copy link
Copy Markdown
Contributor

mtkcompile of a large, purely linear steady system collapses it badly. MethodOfLines' steady 2D Laplace 5-point stencil (Dirichlet u = x*y, rows scaled by 1/h^2) is a good example: at n = 9 (81 unknowns) tearing leaves 8 iteration variables plus 74 solved observed, at n = 11 NewtonRaphson reports Stalled, and at n = 31 it reaches 6e23 error. The stencil interior is one big strongly connected component of the equation-unknown graph that is linear in its own unknowns; tearing turns it into a boundary strip of iteration variables plus a recursion u[i+1,j] = 4u[i,j] - ... whose roundoff grows exponentially with n. (The 127 cap on integer coefficients, manual_dispatch_is_small_int in ModelingToolkitTearing, is why the 1/h^2-scaled rows never reach the exact integer linear subsystem; widening it is not the fix, since the rows that are in that subsystem go through Bareiss triangularisation, which fills in densely and overflows Int64 (#5332), and it does nothing for non-integer coefficients.)

For systems with no independent variable, a strongly connected component of more than max_linear_scc_tearing (default 16) equations that are all linear in the component's own unknowns is now left untorn: its rows are withheld from the exact-Bareiss path and its variables stay unknowns solved together by the nonlinear solver. max_linear_scc_tearing is a new keyword of dummy_derivative, reachable from mtkcompile; max_linear_scc_tearing = typemax(Int) restores the old behaviour. Time-dependent systems already have inline_linear_sccs and are unchanged, as are small blocks (n <= 6 grids).

Hand-written stencil system (n x n scalar unknowns, 1/h^2 scaling, NewtonRaphson), unknowns / observed / max error / retcode:

n master this PR
7 9 / 41 / 7e-16 / Success 25 / 25 / 2e-16 / Success
9 8 / 74 / 4.5e-13 / Stalled 49 / 33 / 2e-16 / Success
11 10 / 112 / 1.3e-10 / Stalled 81 / 41 / 4e-16 / Success
15 14 / 212 / 2.2e-5 / Stalled 169 / 57 / 6e-16 / Success

Every case solves in one Newton step with this PR. On MethodOfLines master with this PR, the discretized steady Laplace gives n = 9 / 11 / 31 / 61 with 49 / 81 / 841 / 3481 unknowns and max error 4e-16 / 1.5e-15 / 4e-16 / 9e-16. The retcode is Success for n = 9 and 11 but Stalled for n = 31 and 61 even though the solutions are exact: that is the roundoff floor of the 1/h^2 stencil residual against NonlinearSolve's default abstol and is handled on the MethodOfLines side (its steady-state branch scales abstol). The 400-unknown mixed-derivative case (order 4, 20x20) returns Success.

Not fixed here: all-integer-coefficient stencils (coefficient 1, n >= 7) and the 1/h^2 stencil at n = 5 still hit the Int64 OverflowError in alias elimination, which runs before tearing; that is the separate problem in #5332. The wrapper replicates a three-line preamble of StateSelection's dummy_derivative_graph! because that function drops tearing_alg; it could drift if StateSelection changes, and an upstream change to forward tearing_alg would let this shrink. I tested Julia 1.12.1 only. The untorn block gives a larger Jacobian than the torn one, which on Julia 1.10 can only make the inference stack overflow MethodOfLines saw with jac = true on large Jacobians more likely, not less.

Tests: new test/structural_transformation/ file (13/13) covering the collapse, solve accuracy, unchanged behaviour for small and nonlinear blocks, and the keyword. InterfaceI on the branch merged with current master: 1718 passed, 0 failed, 3 broken; Initialization passed before the merge with master and was not rerun after it. Codex review approved without findings.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

xtalax and others added 2 commits November 2, 2026 17:42
Tearing the interior of a discretized Laplace equation selects a boundary strip as iteration variables and solves the rest by a recursion whose conditioning degrades exponentially with the grid size (Newton stalls from about 8x8, error 6e23 at 31x31 in MethodOfLines). For systems without an independent variable, strongly connected components of more than max_linear_scc_tearing (default 16) equations that are all linear in their own unknowns are now left untorn and solved as one block. Related: PR SciML#5332 (separate Int64 Bareiss overflow in alias elimination).

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
One conflict in dummy_derivative's signature in src/structural_transformation/symbolics_tearing.jl: master added the non-forwarded verbose keyword, this branch added max_linear_scc_tearing. Kept both.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
@xtalax-droid

Copy link
Copy Markdown
Contributor Author

Independent check from the MethodOfLines side, MOL master fcf63bed (v1.6.0, no source change) against this branch at de47c44565, Julia 1.12.1 unless noted. Steady 2D Laplace, Dirichlet u = x*y, NewtonRaphson:

n unknowns retcode steps max error
9 49 Success 1 4.4e-16
11 81 Success 1 1.6e-15
31 841 Stalled 33 4.4e-16
61 3481 Stalled 33 7.8e-16
101 9801 Stalled 34 1.7e-15

With registered MTK the same MOL code gives, for n = 9 / 11 / 31, 8 / 10 / 30 unknowns, with Stalled (error 6.6e-11), Stalled (9.5e-8) and MaxIters (error 1.85e26, 1172 s). Neumann at n = 9 / 11 gives 56 / 90 unknowns, Success in one step, errors 4.8e-15 / 8.6e-15. The 400-unknown mixed-derivative steady case (order 4, 20x20) goes from 65 unknowns and MaxIters to 324 unknowns and Success in 2 steps. On Julia 1.10.12 the Dirichlet, Neumann and mixed cases behave the same, and the inference stack overflow / hang seen earlier with jac = true on large Jacobians did not appear.

The Stalled retcodes from n = 31 come with exact solutions: the default abstol is below the roundoff floor of the 1/h^2 stencil residual, which is a solver-tolerance matter on the MethodOfLines side, not the tearing. The unknown count is the interior (n-2)^2, since boundary nodes stay observed.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

… ignore list

The stationary linear tearing path calls StateSelection.get_mm, which
StateSelection does not declare public, failing ExplicitImports
all_qualified_accesses_are_public. No public route to the value exists
(state.mm is not equivalent after pantelides!), so list it with the other
StateSelection names.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
@xtalax-droid

Copy link
Copy Markdown
Contributor Author

Pushed 19bc240b35: :get_mm is added to NONPUBLIC_QUALIFIED_ACCESSES in test/qa/qa.jl, next to the other non-public StateSelection names (get_new_mm, pantelides!, ...). It fixes the QA failure get_mm is not public in StateSelection introduced by this PR. A public accessor was not used because StateSelection documents that get_mm must be queried after pantelides! has extended the matrix, so reading state.mm there could change behaviour. The ExplicitImports all_qualified_accesses_are_public check returns clean locally; the other red jobs on this PR (ModelOrderReduction, SciMLSensitivity Core8, docs build, Extensions) are red on master with the same errors.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b


function is_linear_in(eq::Equation, vars::Set{SymbolicT})
expr = eq.rhs - eq.lhs
for v in Symbolics.get_variables(expr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the graph to figure out incidence instead of get_variables.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in c8383ec: the equation's incident variables now come from the structural graph (𝑠neighbors(graph, ieq) restricted to the component), and get_variables is no longer used for this check.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

expr = eq.rhs - eq.lhs
for v in Symbolics.get_variables(expr)
v in vars || continue
coeff, _, islinear = Symbolics.linear_expansion(expr, v)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the get_linear_expander_for! API, which is much faster.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in c8383ec: linearity is now decided with get_linear_expander_for!(sys, var, true), expanding each incident variable in turn and carrying the remainder, the same step get_linear_scc_linsol takes. One extra check: a coefficient that still depends on another unknown of the block (for example u1*u2) means the equation is not linear in the block, so it is torn as before; linear in each variable separately would otherwise accept it. There is a test for that case.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

return big_linear_vars, big_linear_eqs
end

function is_linear_in(eq::Equation, vars::Set{SymbolicT})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire function should instead just replicate the logic in the inline linear SCC code in reassembly. In fact, I'd propose that LinearBlockTearing be moved to MTKTearing.jl.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The detection now follows the inline linear-SCC code in reassembly (graph incidence, get_linear_expander_for!, the same component definition) instead of a separate symbolic traversal (c8383ec). LinearBlockTearing is still defined in this repo: moving it into ModelingToolkitTearing needs a change and a release in that package and then a compat bump here, while the struct only uses StateSelection entry points this repo already imports. Would you rather keep it here for now?


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

…near block detection

Incidence of the equations in a strongly connected component now comes from the
structural graph instead of get_variables, and linearity is decided with
get_linear_expander_for!, following the inline linear SCC code in reassembly.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
mm.nparentrows, mm.ncols, mm.nzrows[keep], mm.row_cols[keep], mm.row_vals[keep]
)
end
tearing_result, extra = StateSelection.DummyDerivativeTearing()(structure, dummy_derivatives; mm)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of assuming the default DummyDerivativeTearing, store this as a configurable option in LinearBlockTearing so users can change the underlying tearing algorithm.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is still not addressed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underlying tearing algorithm is now a field of LinearBlockTearing (tearing_alg, defaulting to StateSelection.DummyDerivativeTearing()). It is exposed as the tearing_alg keyword of dummy_derivative, and therefore of mtkcompile, and is called as tearing_alg(structure, dummy_derivatives; mm). A new test passes a recording wrapper algorithm and checks that it is used, both with the default max_linear_scc_tearing and with typemax(Int). The keyword applies to systems without an independent variable, since the time-dependent path does not go through LinearBlockTearing. Addressed in c71e2631d1.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

SU.isconst(coeff) && continue
# A coefficient containing another unknown of the block makes the equation nonlinear.
for w in @view vars[(i + 1):end]
dcoeff, _, coeff_linear = MTKBase.get_linear_expander_for!(state.sys, state.fullvars[w], true)(coeff)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to do a second linear expansion, it just needs to use SU.query to check if any of the variables occur in coeff. Look at how the calculate_A_b function does it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the second linear expansion with SU.query(in(scc_symbols), coeff) over the component's variables, following calculate_A_b. A coefficient that mentions any block unknown still makes the equation count as nonlinear (pushed in 686110b60d; the coupled-block test still passes).


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

eqs = equations(state)
for scc in StateSelection.find_var_sccs(graph, matching)
length(scc) > max_size || continue
scc_vars = BitSet(scc)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare scc_vars outside the loop so every iteration doesn't allocate a fresh BitSet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scc_vars (and the matching symbolic set) is now created once before the loop and refilled with empty!/push! for each component.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

for scc in StateSelection.find_var_sccs(graph, matching)
length(scc) > max_size || continue
scc_vars = BitSet(scc)
all(v -> matching[v] isa Int && is_linear_in(state, graph, matching[v], scc_vars), scc) || continue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check that this closure doesn't cause captured variables to be boxed. I don't know when Julia does that but it does, sometimes, randomly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with code_warntype(optimize = true): there is no Core.Box in large_linear_sccs or is_linear_in. The captured variables are never rebound after the closure is created, so nothing is boxed.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

function is_linear_in(state::TearingState, graph, ieq::Int, scc_vars::BitSet)
eq = equations(state)[ieq]
expr = SU._iszero(eq.lhs) ? eq.rhs : eq.rhs - eq.lhs
vars = [v for v in 𝑠neighbors(graph, ieq) if v in scc_vars]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vars = [v for v in 𝑠neighbors(graph, ieq) if v in scc_vars]
vars = filter(in(scc_vars), 𝑠neighbors(graph, ieq))

Avoids a closure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied: filter(in(scc_vars), 𝑠neighbors(graph, ieq)); the intermediate closure and comprehension are gone.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

Agent footer below.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
@xtalax-droid

Copy link
Copy Markdown
Contributor Author

MOL re-test of #5352 at head c8383ecee8 (previous independent check was against de47c44565).

Setup: MethodOfLines fcf63bed (v1.6.0, unmodified), ModelingToolkit branch forge/stationary-linear-tearing @ c8383ecee8 (reports as ModelingToolkit v11.47.0, developed together with lib/ModelingToolkitBase v1.79.0). Julia 1.12.1 (main runs) and 1.10.12 (spot checks, JULIA_NUM_THREADS=1). Other resolved versions: SymbolicUtils 4.54.0 (1.12 env) / 4.55.0 (1.10 env and registered baseline env), Symbolics 7.48.0, StateSelection 1.11.1, ModelingToolkitTearing 1.20.7, NonlinearSolve 4.32.0, SciMLBase 3.58.0. "Registered" baseline = the same MOL code with registered ModelingToolkit 11.46.1 (ModelingToolkitBase 1.79.0). Problem: steady 2D Laplace on [0,1]^2, Dirichlet u = x*y (u(0,y)~0, u(1,y)~y, u(x,0)~0, u(x,1)~x), MOLFiniteDifference([x=>h,y=>h], nothing, approx_order=2), NewtonRaphson() with default tolerances, n = grid points per side, h = 1/(n-1). "max err" is the max |u - x*y| over non-corner nodes (identical to interior-only in every run). Build/solve times are first-call wall times on a busy box (the first case in a session includes compilation, ~13 s).

Laplace, Dirichlet (unknowns = length(prob.u0))

n registered MTK 11.46.1 de47c44565 c8383ecee8 (build / solve / retcode / steps / max err)
5 build throws OverflowError (Int64 in StateSelection Bareiss) not run build throws the same OverflowError (see notes)
6 5 unknowns, Success, 2 steps, 1.4e-16 not run 5 unknowns, 0.7 s / 2.6 s, Success, 3 steps, 3.9e-16
7 9 unknowns, Success, 3 steps, 1.3e-15 not run 25 unknowns, 0.6 s / 1.0 s, Success, 1 step, 5.6e-16
8 7 unknowns, Stalled, 34 steps, 2.2e-11 not run 36 unknowns, 0.1 s / 0.3 s, Success, 1 step, 4.4e-16
9 8 unknowns, Stalled, 34 steps, 6.6e-11 49 unknowns, Success, 1 step, 4.4e-16 49 unknowns, 0.1 s / 0.35 s, Success, 1 step, 4.4e-16
11 10 unknowns, Stalled, 9.5e-8 81 unknowns, Success, 1 step, 1.6e-15 81 unknowns, 0.2 s / 0.6 s, Success, 1 step, 1.5e-15
31 30 unknowns, MaxIters (1000 steps), 1.85e26 841 unknowns, Stalled, 33 steps, 4.4e-16 841 unknowns, 1.2 s / 4.3 s, Stalled, 33 steps, 4.4e-16
61 not run 3481 unknowns, Stalled, 33 steps, 7.8e-16 3481 unknowns, 5.1 s / 31 s, Stalled, 33 steps, 8.9e-16
101 not run 9801 unknowns, Stalled, 34 steps, 1.7e-15 9801 unknowns, 28 s / 205 s, Stalled, 34 steps, 2.0e-15

The n=5..9 registered column was re-run in this session; n=11 and n=31 registered and all de47c44565 entries are copied from the earlier run (MOL fcf63bed, Julia 1.12.1). The interior of an n x n grid has (n-2)^2 unknowns; the branch keeps all of them from n=7 on.

Laplace, Neumann (Dx(u(1,y)) ~ y)

n registered MTK de47c44565 c8383ecee8
9 not re-run 56 unknowns, Success, 1 step, 4.8e-15 56 unknowns, 15 s (includes compilation) / 2.9 s, Success, 1 step, 2.3e-15
11 not re-run 90 unknowns, Success, 1 step, 8.6e-15 90 unknowns, 0.2 s / 1.2 s, Success, 1 step, 4.6e-15
31 not re-run 870 unknowns, Stalled, 33 steps, 7.8e-16 870 unknowns, 1.4 s / 4.8 s, Stalled, 33 steps, 3.3e-16

400-unknown mixed-derivative steady case (test/Mixed_Derivatives/MOL_Mixed_Deriv.jl setup, order-4 20x20)

registered MTK de47c44565 c8383ecee8 Julia 1.12.1 c8383ecee8 Julia 1.10.12
unknowns 65 324 324 324
retcode MaxIters Success Success Success
Newton steps 1000 2 3 5
build / solve not re-run 21 s / 6.5 s 15.6 s / 5.0 s 13.8 s / 3.4 s

SciMLBase.successful_retcode(sol) is true, so the @test_broken SciMLBase.successful_retcode(sol) at test/Mixed_Derivatives/MOL_Mixed_Deriv.jl:129 still passes unexpectedly (same as with de47c44565). The accuracy check against x*y still differs by 7.5e-2, as before (that PDE has a Dxy term, so x*y is not its solution). I ran the setup of this test as a script; I did not run the GROUP=Mixed_Derivatives test group this time.

max_linear_scc_tearing

The keyword is a keyword of ModelingToolkit.dummy_derivative (default 16), reached through mtkcompile keyword forwarding. MOL calls mtkcompile(sys) without keywords, so it is not reachable through discretize or the discretization kwargs. For the typemax(Int) rows below I added a method for StructuralTransformations.dummy_derivative(::System, ::TearingState; ...) in the test script that forwards max_linear_scc_tearing = typemax(Int); MOL itself was not changed.

n interior unknowns (block size) registered MTK c8383ecee8 default (16) c8383ecee8, typemax(Int)
5 9 (below 16) build throws OverflowError build throws OverflowError not run (throws earlier, see notes)
6 16 (not above 16) 5 unknowns 5 unknowns (same as registered) 5 unknowns, Success, 3 steps
7 25 (above 16) 9 unknowns 25 unknowns 9 unknowns, Success, 16 steps
9 49 (above 16) 8 unknowns, Stalled 49 unknowns, Success 8 unknowns, Success, 10 steps, 4.4e-16
31 841 30 unknowns, MaxIters 841 unknowns, Stalled 30 unknowns, MaxIters (1000 steps), 6.3e23

So a block at or below 16 gives the same unknown count as the registered path, and a block above 16 is left untorn. Note that the typemax(Int) run at n=9 reaches Success in 10 steps whereas the registered run stalls at 34 steps with the same 8 unknowns; the two runs differ in ModelingToolkit 11.47.0 (branch) versus 11.46.1 (registered), so I cannot attribute that difference to a single change.

abstol

n default tolerances abstol = 1e-9
31 Stalled, 33 steps, 4.4e-16 Success, 1 step, 3.8e-15
61 Stalled, 33 steps, 8.9e-16 Success, 1 step, 8.7e-15

The solutions are exact to roundoff either way; with default tolerances NonlinearSolve reports Stalled from n=31 on, as with de47c44565.

Julia 1.10.12

case unknowns retcode steps max err
Dirichlet n=9 49 Success 1 2.2e-16
Dirichlet n=31 841 Stalled 33 3.3e-16
mixed 20x20 order 4 324 Success 5 (7.5e-2 vs x*y, as on 1.12)

No Internal error: stack overflow in type inference and no hang in any 1.10.12 run (environment setup with precompilation, and all three solves, finished well within the 30-minute limit).

What changed since de47c44565 (PR diff de47c44565..c8383ecee8)

Two commits: one adds StateSelection.get_mm to the QA qualified-access ignore list, and c8383ecee8 rewrites the "is this block linear in its own unknowns" test in large_linear_sccs to use the structure graph incidence and the cached get_linear_expander_for!, and to reject coefficients that contain another unknown of the block (new coupled = true test). For the MOL cases above the results are unchanged from de47c44565 (same unknown counts, retcodes and step counts, apart from the mixed case needing 3 instead of 2 steps on 1.12).

Notes and limits

  • The n=5 OverflowError (checked_mul overflow in StateSelection.CLIL.bareiss_update_virtual_colswap_mtk!, reached from alias_elimination!) occurs identically with the registered MTK 11.46.1, so it is not introduced by the PR; it happens before dummy_derivative, so max_linear_scc_tearing does not affect it. I did not investigate further.
  • The 127 integer-coefficient cap was not probed directly; n=6, 7, 8, 9 all behave according to block size (16 / 25 / 36 / 49 interior unknowns), not according to the stencil centre coefficient (-100, -144, -196, -256).
  • Registered-MTK numbers for n=5..9 were run with MTK 11.46.1; the other registered numbers are from the earlier run and may use a slightly different MTK patch version.
  • No Neumann or n=61/101 baseline was re-run with the registered MTK; the second solve of an already-solved problem was not repeated this time.
  • Single runs, no repeated timings; the box was shared.

🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: 6c520c71-764b-4a7e-a484-62d5a95bcfa1

@xtalax-droid

Copy link
Copy Markdown
Contributor Author

Spot check at the new head 686110b60d (MethodOfLines fcf63bed unmodified, Julia 1.12.1, branch reports ModelingToolkit v11.47.0 / ModelingToolkitBase v1.79.0): the results equal the c8383ecee8 table above for the four cases re-run (Dirichlet n=8: 36 unknowns, Success, 1 step; Dirichlet n=31: 841 unknowns, Stalled at default tolerances, 33 steps, max error 4.4e-16; Neumann n=9: 56 unknowns, Success, 1 step; 400-unknown mixed case: 324 unknowns, Success, 3 steps). The other rows of the table were not re-run.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: 6c520c71-764b-4a7e-a484-62d5a95bcfa1

xtalax and others added 2 commits November 4, 2026 19:51
LinearBlockTearing now stores the algorithm it delegates to (default
StateSelection.DummyDerivativeTearing()) and dummy_derivative / mtkcompile
accept it as the `tearing_alg` keyword, as requested in review.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
The stationary linear block check reaches for the cached linear expander through
ModelingToolkitBase, where it is not public; add it to the ModelingToolkitBase group of
NONPUBLIC_QUALIFIED_ACCESSES like the other pair-internal seams.

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
@xtalax-droid

Copy link
Copy Markdown
Contributor Author

Spot check at the approved head 11bcc63806 (MethodOfLines fcf63bed unmodified, Julia 1.12.1, branch reports ModelingToolkit v11.47.0 / ModelingToolkitBase v1.79.0): same four cases as the c8383ecee8 table and the 686110b60d check, same results (Dirichlet n=8: 36 unknowns, Success, 1 step; Dirichlet n=31: 841 unknowns, Stalled at default tolerances, 33 steps, max error 4.4e-16; Neumann n=9: 56 unknowns, Success, 1 step; 400-unknown mixed case: 324 unknowns, Success, 3 steps). Passing tearing_alg = DummyDerivativeTearing() explicitly gives the same result as the default at n=8 and n=31. The other rows of the table were not re-run.


🤖 Posted by an AI agent · harness: Claude Code 2.1.312 · model: claude-sonnet-5-5
Review: unreviewed
Session: 6c520c71-764b-4a7e-a484-62d5a95bcfa1

@AayushSabharwal
AayushSabharwal merged commit d6e93c5 into SciML:master Nov 6, 2026
84 of 85 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