Repository navigation
Preserve array flow balances when expanding connections - #5135
ChrisRackauckas wants to merge 4 commits into
Conversation
`expand_connections` expanded an array flow balance into one scalar equation per element, so a network with array-valued flow connectors grew its symbolic equation count with the array size (4 -> 103 equation blocks from 1 to 100 rows in the reproducer of #5119). When every flow variable in a connection set has the same shape, emit a single broadcast conservation equation instead. Connection sets with mixed axes keep the existing element-wise construction. The existing stream-connector assertion compared against scalarized equations, so it now scalarizes the array flow equation before comparing. Adds `test/array_flow_connections.jl`, which checks that the connection equation count and symbolic size are independent of the array shape and that the generated equations still express flow conservation. Fixes #5119. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.270 Agent-Model: claude-fable-5-1 Agent-Session: local Claude Code session 9b5c3ae5-6a0f-41b8-bd69-03bf3b5e7083
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
Benchmark Results (Julia vlts)Time benchmarks
Memory benchmarks
|
|
This PR's commit has been carried forward, with its authorship kept, onto current master in #5239. That PR has fresh fail-before/pass-after evidence and an independent review. The review found the change correct but flagged a design decision: array flow balances become broadcast equations. If #5239 is the one to continue, this one can be closed. 🤖 Generated with Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01H4fXBChQshAwfpLMCpEvAX |
Brings in the Symbolics 7.45/Latexify 0.16.6 compat floors and the variable_parsing/latexify reference updates from #5281, which resolve the InterfaceI (variable_parsing.jl) and RegressionI (50.tex) failures seen on the previous CI run. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Devin <noreply@cognition.ai> Agent-Harness: Devin CLI 3000.11.92 Agent-Model: swe-2-max Agent-Session: local Devin CLI session misty-bergamot
The branch had gone stale against
What I changed: merged Local validation on the merged branch (
Pre-existing failures left alone: 🤖 Posted by an AI agent — harness: Devin CLI 3000.11.92 · model: swe-2-max |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI Agent-Model: gpt-6-luna Agent-Session: local fixer job SciML__ModelingToolkit.jl__5135 (no session URL)
expand_connectionskept array potential equalities but expanded an array flow balance into one scalar equation per element. When every flow variable in a connection set is an array of the same shape, this generates one array conservation equation instead, so the equation count of a model with array connectors no longer grows with the array size. Fixes #5119.Evidence (Julia 1.12.6, aarch64, fresh processes;
lib/ModelingToolkitBase/test/array_flow_connections.jl):Not verified: full test groups and the QA group (earlier notes on this change mention QA failures still to be baselined against master), x86.
🤖 Posted by an AI agent — harness: Claude Code 2.1.270 · model: claude-fable-5-1
Conversation: local Claude Code session
9b5c3ae5-6a0f-41b8-bd69-03bf3b5e7083(no shareable URL available)Risk assessment (independent review, codex-cli gpt-6-astra, reviewed head 4163092)
expand_connections. Scalar flow variables and mixed-shape fallback retain their implementation. Consumers inspecting raw equation blocks see a representation change; the conservation equations remain equivalent after scalarization.416309253df9052513d6f06d9d97c0d0255a3ac1, unchanged at final check. Julia 1.13.0, four threads: new regression 1250/1250 passed; restoring the exact original method from the merge's base parent yielded 1248 passed / 2 failed; independent scalar/array, singleton/multiport, and nested inner/outer parity probe 20/20 passed; modified existing array-stream assertion 1/1 passed. Final CI snapshot: 99 passed, seven failed, one pending, one cancelled, one skipped; failed logs match default-branch failures as detailed below. No PR-caused CI regression identified.🤖 Posted by an AI agent — harness: codex-cli · model: gpt-6-astra (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq
Risk assessment (independent review, Codex gpt-6.1-sol, head 4602416)
expand_connectionschanges the equation-block representation of working array-flow connections; its documentation does not promise scalar flow equations, making this a representation-design judgment rather than a documented-contract correction).git diff origin/HEAD...HEAD, surrounding connection generation and documentation, and risk.md in full. Confirmed HEAD is46024162458969c779f74b954408a9f359dd008a;git diff --check origin/HEAD...HEADpassed and checkout status remained clean. Local Julia 1.12.4, four Julia threads, Symbolics 7.46.0 / SymbolicUtils 4.51.0: the new test passed 1250/1250 on head; the identical test against archived origin/HEAD808a4f13e865cf457396ed72ed7d5e7a9ae2a4f8failed onlyallequal(counts)andallequal(sizes)(1248 pass, 2 fail). An independent probe comparing exact scalarized symbolic residuals with the original method passed 42/42 checks across scalar/array ports, singleton/two/four-port sets and nested inner/outer connections. CI snapshot: 104 success, 3 failure, 1 cancelled, 1 skipped. G1 pass: the regression checks conservation and thermal constitutive equations against independently specified 300 K, ±3.7 flow and the stated constitutive law; symbolic comparisons additionally establish equivalence to the original elementwise implementation. G2 not applicable: no GPU kernels, AD rules, Reactant or MPI implementation changed; changed CPU connection paths ran locally and the InterfaceI CI jobs passed. G3 not applicable: no shared state, cache, threading or global-default change.🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: local headless review run (no public session URL); transcript kept by the fleet master.