Giter Club home page Giter Club logo

Comments (5)

rveltz avatar rveltz commented on May 29, 2024

you have to do

using JLD2

before using BifurcationKit. The online docs have not yet propagated the change but this is explained when doing ? continuation or ? ContinuationPar

from bifurcationkit.jl.

yhchang96 avatar yhchang96 commented on May 29, 2024

I have installed JLD2 and now it works. Thanks. However, I find that it has issues saving the last continuation step and also the reverse branch when I have bothside=true.

using BifurcationKit, LinearAlgebra, Plots, Parameters, Setfield, JLD2

const BK = BifurcationKit

N(x; a = 0.5, b = 0.01) = 1 + (x + a*x^2)/(1 + b*x^2)

function F_chan(x, p)
    @unpack α, β = p
    f = similar(x)
    n = length(x)
    f[1] = x[1] - β
    f[n] = x[n] - β
    for i=2:n-1
        f[i] = (x[i-1] - 2 * x[i] + x[i+1]) * (n-1)^2 + α * N(x[i], b = β)
    end
    return f
end

n = 101
sol = [(i-1)*(n-i)/n^2+0.1 for i=1:n]

par = (α = 3.3, β = 0.01)

optnewton = NewtonPar(tol = 1e-11, verbose = false)

out, = @time newton( F_chan, sol, par, optnewton)

optcont = ContinuationPar(dsmin = 0.01, dsmax = 0.2, ds= 0.1, pMin = 0., pMax = 4.1, saveToFile=true,
    newtonOptions = NewtonPar(maxIter = 10, tol = 1e-9))

filename = "test_123"

br, = continuation(F_chan, out, par, (@lens _.α), optcont; plot = false, verbosity = 1, filename=filename, bothside=true)

br2 = load(@sprintf("%s-branch.jld2",filename))["branch"]  # load the saved branch
  1. The output screen (from verbosity=1) doesn't show any error/warnings for the 'forward' continuation, but I think it fails to save the last continuation step at alpha=4.1:
julia> any(br.param .== 4.1)
true

julia> any(br2.param .== 4.1)
false
  1. Once the 'forward' continuation is done, it starts doing the 'reverse' continuation. Now the output screen shows the following:
#####################################################
────────── Pseudo-Arclength Continuation ────────────

─────────────────  INITIAL GUESS ────────────────────
--> convergence of initial guess = OK

--> parameter = 3.3, initial step

───────────────── INITIAL TANGENT ───────────────────
--> convergence of initial guess = OK

--> parameter = 3.2993333333333332, initial step (bis)
Predictor: SecantPred()
──────────────────────────────────────────────────────────────────────
Continuation Step 0 
Step size = -1.0000e-01
Parameter α = 3.3000e+00 ⟶  3.1672e+00 [guess]
Parameter α = 3.3000e+00 ⟶  3.1662e+00 
Predictor: SecantPred()
┌ Error: Could not save branch in the jld2 file
└ @ BifurcationKit C:\Users\dchang\.julia\packages\BifurcationKit\eoTLY\src\BifurcationKit.jl:114
──────────────────────────────────────────────────────────────────────
Continuation Step 1 
Step size = -1.2450e-01
Parameter α = 3.1662e+00 ⟶  2.9997e+00 [guess]
Parameter α = 3.1662e+00 ⟶  2.9974e+00
Predictor: SecantPred()
┌ Error: Could not save branch in the jld2 file
└ @ BifurcationKit C:\Users\dchang\.julia\packages\BifurcationKit\eoTLY\src\BifurcationKit.jl:114

I get that error message for all the steps in the 'reverse' continuation. And when I compare br.param and br2.param, then it is clear that the whole 'reverse' branch is missing.

from bifurcationkit.jl.

rveltz avatar rveltz commented on May 29, 2024

Oh! I never tested it with bothside = true. I will try to fix it asap

from bifurcationkit.jl.

rveltz avatar rveltz commented on May 29, 2024

This should be fixed on master

from bifurcationkit.jl.

rveltz avatar rveltz commented on May 29, 2024

Can I close this issue?

from bifurcationkit.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.