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
Conversation
…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>
96c5497 to
e7b67ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 passesinitializealg = BrownFullBasicInit()explicitly in its ownsolve(...)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 defaultCheckInitrejects the finite-difference-inconsistent ICs with:BrownFullBasicInitholds the differential variables fixed and solves only the algebraic equations.Reverted (vs the earlier version of this PR)
src/interface/MOLFiniteDifference.jl: the block injectinginitializealg = 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 thefunc_kwargs = Base.structdiff(...)init-strip (which only existed to support the kwargs injection) are reverted; theODEFunction(pdesys, discretization; ...)signature anddiscretization.kwargs...splat are restored.Independent source bugfix kept (justified)
src/MOL_discretization.jl:f_analytic = nothingis initialized before theif analytic !== nothingblock. On master,ODEFunction(simpsys; analytic = f_analytic, ...)referencesf_analyticunconditionally while it is only assigned inside theif, soODEFunction(pdesys, disc)with no analytic function is anUndefVarError. This is a real pre-existing bug independent of any init change, so the one-line guard is kept.Per-call explicit fixes
test/DAE/MOL_1D_PDAE.jl0 ~ Dxx(v) + ...constraintsolve(prob, Rodas4(), saveat = 0.1, initializealg = BrownFullBasicInit())test/Higher_Order/MOL_1D_HigherOrder.jlsolve(prob, FBDF(), saveat = 0.1, initializealg = BrownFullBasicInit())test/MOL_Interface1/MOLtest1.jlsolve(prob, Rodas4(), initializealg = BrownFullBasicInit())docs/src/tutorials/schroedinger.mdsolve(prob, FBDF(), saveat = 0.01, initializealg = BrownFullBasicInit())BrownFullBasicInitis imported fromDiffEqBase(matchingtest/Complex/schroedinger.jl, which already does this on master).Independent docs fixes (not default-init related)
docs/src/tutorials/PIDE.md:QNDF()→FBDF().QNDFno longer exists in OrdinaryDiffEq 7 (the docs env resolves OrdinaryDiffEq 7.1.0, where the only exported BDF integrator isFBDF); the block was anUndefVarError. Verified the integro-PDE solves toSuccesswithFBDFand needs no explicit init (its constraint is consistent with the FD ICs).docs/src/tutorials/sispde.md(+docs/Project.toml): addusing SteadyStateDiffEq.DynamicSSis no longer exported by DifferentialEquations 8; it lives in SteadyStateDiffEq. This is an API migration, not a default-init change. (The time-dependentTsit5solve 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:normresid = 0.00299 > abstol = 1.0e-6normresid = 0.000158 > abstol = 1.0e-6normresid = 0.559 > abstol = 1.0e-6normresid = 2182.3 > abstol = 1.0e-6After the per-call fixes:
@test successful_retcodePass (pre-existing rtol@test_brokenunchanged); Beam Test 00 Broken (pre-existing); Test 01 pass.Successwith the explicit init; PIDE and heat Dirichlet/Neumann/Robin solve toSuccess; sispde uses the SteadyStateDiffEqDynamicSSAPI.No tests/examples were skipped,
@test_broken-ed, try/catch-swallowed, or tolerance-loosened.🤖 Generated with Claude Code