Skip to content

test: bound reconstructed magnetic flux balance by ULPs#484

Merged
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:agent/tight-magnetic-flux-balance
Jul 13, 2026
Merged

test: bound reconstructed magnetic flux balance by ULPs#484
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:agent/tight-magnetic-flux-balance

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Please ignore this PR until reviewed by @ChrisRackauckas.

Summary

  • Replace exact equality for a sum of three reconstructed magnetic-flux observables with an absolute four-ULP bound derived from their simulated scale.
  • Keep the test sensitive to physical flux-balance regressions without assuming that reconstructed Float64 observables cancel bit-for-bit after two additions.

Root cause and boundary

The connector equation remains symbolically exact, but ModelingToolkit's perfect-alias elimination changes which fluxes are solved directly and which are reconstructed as observables. The queried Float64 values therefore accumulate reconstruction and summation roundoff even though the physical balance is unchanged.

The release boundary is ModelingToolkit 11.19 (passes) to 11.20 (fails). Companion-only controls pass with MTK 11.19 + MTKBase 1.29.1 and with MTK 11.19 + MTKTearing 1.12.1. On an otherwise identical Julia 1.12.6 / MTKBase 1.29.1 / MTKTearing 1.12.1 stack:

  • a4bf0bd37e, the parent of the alias-elimination change: 3/3 pass.
  • c49d619f6c (feat: eliminate perfect aliases in favor of higher priority variables): 2/3, failing only the exact flux-balance equality.

Older boundary checks also pass with MTKSL 2.21.1 / MTK 9.84, MTKSL 2.22.0 / MTK 10.32, and current MTKSL source with MTK 11.0, 11.15, 11.18, and 11.19. MTK 11.20 and current MTK 11.31 reproduce the one-ULP residual.

The observed maximum residual is 2.168404344971009e-19, exactly eps(flux_scale), at a maximum flux scale of about 1.72464e-3. It is unchanged with abstol = reltol = 1e-12 and across Julia 1.10, 1.12, and 1.13 RC. The new ceiling is 4 * eps(flux_scale), an absolute-only bound of about 8.67e-19 that covers three reconstructed values and two additions while remaining sensitive at roughly 5e-16 relative to the flux scale.

Validation

  • Julia 1.10.11 focused test/magnetic.jl: 3/3 pass.
  • Julia 1.12.6 focused test/magnetic.jl: 3/3 pass.
  • Julia 1.13.0-rc1 focused test/magnetic.jl: 3/3 pass (after pre-existing stdlib package-image warnings).
  • Native GROUP=Core on current upstream: Core/magnetic.jl passes 3/3; the run then stops at the separately bisected clean-main Core/motor.jl _check_if_dde(::Vector{Equation}, ::PleaseImportDynamicQuantities, ...) error.
  • Full-repository Runic check: pass.
  • git diff --check: pass.

Compare the reconstructed connector flux balance against an absolute four-ULP bound derived from the simulated flux scale.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review July 13, 2026 12:28
@ChrisRackauckas
ChrisRackauckas merged commit d369822 into SciML:main Jul 13, 2026
4 of 7 checks passed
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI downgrade mapping: the job uses clean-main ModelingToolkitBase 1.0.0 and stops before Core/magnetic.jl at the already-audited symbolic-array indexing defect in Core/continuous.jl (54 pass, 2 errors in StateSpace/TransferFunction). Focused draft #482 raises the MTKBase floor to the first fixed release and passes the exact StateSpace regression 1/1 plus continuous 76/76. No change to #484’s ULP-bounded magnetic assertion is indicated by this unrelated minimum-compatibility failure. Exact job

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI docs mapping: the strict documentation job reports the unmodified clean-main example failures already isolated in #480/#481—ambiguous bare @extend OnePort(), the resulting parametrized-interpolation cascade, and missing direct OrdinaryDiffEqSDIRK ownership. Stacked #481 passes the full hosted strict docs job. The docs run never depends on #484’s magnetic assertion, so no docs change belongs here. Exact job

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Hosted substantive checkpoint: the Julia LTS Core job passes Core/magnetic.jl 3/3 with this branch, then proceeds through Core/math.jl 93/93 before stopping at the independently audited clean-main motor PleaseImportDynamicQuantities error. Focused draft #483 fixes that motor test by importing/declaring the independent variable through its public owner. Thus the hosted run directly validates #484’s magnetic regression and exposes only the known next baseline blocker. Exact job

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

All three hosted Core variants now agree: Julia 1.10, 1.12, and pre each pass Core/magnetic.jl 3/3 and Core/math.jl 93/93, then stop at the exact independent motor failure fixed by #483. This gives cross-version hosted confirmation of the ULP bound in addition to the local Julia 1.10/1.12/1.13-rc runs.

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