Skip to content

Commit 43bb2e1

Browse files
fix: fix BifurcationKitExt
1 parent bc425bb commit 43bb2e1

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

ext/MTKBifurcationKitExt.jl

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module MTKBifurcationKitExt
55
# Imports
66
using ModelingToolkit, Setfield
77
import BifurcationKit
8+
using SymbolicIndexingInterface: is_time_dependent
89

910
### Observable Plotting Handling ###
1011

@@ -94,6 +95,14 @@ function BifurcationKit.BifurcationProblem(nsys::System,
9495
if !ModelingToolkit.iscomplete(nsys)
9596
error("A completed `System` is required. Call `complete` or `structural_simplify` on the system before creating a `BifurcationProblem`")
9697
end
98+
if is_time_dependent(nsys)
99+
nsys = System([0 ~ eq.rhs for eq in full_equations(nsys)],
100+
unknowns(nsys),
101+
parameters(nsys);
102+
observed = observed(nsys),
103+
name = nameof(nsys))
104+
nsys = complete(nsys)
105+
end
97106
@set! nsys.index_cache = nothing # force usage of a parameter vector instead of `MTKParameters`
98107
# Creates F and J functions.
99108
ofun = NonlinearFunction(nsys; jac = jac)
@@ -143,17 +152,4 @@ function BifurcationKit.BifurcationProblem(nsys::System,
143152
kwargs...)
144153
end
145154

146-
# When input is a ODESystem.
147-
function BifurcationKit.BifurcationProblem(osys::System, args...; kwargs...)
148-
if !ModelingToolkit.iscomplete(osys)
149-
error("A completed `ODESystem` is required. Call `complete` or `structural_simplify` on the system before creating a `BifurcationProblem`")
150-
end
151-
nsys = System([0 ~ eq.rhs for eq in full_equations(osys)],
152-
unknowns(osys),
153-
parameters(osys);
154-
observed = observed(osys),
155-
name = nameof(osys))
156-
return BifurcationKit.BifurcationProblem(complete(nsys), args...; kwargs...)
157-
end
158-
159155
end # module

0 commit comments

Comments
 (0)