CO-oxydation (codim 2)
In this tutorial, we study the Bykov–Yablonskii–Kim model of CO-oxydation (see [Govaerts]). The goal of the tutorial is to show a simple example of how to perform codimension 2 bifurcation detection.
\[\left\{\begin{array}{l}\dot{x}=2 q_{1} z^{2}-2 q_{5} x^{2}-q_{3} x y \\ \dot{y}=q_{2} z-q_{6} y-q_{3} x y \\ \dot{s}=q_{4} z-k q_{4} s\end{array}\right.\tag{E}\]
where $z=1-x-y-s$.
We start with some imports that are useful in the following.
using Revise, ForwardDiff, Parameters, Plots, LinearAlgebra
using BifurcationKit
const BK = BifurcationKit
# define the sup norm
norminf(x) = norm(x, Inf)
Problem setting
We can now encode the vector field (E) in a function and use automatic differentiation to compute its various derivatives.
# vector field of the problem
function COm(u, p)
@unpack q1,q2,q3,q4,q5,q6,k = p
x, y, s = u
z = 1-x-y-s
out = similar(u)
out[1] = 2q1 * z^2 - 2q5 * x^2 - q3 * x * y
out[2] = q2 * z - q6 * y - q3 * x * y
out[3] = q4 * z - k * q4 * s
out
end
# parameters used in the model
par_com = (q1 = 2.5, q2 = 0.6, q3 = 10., q4 = 0.0675, q5 = 1., q6 = 0.1, k = 0.4)
recordCO(x, p) = (x = x[1], y = x[2], s = x[3])
# initial condition
z0 = [0.07, 0.2, 05]
# Bifurcation Problem
prob = BifurcationProblem(COm, z0, par_com, (@lens _.q2); recordFromSolution = recordCO)
Continuation and codim 1 bifurcations
Once the problem is set up, we can continue the state w.r.t. $q_2$ to and detect codim 1 bifurcations. This is achieved as follows:
# continuation parameters
opts_br = ContinuationPar(pMin = 0., pMax = 1.9, ds = 0.002, dsmax = 0.01)
# compute the branch of solutions
br = continuation(prob, PALC(), opts_br;
plot = true, verbosity = 2, normC = norminf)
┌─ Curve type: EquilibriumCont
├─ Number of points: 101
├─ Type of vectors: Vector{Float64}
├─ Parameter q2 starts at 0.6, ends at 1.6848122458850936
├─ Algo: PALC
└─ Special points:
If `br` is the name of the branch,
ind_ev = index of the bifurcating eigenvalue e.g. `br.eig[idx].eigenvals[ind_ev]`
- # 1, hopf at q2 ≈ +1.04106765 ∈ (+1.04084579, +1.04106765), |δp|=2e-04, [converged], δ = ( 2, 2), step = 36, eigenelements in eig[ 37], ind_ev = 2
- # 2, bp at q2 ≈ +1.05219982 ∈ (+1.05219332, +1.05219982), |δp|=6e-06, [converged], δ = (-1, 0), step = 40, eigenelements in eig[ 41], ind_ev = 2
- # 3, bp at q2 ≈ +1.04204863 ∈ (+1.04204863, +1.04204865), |δp|=3e-08, [converged], δ = ( 1, 0), step = 48, eigenelements in eig[ 49], ind_ev = 2
- # 4, hopf at q2 ≈ +1.05223978 ∈ (+1.05085807, +1.05223978), |δp|=1e-03, [converged], δ = (-2, -2), step = 52, eigenelements in eig[ 53], ind_ev = 2
- # 5, endpoint at q2 ≈ +1.69888900, step = 101
# plot the branch
scene = plot(br, xlims = (0.8,1.8))
Continuation of Fold points
We follow the Fold points in the parameter plane $(q_2, k)$. We tell the solver to consider br.specialpoint[2]
and continue it.
sn_codim2 = continuation(br, 2, (@lens _.k),
ContinuationPar(opts_br, pMax = 2.2, ds = -0.001, dsmax = 0.05);
normC = norminf,
# detection of codim 2 bifurcations with bisection
detectCodim2Bifurcation = 2,
# we update the Fold problem at every continuation step
updateMinAugEveryStep = 1,
# compute both sides of the initial condition
bothside=true,)
scene = plot(sn_codim2, vars = (:q2, :x), branchlabel = "Fold")
plot!(scene, br, xlims=(0.8, 1.8))
Continuation of Hopf points
We tell the solver to consider br.specialpoint[1]
and continue it.
hp_codim2 = continuation(br, 1, (@lens _.k),
ContinuationPar(opts_br, pMax = 2.8, ds = -0.001, dsmax = 0.05) ;
normC = norminf,
# detection of codim 2 bifurcations with bisection
detectCodim2Bifurcation = 2,
# tell to start the Hopf problem using eigen elements: compute left eigenvector
startWithEigen = true,
# we update the Hopf problem at every continuation step
updateMinAugEveryStep = 1,
# compute both sides of the initial condition
bothside = true,
)
# plotting
scene = plot(sn_codim2, vars = (:q2, :x), branchlabel = "Fold")
plot!(scene, hp_codim2, vars = (:q2, :x), branchlabel = "Hopf")
plot!(scene, br, xlims = (0.6, 1.5))
References
- Govaerts
Govaerts, Willy J. F. Numerical Methods for Bifurcations of Dynamical Equilibria. Philadelphia, Pa: Society for Industrial and Applied Mathematics, 2000.