From 7adc6ffb2fca46b6f6ebe5bb58b90dd1170333c7 Mon Sep 17 00:00:00 2001 From: Orjan Ameye Date: Mon, 14 Oct 2024 15:36:19 +0200 Subject: [PATCH] fix docs for time_dependent tutorial (#271) --- docs/src/tutorials/limit_cycles.md | 2 +- docs/src/tutorials/time_dependent.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/tutorials/limit_cycles.md b/docs/src/tutorials/limit_cycles.md index 9c342545..8b265777 100644 --- a/docs/src/tutorials/limit_cycles.md +++ b/docs/src/tutorials/limit_cycles.md @@ -109,7 +109,7 @@ sweep = ParameterSweep(F0 => (0.002, 0.011), (0,T)) # start from initial_state, use sweep, total time is 2*T time_problem = ODEProblem(harmonic_eq, initial_state, sweep=sweep, timespan=(0,2*T)) -time_evo = solve(time_problem, saveat=100); +time_evo = solve(time_problem, Tsit5(), saveat=100); nothing # hide ``` Inspecting the amplitude as a function of time, diff --git a/docs/src/tutorials/time_dependent.md b/docs/src/tutorials/time_dependent.md index fc601026..d6614b09 100644 --- a/docs/src/tutorials/time_dependent.md +++ b/docs/src/tutorials/time_dependent.md @@ -42,7 +42,7 @@ Given $\mathbf{u}(T_0)$, what is $\mathbf{u}(T)$ at future times? For constant parameters, a [`HarmonicEquation`](@ref HarmonicBalance.HarmonicEquation) object can be fed into the constructor of [`ODEProblem`](@ref ODEProblem). The syntax is similar to DifferentialEquations.jl : ```@example time_dependent -using OrdinaryDiffEq +using OrdinaryDiffEqTsit5 x0 = [0.; 0.] # initial condition fixed = (ω0 => 1.0, γ => 1e-2, λ => 5e-2, F => 1e-3, α => 1.0, η => 0.3, θ => 0, ω => 1.0) # parameter values @@ -51,7 +51,7 @@ ode_problem = ODEProblem(harmonic_eq, fixed, x0 = x0, timespan = (0,1000)) OrdinaryDiffEq.jl takes it from here - we only need to use `solve`. ```@example time_dependent -time_evo = solve(ode_problem, saveat=1.0); +time_evo = solve(ode_problem, Tsit5(), saveat=1.0); plot(time_evo, ["u1", "v1"], harmonic_eq) ``` @@ -59,7 +59,7 @@ Running the above code with `x0 = [0.2, 0.2]` gives the plots ```@example time_dependent x0 = [0.2; 0.2] # initial condition ode_problem = remake(ode_problem, u0 = x0) -time_evo = solve(ode_problem, saveat=1.0); +time_evo = solve(ode_problem, Tsit5(), saveat=1.0); plot(time_evo, ["u1", "v1"], harmonic_eq) ``` @@ -85,7 +85,7 @@ The sweep linearly interpolates between $\omega = 0.9$ at time 0 and $\omega = Let us now define a new `ODEProblem` which incorporates `sweep` and again use `solve`: ```@example time_dependent ode_problem = ODEProblem(harmonic_eq, fixed, sweep=sweep, x0=[0.1;0.0], timespan=(0, 2e4)) -time_evo = solve(ode_problem, saveat=100) +time_evo = solve(ode_problem, Tsit5(), saveat=100) plot(time_evo, "sqrt(u1^2 + v1^2)", harmonic_eq) ``` We see the system first evolves from the initial condition towards the low-amplitude steady state. The amplitude increases as the sweep proceeds, with a jump occurring around $\omega = 1.08$ (i.e., time 18000).