Skip to content

Commit 8e03008

Browse files
GodotMisogiGodotMisogi
authored andcommitted
Tested higher-order methods; need to further diagnose KenCarp and ARKODE
1 parent 164ce6c commit 8e03008

File tree

8 files changed

+783
-452
lines changed

8 files changed

+783
-452
lines changed

benchmarks/SimpleHandwrittenPDE/allen_cahn_fdm_wpd.jmd

Lines changed: 53 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ plt = heatmap(xs, tslices, ys', xlabel="x", ylabel="t")
8787
#### Implicit-Explicit Methods
8888

8989
```julia
90-
abstols = 0.1 .^ (5:9) # all fixed dt methods so these don't matter much
91-
reltols = 0.1 .^ (1:5)
92-
multipliers = 0.5 .^ (0:4)
90+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
91+
reltols = 0.1 .^ (1:4)
92+
multipliers = 0.5 .^ (0:3)
9393
setups = [
9494
Dict(:alg => IMEXEuler(), :dts => 1e-4 * multipliers),
9595
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
9696
Dict(:alg => CNLF2(), :dts => 1e-4 * multipliers),
97-
Dict(:alg => SBDF2(), :dts => 1e-4 * multipliers)
97+
Dict(:alg => SBDF2(), :dts => 1e-4 * multipliers),
9898
]
9999
labels = hcat(
100100
"IMEXEuler",
@@ -112,9 +112,9 @@ plot(wp, label=labels, markershape=:auto, title="Work-Precision Diagram, High To
112112
#### Exponential Integrators
113113

114114
```julia
115-
abstols = 0.1 .^ (5:9) # all fixed dt methods so these don't matter much
116-
reltols = 0.1 .^ (1:5)
117-
multipliers = 0.5 .^ (0:4)
115+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
116+
reltols = 0.1 .^ (1:4)
117+
multipliers = 0.5 .^ (0:3)
118118
setups = [
119119
Dict(:alg => NorsettEuler(), :dts => 1e-4 * multipliers),
120120
Dict(:alg => NorsettEuler(krylov=true, m=5), :dts => 1e-4 * multipliers),
@@ -135,39 +135,15 @@ labels = hcat(
135135
print_names=true, names=labels, numruns=5, error_estimate=:l2,
136136
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
137137

138-
plot(wp, label=labels, markershape=:auto, title="ExpRK methods, High Tolerance")
139-
```
140-
141-
#### Explicit Methods
142-
143-
```julia
144-
abstols = 0.1 .^ (5:7) # all fixed dt methods so these don't matter much
145-
reltols = 0.1 .^ (1:3)
146-
multipliers = 0.5 .^ (0:4)
147-
setups = [
148-
Dict(:alg => RK4(), :dts => 1e-4 * multipliers),
149-
Dict(:alg => Tsit5(), :dts => 1e-4 * multipliers),
150-
Dict(:alg => Vern7(), :dts => 1e-4 * multipliers)
151-
]
152-
labels = hcat(
153-
"RK4",
154-
"Tsit5",
155-
"Vern7",
156-
)
157-
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
158-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
159-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
160-
161-
plot(wp, label=labels, markershape=:auto, title="Work-Precision Diagram, High Tolerance")
138+
plot(wp, label=labels, markershape=:auto, title="ExpRK Methods, High Tolerance")
162139
```
163140

164-
165141
#### Comparisons Between Families
166142

167143
```julia
168-
abstols = 0.1 .^ (5:9) # all fixed dt methods so these don't matter much
169-
reltols = 0.1 .^ (1:5)
170-
multipliers = 0.5 .^ (0:4)
144+
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much
145+
reltols = 0.1 .^ (1:4)
146+
multipliers = 0.5 .^ (0:3)
171147
setups = [
172148
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers),
173149
Dict(:alg => CNAB2(linsolve=KrylovJL_GMRES()), :dts => 1e-4 * multipliers),
@@ -184,7 +160,7 @@ labels = hcat(
184160
print_names=true, names=labels, numruns=5, error_estimate=:l2,
185161
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
186162

187-
plot(wp, label=labels, markershape=:auto, title="Between family, High Tolerances")
163+
plot(wp, label=labels, markershape=:auto, title="Between Families, High Tolerances")
188164
```
189165

190166

@@ -197,12 +173,14 @@ Dense/banded linear solvers.
197173
```julia
198174
abstols = 0.1 .^ (7:13)
199175
reltols = 0.1 .^ (4:10)
200-
setups = [Dict(:alg => KenCarp3()),
201-
Dict(:alg => KenCarp4()),
202-
Dict(:alg => KenCarp5()),
203-
Dict(:alg => ARKODE(Sundials.Implicit(), order=3, linear_solver=:Band, jac_upper=1, jac_lower=1)),
204-
Dict(:alg => ARKODE(Sundials.Implicit(), order=4, linear_solver=:Band, jac_upper=1, jac_lower=1)),
205-
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:Band, jac_upper=1, jac_lower=1))]
176+
setups = [
177+
Dict(:alg => KenCarp3()),
178+
Dict(:alg => KenCarp4()),
179+
Dict(:alg => KenCarp5()),
180+
Dict(:alg => ARKODE(Sundials.Implicit(), order=3, linear_solver=:Band, jac_upper=1, jac_lower=1)),
181+
Dict(:alg => ARKODE(Sundials.Implicit(), order=4, linear_solver=:Band, jac_upper=1, jac_lower=1)),
182+
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:Band, jac_upper=1, jac_lower=1)),
183+
]
206184
labels = hcat(
207185
"KenCarp3",
208186
"KenCarp4",
@@ -211,23 +189,25 @@ labels = hcat(
211189
"ARKODE4",
212190
"ARKODE5",
213191
)
214-
@time wp = WorkPrecisionSet(prob,abstols,reltols,setups;
215-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
216-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
192+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
193+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
194+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
217195

218-
plot(wp, label=labels, markershape=:auto, title="IMEX methods, band linsolve, Low Tolerances")
196+
plot(wp, label=labels, markershape=:auto, title="IMEX Methods, Band Linsolve, Low Tolerances")
219197
```
220198

221199
Krylov linear solvers.
222200
```julia
223201
abstols = 0.1 .^ (7:13)
224202
reltols = 0.1 .^ (4:10)
225-
setups = [Dict(:alg => KenCarp3(linsolve=KrylovJL_GMRES())),
226-
Dict(:alg => KenCarp4(linsolve=KrylovJL_GMRES())),
227-
Dict(:alg => KenCarp5(linsolve=KrylovJL_GMRES())),
228-
Dict(:alg => ARKODE(Sundials.Implicit(), order=3, linear_solver=:GMRES)),
229-
Dict(:alg => ARKODE(Sundials.Implicit(), order=4, linear_solver=:GMRES)),
230-
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:GMRES))]
203+
setups = [
204+
Dict(:alg => KenCarp3(linsolve=KrylovJL_GMRES())),
205+
Dict(:alg => KenCarp4(linsolve=KrylovJL_GMRES())),
206+
Dict(:alg => KenCarp5(linsolve=KrylovJL_GMRES())),
207+
Dict(:alg => ARKODE(Sundials.Implicit(), order=3, linear_solver=:GMRES)),
208+
Dict(:alg => ARKODE(Sundials.Implicit(), order=4, linear_solver=:GMRES)),
209+
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:GMRES)),
210+
]
231211
labels = hcat(
232212
"KenCarp3",
233213
"KenCarp4",
@@ -236,11 +216,11 @@ labels = hcat(
236216
"ARKODE4",
237217
"ARKODE5",
238218
)
239-
@time wp = WorkPrecisionSet(prob,abstols,reltols,setups;
240-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
241-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
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));
242222

