Skip to content

Commit 2020765

Browse files
Merge pull request #4 from Shreyas-Ekanathan/master
update
2 parents 17bd407 + 798fef8 commit 2020765

File tree

9 files changed

+34
-30
lines changed

9 files changed

+34
-30
lines changed

src/OrdinaryDiffEq.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export FunctionMap, Euler, Heun, Ralston, Midpoint, RK4, ExplicitRK, OwrenZen3,
428428
FRK65, PFRK87,
429429
RKM, MSRK5, MSRK6, Stepanov5, SIR54, QPRK98, PSRK4p7q6, PSRK3p6q5, PSRK3p5q4
430430

431-
export RadauIIA3, RadauIIA5, RadauIIA7
431+
export RadauIIA3, RadauIIA5, RadauIIA9
432432

433433
export MagnusMidpoint, LinearExponential, MagnusLeapfrog, LieEuler, CayleyEuler,
434434
MagnusGauss4, MagnusNC6, MagnusGL6, MagnusGL8, MagnusNC8, MagnusGL4,

src/alg_utils.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ qmin_default(alg::DP8) = 1 // 3
175175
qmax_default(alg::Union{OrdinaryDiffEqAlgorithm, DAEAlgorithm}) = 10
176176
qmax_default(alg::CompositeAlgorithm) = minimum(qmax_default.(alg.algs))
177177
qmax_default(alg::DP8) = 6
178-
qmax_default(alg::Union{RadauIIA3, RadauIIA5, RadauIIA7}) = 8
178+
qmax_default(alg::Union{RadauIIA3, RadauIIA5, RadauIIA9}) = 8
179179

