From f9e447d1848f241b8bdb6b315eb604e8e599f55e Mon Sep 17 00:00:00 2001 From: "Bowen S. Zhu" Date: Mon, 10 Nov 2025 15:15:07 -0500 Subject: [PATCH 1/2] Fix DEIM system construction by completing system before return Co-authored-by: Aayush Sabharwal --- src/deim.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/deim.jl b/src/deim.jl index a2e72eb..8358c83 100644 --- a/src/deim.jl +++ b/src/deim.jl @@ -172,4 +172,11 @@ function deim(sys::ODESystem, snapshot::AbstractMatrix, pod_dim::Integer; inv_dict = Dict(Symbolics.scalarize(ŷ .=> V' * dvs)) # reduced vars to original vars @set! sys.defaults = merge(ModelingToolkit.defaults(sys), inv_dict) + + # CRITICAL: Call complete() on the system before returning to ensure all subsystems, + # variables, and parameters are properly registered and namespaced. Without this, + # attempting to create an ODEProblem from the DEIM system will fail with errors about + # missing initial conditions for variables that should exist in the system. + # This is required due to changes in ModelingToolkit.jl's internal structure handling. + return complete(sys) end From 67603fd9d4f517a48c45c2348db078b3e77231c2 Mon Sep 17 00:00:00 2001 From: "Bowen S. Zhu" Date: Wed, 12 Nov 2025 10:29:05 -0500 Subject: [PATCH 2/2] Fix equation access in DEIM tutorial for ModelingToolkit API changes --- docs/src/tutorials/deim_FitzHugh-Nagumo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/tutorials/deim_FitzHugh-Nagumo.md b/docs/src/tutorials/deim_FitzHugh-Nagumo.md index e53fef7..1c1ab13 100644 --- a/docs/src/tutorials/deim_FitzHugh-Nagumo.md +++ b/docs/src/tutorials/deim_FitzHugh-Nagumo.md @@ -181,7 +181,7 @@ plt_2 = plot(xlabel = L"v(x,t)", ylabel = L"x", zlabel = L"w(x,t)", xlims = (-0. ylims = (0.0, L), zlims = (0.0, 0.25), xflip = true, camera = (50, 30), titlefont = 10, title = "Comparison of full and reduced systems") plot!(plt_2, unconnected(snapshot_v), unconnected(sol_x, nₜ), unconnected(snapshot_w), - label = "Full$(length(ode_sys.eqs))") + label = "Full$(length(ModelingToolkit.get_eqs(ode_sys)))") plot!(plt_2, unconnected(sol_deim_v), unconnected(sol_deim_x, nₜ_deim), unconnected(sol_deim_w), label = "POD$(pod_dim)/DEIM$(deim_dim)") ```