diff --git a/benchmarks/hodgkinhuxley.jmd b/benchmarks/hodgkinhuxley.jmd index 7724a7a68..d2e9a6a5f 100644 --- a/benchmarks/hodgkinhuxley.jmd +++ b/benchmarks/hodgkinhuxley.jmd @@ -65,11 +65,13 @@ plot(test_sol, layout=(4,1), title=["Hodgkin-Huxley Solution" "" "" ""], ylabel=["V(t)" "m(t)" "n(t)" "h(t)"], + xlabel=["" "" "" "t"], size = (1000, 600), + color=[1 2 3 4], ) ``` -## Adaptive steps +## Adaptive steps - no smoothing ```julia DENSE = SAVE_EVERYSTEP = false @@ -109,20 +111,68 @@ wp = WorkPrecisionSet( plot( wp, - title = "Hodgkin-Huxley with adaptive steps", + title = "Adaptive steps - no smoothing", color = colors, xticks = 10.0 .^ (-16:1:5), yticks = 10.0 .^ (-6:1:5), ) ``` +## Adaptive steps - with smoothing + +```julia +DENSE = SAVE_EVERYSTEP = true + +_setups = [ + "EK0(2)" => Dict(:alg=>EK0(order=2, smooth=DENSE)) + "EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE)) + "EK0(5)" => Dict(:alg=>EK0(order=5, smooth=DENSE)) + "EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE)) + "EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE)) + "EK1(5)" => Dict(:alg=>EK1(order=5, smooth=DENSE)) + "EK1(8)" => Dict(:alg=>EK1(order=8, smooth=DENSE)) + "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE)) + "RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE)) + "RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE)) +] + +labels = first.(_setups) +setups = last.(_setups) +colors = [1 1 1 2 2 2 2 3 3 3] + +abstols = 1.0 ./ 10.0 .^ (6:10) +reltols = 1.0 ./ 10.0 .^ (3:7) + +wp = WorkPrecisionSet( + prob, abstols, reltols, setups; + names = labels, + #print_names = true, + appxsol = test_sol, + dense = DENSE, + save_everystep = SAVE_EVERYSTEP, + numruns = 10, + maxiters = Int(1e7), + timeseries_errors = false, + verbose = false, +) + +plot( + wp, + title = "Adaptive steps - with smoothing", + color = colors, + xticks = 10.0 .^ (-16:1:5), + yticks = 10.0 .^ (-6:1:5), +) +``` -## Fixed steps + +## Fixed steps - no smoothing ```julia DENSE = SAVE_EVERYSTEP = false -dts = 10.0 .^ range(-1, -3, length=length(abstols)) +dts = 10.0 .^ range(-2, -3, length=10) +abstols = reltols = repeat([missing], length(dts)) DM = FixedDiffusion() _setups = [ @@ -137,6 +187,7 @@ colors = [1 2 3] wp = WorkPrecisionSet( prob, abstols, reltols, setups; + adaptive = false, names = labels, #print_names = true, appxsol = test_sol, @@ -150,7 +201,7 @@ wp = WorkPrecisionSet( plot( wp, - title = "Hodgkin-Huxley with fixed steps", + title = "Fixed steps - no smoothing", color = colors, xticks = 10.0 .^ (-16:1:5), yticks = 10.0 .^ (-6:1:5), @@ -158,6 +209,47 @@ plot( ``` +## Fixed steps - with smoothing + +```julia +DENSE = SAVE_EVERYSTEP = true + +dts = 10.0 .^ range(-2, -3, length=length(abstols)) + +DM = FixedDiffusion() +_setups = [ + "EK0(2)" => Dict(:alg=>EK0(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) + "EK1(2)" => Dict(:alg=>EK1(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) + "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) +] + +labels = first.(_setups) +setups = last.(_setups) +colors = [1 2 3] + +wp = WorkPrecisionSet( + prob, abstols, reltols, setups; + adaptive = false, + names = labels, + #print_names = true, + appxsol = test_sol, + dense = DENSE, + save_everystep = SAVE_EVERYSTEP, + numruns = 10, + maxiters = Int(1e7), + timeseries_errors = false, + verbose = false, +) + +plot( + wp, + title = "Fixed steps - with smoothing", + color = colors, + xticks = 10.0 .^ (-16:1:5), + yticks = 10.0 .^ (-6:1:5), +) +``` + ## Appendix diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg index 76bf1d4a3..fd6d89049 100644 --- a/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg +++ b/docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg @@ -1,444 +1,444 @@ - + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg index 9c2462e8d..2e5dc9f4a 100644 --- a/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg +++ b/docs/src/benchmarks/figures/hodgkinhuxley_3_1.svg @@ -1,270 +1,270 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg index 130df3f0c..a186d5286 100644 --- a/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg +++ b/docs/src/benchmarks/figures/hodgkinhuxley_4_1.svg @@ -1,180 +1,268 @@ - + - + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg new file mode 100644 index 000000000..9285daeb0 --- /dev/null +++ b/docs/src/benchmarks/figures/hodgkinhuxley_5_1.svg @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg b/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg new file mode 100644 index 000000000..a76fed732 --- /dev/null +++ b/docs/src/benchmarks/figures/hodgkinhuxley_6_1.svg @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/benchmarks/hodgkinhuxley.md b/docs/src/benchmarks/hodgkinhuxley.md index 5e8f7eaed..64570b39c 100644 --- a/docs/src/benchmarks/hodgkinhuxley.md +++ b/docs/src/benchmarks/hodgkinhuxley.md @@ -68,7 +68,9 @@ plot(test_sol, layout=(4,1), title=["Hodgkin-Huxley Solution" "" "" ""], ylabel=["V(t)" "m(t)" "n(t)" "h(t)"], + xlabel=["" "" "" "t"], size = (1000, 600), + color=[1 2 3 4], ) ``` @@ -76,7 +78,7 @@ plot(test_sol, -## Adaptive steps +## Adaptive steps - no smoothing ```julia DENSE = SAVE_EVERYSTEP = false @@ -127,31 +129,80 @@ plot( +## Adaptive steps - with smoothing -## Fixed steps +```julia +DENSE = SAVE_EVERYSTEP = true + +_setups = [ + "EK0(2)" => Dict(:alg=>EK0(order=2, smooth=DENSE)) + "EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE)) + "EK0(5)" => Dict(:alg=>EK0(order=5, smooth=DENSE)) + "EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE)) + "EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE)) + "EK1(5)" => Dict(:alg=>EK1(order=5, smooth=DENSE)) + "EK1(8)" => Dict(:alg=>EK1(order=8, smooth=DENSE)) + "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE)) + "RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE)) + "RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE)) +] + +labels = first.(_setups) +setups = last.(_setups) +colors = [1 1 1 2 2 2 2 3 3 3] + +abstols = 1.0 ./ 10.0 .^ (6:10) +reltols = 1.0 ./ 10.0 .^ (3:7) + +wp = WorkPrecisionSet( + prob, abstols, reltols, setups; + names = labels, + #print_names = true, + appxsol = test_sol, + dense = DENSE, + save_everystep = SAVE_EVERYSTEP, + numruns = 10, + maxiters = Int(1e7), + timeseries_errors = false, + verbose = false, +) + +plot( + wp, + title = "Hodgkin-Huxley with adaptive steps", + color = colors, + xticks = 10.0 .^ (-16:1:5), + yticks = 10.0 .^ (-6:1:5), +) +``` + +![](figures/hodgkinhuxley_4_1.svg) + + + + +## Fixed steps - no smoothing ```julia DENSE = SAVE_EVERYSTEP = false -dts = 10.0 .^ range(-1, -3, length=length(abstols)) +dts = 10.0 .^ range(-2, -3, length=10) +abstols = reltols = repeat([missing], length(dts)) +DM = FixedDiffusion() _setups = [ - "EK0(2)" => Dict(:alg=>EK0(order=2, smooth=DENSE), :dts=>dts) - #"EK0(3)" => Dict(:alg=>EK0(order=3, smooth=DENSE), :dts=>dts) - "EK1(2)" => Dict(:alg=>EK1(order=2, smooth=DENSE), :dts=>dts) - #"EK1(3)" => Dict(:alg=>EK1(order=3, smooth=DENSE), :dts=>dts) - "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, smooth=DENSE), :dts=>dts) - #"RosenbrockExpEK1(3)" => Dict(:alg=>RosenbrockExpEK(order=3, smooth=DENSE), :dts=>dts) - #"RosenbrockExpEK1(5)" => Dict(:alg=>RosenbrockExpEK(order=5, smooth=DENSE), :dts=>dts) + "EK0(2)" => Dict(:alg=>EK0(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) + "EK1(2)" => Dict(:alg=>EK1(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) + "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) ] labels = first.(_setups) setups = last.(_setups) colors = [1 2 3] - wp = WorkPrecisionSet( prob, abstols, reltols, setups; + adaptive = false, names = labels, #print_names = true, appxsol = test_sol, @@ -172,8 +223,53 @@ plot( ) ``` -![](figures/hodgkinhuxley_4_1.svg) +![](figures/hodgkinhuxley_5_1.svg) + + + + +## Fixed steps - with smoothing + +```julia +DENSE = SAVE_EVERYSTEP = true + +dts = 10.0 .^ range(-2, -3, length=length(abstols)) + +DM = FixedDiffusion() +_setups = [ + "EK0(2)" => Dict(:alg=>EK0(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) + "EK1(2)" => Dict(:alg=>EK1(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) + "RosenbrockExpEK1(2)" => Dict(:alg=>RosenbrockExpEK(order=2, diffusionmodel=DM, smooth=DENSE), :dts=>dts) +] + +labels = first.(_setups) +setups = last.(_setups) +colors = [1 2 3] + +wp = WorkPrecisionSet( + prob, abstols, reltols, setups; + adaptive = false, + names = labels, + #print_names = true, + appxsol = test_sol, + dense = DENSE, + save_everystep = SAVE_EVERYSTEP, + numruns = 10, + maxiters = Int(1e7), + timeseries_errors = false, + verbose = false, +) + +plot( + wp, + title = "Hodgkin-Huxley with fixed steps", + color = colors, + xticks = 10.0 .^ (-16:1:5), + yticks = 10.0 .^ (-6:1:5), +) +``` +![](figures/hodgkinhuxley_6_1.svg)