243-
plot(wp, label=labels, markershape=:auto, title="IMEX methods, Krylov linsolve, Low Tolerances")
223+
plot(wp, label=labels, markershape=:auto, title="IMEX Methods, Krylov Linsolve, Low Tolerances")
244224
```
245225

246226
#### Exponential Integrators
@@ -249,19 +229,21 @@ plot(wp, label=labels, markershape=:auto, title="IMEX methods, Krylov linsolve,
249229
abstols = 0.1 .^ (7:11) # all fixed dt methods so these don't matter much
250230
reltols = 0.1 .^ (4:8)
251231
multipliers = 0.5 .^ (0:4)
252-
setups = [Dict(:alg => ETDRK3(), :dts => 1e-2 * multipliers),
253-
Dict(:alg => ETDRK4(), :dts => 1e-2 * multipliers),
254-
Dict(:alg => HochOst4(), :dts => 1e-2 * multipliers)]
232+
setups = [
233+
Dict(:alg => ETDRK3(), :dts => 1e-2 * multipliers),
234+
Dict(:alg => ETDRK4(), :dts => 1e-2 * multipliers),
235+
Dict(:alg => HochOst4(), :dts => 1e-2 * multipliers),
236+
]
255237
labels = hcat(
256238
"ETDRK3 (caching)",
257239
"ETDRK4 (caching)",
258240
"HochOst4 (caching)",
259241
)
260-
@time wp = WorkPrecisionSet(prob,abstols,reltols,setups;
261-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
262-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
242+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
243+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
244+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
263245

264-
plot(wp, label=labels, markershape=:auto, title="ExpRK methods, Low Tolerances")
246+
plot(wp, label=labels, markershape=:auto, title="ExpRK Methods, Low Tolerances")
265247
```
266248

267249
#### Comparisons Between Families
@@ -270,13 +252,15 @@ plot(wp, label=labels, markershape=:auto, title="ExpRK methods, Low Tolerances")
270252
abstols = 0.1 .^ (7:11)
271253
reltols = 0.1 .^ (4:8)
272254
multipliers = 0.5 .^ (0:4)
273-
setups = [Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:Band, jac_upper=1, jac_lower=1)),
274-
Dict(:alg => ETDRK3(), :dts => 1e-2 * multipliers),
275-
Dict(:alg => ETDRK4(), :dts => 1e-2 * multipliers)]
255+
setups = [
256+
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:GMRES)),
257+
Dict(:alg => ETDRK3(), :dts => 1e-2 * multipliers),
258+
Dict(:alg => ETDRK4(), :dts => 1e-2 * multipliers),
259+
]
276260
labels = hcat("ARKODE (nondiagonal linsolve)", "ETDRK3 ()", "ETDRK4 ()")
277-
@time wp = WorkPrecisionSet(prob,abstols,reltols,setups;
278-
print_names=true, names=labels, numruns=5, error_estimate=:l2,
279-
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
261+
@time wp = WorkPrecisionSet(prob, abstols, reltols, setups;
262+
print_names=true, names=labels, numruns=5, error_estimate=:l2,
263+
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5));
280264

281265
plot(wp, label=labels, markershape=:auto, title="Between Families, Low Tolerances")
282266
```

0 commit comments

Comments
 (0)