Coder Social home page Coder Social logo

bifurcationkitdocs.jl's People

Contributors

datseris avatar musvaage avatar rveltz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

bifurcationkitdocs.jl's Issues

Method extractPeriodShooting in Floquet.jl is not defined

I was trying to compute a branch of periodic orbits of a forced nonlinear oscillator with shooting when I came across this issue. It happens when the continuation method is used with AbstractShootingProblem and detectBifurcation > 0. The method extractPeriodShooting is called by MonodromyQaD in Floquet.jl, giving the error. Bellow is a code sample that reproduces the error.

using Revise, Parameters, Setfield, Plots, LinearAlgebra
using DifferentialEquations
using BifurcationKit
const BK = BifurcationKit

# define the sup norm
norminf(x) = norm(x, Inf)

# function to record information from a solution
recordFromSolution(x, p) = (u1 = x[1], u2 = x[2])

####################################################################################################

function F!(f, x, p, t=0)
	@unpack a, b1, b2, d, λ, ω = p
	f[1] = x[2]
	f[2] = - d * x[2] - a * x[1] - b1 * (x[1]^2) - b2 * (x[1]^3) + λ * sin* t)
    return f
end
F(x,p,t) = F!(similar(x),x,p,t)

# Defining the Jacobian
function dF(x,p,t = 0)
	@unpack a, b1, b2, d, λ, ω = p
    M = zeros(2,2)
    M[1,1] = 0
    M[1,2] = 1
    M[2,1] = -a -b1*2*x[1] -b2*3*(x[1]^2)
    M[2,2] = -d
    return M
 end

# parameters of the model
P = @with_kw (a=-1., b1=1., b2=0., d=0.1, λ=0.06, ω=0.81)
par_Helm = P(-1.0, 1.0, 0.0, 0.1, 0.06, 0.81)
par_Duff = P()
par0 = (@set par_Helm.a = -1.15)

# initial condition guess
z0 = [1.; 0.001]
vf = ODEFunction(F; jac = dF)       #ODEfunction with the Jacobian
prob = ODEProblem(vf, z0, (0.0, 1000*2*π/par0.ω), par0)   #ODEProblem encoding
sol = solve(prob, Tsit5())
plot(sol)

z0 = sol.u[end]
prob = ODEProblem(vf, z0, (0.0, 2*π/par0.ω), par0)   #ODEProblem encoding
sol = solve(prob, Tsit5())
plot(sol)


# this encodes the functional for the Shooting problem
probSh = ShootingProblem(
	# we pass the ODEProblem encoding the flow and the time stepper
	prob, Tsit5(),
	# this is for the phase condition, you can pass your own section as well
	[vec(sol[end])],
	# enable threading
	parallel = true,
	# these are options passed to the ODE time stepper
	atol = 1e-10, rtol = 1e-8)

# Newton interation for low energy level
zp0 = vcat(vec(sol[end]),2*π/par_Helm.ω)

ls = GMRESIterativeSolvers(reltol = 1e-7, N = length(zp0), maxiter = 100)
newtonOpt = NewtonPar(verbose = true, tol = 1e-8, maxIter = 25, linsolver = ls)

norminf(x) = norm(x, Inf)

# continuation options
opts_cont = ContinuationPar(dsmin = 0.001, dsmax = 1.0, ds= 0.01, pMin = 0.02, pMax = 0.1,
	maxSteps = 50, newtonOptions = newtonOpt, nev = 2,
	# options to detect bifurcations
	detectBifurcation = 3, detectFold = true, nInversion = 8, maxBisectionSteps = 25,
	precisionStability = 1e-8, saveSolEveryStep = 1)

br, = continuation(
    probSh,
    zp0,
    par0,
    (@lens _.λ),
    opts_cont,
    linearAlgo = MatrixFreeBLS(@set ls.N = ls.N + 1);
    verbosity = 3,
    plot = true,
    recordFromSolution = recordFromSolution,
	normC = norminf
)

