@@ -497,6 +497,7 @@ mutable struct AdaptiveRadauConstantCache{F, Tab, Tol, Dt, U, JType} <:
497
497
num_stages:: Int
498
498
step:: Int
499
499
hist_iter:: Float64
500
+ index:: Int
500
501
end
501
502
502
503
function alg_cache (alg:: AdaptiveRadau , u, rate_prototype, :: Type{uEltypeNoUnits} ,
@@ -518,7 +519,11 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
518
519
num_stages = min
519
520
520
521
tabs = [RadauIIATableau5 (uToltype, constvalue (tTypeNoUnits)), RadauIIATableau9 (uToltype, constvalue (tTypeNoUnits)), RadauIIATableau13 (uToltype, constvalue (tTypeNoUnits))]
521
- i = 9
522
+ if (min == 3 || min == 5 || min == 7 )
523
+ i = 9
524
+ else
525
+ i = min
526
+ end
522
527
while i <= max
523
528
push! (tabs, RadauIIATableau (uToltype, constvalue (tTypeNoUnits), i))
524
529
i += 2
@@ -528,10 +533,20 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
528
533
cont[i] = zero (u)
529
534
end
530
535
536
+ if (min == 3 )
537
+ index = 1
538
+ elseif (min == 5 )
539
+ index = 2
540
+ elseif (min == 7 )
541
+ index = 3
542
+ else
543
+ index = 4
544
+ end
545
+
531
546
κ = alg. κ != = nothing ? convert (uToltype, alg. κ) : convert (uToltype, 1 // 100 )
532
547
J = false .* _vec (rate_prototype) .* _vec (rate_prototype)'
533
548
AdaptiveRadauConstantCache (uf, tabs, κ, one (uToltype), 10000 , cont, dt, dt,
534
- Convergence, J, num_stages, 1 , 0.0 )
549
+ Convergence, J, num_stages, 1 , 0.0 , index )
535
550
end
536
551
537
552
mutable struct AdaptiveRadauCache{uType, cuType, tType, uNoUnitsType, rateType, JType, W1Type, W2Type,
@@ -578,6 +593,7 @@ mutable struct AdaptiveRadauCache{uType, cuType, tType, uNoUnitsType, rateType,
578
593
num_stages:: Int
579
594
step:: Int
580
595
hist_iter:: Float64
596
+ index:: Int
581
597
end
582
598
583
599
function alg_cache (alg:: AdaptiveRadau , u, rate_prototype, :: Type{uEltypeNoUnits} ,
@@ -599,12 +615,26 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
599
615
num_stages = min
600
616
601
617
tabs = [RadauIIATableau5 (uToltype, constvalue (tTypeNoUnits)), RadauIIATableau9 (uToltype, constvalue (tTypeNoUnits)), RadauIIATableau13 (uToltype, constvalue (tTypeNoUnits))]
602
- i = 9
618
+ if (min == 3 || min == 5 || min == 7 )
619
+ i = 9
620
+ else
621
+ i = min
622
+ end
603
623
while i <= max
604
624
push! (tabs, RadauIIATableau (uToltype, constvalue (tTypeNoUnits), i))
605
625
i += 2
606
626
end
607
627
628
+ if (min == 3 )
629
+ index = 1
630
+ elseif (min == 5 )
631
+ index = 2
632
+ elseif (min == 7 )
633
+ index = 3
634
+ else
635
+ index = 4
636
+ end
637
+
608
638
κ = alg. κ != = nothing ? convert (uToltype, alg. κ) : convert (uToltype, 1 // 100 )
609
639
610
640
z = Vector {typeof(u)} (undef, max)
@@ -677,6 +707,6 @@ function alg_cache(alg::AdaptiveRadau, u, rate_prototype, ::Type{uEltypeNoUnits}
677
707
uf, tabs, κ, one (uToltype), 10000 , tmp,
678
708
atmp, jac_config,
679
709
linsolve1, linsolve2, rtol, atol, dt, dt,
680
- Convergence, alg. step_limiter!, num_stages, 1 , 0.0 )
710
+ Convergence, alg. step_limiter!, num_stages, 1 , 0.0 , index )
681
711
end
682
712
0 commit comments