@@ -62,7 +62,7 @@ struct RosenbrockCombinedConstantCache{TF, UF, Tab, JType, WType, F, AD} <:
6262 interp_order:: Int
6363end
6464
65- @cache mutable struct Rosenbrock23Cache {uType, rateType, uNoUnitsType, JType, WType,
65+ @cache mutable struct RosenbrockCombinedCache {uType, rateType, uNoUnitsType, JType, WType,
6666 TabType, TFType, UFType, F, JCType, GCType,
6767 RTolType, A, AV, StepLimiter, StageLimiter} <: RosenbrockMutableCache
6868 u:: uType
9595 stage_limiter!:: StageLimiter
9696end
9797
98- @cache mutable struct Rosenbrock32Cache{uType, rateType, uNoUnitsType, JType, WType,
99- TabType, TFType, UFType, F, JCType, GCType,
100- RTolType, A, AV, StepLimiter, StageLimiter} <: RosenbrockMutableCache
101- u:: uType
102- uprev:: uType
103- k₁:: rateType
104- k₂:: rateType
105- k₃:: rateType
106- du1:: rateType
107- du2:: rateType
108- f₁:: rateType
109- fsalfirst:: rateType
110- fsallast:: rateType
111- dT:: rateType
112- J:: JType
113- W:: WType
114- tmp:: rateType
115- atmp:: uNoUnitsType
116- weight:: uNoUnitsType
117- tab:: TabType
118- tf:: TFType
119- uf:: UFType
120- linsolve_tmp:: rateType
121- linsolve:: F
122- jac_config:: JCType
123- grad_config:: GCType
124- reltol:: RTolType
125- alg:: A
126- algebraic_vars:: AV
127- step_limiter!:: StepLimiter
128- stage_limiter!:: StageLimiter
129- end
130-
131- function alg_cache (alg:: Rosenbrock23 , u, rate_prototype, :: Type{uEltypeNoUnits} ,
98+ function alg_cache (alg:: Union{Rosenbrock23, Rosenbrock32} , u, rate_prototype, :: Type{uEltypeNoUnits} ,
13299 :: Type{uBottomEltypeNoUnits} , :: Type{tTypeNoUnits} , uprev, uprev2, f, t,
133100 dt, reltol, p, calck,
134101 :: Val{true} ) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
@@ -147,7 +114,7 @@ function alg_cache(alg::Rosenbrock23, u, rate_prototype, ::Type{uEltypeNoUnits},
147114 recursivefill! (atmp, false )
148115 weight = similar (u, uEltypeNoUnits)
149116 recursivefill! (weight, false )
150- tab = Rosenbrock23Tableau (constvalue (uBottomEltypeNoUnits))
117+ tab = RosenbrockCombinedTableau (constvalue (uBottomEltypeNoUnits))
151118 tf = TimeGradientWrapper (f, uprev, p)
152119 uf = UJacobianWrapper (f, t, p)
153120 linsolve_tmp = zero (rate_prototype)
@@ -170,61 +137,13 @@ function alg_cache(alg::Rosenbrock23, u, rate_prototype, ::Type{uEltypeNoUnits},
170137 algebraic_vars = f. mass_matrix === I ? nothing :
171138 [all (iszero, x) for x in eachcol (f. mass_matrix)]
172139
173- Rosenbrock23Cache (u, uprev, k₁, k₂, k₃, du1, du2, f₁,
140+ RosenbrockCombinedCache (u, uprev, k₁, k₂, k₃, du1, du2, f₁,
174141 fsalfirst, fsallast, dT, J, W, tmp, atmp, weight, tab, tf, uf,
175142 linsolve_tmp,
176143 linsolve, jac_config, grad_config, reltol, alg, algebraic_vars, alg. step_limiter!,
177144 alg. stage_limiter!)
178145end
179146
180- function alg_cache (alg:: Rosenbrock32 , u, rate_prototype, :: Type{uEltypeNoUnits} ,
181- :: Type{uBottomEltypeNoUnits} , :: Type{tTypeNoUnits} , uprev, uprev2, f, t,
182- dt, reltol, p, calck,
183- :: Val{true} ) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
184- k₁ = zero (rate_prototype)
185- k₂ = zero (rate_prototype)
186- k₃ = zero (rate_prototype)
187- du1 = zero (rate_prototype)
188- du2 = zero (rate_prototype)
189- # f₀ = zero(u) fsalfirst
190- f₁ = zero (rate_prototype)
191- fsalfirst = zero (rate_prototype)
192- fsallast = zero (rate_prototype)
193- dT = zero (rate_prototype)
194- tmp = zero (rate_prototype)
195- atmp = similar (u, uEltypeNoUnits)
196- recursivefill! (atmp, false )
197- weight = similar (u, uEltypeNoUnits)
198- recursivefill! (weight, false )
199- tab = Rosenbrock32Tableau (constvalue (uBottomEltypeNoUnits))
200-
201- tf = TimeGradientWrapper (f, uprev, p)
202- uf = UJacobianWrapper (f, t, p)
203- linsolve_tmp = zero (rate_prototype)
204-
205- grad_config = build_grad_config (alg, f, tf, du1, t)
206- jac_config = build_jac_config (alg, f, uf, du1, uprev, u, tmp, du2)
207-
208- J, W = build_J_W (alg, u, uprev, p, t, dt, f, jac_config, uEltypeNoUnits, Val (true ))
209-
210- linprob = LinearProblem (W, _vec (linsolve_tmp); u0 = _vec (tmp))
211-
212- Pl, Pr = wrapprecs (
213- alg. precs (W, nothing , u, p, t, nothing , nothing , nothing ,
214- nothing )... , weight, tmp)
215- linsolve = init (
216- linprob, alg. linsolve, alias = LinearAliasSpecifier (alias_A = true , alias_b = true ),
217- Pl = Pl, Pr = Pr,
218- assumptions = LinearSolve. OperatorAssumptions (true ))
219-
220- algebraic_vars = f. mass_matrix === I ? nothing :
221- [all (iszero, x) for x in eachcol (f. mass_matrix)]
222-
223- Rosenbrock32Cache (u, uprev, k₁, k₂, k₃, du1, du2, f₁, fsalfirst, fsallast, dT, J, W,
224- tmp, atmp, weight, tab, tf, uf, linsolve_tmp, linsolve, jac_config,
225- grad_config, reltol, alg, algebraic_vars, alg. step_limiter!, alg. stage_limiter!)
226- end
227-
228147struct Rosenbrock23ConstantCache{T, TF, UF, JType, WType, F, AD} < :
229148 RosenbrockConstantCache
230149 c₃₂:: T
@@ -238,7 +157,7 @@ struct Rosenbrock23ConstantCache{T, TF, UF, JType, WType, F, AD} <:
238157end
239158
240159function Rosenbrock23ConstantCache (:: Type{T} , tf, uf, J, W, linsolve, autodiff) where {T}
241- tab = Rosenbrock23Tableau (T)
160+ tab = RosenbrockCombinedTableau (T)
242161 Rosenbrock23ConstantCache (tab. c₃₂, tab. d, tf, uf, J, W, linsolve, autodiff)
243162end
244163
@@ -268,7 +187,7 @@ struct Rosenbrock32ConstantCache{T, TF, UF, JType, WType, F, AD} <:
268187end
269188
270189function Rosenbrock32ConstantCache (:: Type{T} , tf, uf, J, W, linsolve, autodiff) where {T}
271- tab = Rosenbrock32Tableau (T)
190+ tab = RosenbrockCombinedTableau (T)
272191 Rosenbrock32ConstantCache (tab. c₃₂, tab. d, tf, uf, J, W, linsolve, autodiff)
273192end
274193
@@ -832,7 +751,7 @@ function alg_cache(
832751end
833752
834753function get_fsalfirstlast (
835- cache:: Union {Rosenbrock23Cache, Rosenbrock32Cache , Rosenbrock33Cache,
754+ cache:: Union {RosenbrockCombinedCache , Rosenbrock33Cache,
836755 Rosenbrock34Cache,
837756 Rosenbrock4Cache},
838757 u)
0 commit comments