typos

I can submit a PR but have a couple of questions.

abort
aggressive
algorithm
analyzed
certain
coefficients
homogeneous
match
occurrence
particular
plotting
satisfies
several
techniques

$ grep -nr abord BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/Swift-Hohenberg1d.md:86:               # is too big, abord continuation step
$ grep -nr agressive BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/DeflatedContinuation.md:53:- finally, you can try some agressive shift (here `0.01` in the deflation operator, like `DeflationOperator(2, dot, 0.01, [sol])` but use it wisely.
$ grep -nr algoritm BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/DeflatedContinuation.md:57:We show a quick and simple example of use. Note in particular that the algoritm is able to find the disconnected branch. The starting points are marked with crosses
$ grep -nr anlyzed BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/cgl1dwave.md:196:We note that the branch of travelling wave solutions has a Hopf bifurcation point at which point Modulated Travelling waves will emerge. This will be anlyzed in the future.
$ grep -nr certains BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/faq.md:74:On certains cases, one can still go away with the following trick. Say one is interested (dummy example!) to study
$ grep -nr cofficients BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/tutorials3b.md:294:A basic method for computing Floquet cofficients based on the eigenvalues of the monodromy operator is available (see [`FloquetQaD`](@ref)). It is precise enough to locate bifurcations. Their computation is triggered like in the case of a regular call to `continuation`:
$ grep -nr homogenous BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md:132:## Branch of homogenous solutions
BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md:133:At this stage, we note that the problem has a curve of homogenous (constant in space) solutions $u_h$ solving $N(\lambda, u_h)=0$. We shall compute this branch now.
BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md:143:We call `continuation` with the initial guess `sol0` which is homogenous, thereby generating homogenous solutions:
BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md:182:The second bifurcation point on the branch `br` of homogenous solutions has a 2d kernel. we provide two methods to deal with such case
BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md:248:At this stage, we know what happens at the 2d bifurcation point of the curve of homogenous solutions. We chose another method based on [Deflated problems](@ref). We want to find all nearby solutions of the problem close to this bifurcation point. This is readily done by trying several initial guesses in a brute force manner:
BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md:259:# of homogenous solutions
$ grep -nr mactch BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/faq.md:103:SciML is now able to mactch the performance of the Sundials solver `CVODE_BDF`. Check the [news](https://sciml.ai/news/2021/05/24/QNDF/) for more information.
$ grep -nr occurence BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/DeflatedContinuation.md:52:- try to limit the newton residual by using the argument `callbackN = BifurcationKit. cbMaxNorm(1e7)`. This will likely remove the occurence of `┌ Error: Same solution found for identical parameter value!!`
$ grep -nr particuliar BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/periodicOrbitTrapeze.md:81:For `:BorderedLU`, we take advantage of the bordered shape of the linear solver and use a LU decomposition to invert `dG` using a bordered linear solver. More precisely, the bordered structure of $\mathcal J$ is stored using the internal structure `POTrapJacobianBordered`. Then, $\mathcal J$ is inverted using the custom bordered linear solver `PeriodicOrbitTrapBLS` which is based on the bordering strategy (see [Bordered linear solvers (BLS)](@ref)). This particuliar solver is based on an explicit formula which only requires to invert $A_\gamma$: this is done by the linear solver `AγLinearSolver`. In a nutshell, we have:
$ grep -nr pltting BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/cgl1dwave.md:25:# pltting utilities
$ grep -nr satifies BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/ModulatedTW.md:6:A modulated travelling wave with period $T$ satifies $q(x,t+T) = q(x-s T,t)$. Equivalently, using a moving frame to freeze the wave $\xi=x-st$, it holds that $\tilde q(\xi,t+T) = \tilde q(\xi,t)$ where $\tilde q(\xi,t):=q(\xi+st,t)$. Hence, $\tilde q$ is a periodic solution to
$ grep -nr severals BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/plotting.md:32:If you have severals branches `br1, br2`, you can plot them in the same figure by doing
$ grep -nr technics BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/tutorialCarrier.md:10:It is a remarkably difficult problem which presents many disconnected branches which are not amenable to the classical continuation methods. We thus use the recently developed *deflated continuation method* which builds upon the Deflated Newton (see [Deflated problems](@ref)) technics to find solutions which are different from a set of already known solutions.
BifurcationKitDocs.jl/docs/src/tutorials/tutorialsCGL.md:473:We could use another way to "invert" jacobian of the functional based on bordered technics. We try to use an ILU preconditioner on the cyclic matrix $J_c$ (see [Periodic orbits based on Trapezoidal rule](@ref)) which has a smaller memory footprint:
BifurcationKitDocs.jl/docs/src/tutorials/ode/tutorialsCodim2PO.md:8:The following is a periodically forced predator-prey model studied in [^Kuznetsov] using shooting technics.
$ 

I think this should be CO oxidation.

$ grep -nr oxydation BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/tutorials/ode/tutorialCO.md:1:# CO-oxydation (codim 2)
BifurcationKitDocs.jl/docs/src/tutorials/ode/tutorialCO.md:9: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.
$

What is the fix here?

$ grep -nr catched BifurcationKitDocs.jl
BifurcationKitDocs.jl/docs/src/Predictors.md:19:This is the dumbest predictor based on the formula $(x_1,p_1) = (x_0, p_0 + ds)$ with Newton corrector ; it fails at Turning points. This is set by the algorithm `Natural()` in [`continuation`](@ref). For matrix based jacobian, it is not faster than the pseudo-arclength predictor because the factorisation of the jacobian is catched. For Matrix-free methods, this predictor can be faster than the following ones until it hits a Turning point.
$

Here is what I have so far.

$ cat typos.sh
#!/bin/sh

sed -i "s/abord/abort/g" BifurcationKitDocs.jl/docs/src/tutorials/Swift-Hohenberg1d.md
sed -i "s/agressive/aggressive/g" BifurcationKitDocs.jl/docs/src/DeflatedContinuation.md
sed -i "s/algoritm/algorithm/g" BifurcationKitDocs.jl/docs/src/DeflatedContinuation.md
sed -i "s/anlyzed/analyzed/g" BifurcationKitDocs.jl/docs/src/tutorials/cgl1dwave.md
sed -i "s/certains/certain/g" BifurcationKitDocs.jl/docs/src/faq.md
sed -i "s/cofficients/coefficients/g" BifurcationKitDocs.jl/docs/src/tutorials/tutorials3b.md
sed -i "s/homogenous/homogeneous/g" BifurcationKitDocs.jl/docs/src/tutorials/mittelmann.md
sed -i "s/mactch/match/g" BifurcationKitDocs.jl/docs/src/faq.md
sed -i "s/occurence/occurrence/g" BifurcationKitDocs.jl/docs/src/DeflatedContinuation.md
sed -i "s/particuliar/particular/g" BifurcationKitDocs.jl/docs/src/periodicOrbitTrapeze.md
sed -i "s/pltting/plotting/g" BifurcationKitDocs.jl/docs/src/tutorials/cgl1dwave.md
sed -i "s/satifies/satisfies/g" BifurcationKitDocs.jl/docs/src/ModulatedTW.md
sed -i "s/severals/several/g" BifurcationKitDocs.jl/docs/src/plotting.md
sed -i "s/technics/techniques/g" BifurcationKitDocs.jl/docs/src/tutorials/tutorialCarrier.md
sed -i "s/technics/techniques/g" BifurcationKitDocs.jl/docs/src/tutorials/tutorialsCGL.md
sed -i "s/technics/techniques/g" BifurcationKitDocs.jl/docs/src/tutorials/ode/tutorialsCodim2PO.md
$ 

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.