Skip to content

Commit

Permalink
Update HH Benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Nov 3, 2023
1 parent e54ac0f commit 1cd33f6
Show file tree
Hide file tree
Showing 7 changed files with 1,591 additions and 861 deletions.
102 changes: 97 additions & 5 deletions benchmarks/hodgkinhuxley.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = [
Expand All @@ -137,6 +187,7 @@ colors = [1 2 3]

wp = WorkPrecisionSet(
prob, abstols, reltols, setups;
adaptive = false,
names = labels,
#print_names = true,
appxsol = test_sol,
Expand All @@ -150,14 +201,55 @@ 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),
)
```


## 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

Expand Down
842 changes: 421 additions & 421 deletions docs/src/benchmarks/figures/hodgkinhuxley_2_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1cd33f6

Please sign in to comment.