Skip to content

Commit

Permalink
remove update_minaug_every_step = 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rveltz committed Jan 14, 2024
1 parent 54e5df3 commit e988f21
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 44 deletions.
12 changes: 4 additions & 8 deletions docs/src/tutorials/ode/lorenz84-PO.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ prob = BK.BifurcationProblem(Lor, z0, parlor, (@lens _.F);
record_from_solution = (x, p) -> (X = x[1], Y = x[2], Z = x[3], U = x[4]),)
opts_br = ContinuationPar(p_min = -1.5, p_max = 3.0, ds = 0.002, dsmax = 0.05, n_inversion = 6, detect_bifurcation = 3, max_bisection_steps = 25, nev = 4, max_steps = 200, plot_every_step = 30)
@set! opts_br.newton_options.verbose = false
@set! opts_br.newton_options.tol = 1e-12
br = @time continuation(re_make(prob, params = setproperties(parlor;T=0.04,F=3.)),
@set! opts_br.newton_options.verbose = false
@set! opts_br.newton_options.tol = 1e-12
br = @time continuation(re_make(prob, params = setproperties(parlor;T=0.04,F=3.)),
PALC(), opts_br;
normC = norminf, bothside = true)
Expand All @@ -64,19 +64,16 @@ scene = plot(br, plotfold=false, markersize=4, legend=:topleft)
We follow the Fold points in the parameter plane $(T,F)$. We tell the solver to consider `br.specialpoint[5]` and continue it.

```@example LORENZ84V2
sn_codim2 = continuation(br, 5, (@lens _.T), ContinuationPar(opts_br, p_max = 3.2, p_min = -0.1, detect_bifurcation = 1, dsmin=1e-5, ds = -0.001, dsmax = 0.005, n_inversion = 10, save_sol_every_step = 1, max_steps = 130, max_bisection_steps = 55) ; plot = true,
sn_codim2 = continuation(br, 5, (@lens _.T), ContinuationPar(opts_br, p_max = 3.2, p_min = -0.1, detect_bifurcation = 1, dsmin=1e-5, ds = -0.001, dsmax = 0.005, n_inversion = 10, max_steps = 130, max_bisection_steps = 55) ; plot = true,
normC = norminf,
detect_codim2_bifurcation = 2,
update_minaug_every_step = 1,
start_with_eigen = false,
bothside = false,
)
hp_codim2_1 = continuation(br, 3, (@lens _.T), ContinuationPar(opts_br, ds = -0.001, dsmax = 0.02, dsmin = 1e-4, n_inversion = 8, save_sol_every_step = 1, detect_bifurcation = 1) ; plot = false, verbosity = 0,
normC = norminf,
# tangentAlgo = BorderedPred(),
detect_codim2_bifurcation = 2,
update_minaug_every_step = 1,
start_with_eigen = true,
bothside = true,
)
Expand Down Expand Up @@ -122,7 +119,6 @@ ns_po1 = continuation(hp_codim2_1, 4, opts_ns_po,
# which of the 2 NS curves should we compute?
whichns = 1,
jacobian_ma = :minaug,
verbosity = 3,
)
plot!(ns_po1, vars=(:F, :T), branchlabel = "NS1")
```
Expand Down
7 changes: 0 additions & 7 deletions docs/src/tutorials/ode/lorenz84.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ We follow the Fold points in the parameter plane $(T,F)$. We tell the solver to
sn_codim2 = continuation(br, 5, (@lens _.T), ContinuationPar(opts_br, p_max = 3.2, p_min = -0.1, dsmin=1e-5, ds = -0.001, dsmax = 0.005, n_inversion = 10) ; normC = norminf,
# detection of codim 2 bifurcations with bisection
detect_codim2_bifurcation = 2,
# we update the Fold problem at every continuation step
update_minaug_every_step = 1,
start_with_eigen = false,
# we save the different components for plotting
record_from_solution = recordFromSolutionLor,
Expand Down Expand Up @@ -126,8 +124,6 @@ We follow the Hopf points in the parameter plane $(T,F)$. We tell the solver to
hp_codim2_1 = continuation(br, 3, (@lens _.T), ContinuationPar(opts_br, ds = -0.001, dsmax = 0.02, dsmin = 1e-4, n_inversion = 6) ; normC = norminf,
# detection of codim 2 bifurcations with bisection
detect_codim2_bifurcation = 2,
# we update the Fold problem at every continuation step
update_minaug_every_step = 1,
# we save the different components for plotting
record_from_solution = recordFromSolutionLor,
# compute both sides of the initial condition
Expand Down Expand Up @@ -158,8 +154,6 @@ hp_from_bt = continuation(sn_codim2, 4, ContinuationPar(opts_br, ds = -0.001, ds
n_inversion = 6, detect_bifurcation = 1) ; normC = norminf,
# detection of codim 2 bifurcations with bisection
detect_codim2_bifurcation = 2,
# we update the Fold problem at every continuation step
update_minaug_every_step = 1,
# we save the different components for plotting
record_from_solution = recordFromSolutionLor,
)
Expand All @@ -184,7 +178,6 @@ When we computed the curve of Fold points, we detected a Zero-Hopf bifurcation.
hp_from_zh = continuation(sn_codim2, 2, ContinuationPar(opts_br, ds = 0.001, dsmax = 0.02, n_inversion = 6, detect_bifurcation = 1, max_steps = 150) ;
normC = norminf,
detect_codim2_bifurcation = 2,
update_minaug_every_step = 1,
start_with_eigen = true,
record_from_solution = recordFromSolutionLor,
bothside = false,
Expand Down
74 changes: 64 additions & 10 deletions docs/src/tutorials/ode/steinmetz.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,28 @@ opts_po_cont = ContinuationPar(p_min = 0., p_max = 20.0, ds = 0.002, dsmax = 0.0
@set! opts_po_cont.newton_options.verbose = false
@set! opts_po_cont.newton_options.max_iterations = 10
br_sh = continuation(deepcopy(probsh), cish, PALC(tangent = Bordered()), opts_po_cont;
#verbosity = 3, plot = true,
# verbosity = 3, plot = true,
callback_newton = BK.cbMaxNorm(10),
argspo...)
scene = plot(br_sh)
```

### Curve of Fold points of periodic orbits

```@example STEINMETZ
opts_posh_fold = ContinuationPar(br_sh.contparams, detect_bifurcation = 2, max_steps = 35, p_max = 1.9, plot_every_step = 10, dsmax = 4e-2, ds = 1e-2)
@set! opts_posh_fold.newton_options.tol = 1e-12
@set! opts_posh_fold.newton_options.verbose = true
fold_po_sh = @time continuation(br_sh, 2, (@lens _.k7), opts_posh_fold;
#verbosity = 3, plot = true,
detect_codim2_bifurcation = 2,
start_with_eigen = false,
# @set! opts_posh_fold.newton_options.verbose = true
fold_po_sh = @time continuation(deepcopy(br_sh), 2, (@lens _.k7), opts_posh_fold;
# verbosity = 2, plot = true,
detect_codim2_bifurcation = 0,
update_minaug_every_step = 1,
start_with_eigen = true,
usehessian = false,
jacobian_ma = :minaug,
normC = norminf,
callback_newton = BK.cbMaxNorm(1e1),
bdlinsolver = BorderingBLS(solver = DefaultLS(), check_precision = false),
# bdlinsolver = BorderingBLS(solver = DefaultLS(), check_precision = false),
)
plot(fold_po_sh)
```
Expand All @@ -112,11 +114,12 @@ plot(fold_po_sh)
```@example STEINMETZ
opts_posh_ns = ContinuationPar(br_sh.contparams, detect_bifurcation = 0, max_steps = 35, p_max = 1.9, plot_every_step = 10, dsmax = 4e-2, ds = 1e-2)
@set! opts_posh_ns.newton_options.tol = 1e-12
ns_po_sh = continuation(br_sh, 1, (@lens _.k7), opts_posh_ns;
verbosity = 2, plot = false,
# @set! opts_posh_ns.newton_options.verbose = true
ns_po_sh = continuation(deepcopy(br_sh), 1, (@lens _.k7), opts_posh_ns;
# verbosity = 2, plot = true,
detect_codim2_bifurcation = 2,
update_minaug_every_step = 1,
start_with_eigen = false,
usehessian = false,
jacobian_ma = :minaug,
normC = norminf,
callback_newton = BK.cbMaxNorm(1e1),
Expand All @@ -127,3 +130,54 @@ ns_po_sh = continuation(br_sh, 1, (@lens _.k7), opts_posh_ns;
plot(ns_po_sh, fold_po_sh, branchlabel = ["NS","Fold"])
```

## Computation with collocation

```@example STEINMETZ
probcoll, cicoll = generate_ci_problem( PeriodicOrbitOCollProblem(50, 4), prob, sol, 16.)
opts_po_cont = ContinuationPar(p_min = 0., p_max = 2.0,
ds = 0.002, dsmax = 0.05,
# n_inversion = 6,
nev = 4,
max_steps = 50,
tol_stability = 1e-5)
br_coll = continuation(probcoll, cicoll, PALC(tangent = Bordered()), opts_po_cont;
# verbosity = 3, plot = true,
callback_newton = BK.cbMaxNorm(10),
argspo...)
```

### Curve of Fold points of periodic orbits

```@example STEINMETZ
opts_pocl_fold = ContinuationPar(br_coll.contparams, detect_bifurcation = 1, plot_every_step = 10, dsmax = 4e-2)
fold_po_cl = @time continuation(br_coll, 2, (@lens _.k7), opts_pocl_fold;
# verbosity = 3, plot = true,
detect_codim2_bifurcation = 2,
update_minaug_every_step = 1,
start_with_eigen = false,
usehessian = true,
jacobian_ma = :minaug,
normC = norminf,
callback_newton = BK.cbMaxNorm(1e1),
)
```

### Curve of NS points of periodic orbits

```@example STEINMETZ
opts_pocl_ns = ContinuationPar(br_coll.contparams, detect_bifurcation = 1, plot_every_step = 10, dsmax = 4e-2)
ns_po_cl = continuation(br_coll, 1, (@lens _.k7), opts_pocl_ns;
# verbosity = 3, plot = true,
detect_codim2_bifurcation = 2,
update_minaug_every_step = 1,
start_with_eigen = false,
jacobian_ma = :minaug,
normC = norminf,
callback_newton = BK.cbMaxNorm(1e1),
)
```

```@example STEINMETZ
plot(ns_po_cl, fold_po_cl, branchlabel = ["NS","Fold"])
```
5 changes: 0 additions & 5 deletions docs/src/tutorials/ode/tutorialCO.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ sn_codim2 = continuation(br, 2, (@lens _.k),
bothside = true,
# detection of codim 2 bifurcations
detect_codim2_bifurcation = 2,
# update the Fold problem at every continuation step
update_minaug_every_step = 1,
)
scene = plot(sn_codim2, vars = (:q2, :x), branchlabel = "Fold")
Expand All @@ -99,9 +97,6 @@ hp_codim2 = continuation(br, 1, (@lens _.k),
normC = norminf,
# detection of codim 2 bifurcations
detect_codim2_bifurcation = 2,
# tell to start the Hopf problem using eigen elements: compute left eigenvector
# we update the Hopf problem at every continuation step
update_minaug_every_step = 1,
# compute both sides of the initial condition
bothside = true,
)
Expand Down
20 changes: 7 additions & 13 deletions docs/src/tutorials/ode/tutorialsCodim2PO.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ z0 = [0.1,0.1,1,0]
prob = BifurcationProblem(Pop!, z0, par_pop, (@lens _.b0);
record_from_solution = (x, p) -> (x = x[1], y = x[2], u = x[3]))
opts_br = ContinuationPar(p_min = 0., p_max = 20.0, ds = 0.002, dsmax = 0.01, n_inversion = 6, detect_bifurcation = 3, max_bisection_steps = 25, nev = 4, max_steps = 20000)
opts_br = ContinuationPar(p_min = 0., p_max = 20.0, ds = 0.002, dsmax = 0.01, n_inversion = 6, nev = 4)
nothing #hide
```
Expand Down Expand Up @@ -104,7 +104,6 @@ We continue w.r.t. to $\epsilon$ and find a period-doubling bifurcation.
```@example TUTPPREY
prob2 = @set probtrap.prob_vf.lens = @lens _.ϵ
brpo_pd = continuation(prob2, ci, PALC(), opts_po_cont;
verbosity = 3, plot = true,
argspo...
)
scene = plot(brpo_pd)
Expand All @@ -120,7 +119,6 @@ probsh, cish = generate_ci_problem( ShootingProblem(M=3),
opts_po_cont = setproperties(opts_br, max_steps = 50, tol_stability = 1e-3)
br_fold_sh = continuation(probsh, cish, PALC(tangent = Bordered()), opts_po_cont;
verbosity = 3, plot = true,
argspo...
)
Expand All @@ -132,7 +130,6 @@ We continue w.r.t. to $\epsilon$ and find a period-doubling bifurcation.
```@example TUTPPREY
probsh2 = @set probsh.lens = @lens _.ϵ
brpo_pd_sh = continuation(probsh2, cish, PALC(), opts_po_cont;
verbosity = 3, plot = true,
argspo...
)
scene = plot(brpo_pd_sh)
Expand All @@ -144,12 +141,11 @@ We do the same as in the previous section but using orthogonal collocation. This

```@example TUTPPREY
# this is the function which builds probcoll from sol
probcoll, ci = generate_ci_problem(PeriodicOrbitOCollProblem(26, 3; update_section_every_step = 0),
probcoll, ci = generate_ci_problem(PeriodicOrbitOCollProblem(26, 3),
prob, sol, 2.)
opts_po_cont = setproperties(opts_br, max_steps = 50, tol_stability = 1e-8)
brpo_fold = continuation(probcoll, ci, PALC(), opts_po_cont;
verbosity = 3, plot = true,
argspo...
)
scene = plot(brpo_fold)
Expand All @@ -160,7 +156,6 @@ We continue w.r.t. to $\epsilon$ and find a period-doubling bifurcation.
```@example TUTPPREY
prob2 = @set probcoll.prob_vf.lens = @lens _.ϵ
brpo_pd = continuation(prob2, ci, PALC(), ContinuationPar(opts_po_cont, dsmax = 5e-3);
verbosity = 3, plot = true,
argspo...
)
Expand All @@ -176,7 +171,7 @@ opts_posh_fold = ContinuationPar(br_fold_sh.contparams, detect_bifurcation = 3,
@set! opts_posh_fold.newton_options.tol = 1e-12
fold_po_sh2 = continuation(br_fold_sh, 1, (@lens _.ϵ), opts_posh_fold;
verbosity = 2, plot = true,
# verbosity = 2, plot = true,
detect_codim2_bifurcation = 2,
jacobian_ma = :minaug,
start_with_eigen = false,
Expand All @@ -185,7 +180,7 @@ fold_po_sh2 = continuation(br_fold_sh, 1, (@lens _.ϵ), opts_posh_fold;
)
fold_po_sh1 = continuation(br_fold_sh, 2, (@lens _.ϵ), opts_posh_fold;
verbosity = 2, plot = true,
# verbosity = 2, plot = true,
detect_codim2_bifurcation = 2,
jacobian_ma = :minaug,
start_with_eigen = false,
Expand All @@ -206,18 +201,17 @@ probshpd, ci = generate_ci_problem(ShootingProblem(M=3), re_make(prob, params =
prob2 = @set probshpd.lens = @lens _.ϵ
brpo_pd = continuation(prob2, ci, PALC(), ContinuationPar(opts_po_cont, dsmax = 5e-3);
verbosity = 3, plot = true,
# verbosity = 3, plot = true,
argspo...,
bothside = true,
)
opts_pocoll_pd = ContinuationPar(brpo_pd.contparams, detect_bifurcation = 3, max_steps = 40, p_min = 1.e-2, plot_every_step = 10, dsmax = 1e-2, ds = -1e-3)
opts_pocoll_pd = ContinuationPar(brpo_pd.contparams, max_steps = 40, p_min = 1.e-2, dsmax = 1e-2, ds = -1e-3)
@set! opts_pocoll_pd.newton_options.tol = 1e-12
pd_po_sh2 = continuation(brpo_pd, 2, (@lens _.b0), opts_pocoll_pd;
verbosity = 3,
# verbosity = 3,
detect_codim2_bifurcation = 2,
start_with_eigen = false,
usehessian = false,
jacobian_ma = :minaug,
normC = norminf,
callback_newton = BK.cbMaxNorm(10),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/ode/tutorialsODE-PD.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ br_po = continuation(
scene = plot(br, br_po)
```

Two period doubling bifurcations were detected. We shall now compute the branch of periodic orbits from these PD points. We do not provide Automatic Branch Switching as we do not have the PD normal form computed in `BifurcationKit`. Hence, it takes some trial and error to find the `ampfactor` of the PD branch.
Two period doubling bifurcations were detected. We shall now compute the branch of periodic orbits from these PD points. We do not provide Automatic Branch Switching as we do not have the PD normal form computed for `PeriodicOrbitTrapProblem`. Hence, it takes some trial and error to find the `ampfactor` of the PD branch.

```@example TUTLURE
# aBS from PD
Expand Down

0 comments on commit e988f21

Please sign in to comment.