Skip to content

Commit 7e5cf3c

Browse files
GodotMisogiGodotMisogi
authored andcommitted
Reorganized high tolerance and low tolerance codeblocks in KS and KdV FDM
1 parent 9d6a8e7 commit 7e5cf3c

File tree

2 files changed

+153
-182
lines changed

2 files changed

+153
-182
lines changed

benchmarks/SimpleHandwrittenPDE/kdv_fdm_wpd.jmd

Lines changed: 83 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,95 @@ plt = heatmap(xs, tslices, ys', xlabel="x", ylabel="t")
8484

8585
## Work-Precision Diagrams
8686

87+
### High Tolerances
88+
89+
#### Implicit-Explicit Methods
90+
91+
```julia
92+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
93+
reltols = 0.1 .^ (1:4)
94+
multipliers = 0.5 .^ (0:3)
95+
setups = [
96+
Dict(:alg => IMEXEuler(), :dts => 1e-4 * multipliers),
97+
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
98+
Dict(:alg => CNLF2(), :dts => 1e-4 * multipliers),
99+
Dict(:alg => SBDF2(), :dts => 1e-4 * multipliers),
100+
]
101+
labels = hcat(
102+
"IMEXEuler",
103+
"CNAB2",
104+
"CNLF2",
105+
"SBDF2",
106+
)
107+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
108+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
109+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
110+
111+
plot(wp, label=labels, markershape=:auto, title="Work-Precision Diagram, High Tolerance")
112+
```
113+
114+
#### Exponential Integrators
115+
116+
```julia
117+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
118+
reltols = 0.1 .^ (1:4)
119+
multipliers = 0.5 .^ (0:3)
120+
setups = [
121+
Dict(:alg => NorsettEuler(), :dts => 1e-4 * multipliers),
122+
Dict(:alg => NorsettEuler(krylov=true, m=5), :dts => 1e-4 * multipliers),
123+
Dict(:alg => NorsettEuler(krylov=true, m=20), :dts => 1e-4 * multipliers),
124+
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
125+
Dict(:alg => ETDRK2(krylov=true, m=5), :dts => 1e-4 * multipliers),
126+
Dict(:alg => ETDRK2(krylov=true, m=20), :dts => 1e-4 * multipliers)
127+
]
128+
labels = hcat(
129+
"NorsettEuler (caching)",
130+
"NorsettEuler (m=5)",
131+
"NorsettEuler (m=20)",
132+
"ETDRK2 (caching)",
133+
"ETDRK2 (m=5)",
134+
"ETDRK2 (m=20)"
135+
)
136+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
137+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
138+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
139+
140+
plot(wp, label=labels, markershape=:auto, title="ExpRK Methods, High Tolerance")
141+
```
142+
143+
144+
#### Comparisons Between Families
145+
146+
```julia
147+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
148+
reltols = 0.1 .^ (1:4)
149+
multipliers = 0.5 .^ (0:3)
150+
setups = [
151+
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
152+
Dict(:alg => CNAB2(linsolve=KrylovJL_GMRES()), :dts => 1e-4 * multipliers),
153+
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
154+
]
155+
labels = hcat(
156+
"CNAB2 (dense linsolve)",
157+
"CNAB2 (Krylov linsolve)",
158+
"ETDRK2 (caching)",
159+
)
160+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
161+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
162+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
163+
164+
plot(wp, label=labels, markershape=:auto, title="Between Families, High Tolerances")
165+
```
166+
167+
87168
### Low Tolerances
88169

89170
#### Implicit-Explicit Methods
90171

91172
Krylov linear solvers.
92173
```julia
93-
abstols = 0.1 .^ (7:10)
94-
reltols = 0.1 .^ (4:7)
174+
abstols = 0.1 .^ (7:11)
175+
reltols = 0.1 .^ (4:8)
95176
setups = [
96177
# KenCarp methods take forever with adaptive timestepping for some reason
97178
# Dict(:alg => KenCarp3()),
@@ -167,86 +248,6 @@ plot(wp, label=labels, markershape=:auto, title="Between Families, Low Tolerance
167248
```
168249

169250

170-
### High Tolerances
171-
172-
#### Implicit-Explicit Methods
173-
174-
```julia
175-
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
176-
reltols = 0.1 .^ (1:4)
177-
multipliers = 0.5 .^ (0:3)
178-
setups = [
179-
Dict(:alg => IMEXEuler(), :dts => 1e-4 * multipliers),
180-
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
181-
Dict(:alg => CNLF2(), :dts => 1e-4 * multipliers),
182-
Dict(:alg => SBDF2(), :dts => 1e-4 * multipliers),
183-
]
184-
labels = hcat(
185-
"IMEXEuler",
186-
"CNAB2",
187-
"CNLF2",
188-
"SBDF2",
189-
)
190-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
191-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
192-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
193-
194-
plot(wp, label=labels, markershape=:auto, title="Work-Precision Diagram, High Tolerance")
195-
```
196-
197-
#### Exponential Integrators
198-
199-
```julia
200-
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
201-
reltols = 0.1 .^ (1:4)
202-
multipliers = 0.5 .^ (0:3)
203-
setups = [
204-
Dict(:alg => NorsettEuler(), :dts => 1e-4 * multipliers),
205-
Dict(:alg => NorsettEuler(krylov=true, m=5), :dts => 1e-4 * multipliers),
206-
Dict(:alg => NorsettEuler(krylov=true, m=20), :dts => 1e-4 * multipliers),
207-
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
208-
Dict(:alg => ETDRK2(krylov=true, m=5), :dts => 1e-4 * multipliers),
209-
Dict(:alg => ETDRK2(krylov=true, m=20), :dts => 1e-4 * multipliers)
210-
]
211-
labels = hcat(
212-
"NorsettEuler (caching)",
213-
"NorsettEuler (m=5)",
214-
"NorsettEuler (m=20)",
215-
"ETDRK2 (caching)",
216-
"ETDRK2 (m=5)",
217-
"ETDRK2 (m=20)"
218-
)
219-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
220-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
221-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
222-
223-
plot(wp, label=labels, markershape=:auto, title="ExpRK Methods, High Tolerance")
224-
```
225-
226-
227-
#### Comparisons Between Families
228-
229-
```julia
230-
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
231-
reltols = 0.1 .^ (1:4)
232-
multipliers = 0.5 .^ (0:3)
233-
setups = [
234-
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
235-
Dict(:alg => CNAB2(linsolve=KrylovJL_GMRES()), :dts => 1e-4 * multipliers),
236-
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
237-
]
238-
labels = hcat(
239-
"CNAB2 (dense linsolve)",
240-
"CNAB2 (Krylov linsolve)",
241-
"ETDRK2 (caching)",
242-
)
243-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
244-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
245-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
246-
247-
plot(wp, label=labels, markershape=:auto, title="Between Families, High Tolerances")
248-
```
249-
250251
```julia, echo = false
251252
using SciMLBenchmarks
252253
SciMLBenchmarks.bench_footer(WEAVE_ARGS[:folder], WEAVE_ARGS[:file])

benchmarks/SimpleHandwrittenPDE/ks_fdm_wpd.jmd

Lines changed: 70 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -83,40 +83,91 @@ plt = heatmap(xs, tslices, ys', xlabel="x", ylabel="t")
8383

8484
## Work-Precision Diagrams
8585

86-
### Low Tolerances
86+
### High Tolerances
8787

8888
#### Implicit-Explicit Methods
8989

90-
Dense/banded linear solvers.
90+
```julia
91+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
92+
reltols = 0.1 .^ (1:4)
93+
multipliers = 0.5 .^ (0:3)
94+
setups = [
95+
Dict(:alg => IMEXEuler(), :dts => 1e-4 * multipliers),
96+
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
97+
Dict(:alg => CNLF2(), :dts => 1e-4 * multipliers),
98+
Dict(:alg => SBDF2(), :dts => 1e-4 * multipliers),
99+
]
100+
labels = hcat(
101+
"IMEXEuler",
102+
"CNAB2",
103+
"CNLF2",
104+
"SBDF2",
105+
)
106+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
107+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
108+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
109+
110+
plot(wp, label=labels, markershape=:auto, title="Work-Precision Diagram, High Tolerance")
111+
```
112+
113+
#### Exponential Integrators
91114

92115
```julia
93-
abstols = 0.1 .^ (7:13)
94-
reltols = 0.1 .^ (4:10)
116+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
117+
reltols = 0.1 .^ (1:4)
118+
multipliers = 0.5 .^ (0:3)
95119
setups = [
96-
# KenCarp methods take forever with adaptive timestepping for some reason
97-
# Dict(:alg => KenCarp3()),
98-
# Dict(:alg => KenCarp4()),
99-
# Dict(:alg => KenCarp5()),
100-
# ARKODE with banded linear solves fail with adaptive timestepping for some reason
101-
# Dict(:alg => ARKODE(Sundials.Implicit(), order=3, linear_solver=:Band, jac_upper=1, jac_lower=1)),
102-
# Dict(:alg => ARKODE(Sundials.Implicit(), order=4, linear_solver=:Band, jac_upper=1, jac_lower=1)),
103-
# Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:Band, jac_upper=1, jac_lower=1))
120+
Dict(:alg => NorsettEuler(), :dts => 1e-4 * multipliers),
121+
Dict(:alg => NorsettEuler(krylov=true, m=5), :dts => 1e-4 * multipliers), # Maxiters
122+
Dict(:alg => NorsettEuler(krylov=true, m=20), :dts => 1e-4 * multipliers), # Maxiters
123+
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
124+
Dict(:alg => ETDRK2(krylov=true, m=5), :dts => 1e-4 * multipliers),
125+
Dict(:alg => ETDRK2(krylov=true, m=20), :dts => 1e-4 * multipliers)
104126
]
105127
labels = hcat(
106-
# "KenCarp3",
107-
# "KenCarp4",
108-
# "KenCarp5",
109-
# "ARKODE3",
110-
# "ARKODE4",
111-
# "ARKODE5",
128+
"NorsettEuler (caching)",
129+
"NorsettEuler (m=5)",
130+
"NorsettEuler (m=20)",
131+
"ETDRK2 (caching)",
132+
"ETDRK2 (m=5)",
133+
"ETDRK2 (m=20)"
112134
)
113135
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
114136
print_names=true, names=labels, numruns=5, error_estimate=:l2,
115137
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
116138

117-
plot(wp, label=labels, markershape=:auto, title="IMEX Methods, Band Linsolve, Low Tolerances")
139+
plot(wp, label=labels, markershape=:auto, title="ExpRK Methods, High Tolerance")
118140
```
119141

142+
143+
#### Comparisons Between Families
144+
145+
```julia
146+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
147+
reltols = 0.1 .^ (1:4)
148+
multipliers = 0.5 .^ (0:3)
149+
setups = [
150+
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
151+
Dict(:alg => CNAB2(linsolve=KrylovJL_GMRES()), :dts => 1e-4 * multipliers),
152+
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
153+
]
154+
labels = hcat(
155+
"CNAB2 (dense linsolve)",
156+
"CNAB2 (Krylov linsolve)",
157+
"ETDRK2 (caching)",
158+
)
159+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
160+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
161+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
162+
163+
plot(wp, label=labels, markershape=:auto, title="Between Families, High Tolerances")
164+
```
165+
166+
### Low Tolerances
167+
168+
#### Implicit-Explicit Methods
169+
170+
120171
Krylov linear solvers.
121172
```julia
122173
abstols = 0.1 .^ (7:13)
@@ -188,87 +239,6 @@ plot(wp, label=labels, markershape=:auto, title="Between Families, Low Tolerance
188239
```
189240

190241

191-
### High Tolerances
192-
193-
#### Implicit-Explicit Methods
194-
195-
```julia
196-
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
197-
reltols = 0.1 .^ (1:4)
198-
multipliers = 0.5 .^ (0:3)
199-
setups = [
200-
Dict(:alg => IMEXEuler(), :dts => 1e-4 * multipliers),
201-
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
202-
Dict(:alg => CNLF2(), :dts => 1e-4 * multipliers),
203-
Dict(:alg => SBDF2(), :dts => 1e-4 * multipliers),
204-
]
205-
labels = hcat(
206-
"IMEXEuler",
207-
"CNAB2",
208-
"CNLF2",
209-
"SBDF2",
210-
)
211-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
212-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
213-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
214-
215-
plot(wp, label=labels, markershape=:auto, title="Work-Precision Diagram, High Tolerance")
216-
```
217-
218-
#### Exponential Integrators
219-
220-
```julia
221-
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
222-
reltols = 0.1 .^ (1:4)
223-
multipliers = 0.5 .^ (0:3)
224-
setups = [
225-
Dict(:alg => NorsettEuler(), :dts => 1e-4 * multipliers),
226-
Dict(:alg => NorsettEuler(krylov=true, m=5), :dts => 1e-4 * multipliers), # Maxiters
227-
Dict(:alg => NorsettEuler(krylov=true, m=20), :dts => 1e-4 * multipliers), # Maxiters
228-
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
229-
Dict(:alg => ETDRK2(krylov=true, m=5), :dts => 1e-4 * multipliers),
230-
Dict(:alg => ETDRK2(krylov=true, m=20), :dts => 1e-4 * multipliers)
231-
]
232-
labels = hcat(
233-
"NorsettEuler (caching)",
234-
"NorsettEuler (m=5)",
235-
"NorsettEuler (m=20)",
236-
"ETDRK2 (caching)",
237-
"ETDRK2 (m=5)",
238-
"ETDRK2 (m=20)"
239-
)
240-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
241-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
242-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
243-
244-
plot(wp, label=labels, markershape=:auto, title="ExpRK Methods, High Tolerance")
245-
```
246-
247-
248-
#### Comparisons Between Families
249-
250-
```julia
251-
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
252-
reltols = 0.1 .^ (1:4)
253-
multipliers = 0.5 .^ (0:3)
254-
setups = [
255-
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
256-
Dict(:alg => CNAB2(linsolve=KrylovJL_GMRES()), :dts => 1e-4 * multipliers),
257-
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers),
258-
]
259-
labels = hcat(
260-
"CNAB2 (dense linsolve)",
261-
"CNAB2 (Krylov linsolve)",
262-
"ETDRK2 (caching)",
263-
)
264-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
265-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
266-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
267-
268-
plot(wp, label=labels, markershape=:auto, title="Between Families, High Tolerances")
269-
```
270-
271-
272242
```julia, echo = false
273243
using SciMLBenchmarks
274244
SciMLBenchmarks.bench_footer(WEAVE_ARGS[:folder], WEAVE_ARGS[:file])

0 commit comments

Comments
 (0)