Skip to content

Commit cb77846

Browse files
committed
fixes
1 parent b9dcd23 commit cb77846

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ jac_cache(c::Rosenbrock4Cache) = (c.J, c.W)
300300
tabtype(::Rodas23W) = Rodas23WTableau
301301
tabtype(::ROS3P) = ROS3PTableau
302302
tabtype(::Rodas3) = Rodas3Tableau
303+
tabtype(::Rodas3P) = Rodas3PTableau
303304
tabtype(::Rodas4) = Rodas4Tableau
304305
tabtype(::Rodas42) = Rodas42Tableau
305306
tabtype(::Rodas4P) = Rodas4PTableau
@@ -310,7 +311,7 @@ tabtype(::Rodas5Pr) = Rodas5PTableau
310311
tabtype(::Rodas5Pe) = Rodas5PTableau
311312

312313
function alg_cache(
313-
alg::Union{ROS3P, Rodas3, Rodas23W, Rodas4, Rodas42, Rodas4P, Rodas4P2, Rodas5, Rodas5P, Rodas5Pe, Rodas5Pr},
314+
alg::Union{ROS3P, Rodas3, Rodas3P, Rodas23W, Rodas4, Rodas42, Rodas4P, Rodas4P2, Rodas5, Rodas5P, Rodas5Pe, Rodas5Pr},
314315
u, rate_prototype, ::Type{uEltypeNoUnits},
315316
::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t,
316317
dt, reltol, p, calck,
@@ -353,7 +354,7 @@ function alg_cache(
353354
end
354355

355356
function alg_cache(
356-
alg::Union{ROS3P, Rodas3, Rodas23W, Rodas4, Rodas42, Rodas4P, Rodas4P2, Rodas5, Rodas5P, Rodas5Pe, Rodas5Pr},
357+
alg::Union{ROS3P, Rodas3, Rodas3P, Rodas23W, Rodas4, Rodas42, Rodas4P, Rodas4P2, Rodas5, Rodas5P, Rodas5Pe, Rodas5Pr},
357358
u, rate_prototype, ::Type{uEltypeNoUnits},
358359
::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, uprev2, f, t,
359360
dt, reltol, p, calck,

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ end
495495
end
496496

497497
if integrator.opts.adaptive
498-
utilde = uprev
498+
utilde = zero(u)
499499
for i in 1:num_stages
500500
utilde = @.. utilde + btilde[i] * ks[i]
501501
end
@@ -592,14 +592,10 @@ end
592592
OrdinaryDiffEqCore.increment_nf!(integrator.stats, 1)
593593

594594
du1 .= 0
595-
if mass_matrix === I
596-
for i in 1:(stage - 1)
597-
@.. du1 += dtC[stage, i] * ks[i]
598-
end
599-
else
600-
for i in 1:(stage - 1)
601-
@.. du1 += dtC[stage, i] * ks[i]
602-
end
595+
for i in 1:(stage - 1)
596+
@.. du1 += dtC[stage, i] * ks[i]
597+
end
598+
if mass_matrix !== I
603599
mul!(_vec(du2), mass_matrix, _vec(du1))
604600
du1 .= du2
605601
end
@@ -617,7 +613,7 @@ end
617613
step_limiter!(u, integrator, p, t + dt)
618614

619615
if integrator.opts.adaptive
620-
utilde .= 0
616+
@.. utilde = 0 * u
621617
for i in 1:num_stages
622618
@.. utilde += btilde[i] * ks[i]
623619
end

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ function ROS3PTableau(T, T2)
5151
btilde = T[2.113248654051871, 1, 0.4226497308103742]
5252
c = T2[0, 1, 1]
5353
d = T[0.7886751345948129, -0.2113248654051871, -1.077350269189626]
54-
H = zeros(T, 3, 3)
54+
H = zeros(T, 2, 3)
5555
RodasTableau(A, C, b, btilde, gamma, c, d, H)
5656
end
5757

5858
function Rodas3Tableau(T, T2)
5959
gamma = convert(T, 1 // 2)
6060
A = T[
61-
0 0 0
62-
0 0 0
63-
2 0 0
64-
2 0 1
61+
0 0 0 0
62+
0 0 0 0
63+
2 0 0 0
64+
2 0 1 0
6565
]
6666
C = T[
6767
0 0 0
@@ -71,31 +71,32 @@ function Rodas3Tableau(T, T2)
7171
]
7272
b = T[2, 0, 1, 1]
7373
btilde = T[0, 0, 0, 1]
74-
c = T[0, 1, 1]
74+
c = T[0, 0, 1, 1]
7575
d = T[1 // 2, 3 // 2, 0, 0]
76-
H = zeros(T, 3, 3)
76+
H = zeros(T, 2, 4)
7777
RodasTableau(A, C, b, btilde, gamma, c, d, H)
7878
end
7979

8080
function Rodas3PTableau(T, T2)
8181
gamma = convert(T, 1 // 3)
8282
A = T[
83-
0 0 0 0
84-
4 // 3 0 0 0
85-
4 // 3 0 0 0
86-
2.90625 3.375 0.40625 0
83+
0 0 0 0 0
84+
4 // 3 0 0 0 0
85+
4 // 3 0 0 0 0
86+
2.90625 3.375 0.40625 0 0
87+
2.90625 3.375 0.40625 0 0
8788
]
8889
C = T[
8990
0 0 0 0
90-
4.0 0 0 0
91+
-4.0 0 0 0
9192
8.25 6.75 0 0
92-
1.21875 5.0625 1.96875 0
93-
4.03125 15.1875 4.03125 6.0
93+
1.21875 -5.0625 -1.96875 0
94+
4.03125 -15.1875 -4.03125 6.0
9495
]
95-
b = A[end, :]
96-
btilde = T[0, 0, 0, 1]
97-
c = T2[0, 4 // 9, 1]
98-
d = T[1 // 3, 1 // 9, 1]
96+
b = T[2.90625, 3.375, 0.40625, 1, 0]
97+
btilde = T[0, 0, 0, 1, -1]
98+
c = T2[0, 4 // 9, 4 // 9, 1, 1]
99+
d = T[1 // 3, -1 // 9, 1, 0, 0]
99100
H = T[
100101
1.78125 6.75 0.15625 6 1
101102
4.21875 15.1875 3.09375 9 0
@@ -104,6 +105,10 @@ function Rodas3PTableau(T, T2)
104105
RodasTableau(A, C, b, btilde, gamma, c, d, H)#, h2_2)
105106
end
106107

108+
function Rodas23WTableau(T, T2)
109+
tab = Rodas3PTableau(T, T2)
110+
RodasTableau(tab.A, tab.C, tab.btilde, tab.b, tab.gamma, tab.c, tab.d, tab.H)#, h2_2)
111+
end
107112
@ROS2(:tableau)
108113

109114
@ROS23(:tableau)

0 commit comments

Comments
 (0)