180180
function has_chunksize(alg::OrdinaryDiffEqAlgorithm)
181181
return alg isa Union{OrdinaryDiffEqExponentialAlgorithm,
@@ -430,7 +430,8 @@ alg_order(alg::TanYam7) = 7
430430
alg_order(alg::TsitPap8) = 8
431431
alg_order(alg::RadauIIA3) = 3
432432
alg_order(alg::RadauIIA5) = 5
433-
alg_order(alg::RadauIIA7) = 7
433+
alg_order(alg::RadauIIA9) = 9
434+
alg_order(alg::ImplicitEuler) = 1
434435
alg_order(alg::RKMK2) = 2
435436
alg_order(alg::RKMK4) = 4
436437
alg_order(alg::LieRK4) = 4
@@ -530,6 +531,7 @@ alg_adaptive_order(alg::Rosenbrock32) = 2
530531

531532
alg_adaptive_order(alg::RadauIIA3) = 1
532533
alg_adaptive_order(alg::RadauIIA5) = 3
534+
alg_adaptive_order(alg::RadauIIA9) = 7
533535

534536
# this is actually incorrect and is purposefully decreased as this tends
535537
# to track the real error much better

src/algorithms.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,10 +673,10 @@ year={1999},
673673
publisher={Elsevier}
674674
}
675675
676-
RadauIIA7: Fully-Implicit Runge-Kutta Method
676+
RadauII97: Fully-Implicit Runge-Kutta Method
677677
An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency.
678678
"""
679-
struct RadauIIA7{CS, AD, F, P, FDT, ST, CJ, Tol, C1, C2, StepLimiter} <:
679+
struct RadauIIA9{CS, AD, F, P, FDT, ST, CJ, Tol, C1, C2, StepLimiter} <:
680680
OrdinaryDiffEqNewtonAdaptiveAlgorithm{CS, AD, FDT, ST, CJ}
681681
linsolve::F
682682
precs::P
@@ -690,15 +690,15 @@ struct RadauIIA7{CS, AD, F, P, FDT, ST, CJ, Tol, C1, C2, StepLimiter} <:
690690
step_limiter!::StepLimiter
691691
end
692692

693-
function RadauIIA7(; chunk_size = Val{0}(), autodiff = Val{true}(),
693+
function RadauIIA9(; chunk_size = Val{0}(), autodiff = Val{true}(),
694694
standardtag = Val{true}(), concrete_jac = nothing,
695695
diff_type = Val{:forward},
696696
linsolve = nothing, precs = DEFAULT_PRECS,
697697
extrapolant = :dense, fast_convergence_cutoff = 1 // 5,
698698
new_W_γdt_cutoff = 1 // 5,
699699
controller = :Predictive, κ = nothing, maxiters = 10, smooth_est = true,
700700
step_limiter! = trivial_limiter!)
701-
RadauIIA7{_unwrap_val(chunk_size), _unwrap_val(autodiff), typeof(linsolve),
701+
RadauIIA9{_unwrap_val(chunk_size), _unwrap_val(autodiff), typeof(linsolve),
702702
typeof(precs), diff_type, _unwrap_val(standardtag), _unwrap_val(concrete_jac),
703703
typeof(κ), typeof(fast_convergence_cutoff),
704704
typeof(new_W_γdt_cutoff), typeof(step_limiter!)}(linsolve,
@@ -712,7 +712,7 @@ function RadauIIA7(; chunk_size = Val{0}(), autodiff = Val{true}(),
712712
controller,
713713
step_limiter!)
714714
end
715-
TruncatedStacktraces.@truncate_stacktrace RadauIIA7
715+
TruncatedStacktraces.@truncate_stacktrace RadauIIA9
716716

717717
################################################################################
718718

src/caches/firk_caches.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function alg_cache(alg::RadauIIA5, u, rate_prototype, ::Type{uEltypeNoUnits},
274274
Convergence, alg.step_limiter!)
275275
end
276276

277-
mutable struct RadauIIA7ConstantCache{F, Tab, Tol, Dt, U, JType} <:
277+
mutable struct RadauIIA9ConstantCache{F, Tab, Tol, Dt, U, JType} <:
278278
OrdinaryDiffEqConstantCache
279279
uf::F
280280
tab::Tab
@@ -291,22 +291,22 @@ mutable struct RadauIIA7ConstantCache{F, Tab, Tol, Dt, U, JType} <:
291291
J::JType
292292
end
293293

294-
function alg_cache(alg::RadauIIA7, u, rate_prototype, ::Type{uEltypeNoUnits},
294+
function alg_cache(alg::RadauIIA9, u, rate_prototype, ::Type{uEltypeNoUnits},
295295
::Type{uBottomEltypeNoUnits},
296296
::Type{tTypeNoUnits}, uprev, uprev2, f, t, dt, reltol, p, calck,
297297
::Val{false}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
298298
uf = UDerivativeWrapper(f, t, p)
299299
uToltype = constvalue(uBottomEltypeNoUnits)
300-
tab = RadauIIA7Tableau(uToltype, constvalue(tTypeNoUnits))
300+
tab = RadauIIA9Tableau(uToltype, constvalue(tTypeNoUnits))
301301

302302
κ = alg.κ !== nothing ? convert(uToltype, alg.κ) : convert(uToltype, 1 // 100)
303303
J = false .* _vec(rate_prototype) .* _vec(rate_prototype)'
304304

305-
RadauIIA7ConstantCache(uf, tab, κ, one(uToltype), 10000, u, u, u, u, dt, dt,
305+
RadauIIA9ConstantCache(uf, tab, κ, one(uToltype), 10000, u, u, u, u, dt, dt,
306306
Convergence, J)
307307
end
308308

309-
mutable struct RadauIIA7Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Type, W2Type,
309+
mutable struct RadauIIA9Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Type, W2Type,
310310
UF, JC, F1, F2, Tab, Tol, Dt, rTol, aTol, StepLimiter} <:
311311
OrdinaryDiffEqMutableCache
312312
u::uType
@@ -370,15 +370,15 @@ mutable struct RadauIIA7Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Ty
370370
status::NLStatus
371371
step_limiter!::StepLimiter
372372
end
373-
TruncatedStacktraces.@truncate_stacktrace RadauIIA7Cache 1
373+
TruncatedStacktraces.@truncate_stacktrace RadauIIA9Cache 1
374374

375-
function alg_cache(alg::RadauIIA7, u, rate_prototype, ::Type{uEltypeNoUnits},
375+
function alg_cache(alg::RadauIIA9, u, rate_prototype, ::Type{uEltypeNoUnits},
376376
::Type{uBottomEltypeNoUnits},
377377
::Type{tTypeNoUnits}, uprev, uprev2, f, t, dt, reltol, p, calck,
378378
::Val{true}) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
379379
uf = UJacobianWrapper(f, t, p)
380380
uToltype = constvalue(uBottomEltypeNoUnits)
381-
tab = RadauIIA7Tableau(uToltype, constvalue(tTypeNoUnits))
381+
tab = RadauIIA9Tableau(uToltype, constvalue(tTypeNoUnits))
382382

383383
κ = alg.κ !== nothing ? convert(uToltype, alg.κ) : convert(uToltype, 1 // 100)
384384

@@ -459,7 +459,7 @@ function alg_cache(alg::RadauIIA7, u, rate_prototype, ::Type{uEltypeNoUnits},
459459
rtol = reltol isa Number ? reltol : zero(reltol)
460460
atol = reltol isa Number ? reltol : zero(reltol)
461461

462-
RadauIIA7Cache(u, uprev,
462+
RadauIIA9Cache(u, uprev,
463463
z1, z2, z3, z4, z5, w1, w2, w3, w4, w5,
464464
dw1, ubuff, dw23, dw45, cubuff1, cubuff2, cont1, cont2, cont3, cont4,
465465
du1, fsalfirst, k, k2, k3, k4, k5, fw1, fw2, fw3, fw4, fw5,

src/integrators/controllers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ end
406406
if fac_default_gamma(alg)
407407
fac = gamma
408408
else
409-
if alg isa Union{RadauIIA3, RadauIIA5, RadauIIA7}
409+
if alg isa Union{RadauIIA3, RadauIIA5, RadauIIA9}
410410
@unpack iter = integrator.cache
411411
@unpack maxiters = alg
412412
else

src/integrators/integrator_interface.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ end
113113
end
114114

115115
# avoid method ambiguity
116-
# for typ in (Union{RadauIIA3, RadauIIA5, RadauIIA7})
116+
# for typ in (Union{RadauIIA3, RadauIIA5, RadauIIA9})
117117
# @eval @inline function DiffEqBase.get_tmp_cache(integrator, alg::$typ,
118118
# cache::OrdinaryDiffEqConstantCache)
119119
# nothing
@@ -126,7 +126,7 @@ end
126126
(cache.tmp,)
127127
end
128128
@inline function DiffEqBase.get_tmp_cache(
129-
integrator, alg::Union{RadauIIA3, RadauIIA5, RadauIIA7},
129+
integrator, alg::Union{RadauIIA3, RadauIIA5, RadauIIA9},
130130
cache::OrdinaryDiffEqMutableCache)
131131
(cache.tmp, cache.atmp)
132132
end

src/perform_step/firk_perform_step.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function initialize!(integrator, cache::RadauIIA5ConstantCache)
5151
nothing
5252
end
5353

54-
function initialize!(integrator, cache::RadauIIA7ConstantCache)
54+
function initialize!(integrator, cache::RadauIIA9ConstantCache)
5555
integrator.kshortsize = 2
5656
integrator.k = typeof(integrator.k)(undef, integrator.kshortsize)
5757
integrator.fsalfirst = integrator.f(integrator.uprev, integrator.p, integrator.t) # Pre-start fsal
@@ -98,7 +98,7 @@ function initialize!(integrator, cache::RadauIIA5Cache)
9898
nothing
9999
end
100100

101-
function initialize!(integrator, cache::RadauIIA7Cache)
101+
function initialize!(integrator, cache::RadauIIA9Cache)
102102
integrator.kshortsize = 2
103103
integrator.fsalfirst = cache.fsalfirst
104104
integrator.fsallast = cache.k
@@ -784,7 +784,7 @@ end
784784
return
785785
end
786786

787-
@muladd function perform_step!(integrator, cache::RadauIIA7ConstantCache,
787+
@muladd function perform_step!(integrator, cache::RadauIIA9ConstantCache,
788788
repeat_step = false)
789789
@unpack t, dt, uprev, u, f, p = integrator
790790
@unpack T11, T12, T13, T14, T15, T21, T22, T23, T24, T25, T31, T32, T33, T34, T35, T41, T42, T43, T44, T45, T51 = cache.tab #= T52 = 1, T53 = 0, T54 = 1, T55 = 0=#
@@ -1014,7 +1014,7 @@ end
10141014
return
10151015
end
10161016

1017-
@muladd function perform_step!(integrator, cache::RadauIIA7Cache, repeat_step = false)
1017+
@muladd function perform_step!(integrator, cache::RadauIIA9Cache, repeat_step = false)
10181018
@unpack t, dt, uprev, u, f, p, fsallast, fsalfirst = integrator
10191019
@unpack T11, T12, T13, T14, T15, T21, T22, T23, T24, T25, T31, T32, T33, T34, T35, T41, T42, T43, T44, T45, T51 = cache.tab #= T52 = 1, T53 = 0, T54 = 1, T55 = 0=#
10201020
@unpack TI11, TI12, TI13, TI14, TI15, TI21, TI22, TI23, TI24, TI25, TI31, TI32, TI33, TI34, TI35, TI41, TI42, TI43, TI44, TI45, TI51, TI52, TI53, TI54, TI55 = cache.tab

src/tableaus/firk_tableaus.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function RadauIIA5Tableau(T, T2)
111111
e1, e2, e3)
112112
end
113113

114-
struct RadauIIA7Tableau{T, T2}
114+
struct RadauIIA9Tableau{T, T2}
115115
T11::T
116116
T12::T
117117
T13::T
@@ -178,7 +178,7 @@ struct RadauIIA7Tableau{T, T2}
178178
e5::T
179179
end
180180

181-
function RadauIIA7Tableau(T, T2)
181+
function RadauIIA9Tableau(T, T2)
182182
T11 = convert(T, -1.251758622050104589014e-2)
183183
T12 = convert(T, -1.024204781790882707009e-2)
184184
T13 = convert(T, 4.767387729029572386318e-2)
@@ -248,7 +248,7 @@ function RadauIIA7Tableau(T, T2)
248248
e4 = convert(T, 5.920031671845428725662e-1)
249249
e5 = convert(T, -2.000000000000000000000e-1)
250250

251-
RadauIIA7Tableau{T, T2}(T11, T12, T13, T14, T15,
251+
RadauIIA9Tableau{T, T2}(T11, T12, T13, T14, T15,
252252
T21, T22, T23, T24, T25, T31, T32, T33, T34, T35,
253253
T41, T42, T43, T44, T45, T51, #=T52, T53, T54, T55=#
254254
TI11, TI12, TI13, TI14, TI15, TI21, TI22, TI23, TI24, TI25,
@@ -258,3 +258,5 @@ function RadauIIA7Tableau(T, T2)
258258
γ, α1, β1, α2, β2,
259259
e1, e2, e3, e4, e5)
260260
end
261+
262+

test/algconvergence/ode_firk_tests.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ for prob in [prob_ode_linear, prob_ode_2Dlinear]
88
@test sim21.𝒪est[:final]5 atol=testTol
99
end
1010

11-
sim21 = test_convergence(1 ./ 2 .^ (2.777:-1:0.777), prob_ode_linear, RadauIIA7())
12-
@test sim21.𝒪est[:final]7 atol=testTol
11+
sim21 = test_convergence(1 ./ 2 .^ (2.75:-0.5:0.25), prob_ode_linear, RadauIIA9())
12+
@test sim21.𝒪est[:final]8 atol=testTol
1313

14-
sim21 = test_convergence(1 ./ 2 .^ (2.777:-1:0.777), prob_ode_2Dlinear, RadauIIA7())
14+
sim21 = test_convergence(1 ./ 2 .^ (2.75:-0.5:0.25), prob_ode_2Dlinear, RadauIIA0())
1515
@test sim21.𝒪est[:final]8 atol=testTol
1616

1717
# test adaptivity

0 commit comments

Comments
 (0)