-
-
Notifications
You must be signed in to change notification settings - Fork 235
Bump Symbolics v7, SymbolicUtils v4, ModelingToolkit v11 compat #1025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump Symbolics v7, SymbolicUtils v4, ModelingToolkit v11 compat #1025
Conversation
Fix constraints.md segfaultThe Changes:
Verified locally:
|
Breaking changes handled: - `build_expr` removed from Symbolics v7: defined locally in symbolic_utilities.jl - `defaults` field removed from PDESystem in MTK v11: replaced with `initial_conditions` - `defaults` import removed from ModelingToolkit (no longer exported) - `build_expr` import removed from Symbolics (no longer exported) Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Replace runtime MOL computation in the Burger's equation DGM test with precomputed reference data. The reference solution was generated using MOLFiniteDifference([x => 0.01], t, saveat=0.01) with Tsit5() and subsampled every 10th point for compact storage. Also remove unused MethodOfLines imports from Poisson and Black-Scholes tests which already compare against analytical solutions. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
In SymbolicUtils v4, BasicSymbolic is a sum type that includes both Sym (plain symbols) and Term (callable). The old `isa BasicSymbolic` check matched Sym which has no arguments, causing ArgumentError. Use iscall() to correctly filter for callable terms only. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The constraints tutorial segfaulted because Zygote tried to differentiate through IntegralProblem/HCubatureJL (C-based cubature), which lacks Zygote adjoint rules for getindex on IntegralSolution. - Replace IntegralProblem/HCubatureJL in norm_loss_function with a pure-Julia trapezoidal rule that Zygote can differentiate through - Fix QuadratureTraining to use sol.u instead of sol[1] (IntegralsZygoteExt provides an adjoint for .u but not getindex) - Fix DomainSets imports: use IntervalSets leftendpoint/rightendpoint Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
f75ae77 to
2cd6566
Compare
…atureTraining, fix symbolic tuple in IntegroDiff - Replace deprecated `defaults` keyword with `initial_conditions` in PDESystem constructors (MTK v11 breaking change) in test files - Handle scalar return from loss function in QuadratureTraining integrand to fix MethodError with view() on Float64 (Wave Equation test) - Handle symbolic tuple from toexpr in SymbolicUtils v4 for multi-variable integration domains (IntegroDiff multi-input tests) - Fix Runic formatting (1e5 → 1.0e5) Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix TypeError in NonAdaptiveLoss: wrap initial_conditions values with
ModelingToolkit.value() since they return BasicSymbolic{SymReal} not Float64
- Fix DimensionMismatch in QuadratureTraining: return [abs2(l)] instead of
scalar for BatchIntegralFunction compatibility
- Fix KeyError in IntegroDiff: compare against `tuple` function object (===)
not `:tuple` Symbol, since toexpr produces Expr(:call, tuple, :x, :y)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use Symbolics.value instead of ModelingToolkit.value in discretize.jl to satisfy ExplicitImports ownership check - Rewrite get_symbols in PDE_BPINN.jl to search equation tree for callable depvar terms directly, since SymbolicUtils v4 get_variables decomposes u(x,t) into bare u, x, t instead of returning u(x,t) Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use Symbolics._iszero instead of isequal(..., 0) in parse_equation to
properly detect symbolic zeros from expand_derivatives. In SymbolicUtils v4,
BasicSymbolic{SymReal}(0) is not isequal to Julia's Int 0, causing
derivative BCs like Dt(u(x,0)) to be replaced with literal 0 instead of
the numeric derivative expression. This was the root cause of the Wave
Equation MethodError crash.
- Revert QuadratureTraining scalar loss workaround (no longer needed)
- Fix Symbolics.unwrap → SymbolicUtils.unwrap in PDE_BPINN.jl (ExplicitImports)
- Fix Runic formatting: if → return if in PDE_BPINN.jl
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
In SymbolicUtils v4, expand_derivatives produces Differential(x, 2) (a single higher-order differential with .order field) instead of nested Differential(x)(Differential(x)(...)). The _transform_expression loop was only incrementing order by 1 per Differential object, causing second-order PDEs (Poisson, Wave, etc.) to be treated as first-order. This resulted in completely incorrect loss gradients and training failure. Fix: read the .order field from each Differential and push the derivative variable that many times. Also fix QA: use SymbolicUtils._iszero instead of Symbolics._iszero (ExplicitImports ownership check). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Two issues: 1. v_semiinf checked `a isa Num` but SymbolicUtils v4 unwraps to BasicSymbolic, not Num. Added BasicSymbolic to the check. 2. Boolean mask multiplication with Inf bounds (e.g., false * Inf = NaN via IEEE754) caused NaN integration bounds. Replaced mask arithmetic with conditional logic. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix IntegroDiff infinite bounds (e292d29)The IntegroDiff tests were failing because of two issues with SymbolicUtils v4:
Test result: IntegroDiff Example 7 ( |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use SymbolicUtils.unwrap instead of Symbolics.unwrap in transform_inf_integral.jl (QA ExplicitImports check) - Increase Wave Equation test training iterations from 500 to 1000 for both Adam warmup and BFGS to improve convergence robustness Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adam(0.1) with 500 iters can diverge on some seeds. Changed to Adam(0.01) with 1000 iters warmup followed by BFGS with BackTracking line search for robust convergence. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
acddc2c to
130cb8b
Compare
Summary
build_exprwas removed from Symbolics v7 — defined locally as a simpleExprconstructor helperPDESystem.defaultsfield renamed toinitial_conditionsin MTK v11 — updated accessordefaultsfrom MTK,build_exprfrom Symbolics)Test plan
🤖 Generated with Claude Code