Skip to content

Fix FunctionMap DiscreteProblem import; correct Hard DAE test assertion#3469

Merged
ChrisRackauckas merged 1 commit intoSciML:v7from
ChrisRackauckas-Claude:fix-v7-real-fixes
Apr 19, 2026
Merged

Fix FunctionMap DiscreteProblem import; correct Hard DAE test assertion#3469
ChrisRackauckas merged 1 commit intoSciML:v7from
ChrisRackauckas-Claude:fix-v7-real-fixes

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

FunctionMap — DiscreteProblem not in scope

v7's OrdinaryDiffEq no longer re-exports DiscreteProblem. Import from SciMLBase.

Hard DAE — test assertion was wrong, not solver

The test asserted abs(sol(2 - 2^-10, idxs=1)) <= 1e-4, expecting u[1] to decay from 5 toward 0. But the DAE has:

M * du = f(u)
[1 0 0] [du1]   [-100*(u1-u2)]
[0 0 0] [du2] = [u1 - u2     ]
[0 0 1] [du3]   [-u3 + u1 + p2]

The algebraic constraint (row 2) is u2 = u1. Substituting: du1 = -100*(u1 - u1) = 0. So u1 = 5 (constant) — this is the correct solution.

The old solver had imperfect algebraic constraint enforcement: u2 didn't snap to u1 immediately, leaving a small u1 - u2 residual that drove u1 down over 2000 steps. v7's implicit Euler correctly enforces u2 = u1 from step 1, confirmed locally:

u at t=0:   [5.0, 0.0, 0.0]   (inconsistent u0)
u at t≈1:   [5.0, 5.0, 9.48]  (u2 corrected in first step)
u at t≈2-ε: [5.0, 5.0, 12.97] (u1 constant, correct)

Fix: assert sol(2-2^-10, idxs=1) ≈ 5.0 (the correct DAE solution). Also add initializealg = BrownFullBasicInit() since v7 defaults to CheckInit which rejects inconsistent u0 = [5, 0, 0].

🤖 Generated with Claude Code

- FunctionMap: import DiscreteProblem/DiscreteFunction from SciMLBase.
  v7's OrdinaryDiffEq no longer re-exports these.

- Hard DAE: the test asserted `abs(sol(2-2^-10, idxs=1)) <= 1e-4`
  expecting u[1] to decay from 5 toward 0, but the DAE's algebraic
  constraint `u[2] = u[1]` (from mass matrix row 2 = 0) makes
  `du[1] = -100*(u[1]-u[1]) = 0`, so u[1] = 5 (constant) — the
  correct solution. The old solver had imperfect constraint enforcement
  that let u[1] drift, which the test relied on. v7's solver correctly
  snaps u[2] to u[1] from step 1.

  Change the assertion to `sol(2-2^-10, idxs=1) ≈ 5.0 atol=1e-4`.
  Also add `initializealg = BrownFullBasicInit()` since v7's default
  `CheckInit` rejects the inconsistent u0 = [5, 0, 0].

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 47b84cd into SciML:v7 Apr 19, 2026
60 of 89 checks passed
ChrisRackauckas added a commit that referenced this pull request Apr 20, 2026
…on (#3469)

- FunctionMap: import DiscreteProblem/DiscreteFunction from SciMLBase.
  v7's OrdinaryDiffEq no longer re-exports these.

- Hard DAE: the test asserted `abs(sol(2-2^-10, idxs=1)) <= 1e-4`
  expecting u[1] to decay from 5 toward 0, but the DAE's algebraic
  constraint `u[2] = u[1]` (from mass matrix row 2 = 0) makes
  `du[1] = -100*(u[1]-u[1]) = 0`, so u[1] = 5 (constant) — the
  correct solution. The old solver had imperfect constraint enforcement
  that let u[1] drift, which the test relied on. v7's solver correctly
  snaps u[2] to u[1] from step 1.

  Change the assertion to `sol(2-2^-10, idxs=1) ≈ 5.0 atol=1e-4`.
  Also add `initializealg = BrownFullBasicInit()` since v7's default
  `CheckInit` rejects the inconsistent u0 = [5, 0, 0].

Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ChrisRackauckas added a commit that referenced this pull request Apr 21, 2026
…on (#3469)

- FunctionMap: import DiscreteProblem/DiscreteFunction from SciMLBase.
  v7's OrdinaryDiffEq no longer re-exports these.

- Hard DAE: the test asserted `abs(sol(2-2^-10, idxs=1)) <= 1e-4`
  expecting u[1] to decay from 5 toward 0, but the DAE's algebraic
  constraint `u[2] = u[1]` (from mass matrix row 2 = 0) makes
  `du[1] = -100*(u[1]-u[1]) = 0`, so u[1] = 5 (constant) — the
  correct solution. The old solver had imperfect constraint enforcement
  that let u[1] drift, which the test relied on. v7's solver correctly
  snaps u[2] to u[1] from step 1.

  Change the assertion to `sol(2-2^-10, idxs=1) ≈ 5.0 atol=1e-4`.
  Also add `initializealg = BrownFullBasicInit()` since v7's default
  `CheckInit` rejects the inconsistent u0 = [5, 0, 0].

Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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