Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am lost in upgrading from v0.1.x to v0.2.x #72

Closed
liuyxpp opened this issue Nov 24, 2022 · 2 comments
Closed

I am lost in upgrading from v0.1.x to v0.2.x #72

liuyxpp opened this issue Nov 24, 2022 · 2 comments

Comments

@liuyxpp
Copy link

liuyxpp commented Nov 24, 2022

How can I upgrade following code to be v0.2.x compatible?

        F(x, p) = collect(binodal_condition(p.Aα, x..., p.model))
	J(x, p) = ForwardDiff.jacobian(z->F(z,p), x)
	par = (Aα=ϕAα, model=model)
	x0 = zeros(3)
	prob = BifurcationProblem(F, x0, par, (@lens _.Aα))  # for v0.2.x
	
	opts = BK.ContinuationPar(dsmax=0.02, dsmin=1e-5, ds=0.001, maxSteps=2000,
							pMin=ϕAα_min,
							pMax=ϕAα_max,
							saveSolEveryStep=1,
							maxBisectionSteps=50,
							detectBifurcation=3)
	opts = BK.ContinuationPar(opts; kwargs...)

	# br, = BK.continuation(F, J, x0, par, (@lens _.Aα), opts,
	# 		recordFromSolution = (x,p) -> (ϕBα=x[1], ϕAβ=x[2], ϕBβ=x[3], ϕAα=p),
	# 		bothside=bothside, verbosity=3)  # BifurcationKit version 0.1.X, what is the algo used here?
	br, = BK.continuation(prob, Natural(), opts,
			recordFromSolution = (x,p) -> (ϕBα=x[1], ϕAβ=x[2], ϕBβ=x[3], ϕAα=p),
			bothside=bothside, verbosity=3)  # Try v0.2.x but errored

The error information is

MethodError: no method matching iterate(::BifurcationKit.ContResult{BifurcationKit.EquilibriumCont, NamedTuple{(:x, :param, :itnewton, :itlinear, :ds, :θ, :n_unstable, :n_imag, :stable, :step), Tuple{Float64, Float64, Int64, Int64, Float64, Float64, Int64, Int64, Bool, Int64}}, Vector{ComplexF64}, Matrix{ComplexF64}, BifurcationKit.SpecialPoint{Float64, NamedTuple{(:x,), Tuple{Float64}}, Vector{Float64}, Vector{Float64}}, Vector{NamedTuple{(:x, :p, :step), Tuple{Vector{Float64}, Float64, Int64}}}, BifurcationKit.ContinuationPar{Float64, BifurcationKit.DefaultLS, BifurcationKit.DefaultEig{typeof(real)}}, BifurcationKit.BifurcationProblem{BifurcationKit.BifFunction{Main.var"workspace#21".var"#F#4", BifurcationKit.var"#6#21"{Main.var"workspace#21".var"#F#4"}, Nothing, BifurcationKit.var"#4#19"{Main.var"workspace#21".var"#F#4"}, Nothing, BifurcationKit.var"#9#25"{BifurcationKit.var"#d1Fad#23"{Main.var"workspace#21".var"#F#4"}}, BifurcationKit.var"#11#27", BifurcationKit.var"#13#29", BifurcationKit.var"#15#31", Bool, Float64}, Vector{Float64}, NamedTuple{(:Aα, :model), Tuple{Float64, NamedTuple{(:αA, :αB, :αS, :χABN, :χASN, :χBSN), NTuple{6, Float64}}}}, Setfield.PropertyLens{:Aα}, typeof(BifurcationKit.plotDefault), typeof(BifurcationKit.recordSolDefault)}, BifurcationKit.Natural})

Closest candidates are:

iterate(!Matched::Union{LinRange, StepRangeLen}) at range.jl:872

iterate(!Matched::Union{LinRange, StepRangeLen}, !Matched::Integer) at range.jl:872

iterate(!Matched::T) where T<:Union{Base.KeySet{<:Any, <:Dict}, Base.ValueIterator{<:Dict}} at dict.jl:712

...

indexed_iterate(::BifurcationKit.ContResult{BifurcationKit.EquilibriumCont,

...

Sorry for the bother. But I can not find any tips for migration in the doc.

@rveltz
Copy link
Member

rveltz commented Nov 24, 2022

Yes the error is not very helpful. It should not be br, = continuation... but br = continuation...

prob = BifurcationProblem(F, x0, par, (@lens _.Aα) ; recordFromSolution = (x,p) -> (ϕBα=x[1], ϕAβ=x[2], ϕBβ=x[3], ϕAα=p),)
br = BK.continuation(prob, Natural(), opts,
			bothside=bothside, verbosity=3) 

@liuyxpp
Copy link
Author

liuyxpp commented Nov 25, 2022

Ah, it is my bad, thanks! However, I do think it is a good idea to have a migration guide in the doc somewhere to ease transition.

@liuyxpp liuyxpp closed this as completed Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants