Skip to content

Fix discretized-DAE tests/docs by passing initializealg explicitly per-call (no library default change)#579

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-master-ci-dae-init
Draft

Fix discretized-DAE tests/docs by passing initializealg explicitly per-call (no library default change)#579
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-master-ci-dae-init

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Please ignore until reviewed by @ChrisRackauckas.

What this does

Fixes the master-CI reds (DAE, Higher_Order, MOL_Interface1 test groups, plus the Schrödinger docs example) without changing MethodOfLines' default DAE initialization. MethodOfLines keeps its existing default (downstream CheckInit). Each failing case instead passes initializealg = BrownFullBasicInit() explicitly in its own solve(...) call.

These are MOL discretizations of PDEs with algebraic constraints (elliptic coupling, over-determined boundaries, Robin/flux BCs, complex split into real/imag). They are built with build_initializeprob = false, so the solver's default CheckInit rejects the finite-difference-inconsistent ICs with:

DAE initialization failed: your u0 did not satisfy the initialization requirements ... please pass initializealg = BrownFullBasicInit() to solve

BrownFullBasicInit holds the differential variables fixed and solves only the algebraic equations.

Reverted (vs the earlier version of this PR)

  • src/interface/MOLFiniteDifference.jl: the block injecting initializealg = BrownFullBasicInit() into the discretization kwargs is fully reverted — this file is now identical to master. No library default change.
  • src/MOL_discretization.jl: the _problem_opts... positional absorber and the func_kwargs = Base.structdiff(...) init-strip (which only existed to support the kwargs injection) are reverted; the ODEFunction(pdesys, discretization; ...) signature and discretization.kwargs... splat are restored.

Independent source bugfix kept (justified)

  • src/MOL_discretization.jl: f_analytic = nothing is initialized before the if analytic !== nothing block. On master, ODEFunction(simpsys; analytic = f_analytic, ...) references f_analytic unconditionally while it is only assigned inside the if, so ODEFunction(pdesys, disc) with no analytic function is an UndefVarError. This is a real pre-existing bug independent of any init change, so the one-line guard is kept.

Per-call explicit fixes

File failing case fix
test/DAE/MOL_1D_PDAE.jl elliptic 0 ~ Dxx(v) + ... constraint solve(prob, Rodas4(), saveat = 0.1, initializealg = BrownFullBasicInit())
test/Higher_Order/MOL_1D_HigherOrder.jl KdV, over-determined boundary solve(prob, FBDF(), saveat = 0.1, initializealg = BrownFullBasicInit())
test/MOL_Interface1/MOLtest1.jl "Rearranged Robin" algebraic Robin BC solve(prob, Rodas4(), initializealg = BrownFullBasicInit())
docs/src/tutorials/schroedinger.md complex eq split into real/imag solve(prob, FBDF(), saveat = 0.01, initializealg = BrownFullBasicInit())

BrownFullBasicInit is imported from DiffEqBase (matching test/Complex/schroedinger.jl, which already does this on master).

Independent docs fixes (not default-init related)

  • docs/src/tutorials/PIDE.md: QNDF()FBDF(). QNDF no longer exists in OrdinaryDiffEq 7 (the docs env resolves OrdinaryDiffEq 7.1.0, where the only exported BDF integrator is FBDF); the block was an UndefVarError. Verified the integro-PDE solves to Success with FBDF and needs no explicit init (its constraint is consistent with the FD ICs).
  • docs/src/tutorials/sispde.md (+ docs/Project.toml): add using SteadyStateDiffEq. DynamicSS is no longer exported by DifferentialEquations 8; it lives in SteadyStateDiffEq. This is an API migration, not a default-init change. (The time-dependent Tsit5 solve is pure-parabolic and needs no init.)

Local verification (Julia 1.10; OrdinaryDiffEq 7.1.0, DiffEqBase 7.5.5, MTK 11.28.2, SciMLBase 3.21.0)

Before the per-call fixes (with the src reverted), all three groups error on CheckInit:

  • DAE: normresid = 0.00299 > abstol = 1.0e-6
  • Higher_Order (KdV): normresid = 0.000158 > abstol = 1.0e-6
  • MOL_Interface1 (Rearranged Robin): normresid = 0.559 > abstol = 1.0e-6
  • schroedinger docs: normresid = 2182.3 > abstol = 1.0e-6

