Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/tutorials/deim_FitzHugh-Nagumo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
```
Expand Down
7 changes: 7 additions & 0 deletions src/deim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading