Help with continuation using BifurcationKit.jl

Hello all,

Relatively new to BifurcationKit (I have used other continuation software in the past). I’ve been able to get a 2D system (quite similar to the 3D system I’m having trouble with) to work, so any help or advice would be welcome.

The sample code is:

using Revise
using Plots, Setfield
using BifurcationKit
const BK = BifurcationKit
gr()

# vector field
function ODE_3D(u, p)
    (;A1,A2,A3,B1,B2,B3,mu12,mu21,mu31,mu32,mu33,
        K1,K2,K3,K4,K5,Tr_mom,Tr_cyt,x_tot,y_tot) = p
    x, y, z = u
    out = similar(u)
    out[1] = A1 - B1*x + mu12*K1/(K1 + y) + Tr_mom*(x_tot - x) - Tr_cyt*x
    out[2] = A2 - B2*y + mu21*K2/(K2 + x) + Tr_mom*(y_tot - y) - Tr_cyt*y
    out[3] = A3 - B3*z + mu31*x/(K3 + x) + mu32*K4/(K4 + y) - mu33*z^2/(K5^2 + z^2)
    out
end 

# Model parameters
params = (A1 = 0, A2 = 9127.71, A3 = 44178.2,
    B1 = 0.5796, B2 = 0.1205, B3 = 0.347,
    mu12 = 2.76873, mu21 = 2.14908, mu31 = 0.586803, mu32 = 0.907841, mu33 = 2.13773,
    K1 = 0.0615, K2 = 0.0615, K3 = 0.0116, K4 = 0.0219, K5 = 0.0143,
    Tr_mom = 1.16e-2, Tr_cyt = 1.16e-3, x_tot = 16850, y_tot = 7000)

record3D(x, p; k...) = (x = x[1], y = x[2], z = x[3])

# Initial conditions
u0 = [329.9683, 69104.8357, 127310.2278];

prob = BifurcationProblem(ODE_3D, u0, params, (@optic _.A1); record_from_solution = record3D)

# Continuation parameters
opts_br = ContinuationPar(
    dsmin = 1e-9,           # Minimum step size
    dsmax = 1e-3,           # Maximum step size
    ds = 1e-6,              # Initial step size
    p_min = 0.0,            # Minimum value of the parameter
    p_max = 100.0,          # Maximum value of the parameter
    max_steps = 1e6,        # Maximum number of continuation steps
    tol_stability = 1e-12,  # Tolerance for stability computation
    detect_fold = true,     # Detect fold bifurcations
    detect_bifurcation = 1  # Number of bifurcation detection methods
)

br = continuation(prob, PALC(), opts_br, bothside = true, normC = norminf)

The following error is generated

MethodError: no method matching iterate_from_two_points(::ContIterable{BifurcationKit.EquilibriumCont, BifurcationProblem{BifFunction{typeof(ODE_3D), BifurcationKit.var"#8#24", Nothing, BifurcationKit.var"#6#22", Nothing, BifurcationKit.var"#11#28"{BifurcationKit.var"#d1Fad#26"}, BifurcationKit.var"#13#30", BifurcationKit.var"#15#32", BifurcationKit.var"#17#34", Bool, Float64}, Vector{Float64}, @NamedTuple{A1::Int64, A2::Int64, A3::Int64, B1::Float64, B2::Float64, B3::Float64, mu12::Float64, mu21::Float64, mu31::Float64, mu32::Float64, mu33::Float64, K1::Float64, K2::Float64, K3::Float64, K4::Float64, K5::Float64, Tr_mom::Float64, Tr_cyt::Float64, x_tot::Int64, y_tot::Int64}, PropertyLens{:A1}, typeof(BifurcationKit.plot_default), typeof(record3D), typeof(BifurcationKit.save_solution_default)}, PALC{Secant, MatrixBLS{DefaultLS}, Float64, BifurcationKit.DotTheta{BifurcationKit.var"#279#281", BifurcationKit.var"#280#282"}}, Float64, DefaultLS, DefaultEig{typeof(real)}, typeof(norminf), typeof(BifurcationKit.finalise_default), typeof(BifurcationKit.cb_default), Nothing}, ::Vector{Float64}, ::Int64, ::Vector{Float64}, ::Float64; _verbosity::UInt8)

Closest candidates are:
  iterate_from_two_points(::ContIterable, ::Any, ::T, ::Any, ::T; _verbosity) where T
   @ BifurcationKit ~/.julia/packages/BifurcationKit/KwA2l/src/Continuation.jl:382

I’ve tried a number of fixes without any success

  • Perform the continuation in one direction
  • Use the default continuation parameters
  • Alternative continuation algorithms
  • I’ve checked that the continuation is close to the steady state

Thanks

A1 is an Int in params and BK does not know to what it should convert it.
Given the range of values, you may have to adjust the newton tolerance @reset opts_br.newton_options.tol = new_wanted_tolerance