|
45 | 45 |
|
46 | 46 | #= |
47 | 47 | using Revise; include("test/convergence.jl") |
48 | | -results = tabulate_convergence_orders(); |
| 48 | +results = tabulate_convergence_orders_imex_ark(); |
49 | 49 | =# |
50 | | -function tabulate_convergence_orders() |
| 50 | +function tabulate_convergence_orders_imex_ark() |
51 | 51 | tabs = [ |
52 | 52 | ARS111, |
53 | 53 | ARS121, |
@@ -76,54 +76,78 @@ function tabulate_convergence_orders() |
76 | 76 | tabs = map(t -> t(), tabs) |
77 | 77 | test_cases = all_test_cases(Float64) |
78 | 78 | results = convergence_order_results(tabs, test_cases) |
79 | | - tabulate_convergence_orders(test_cases, tabs, results) |
| 79 | + algs = algorithm.(tabs) |
| 80 | + prob_names = map(t -> t.test_name, test_cases) |
| 81 | + expected_orders = ODE.alg_order.(tabs) |
| 82 | + tabulate_convergence_orders(prob_names, algs, results, expected_orders; tabs) |
80 | 83 | return results |
81 | 84 | end |
82 | | -tabulate_convergence_orders() |
| 85 | +tabulate_convergence_orders_imex_ark() |
83 | 86 |
|
84 | | -#= |
85 | | -if ArrayType == Array |
86 | | -for (prob, sol) in [ |
87 | | - imex_autonomous_prob => imex_autonomous_sol, |
88 | | - #imex_nonautonomous_prob => imex_nonautonomous_sol, |
89 | | -] |
90 | | -# IMEX |
91 | | - @test convergence_order(prob, sol, ARK1ForwardBackwardEuler(linsolve=DirectSolver), dts) ≈ 1 atol=0.1 |
92 | | - @test convergence_order(prob, sol, ARK2ImplicitExplicitMidpoint(linsolve=DirectSolver), dts) ≈ 2 atol=0.05 |
93 | | - @test convergence_order(prob, sol, ARK2GiraldoKellyConstantinescu(linsolve=DirectSolver), dts) ≈ 2 atol=0.05 |
94 | | - @test convergence_order(prob, sol, ARK2GiraldoKellyConstantinescu(linsolve=DirectSolver; paperversion=true), dts) ≈ 2 atol=0.05 |
95 | | - @test convergence_order(prob, sol, ARK437L2SA1KennedyCarpenter(linsolve=DirectSolver), dts) ≈ 4 atol=0.05 |
96 | | - @test convergence_order(prob, sol, ARK548L2SA2KennedyCarpenter(linsolve=DirectSolver), dts) ≈ 5 atol=0.05 |
97 | | -end |
| 87 | +function tabulate_convergence_orders_ark() |
| 88 | + # IMEX |
| 89 | + co = Dict() |
| 90 | + names_probs_sols = [ |
| 91 | + (:auto, imex_autonomous_prob(Array{Float64}), imex_autonomous_sol), |
| 92 | + (:nonauto, imex_nonautonomous_prob(Array{Float64}), imex_nonautonomous_sol), |
| 93 | + ] |
| 94 | + algs_orders = [ |
| 95 | + (ARK1ForwardBackwardEuler(DirectSolver), 1), |
| 96 | + (ARK2ImplicitExplicitMidpoint(DirectSolver), 2), |
| 97 | + (ARK2GiraldoKellyConstantinescu(DirectSolver), 2), |
| 98 | + (ARK2GiraldoKellyConstantinescu(DirectSolver; paperversion = true), 2), |
| 99 | + (ARK437L2SA1KennedyCarpenter(DirectSolver), 4), |
| 100 | + (ARK548L2SA2KennedyCarpenter(DirectSolver), 5), |
| 101 | + ] |
| 102 | + dts = 0.5 .^ (4:7) |
| 103 | + for (name, prob, sol) in names_probs_sols |
| 104 | + for (alg, ord) in algs_orders |
| 105 | + co[name, typeof(alg)] = (ord, convergence_order(prob, sol, alg, dts)) |
| 106 | + end |
| 107 | + end |
| 108 | + prob_names = first.(names_probs_sols) |
| 109 | + algs = first.(algs_orders) |
| 110 | + expected_orders = last.(algs_orders) |
| 111 | + tabulate_convergence_orders(prob_names, algs, co, expected_orders) |
98 | 112 | end |
99 | | -for (prob, sol) in [ |
100 | | - imex_autonomous_prob => imex_autonomous_sol, |
101 | | - imex_nonautonomous_prob => imex_nonautonomous_sol, |
102 | | - # kpr_multirate_prob => kpr_sol, |
103 | | -] |
104 | | - # Multirate |
105 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),LSRK54CarpenterKennedy()), dts; |
106 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 4 atol=0.05 |
107 | | - # MIS |
108 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),MIS2()), dts; |
109 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 2 atol=0.05 |
110 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),MIS3C()), dts; |
111 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 2 atol=0.05 |
112 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),MIS4()), dts; |
113 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 3 atol=0.05 |
114 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),MIS4a()), dts; |
115 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 3 atol=0.05 |
116 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),TVDMISA()), dts; |
117 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 2 atol=0.05 |
118 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),TVDMISB()), dts; |
119 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 2 atol=0.05 |
120 | | -
|
121 | | - # Wicker Skamarock |
122 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),WSRK2()), dts; |
123 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 2 atol=0.05 |
124 | | - @test convergence_order(prob, sol, Multirate(LSRK54CarpenterKennedy(),WSRK3()), dts; |
125 | | - fast_dt = 0.5^12, adjustfinal=true) ≈ 2 atol=0.05 |
126 | 113 |
|
| 114 | +tabulate_convergence_orders_ark() |
| 115 | + |
| 116 | +function tabulate_convergence_orders_multirate() |
| 117 | + |
| 118 | + co = Dict() |
| 119 | + names_probs_sols = [ |
| 120 | + (:imex_auto, imex_autonomous_prob(Array{Float64}), imex_autonomous_sol), |
| 121 | + (:imex_nonauto, imex_nonautonomous_prob(Array{Float64}), imex_nonautonomous_sol), |
| 122 | + # (:kpr_multirate, kpr_multirate_prob(), kpr_sol), |
| 123 | + ] |
| 124 | + dts = 0.5 .^ (4:7) |
| 125 | + |
| 126 | + algs_orders = [ |
| 127 | + # Multirate |
| 128 | + (Multirate(LSRK54CarpenterKennedy(), LSRK54CarpenterKennedy()), 4), |
| 129 | + # MIS |
| 130 | + (Multirate(LSRK54CarpenterKennedy(), MIS2()), 2), |
| 131 | + (Multirate(LSRK54CarpenterKennedy(), MIS3C()), 2), |
| 132 | + (Multirate(LSRK54CarpenterKennedy(), MIS4()), 3), |
| 133 | + (Multirate(LSRK54CarpenterKennedy(), MIS4a()), 3), |
| 134 | + (Multirate(LSRK54CarpenterKennedy(), TVDMISA()), 2), |
| 135 | + (Multirate(LSRK54CarpenterKennedy(), TVDMISB()), 2), |
| 136 | + # Wicker Skamarock |
| 137 | + (Multirate(LSRK54CarpenterKennedy(), WSRK2()), 2), |
| 138 | + (Multirate(LSRK54CarpenterKennedy(), WSRK3()), 2), |
| 139 | + ] |
127 | 140 |
|
| 141 | + for (name, prob, sol) in names_probs_sols |
| 142 | + for (alg, ord) in algs_orders |
| 143 | + co[name, typeof(alg)] = (ord, convergence_order(prob, sol, alg, dts; fast_dt = 0.5^12)) |
| 144 | + end |
128 | 145 | end |
129 | | -=# |
| 146 | + |
| 147 | + prob_names = first.(names_probs_sols) |
| 148 | + algs = first.(algs_orders) |
| 149 | + expected_orders = last.(algs_orders) |
| 150 | + tabulate_convergence_orders(prob_names, algs, co, expected_orders) |
| 151 | +end |
| 152 | + |
| 153 | +tabulate_convergence_orders_multirate() |
0 commit comments