Skip to content

Commit

Permalink
Merge pull request #2917 from jClugstor/bifurcation_ext_codegen_fix
Browse files Browse the repository at this point in the history
Bifurcationkit_ext observable fix
  • Loading branch information
ChrisRackauckas authored Aug 13, 2024
2 parents cf929ad + d4899bc commit ca85342
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
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

0 comments on commit ca85342

Please sign in to comment.