SciML / DiffEqDevTools.jl

Benchmarking, testing, and development tools for differential equations and scientific machine learning (SciML)
https://benchmarks.sciml.ai/
Other
46 stars 35 forks source link

Update the plotting recipe to flexibly plot some x against some y #129

Closed nathanaelbosch closed 10 months ago

nathanaelbosch commented 10 months ago

Implements #128

Code snipped to try this out:

using TestEnv
TestEnv.activate()

using OrdinaryDiffEq, DiffEqDevTools, Plots

# dummy ODE work-precision diagram
f_rode_lin = function (du, u, p, t)
    @inbounds for i in eachindex(u)
        du[i] = cos(t) * u[i]
    end
end

f_rode_lin_analytic = function (u₀, p, t)
    u₀ * exp(sin(t))
end

tspan = (0.0, 10.0)
prob = ODEProblem(ODEFunction(f_rode_lin, analytic = f_rode_lin_analytic), rand(10, 10),
    tspan)

abstols = 1.0 ./ 10.0 .^ (3:8)
reltols = 1.0 ./ 10.0 .^ (0:5)

setups = [Dict(:alg => DP5())
          Dict(:alg => Tsit5())]
wp_names = ["DP5", "Tsit5"]
wps = WorkPrecisionSet(prob, abstols, reltols, setups; names = wp_names, error_estimate=:l2)

plot(wps)
plot(wps, y=:final)
plot(wps, x=:l2, y=:final)
plot(wps, x=:abstols, y=:final)
plot(wps, x=:nf, y=:final)
ChrisRackauckas commented 10 months ago

Wow simple and effective. Thanks!