Skip to content

Commit 5439e58

Browse files
Merge branch 'Fixes6' of https://github.com/ParamThakkar123/OrdinaryDiffEq.jl into Fixes6
2 parents 6add4d6 + d477d7d commit 5439e58

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_caches.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ get_fsalfirstlast(cache::RosenbrockMutableCache, u) = (zero(u), zero(u))
88

99
# Shampine's Low-order Rosenbrocks
1010

11-
@cache mutable struct RosenbrockCache{uType, rateType, uNoUnitsType, JType, WType, TabType,
11+
mutable struct RosenbrockCache{uType, rateType, uNoUnitsType, JType, WType, TabType,
1212
TFType, UFType, F, JCType, GCType, RTolType, A, StepLimiter, StageLimiter} <: RosenbrockMutableCache
1313
u::uType
1414
uprev::uType
@@ -37,6 +37,10 @@ get_fsalfirstlast(cache::RosenbrockMutableCache, u) = (zero(u), zero(u))
3737
step_limiter!::StepLimiter
3838
stage_limiter!::StageLimiter
3939
end
40+
function full_cache(c::RosenbrockCache)
41+
return [c.u, c.uprev, c.dense..., c.du, c.du1, c.du2,
42+
c.ks..., c.fsalfirst, c.fsallast, c.dT, c.tmp, c.atmp, c.weight, c.linsolve_tmp]
43+
end
4044

4145
@cache mutable struct Rosenbrock23Cache{uType, rateType, uNoUnitsType, JType, WType,
4246
TabType, TFType, UFType, F, JCType, GCType,

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_perform_step.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ end
13281328
solverdata = (; gamma = dtgamma))
13291329
end
13301330

1331-
@.. broadcast=false $(_vec(ks[1]))=-linres.u
1331+
@.. $(_vec(ks[1]))=-linres.u
13321332
integrator.stats.nsolve += 1
13331333

13341334
for stage in 2:length(ks)
@@ -1370,11 +1370,13 @@ end
13701370
end
13711371

13721372
if integrator.opts.calck
1373-
integrator.k[1] .= 0
1374-
integrator.k[2] .= 0
1373+
for j in 1:length(integrator.k)
1374+
integrator.k[j] .= 0
1375+
end
13751376
for i in 1:length(ks)
1376-
@.. integrator.k[1] += H[1, i] * ks[i]
1377-
@.. integrator.k[2] += H[2, i] * ks[i]
1377+
for j in 1:length(integrator.k)
1378+
@.. integrator.k[j] += H[j, i] * ks[i]
1379+
end
13781380
end
13791381
end
13801382
cache.linsolve = linres.cache

lib/OrdinaryDiffEqRosenbrock/src/rosenbrock_tableaus.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ function Rodas4Tableau(T, T2)
253253
7.496443313967647 -10.24680431464352 -33.99990352819905 11.70890893206160 0
254254
8.083246795921522 -7.981132988064893 -31.52159432874371 16.31930543123136 -6.058818238834054
255255
]
256-
c = T2[0, 0.386, 0.21, 0.63, 1, 1, 1]
257-
d = T[0.25, -0.1043, 0.1035, -0.0362, 0, 0, 0]
256+
c = T2[0, 0.386, 0.21, 0.63, 1, 1]
257+
d = T[0.25, -0.1043, 0.1035, -0.0362, 0, 0]
258258
H = T[10.12623508344586 -7.487995877610167 -34.80091861555747 -7.992771707568823 1.025137723295662 0
259259
-0.6762803392801253 6.087714651680015 16.43084320892478 24.76722511418386 -6.594389125716872 0]
260260
RodasTableau(A, C, gamma, c, d, H)
@@ -263,12 +263,12 @@ end
263263
function Rodas42Tableau(T, T2)
264264
gamma = convert(T, 1 // 4)
265265
A = T[
266-
0.0 0 0 0 0 0
267-
1.4028884 0 0 0 0 0
268-
0.6581213 -1.320936088384301 0 0 0 0
269-
7.131197445744498 16.02964143958207 -5.561572550509766 0 0 0
270-
22.73885722420363 67.38147284535289 -31.21877493038560 0.7285641833203814 0 0
271-
22.73885722420363 67.38147284535289 -31.21877493038560 0.7285641833203814 1 0
266+
0.0 0 0 0 0 0
267+
1.4028884 0 0 0 0 0
268+
0.6581212688557198 -1.320936088384301 0 0 0 0
269+
7.131197445744498 16.02964143958207 -5.561572550509766 0 0 0
270+
22.73885722420363 67.38147284535289 -31.21877493038560 0.7285641833203814 0 0
271+
22.73885722420363 67.38147284535289 -31.21877493038560 0.7285641833203814 1 0
272272
]
273273
C = T[
274274
0 0 0 0 0
@@ -278,8 +278,8 @@ function Rodas42Tableau(T, T2)
278278
-76.46023087151691 -278.5942120829058 153.9294840910643 10.97101866258358 0
279279
-76.29701586804983 -294.2795630511232 162.0029695867566 23.65166903095270 -7.652977706771382
280280
]
281-
c = T2[0, 0.3507221, 0.2557041, 0.681779, 1, 1, 1]
282-
d = T[0.25, -0.0690221, -0.0009672, -0.087979, 0, 0, 0]
281+
c = T2[0, 0.3507221, 0.2557041, 0.681779, 1, 1]
282+
d = T[0.25, -0.0690221, -0.0009672, -0.087979, 0, 0]
283283
H = T[-38.71940424117216 -135.8025833007622 64.51068857505875 -4.192663174613162 -2.531932050335060 0
284284
-14.99268484949843 -76.30242396627033 58.65928432851416 16.61359034616402 -0.6758691794084156 0]
285285
RodasTableau(A, C, gamma, c, d, H)
@@ -306,8 +306,8 @@ function Rodas4PTableau(T, T2)
306306
34.19095006749676 15.49671153725963 54.74760875964130 14.16005392148534 0
307307
34.62605830930532 15.30084976114473 56.99955578662667 18.40807009793095 -5.714285714285717
308308
]
309-
c = T2[0, 0.75, 0.21, 0.63, 1, 1, 1]
310-
d = T[0.25, -0.5, -0.023504, -0.0362, 0, 0, 0]
309+
c = T2[0, 0.75, 0.21, 0.63, 1, 1]
310+
d = T[0.25, -0.5, -0.023504, -0.0362, 0, 0]
311311
H = T[25.09876703708589 11.62013104361867 28.49148307714626 -5.664021568594133 0 0
312312
1.638054557396973 -0.7373619806678748 8.477918219238990 15.99253148779520 -1.882352941176471 0]
313313
RodasTableau(A, C, gamma, c, d, H)
@@ -331,8 +331,8 @@ function Rodas4P2Tableau(T, T2)
331331
-5.888975457523102 -8.157396617841821 24.805546872612922 12.790401512796979 0
332332
-4.408651676063871 -6.692003137674639 24.625568527593117 16.627521966636085 -5.714285714285718
333333
]
334-
c = T2[0, 0.75, 0.321448134013046, 0.519745732277726, 1, 1, 1]
335-
d = T[0.25, -0.5, -0.189532918363016, 0.085612108792769, 0, 0, 0]
334+
c = T2[0, 0.75, 0.321448134013046, 0.519745732277726, 1, 1]
335+
d = T[0.25, -0.5, -0.189532918363016, 0.085612108792769, 0, 0]
336336
H = [-5.323528268423303 -10.042123754867493 17.175254928256965 -5.079931171878093 -0.016185991706112 0
337337
6.984505741529879 6.914061169603662 -0.849178943070653 18.104410789349338 -3.516963011559032 0]
338338
RodasTableau(A, C, gamma, c, d, H)

lib/OrdinaryDiffEqRosenbrock/src/stiff_addsteps.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,7 @@ function _ode_addsteps!(k, t, uprev, u, dt, f, p, cache::RosenbrockCache,
383383

384384
linsolve = cache.linsolve
385385

386-
linres = dolinsolve(cache, linsolve; A = W, b = _vec(linsolve_tmp),
387-
reltol = cache.reltol)
386+
linres = dolinsolve(cache, linsolve; A = W, b = _vec(linsolve_tmp), reltol = cache.reltol)
388387
@.. $(_vec(ks[1]))=-linres.u
389388
for stage in 2:length(ks)
390389
tmp .= uprev

0 commit comments

Comments
 (0)