Skip to content

Skip running-integral rules for equations without Integrals - #728

Merged
xtalax merged 1 commit into
SciML:masterfrom
xtalax-droid:forge/warm-discretize
Oct 28, 2026
Merged

xtalax merged 1 commit into
SciML:masterfrom
xtalax-droid:forge/warm-discretize

Conversation

@xtalax-droid

Copy link
Copy Markdown
Contributor

Problem

generate_finite_difference_rules built the cumulative Euler integral rules (generate_euler_integration_rules) at every grid point, whether or not the equation contains an Integral. Each rule is a recursive trapezoid sum with O(index) symbolic terms, so symbolic_discretize was quadratic in the grid size. On the 4000-point WENO Burgers corpus system this was 97% of the warm profile.

Fix

Build those rules only when the equation contains an Integral (has_integral(pde)). A rule keyed on an Integral call cannot match an equation without one, so the equation set is unchanged.

Tests

  • GROUP=Components, GROUP=QA, GROUP=Integrals, GROUP=MOL_Interface2 and GROUP=Discretization pass (the Integral groups keep their existing Broken markers).
  • Equations and initialization equations from symbolic_discretize are byte-identical before and after on six small systems, including a cumulative-Integral PDE.

Numbers

Warm symbolic_discretize, weno_burgers1d_large (n = 4000), ModelingToolkit master:

before after
time 1.79 s 0.059 s
allocated 1602 MiB 27 MiB

Warm discretize for the same system goes from 3.53 s / 4.1 GB to 1.81 s / 2.5 GB; the remainder is DAEProblem construction in ModelingToolkit. Other corpus systems (brusselator2d, heat3d, grayscott2d) are unchanged; their warm symbolic_discretize was already milliseconds.

Review notes

has_integral assumes an Integral rule can only fire if an Integral call appears in pde.lhs or pde.rhs; if some transformation introduced integrals after this point, those rules would now be missing. The Integral-bearing test groups above pass. The staggered generate_finite_difference_rules method has no integral rules and is untouched.


🤖 Posted by an AI agent · harness: Claude Code 2.1.309 · model: claude-sonnet-5-5
Review: unreviewed
Session: 47ff55ef-8952-4078-8e4e-77c72c85d6c4

generate_finite_difference_rules built the cumulative Euler integral rules at every grid point; each is O(index) symbolic terms, so symbolic_discretize was quadratic in the grid size even for equations without integrals. weno_burgers1d_large (4000 points): warm symbolic_discretize 1.79 s / 1602 MiB -> 0.059 s / 27 MiB. Equation sets are identical before and after on small grids.

Agent-Harness: Claude Code 2.1.309
Agent-Model: claude-sonnet-5-5
Agent-Session: 47ff55ef-8952-4078-8e4e-77c72c85d6c4
Agent-Review: unreviewed
Co-authored-by: Claude Code <[email protected]>
@xtalax
xtalax merged commit 71860eb into SciML:master Oct 28, 2026
88 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.

2 participants