Skip to content

Commit

Permalink
correct tuto sh2d FD
Browse files Browse the repository at this point in the history
  • Loading branch information
rveltz committed Jan 7, 2024
1 parent 99789d4 commit da46735
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 65 deletions.
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Needless to say, if you use regular arrays, you don't need to worry about what f

We make the same requirements as `KrylovKit.jl`. Hence, we refer to its [docs](https://jutho.github.io/KrylovKit.jl/stable/#Package-features-and-alternatives-1) for more information. We additionally require the following methods to be available:

- `Base.length(x)`: it is used in the constraint equation of the pseudo arclength continuation method (see [`continuation`](@ref) for more details). If `length` is not available for your "vector", define it `length(x) = 1` and adjust tuning the parameter `θ` in `PALC`.
- `Base.length(x)`: it is used in the constraint equation of the pseudo arclength continuation method (see [`continuation`](@ref) for more details). If `length` is not available for your "vector", define `length(x) = 1` and adjust the parameter `θ` in `PALC`.
- `Base.copyto!(dest, in)` this is required to reduce the allocations by avoiding too many copies
- `Base.eltype` must be extended to your vector type. It is mainly used for branching.

Expand Down
57 changes: 0 additions & 57 deletions docs/src/intro-abs.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,63 +48,6 @@ We refer to [Branch switching](@ref abs-nonsimple-eq) for more details.
We provide a graph of bifurcations of equilbria and periodic orbits that can be detected in `BifurcationKit`. An arrow from say `Equilibrium` to `Hopf` means that Hopf bifurcations can be detected while continuing equilibria. Each object of codim 0 (resp. 1) can be continued in one (resp. 2) parameters.


```@diagram mermaid
graph LR
S[ ]
C[ Equilibrium ]
PO[ Periodic orbit ]
BP[ Fold/simple branch point ]
H[ Hopf \n :hopf]
CP[Cusp]
BT[ Bogdanov-Takens ]
ZH[ZH]
HH[HH]
GH[Bautin]
FPO[ Fold Periodic orbit ]
NS[ Neimark-Sacker ]
PD[ Period Doubling ]
BPC[BPC]
S --> C
S --> PO
C --> nBP[ non simple\n branch point ]
C --> BP
C --> H
BP --> CP
BP --> BT
PO --> H
PO --> FPO
PO --> NS
PO --> PD
FPO --> GH
FPO --> BPC
FPO --> R1
NS --> R1
NS --> R3
NS --> R4
NS --> CH
NS --> LPNS
NS --> PDNS
NS --> R2
NS --> NSNS
PD --> PDNS
PD --> R2
PD --> LPPD
PD --> GPD
H --> BT
H --> ZH
BP --> ZH
H --> HH
H --> GH
Codim --> Codim0 --> Codim1 --> Codim2
```

## Summary of branching procedures

Expand Down
9 changes: 5 additions & 4 deletions docs/src/tutorials/tutorials2.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $$-(I+\Delta)^2 u+l\cdot u +\nu u^2-u^3 = 0$$

with Neumann boundary conditions. This full example is in the file `example/SH2d-fronts.jl`. This example is also treated in the MATLAB package [pde2path](http://www.staff.uni-oldenburg.de/hannes.uecker/pde2path/). We use a Sparse Matrix to express the operator $L_1=(I+\Delta)^2$.

```@example sh2d_fd
```@example sh2dFD
using DiffEqOperators, Parameters
using BifurcationKit, Plots, SparseArrays
import LinearAlgebra: I, norm
Expand Down Expand Up @@ -39,9 +39,10 @@ function Laplacian2D(Nx, Ny, lx, ly)
return A, D2x
end
```

We also write the functional and its Jacobian which is a Sparse Matrix

```julia
```@example sh2dFD
function F_sh(u, p)
@unpack l, ν, L1 = p
return -L1 * u .+ (l .* u .+ ν .* u.^2 .- u.^3)
Expand All @@ -59,7 +60,7 @@ d3F_sh(u, p, dx1, dx2, dx3) = (-6 .* dx2 .* dx3) .* dx1

We first look for hexagonal patterns. This is done with

```julia
```@example sh2dFD
X = -lx .+ 2lx/(Nx) * collect(0:Nx-1)
Y = -ly .+ 2ly/(Ny) * collect(0:Ny-1)
Expand Down Expand Up @@ -114,7 +115,7 @@ which produces the results

with `sol_hexa` being

```@example sh2d_fd
```@example sh2dFD
println("--> norm(sol) = ",norminf(sol_hexa.u))
heatmapsol(sol_hexa.u)
```
Expand Down
9 changes: 7 additions & 2 deletions docs/src/tutorials/tutorials3.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Depth = 3
!!! unknown "References"
This example is taken from **Numerical Bifurcation Analysis of Periodic Solutions of Partial Differential Equations,** Lust, 1997.

We look at the Brusselator in 1d. The equations are as follows
We look at the Brusselator in 1d (see [^Lust]). The equations are as follows

$$\begin{aligned} \frac { \partial X } { \partial t } & = \frac { D _ { 1 } } { l ^ { 2 } } \frac { \partial ^ { 2 } X } { \partial z ^ { 2 } } + X ^ { 2 } Y - ( β + 1 ) X + α \\ \frac { \partial Y } { \partial t } & = \frac { D _ { 2 } } { l ^ { 2 } } \frac { \partial ^ { 2 } Y } { \partial z ^ { 2 } } + β X - X ^ { 2 } Y \end{aligned}$$

Expand Down Expand Up @@ -366,7 +366,7 @@ br_po = continuation(
br, 1,
# arguments for continuation
opts_po_cont,
PoincareShootingProblem(Mt, prob_ode, Rodas4P(); jacobian = BK.FiniteDifferencesMF());
PoincareShootingProblem(Mt, prob_ode, Rodas4P(); jacobian = BK.FiniteDifferencesMF(), update_section_every_step = 0);
# the next option is not necessary
# it speeds up the newton iterations
# by combining the linear solves of the bordered linear system
Expand All @@ -379,3 +379,8 @@ br_po = continuation(
and you should see:

![](brus-psh-cont.png)


## References

[^Lust]:> **Numerical Bifurcation Analysis of Periodic Solutions of Partial Differential Equations,** Lust, 1997.
2 changes: 1 addition & 1 deletion docs/src/tutorials/tutorials3b.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ Bifurcation points:
- # 4, ns at p ≈ 1.87667870 ∈ (1.86813520, 1.87667870), |δp|=9e-03, [converged], δ = ( 2, 2), step = 32, eigenelements in eig[ 33], ind_ev = 6
```

# References
## References

[^Lust]:> **Numerical Bifurcation Analysis of Periodic Solutions of Partial Differential Equations,** Lust, 1997.
Expand Down

0 comments on commit da46735

Please sign in to comment.