QNDF Benchmarks for Van der Pol

These are some of the benchmarks on Stiff-ODE problems for QNDF Methods. The problems are based on DiffEqBenchmarks.jl

Installing required dependencies

using Pkg
pkg"update"
pkg"add BenchmarkTools DiffEqBase DiffEqDevTools DiffEqFlux DiffEqOperators DiffEqProblemLibrary DifferentialEquations FillArrays Flux LSODA ODE ODEInterface ODEInterfaceDiffEq ParameterizedFunctions Test Plots RecursiveArrayTools StaticArrays Sundials LinearAlgebra Random"
pkg"add OrdinaryDiffEq"
156.8s
using OrdinaryDiffEq, DiffEqDevTools, Sundials, ParameterizedFunctions, Plots, ODE, ODEInterfaceDiffEq, ODEInterface, LSODA
gr() # gr(fmt=:png)
using LinearAlgebra
LinearAlgebra.BLAS.set_num_threads(1)
724.2s

Defining the Van der Pol Problem

van = @ode_def begin
  dy = μ*((1-x^2)*y - x)
  dx = 1*y
end μ
prob = ODEProblem(van,[0;2.],(0.0,6.3),1e6)
28.5s
ODEProblem with uType Array{Float64,1} and tType Float64. In-place: true timespan: (0.0, 6.3) u0: [0.0, 2.0]

Defining our test solution to compare our benchmarks with

sol = solve(prob,CVODE_BDF(),abstol=1/10^14,reltol=1/10^14)
test_sol = TestSolution(sol)
7.2s
retcode: Success Interpolation: 3rd order Hermite t: nothing u: nothing
plot(sol,ylim=[-4;4],dpi=200)
1.5s

High Tolerances

Final timepoint error

This measures the efficiency to get the value at the endpoint correct.

Setups

abstols = 1.0 ./ 10.0 .^ (4:7)
reltols = 1.0 ./ 10.0 .^ (1:4)
setups = [Dict(:alg=>Rosenbrock23()),
          Dict(:alg=>TRBDF2()),
          Dict(:alg=>ImplicitEulerExtrapolation()),
          #Dict(:alg=>ABDF2()),
          Dict(:alg=>QNDF()),
          #Dict(:alg=>Exprb43()), # Diverges
          Dict(:alg=>Exprb32()),
]
names = ["Rosenbrock23" "TRBDF2" "ImplicitEulerExtrapolation" "ABDF2" "QNDF" "Exprb32"]
0.3s
1×6 Array{String,2}: "Rosenbrock23" "TRBDF2" … "ABDF2" "QNDF" "Exprb32"
wp = WorkPrecisionSet(prob,abstols,reltols,setups;                      save_everystep=false,appxsol=test_sol,maxiters=Int(1e5),numruns=10)
plot(wp,legend=:bottomleft)
5.0s

Timeseries Error

Now we measure the average error of the timeseries.

setups = [Dict(:alg=>Rosenbrock23()),
          Dict(:alg=>TRBDF2()),
          Dict(:alg=>ImplicitEulerExtrapolation()),
          #Dict(:alg=>ImplicitDeuflhardExtrapolation()), # Diverges
          #Dict(:alg=>ImplicitHairerWannerExtrapolation()), # Diverges
          #Dict(:alg=>ABDF2()),
          Dict(:alg=>QNDF()), # ???
          #Dict(:alg=>Exprb43()), # Diverges
          Dict(:alg=>Exprb32()),
]
names = ["Rosenbrock23" "TRBDF2" "ImplicitEulerExtrapolation" "ABDF2" "QNDF" "Exprb32"]
0.3s
1×6 Array{String,2}: "Rosenbrock23" "TRBDF2" … "ABDF2" "QNDF" "Exprb32"
wp = WorkPrecisionSet(prob,abstols,reltols,setups;                    save_everystep=false,appxsol=test_sol,maxiters=Int(1e5),numruns=10)
plot(wp,legend=:bottomleft)
4.8s
Runtimes (1)