1
- mutable struct GenericImplicitEulerCache{uType,uArrayType,vecuType,DiffCacheType,rateType,rhsType,nl_rhsType} <: OrdinaryDiffEqMutableCache
1
+ mutable struct GenericImplicitEulerCache{uType,uArrayType,vecuType,DiffCacheType,uNoUnitsType, rateType,rhsType,nl_rhsType} <: OrdinaryDiffEqMutableCache
2
2
u:: uType
3
3
uprev:: uType
4
4
uprev2:: uType
5
5
uhold:: vecuType
6
6
dual_cache:: DiffCacheType
7
7
C:: uArrayType
8
8
tmp:: uType
9
+ atmp:: uNoUnitsType
9
10
k:: rateType
10
11
fsalfirst:: rateType
11
12
rhs:: rhsType
@@ -18,7 +19,7 @@ vecu_cache(c::GenericImplicitEulerCache) = (c.uhold,)
18
19
dual_cache (c:: GenericImplicitEulerCache ) = (c. dual_cache,)
19
20
20
21
function alg_cache (alg:: GenericImplicitEuler ,u,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,:: Type{Val{true}} )
21
- tmp = similar (u)
22
+ tmp = similar (u); atmp = similar (u,uEltypeNoUnits)
22
23
C = vec (tmp); k = zeros (rate_prototype)
23
24
dual_cache = DiffCache (u,Val{determine_chunksize (u,get_chunksize (alg. nlsolve))})
24
25
uhold = vec (u) # this makes uhold the same values as integrator.u
@@ -27,8 +28,8 @@ function alg_cache(alg::GenericImplicitEuler,u,rate_prototype,uEltypeNoUnits,tTy
27
28
nl_rhs = alg. nlsolve (Val{:init },rhs,uhold)
28
29
29
30
GenericImplicitEulerCache{typeof (u),typeof (C),typeof (uhold),typeof (dual_cache),
30
- typeof (k),typeof (rhs),typeof (nl_rhs)}(
31
- u,uprev,uprev2,uhold,dual_cache,C,tmp,k,fsalfirst,rhs,nl_rhs)
31
+ typeof (atmp), typeof ( k),typeof (rhs),typeof (nl_rhs)}(
32
+ u,uprev,uprev2,uhold,dual_cache,C,tmp,atmp, k,fsalfirst,rhs,nl_rhs)
32
33
end
33
34
34
35
struct GenericImplicitEulerConstantCache{vecuType,rhsType,nl_rhsType} <: OrdinaryDiffEqConstantCache
@@ -47,7 +48,7 @@ function alg_cache(alg::GenericImplicitEuler,u,rate_prototype,uEltypeNoUnits,tTy
47
48
GenericImplicitEulerConstantCache {typeof(uhold),typeof(rhs),typeof(nl_rhs)} (uhold,C,rhs,nl_rhs)
48
49
end
49
50
50
- mutable struct GenericTrapezoidCache{uType,uArrayType,vecuType,DiffCacheType,rateType,rhsType,nl_rhsType,tType} <: OrdinaryDiffEqMutableCache
51
+ mutable struct GenericTrapezoidCache{uType,uArrayType,vecuType,DiffCacheType,uNoUnitsType, rateType,rhsType,nl_rhsType,tType} <: OrdinaryDiffEqMutableCache
51
52
u:: uType
52
53
uprev:: uType
53
54
uprev2:: uType
@@ -56,6 +57,7 @@ mutable struct GenericTrapezoidCache{uType,uArrayType,vecuType,DiffCacheType,rat
56
57
fsalfirst:: rateType
57
58
dual_cache:: DiffCacheType
58
59
tmp:: uType
60
+ atmp:: uNoUnitsType
59
61
k:: rateType
60
62
rhs:: rhsType
61
63
nl_rhs:: nl_rhsType
@@ -69,7 +71,7 @@ vecu_cache(c::GenericTrapezoidCache) = (c.uhold,)
69
71
dual_cache (c:: GenericTrapezoidCache ) = (c. dual_cache,)
70
72
71
73
function alg_cache (alg:: GenericTrapezoid ,u,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,uprev2,f,t,dt,reltol,:: Type{Val{true}} )
72
- tmp = similar (u)
74
+ tmp = similar (u); atmp = similar (u,uEltypeNoUnits)
73
75
C = vec (tmp); k = zeros (rate_prototype)
74
76
uhold = vec (u); fsalfirst = zeros (rate_prototype)
75
77
dual_cache = DiffCache (u,Val{determine_chunksize (u,get_chunksize (alg. nlsolve))})
@@ -78,10 +80,10 @@ function alg_cache(alg::GenericTrapezoid,u,rate_prototype,uEltypeNoUnits,tTypeNo
78
80
uprev3 = similar (u)
79
81
tprev2 = t
80
82
GenericTrapezoidCache{typeof (u),typeof (C),typeof (uhold),
81
- typeof (dual_cache),typeof (k),
83
+ typeof (dual_cache),typeof (atmp), typeof ( k),
82
84
typeof (rhs),typeof (nl_rhs),typeof (t)}(
83
85
u,uprev,uprev2,uhold,C,fsalfirst,
84
- dual_cache,tmp,k,rhs,nl_rhs,uprev3,tprev2)
86
+ dual_cache,tmp,atmp, k,rhs,nl_rhs,uprev3,tprev2)
85
87
end
86
88
87
89
0 commit comments