After the per-call fixes:

  • DAE: 22/22 Pass.
  • Higher_Order: KdV @test successful_retcode Pass (pre-existing rtol @test_broken unchanged); Beam Test 00 Broken (pre-existing); Test 01 pass.
  • MOL_Interface1: every testset green — Heat 1D/2D, Spherical Diffusion, RHS=0, Wave Equation, Rearranged Robin, Array u, Non-Uniform Grid, 2D-1D boundary 2D variable connected to 1D variable via boundary #33.
  • docs: schroedinger solves to Success with the explicit init; PIDE and heat Dirichlet/Neumann/Robin solve to Success; sispde uses the SteadyStateDiffEq DynamicSS API.

No tests/examples were skipped, @test_broken-ed, try/catch-swallowed, or tolerance-loosened.

🤖 Generated with Claude Code

…library default change)

MethodOfLines keeps its existing default DAE initialization (downstream `CheckInit`).
Instead of changing the library default, the discretized-DAE tests and docs examples
that build a problem with `build_initializeprob = false` now pass
`initializealg = BrownFullBasicInit()` explicitly in their own `solve` calls. These are
PDEs whose finite-difference initial conditions do not satisfy the algebraic boundary /
constraint equations, so the default `CheckInit` rejects them with "DAE initialization
failed: your u0 did not satisfy the initialization requirements".

Per-call fixes (each was erroring on `CheckInit`):
- test/DAE/MOL_1D_PDAE.jl: elliptic `0 ~ Dxx(v) + ...` constraint, solve(Rodas4).
- test/Higher_Order/MOL_1D_HigherOrder.jl: KdV with over-determined boundary, solve(FBDF).
- test/MOL_Interface1/MOLtest1.jl: "Rearranged Robin" algebraic Robin BC, solve(Rodas4).
- docs schroedinger.md: complex equation split into real/imag leaves algebraic boundary
  rows, solve(FBDF).
`BrownFullBasicInit` is imported from DiffEqBase, matching test/Complex/schroedinger.jl
which already does this.

Independent docs fixes (not default-init related):
- docs PIDE.md: QNDF() -> FBDF(). QNDF no longer exists in OrdinaryDiffEq 7; the docs
  env resolves OrdinaryDiffEq 7.1.0 where the only exported BDF integrator is FBDF, so
  the block was an UndefVarError. Verified the integro-PDE solves to Success with FBDF
  and needs no explicit init.
- docs sispde.md: add `using SteadyStateDiffEq` (and the docs dep). `DynamicSS` is no
  longer exported by DifferentialEquations 8; it lives in SteadyStateDiffEq.

Independent source bugfix kept from the prior work:
- src/MOL_discretization.jl: initialize `f_analytic = nothing` before the
  `if analytic !== nothing` block. On master, `ODEFunction(...; analytic = f_analytic)`
  references `f_analytic` unconditionally while it is only assigned inside the `if`, so
  `ODEFunction(pdesys, disc)` with no analytic function is an UndefVarError. This is a
  real pre-existing bug independent of any init change.

The library-default injection of `initializealg = BrownFullBasicInit()` into
MOLFiniteDifference kwargs (and the MOL_discretization positional-absorber / kwarg-strip
that only existed to support it) are reverted; src/interface/MOLFiniteDifference.jl is
identical to master.

Verified locally on Julia 1.10 (OrdinaryDiffEq 7.1.0, DiffEqBase 7.5.5, MTK 11.28.2):
DAE 22/22 pass; Higher_Order KdV pass (pre-existing rtol @test_broken unchanged);
MOL_Interface1 all testsets pass (Rearranged Robin, Array u, Non-Uniform Grid, 2D-1D
boundary all green). Docs: schroedinger solves to Success with the explicit init; PIDE
and the heat Dirichlet/Neumann/Robin examples solve to Success; sispde uses the
SteadyStateDiffEq DynamicSS API.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Default to BrownFullBasicInit for discretized DAEs; fix sispde docs DynamicSS Fix discretized-DAE tests/docs by passing initializealg explicitly per-call (no library default change) Jun 23, 2026
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