Skip to content

fix(discretization): fold symbolic initial conditions for MTK v1.45 compatibility#584

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
utkuyilmaz1903:fix/mtk-ic-underdefined-regression
Jul 8, 2026
Merged

fix(discretization): fold symbolic initial conditions for MTK v1.45 compatibility#584
ChrisRackauckas merged 2 commits into
SciML:masterfrom
utkuyilmaz1903:fix/mtk-ic-underdefined-regression

Conversation

@utkuyilmaz1903

@utkuyilmaz1903 utkuyilmaz1903 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Root Cause

MTKBase v1.45.1-era varmap_to_vars now strictly enforces SU.isconst checks on u0 map values. Meanwhile, MOL's generate_ic_defaults builds u0 values via substitution (here via pde_substitute), which leaves function-call ICs as unfolded symbolic trees rather than literal constants (e.g., cos(0.108) remains a symbolic tree). This mismatch triggers Initial condition underdefined errors during discretize(). ICs containing function calls fail, while plain/constant ICs (e.g., Burgers, Integrals) continue to pass.

Fix

  • generate_ic_defaults.jl: Wrapped substituted u0 values in Symbolics.symbolic_to_float. This safely folds constant expressions into numbers while preserving genuinely symbolic/parametric expressions for MTK to resolve. Also removed a dead out = ... block.
  • MethodOfLines.jl: Imported symbolic_to_float.
  • qa.jl: Added :symbolic_to_float to the ExplicitImports ignore list.

Verification: Verified locally on failing groups. Diffusion, Components, Convection_WENO, Sol_Interface, Complex, and Wave_Eq_Staggered are now green. No regressions in previously passing groups (Burgers, Integrals, Stationary).

Reviewer Note

  • QA / Non-Public API: symbolic_to_float is not public API, so I added it to the QA ignore list (following the :diff2term precedent). Since public APIs like simplify or substitute no longer fold constants in Symbolics v7, this was the safest workaround. If there is a preferred public alternative, please let me know and I will gladly switch! (Note: I did not bisect the exact MTKBase commit, but the failure window aligns perfectly with the v1.45.1 release and the new SU.isconst checks).
  • DAE Group: Still fails, but due to an independent cause. OrdinaryDiffEq's stricter CheckInit now rejects the O(dx²) residual in MOL_1D_PDAE.jl. Passing initializealg = BrownFullBasicInit() fixes it locally (matching the schroedinger.jl precedent), but I left it out of this PR to strictly contain scope.

Refactor the handling of initial conditions to ensure proper folding of symbolic expressions.
@utkuyilmaz1903 utkuyilmaz1903 marked this pull request as ready for review July 7, 2026 14:55
@ChrisRackauckas ChrisRackauckas merged commit cc49e9b into SciML:master Jul 8, 2026
54 of 65 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