Utkarsh / Jul 02 2020
Remix of QNDF Benchmarks for POLLU by UUtkarsh
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
Julia
using OrdinaryDiffEq, DiffEqDevTools, Sundials, ParameterizedFunctions, Plots, ODE, ODEInterfaceDiffEq, ODEInterface, LSODA
gr() # gr(fmt=:png)
using LinearAlgebra
LinearAlgebra.BLAS.set_num_threads(1)
724.2s
Julia
Defining the Van der Pol Problem
van = begin
dy = μ*((1-x^2)*y - x)
dx = 1*y
end μ
prob = ODEProblem(van,[0;2.],(0.0,6.3),1e6)
28.5s
Julia
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
Julia
retcode: Success
Interpolation: 3rd order Hermite
t: nothing
u: nothing
plot(sol,ylim=[-4;4],dpi=200)
1.5s
Julia
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
Julia
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
Julia
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
Julia
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
Julia