|
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, |
@@ -79,51 +79,72 @@ function tabulate_convergence_orders() |
79 | 79 | tabulate_convergence_orders(test_cases, tabs, results) |
80 | 80 | return results |
81 | 81 | end |
82 | | -tabulate_convergence_orders() |
| 82 | +tabulate_convergence_orders_imex_ark() |
83 | 83 |
|
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 |
| 84 | +function tabulate_convergence_orders_ark() |
| 85 | + # IMEX |
| 86 | + co = Dict() |
| 87 | + names_probs_sols = [ |
| 88 | + (:auto, imex_autonomous_prob(Array{Float64}), imex_autonomous_sol), |
| 89 | + (:nonauto, imex_nonautonomous_prob(Array{Float64}), imex_nonautonomous_sol), |
| 90 | + ] |
| 91 | + algs_orders = [ |
| 92 | + (ARK1ForwardBackwardEuler(DirectSolver), 1), |
| 93 | + (ARK2ImplicitExplicitMidpoint(DirectSolver), 2), |
| 94 | + (ARK2GiraldoKellyConstantinescu(DirectSolver), 2), |
| 95 | + (ARK2GiraldoKellyConstantinescu(DirectSolver; paperversion = true), 2), |
| 96 | + (ARK437L2SA1KennedyCarpenter(DirectSolver), 4), |
| 97 | + (ARK548L2SA2KennedyCarpenter(DirectSolver), 5), |
| 98 | + ] |
| 99 | + dts = 0.5 .^ (4:7) |
| 100 | + for (name, prob, sol) in names_probs_sols |
| 101 | + for (alg, ord) in algs_orders |
| 102 | + co[name, typeof(alg)] = (ord, convergence_order(prob, sol, alg, dts)) |
| 103 | + end |
| 104 | + end |
| 105 | + prob_names = first.(names_probs_sols) |
| 106 | + algs = first.(algs_orders) |
| 107 | + expected_orders = last.(algs_orders) |
| 108 | + tabulate_convergence_orders_new(prob_names, algs, co, expected_orders) |
98 | 109 | 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 | 110 |
|
| 111 | +tabulate_convergence_orders_ark() |
| 112 | + |
| 113 | +function tabulate_convergence_orders_multirate() |
| 114 | + |
| 115 | + co = Dict() |
| 116 | + names_probs_sols = [ |
| 117 | + (:imex_auto, imex_autonomous_prob(Array{Float64}), imex_autonomous_sol), |
| 118 | + (:imex_nonauto, imex_nonautonomous_prob(Array{Float64}), imex_nonautonomous_sol), |
| 119 | + # (:kpr_multirate, kpr_multirate_prob(), kpr_sol), |
| 120 | + ] |
| 121 | + dts = 0.5 .^ (4:7) |
| 122 | + |
| 123 | + algs_orders = [ |
| 124 | + # Multirate |
| 125 | + (Multirate(LSRK54CarpenterKennedy(), LSRK54CarpenterKennedy()), 4), |
| 126 | + # MIS |
| 127 | + (Multirate(LSRK54CarpenterKennedy(), MIS2()), 2), |
| 128 | + (Multirate(LSRK54CarpenterKennedy(), MIS3C()), 2), |
| 129 | + (Multirate(LSRK54CarpenterKennedy(), MIS4()), 3), |
| 130 | + (Multirate(LSRK54CarpenterKennedy(), MIS4a()), 3), |
| 131 | + (Multirate(LSRK54CarpenterKennedy(), TVDMISA()), 2), |
| 132 | + (Multirate(LSRK54CarpenterKennedy(), TVDMISB()), 2), |
| 133 | + # Wicker Skamarock |
| 134 | + (Multirate(LSRK54CarpenterKennedy(), WSRK2()), 2), |
| 135 | + (Multirate(LSRK54CarpenterKennedy(), WSRK3()), 2), |
| 136 | + ] |
127 | 137 |
|
| 138 | + for (name, prob, sol) in names_probs_sols |
| 139 | + for (alg, ord) in algs_orders |
| 140 | + co[name, typeof(alg)] = (ord, convergence_order(prob, sol, alg, dts; fast_dt = 0.5^12)) |
| 141 | + end |
128 | 142 | end |
129 | | -=# |
| 143 | + |
| 144 | + prob_names = first.(names_probs_sols) |
| 145 | + algs = first.(algs_orders) |
| 146 | + expected_orders = last.(algs_orders) |
| 147 | + tabulate_convergence_orders_new(prob_names, algs, co, expected_orders) |
| 148 | +end |
| 149 | + |
| 150 | +tabulate_convergence_orders_multirate() |
0 commit comments