Skip to content
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

Bifurcationkit_ext observable fix #2917

Merged
merged 5 commits into from
Aug 13, 2024
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
3 changes: 2 additions & 1 deletion ext/MTKBifurcationKitExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ function BifurcationKit.BifurcationProblem(osys::ODESystem, args...; kwargs...)
if !ModelingToolkit.iscomplete(osys)
error("A completed `ODESystem` is required. Call `complete` or `structural_simplify` on the system before creating a `BifurcationProblem`")
end
nsys = NonlinearSystem([0 ~ eq.rhs for eq in equations(osys)],
nsys = NonlinearSystem([0 ~ eq.rhs for eq in full_equations(osys)],
unknowns(osys),
parameters(osys);
observed = observed(osys),
name = nameof(osys))
return BifurcationKit.BifurcationProblem(complete(nsys), args...; kwargs...)
end
Expand Down
30 changes: 30 additions & 0 deletions test/extensions/bifurcationkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,33 @@ let
@test length(fold_points) == 2
@test fold_points [-1.1851851706940317, -5.6734983580551894e-6] # test that they occur at the correct parameter values).
end

let
@mtkmodel FOL begin
@parameters begin
τ # parameters
end
@variables begin
x(t) # dependent variables
RHS(t)
end
@equations begin
RHS ~ τ + x^2 - 0.1
D(x) ~ RHS
end
end

@mtkbuild fol = FOL()

par = [fol.τ => 0.0]
u0 = [fol.x => -1.0]
#prob = ODEProblem(fol, u0, (0.0, 1.), par)

bif_par = fol.τ
bp = BifurcationProblem(fol, u0, par, bif_par)
opts_br = ContinuationPar(p_min = -1.0,
p_max = 1.0)
bf = bifurcationdiagram(bp, PALC(), 2, opts_br)

@test bf.γ.specialpoint[1].param0.1 atol=1e-4 rtol=1e-4
end
Loading