@@ -273,3 +273,184 @@ function alg_cache(alg::RadauIIA5, u, rate_prototype, ::Type{uEltypeNoUnits},
273273 tmp, atmp, jac_config, linsolve1, linsolve2, rtol, atol, dt, dt,
274274 Convergence, alg. step_limiter!)
275275end
276+
277+ mutable struct RadauIIA7ConstantCache{F, Tab, Tol, Dt, U, JType} < :
278+ OrdinaryDiffEqConstantCache
279+ uf:: F
280+ tab:: Tab
281+ κ:: Tol
282+ ηold:: Tol
283+ iter:: Int
284+ cont1:: U
285+ cont2:: U
286+ cont3:: U
287+ dtprev:: Dt
288+ W_γdt:: Dt
289+ status:: NLStatus
290+ J:: JType
291+ end
292+
293+ function alg_cache (alg:: RadauIIA7 , u, rate_prototype, :: Type{uEltypeNoUnits} ,
294+ :: Type{uBottomEltypeNoUnits} ,
295+ :: Type{tTypeNoUnits} , uprev, uprev2, f, t, dt, reltol, p, calck,
296+ :: Val{false} ) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
297+ uf = UDerivativeWrapper (f, t, p)
298+ uToltype = constvalue (uBottomEltypeNoUnits)
299+ tab = RadauIIA7Tableau (uToltype, constvalue (tTypeNoUnits))
300+
301+ κ = convert (uToltype, 1 // 100 )
302+ J = false .* _vec (rate_prototype) .* _vec (rate_prototype)'
303+
304+ RadauIIA7ConstantCache (uf, tab, κ, one (uToltype), 10000 , u, u, u, dt, dt,
305+ Convergence, J)
306+ end
307+
308+ mutable struct RadauIIA7Cache{uType, cuType, uNoUnitsType, rateType, JType, W1Type, W2Type,
309+ UF, JC, F1, F2, Tab, Tol, Dt, rTol, aTol} < :
310+ OrdinaryDiffEqMutableCache
311+ u:: uType
312+ uprev:: uType
313+ z1:: uType
314+ z2:: uType
315+ z3:: uType
316+ z4:: uType
317+ z5:: uType
318+ w1:: uType
319+ w2:: uType
320+ w3:: uType
321+ w4:: uType
322+ w5:: uType
323+ dw1:: uType
324+ ubuff:: uType
325+ dw23:: cuType
326+ dw45:: cuType
327+ cubuff:: cuType
328+ cont1:: uType
329+ cont2:: uType
330+ cont3:: uType
331+ cont4:: uType
332+ du1:: rateType # why is this here?
333+ fsalfirst:: rateType
334+ k:: rateType
335+ k2:: rateType
336+ k3:: rateType
337+ k4:: rateType
338+ k5:: rateType
339+ fw1:: rateType
340+ fw2:: rateType
341+ fw3:: rateType
342+ fw4:: rateType
343+ fw5:: rateType
344+ J:: JType
345+ W1:: W1Type
346+ W2:: W2Type # complex
347+ W3:: W3Type # CHECK THIS TYPE
348+ uf:: UF
349+ tab:: Tab
350+ κ:: Tol
351+ ηold:: Tol
352+ iter:: Int
353+ tmp:: uType
354+ atmp:: uNoUnitsType
355+ jac_config:: JC
356+ linsolve1:: F1
357+ linsolve2:: F2
358+ linsolve3:: F2 # CHECK THIS TYPE
359+ rtol:: rTol
360+ atol:: aTol
361+ dtprev:: Dt
362+ W_γdt:: Dt
363+ status:: NLStatus
364+ end
365+ TruncatedStacktraces. @truncate_stacktrace RadauIIA7Cache 1
366+
367+ function alg_cache (alg:: RadauIIA7 , u, rate_prototype, :: Type{uEltypeNoUnits} ,
368+ :: Type{uBottomEltypeNoUnits} ,
369+ :: Type{tTypeNoUnits} , uprev, uprev2, f, t, dt, reltol, p, calck,
370+ :: Val{true} ) where {uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits}
371+ uf = UJacobianWrapper (f, t, p)
372+ uToltype = constvalue (uBottomEltypeNoUnits)
373+ tab = RadauIIA7Tableau (uToltype, constvalue (tTypeNoUnits))
374+
375+ κ = alg. κ != = nothing ? convert (uToltype, alg. κ) : convert (uToltype, 1 // 100 )
376+
377+ z1 = zero (u)
378+ z2 = zero (u)
379+ z3 = zero (u)
380+ z4 = zero (u)
381+ z5 = zero (u)
382+ w1 = zero (u)
383+ w2 = zero (u)
384+ w3 = zero (u)
385+ w4 = zero (u)
386+ w5 = zero (u)
387+ dw1 = zero (u)
388+ ubuff = zero (u)
389+ dw23 = similar (u, Complex{eltype (u)})
390+ dw45 = similar (u, Complex{eltype (u)})
391+ recursivefill! (dw23, false )
392+ recursivefill! (dw45, false )
393+ cubuff = similar (u, Complex{eltype (u)})
394+ recursivefill! (cubuff, false )
395+ cont1 = zero (u)
396+ cont2 = zero (u)
397+ cont3 = zero (u)
398+ cont4 = zero (u)
399+
400+ fsalfirst = zero (rate_prototype)
401+ k = zero (rate_prototype)
402+ k2 = zero (rate_prototype)
403+ k3 = zero (rate_prototype)
404+ k4 = zero (rate_prototype)
405+ k5 = zero (rate_prototype)
406+ fw1 = zero (rate_prototype)
407+ fw2 = zero (rate_prototype)
408+ fw3 = zero (rate_prototype)
409+ fw4 = zero (rate_prototype)
410+ fw5 = zero (rate_prototype)
411+
412+ J, W1 = build_J_W (alg, u, uprev, p, t, dt, f, uEltypeNoUnits, Val (true ))
413+ if J isa AbstractSciMLOperator
414+ error (" Non-concrete Jacobian not yet supported by RadauIIA5." )
415+ end
416+ W2 = similar (J, Complex{eltype (W1)})
417+ W3 = similar (J, Complex{eltype (W1)})
418+ recursivefill! (W2, false )
419+ recursivefill! (W3, false )
420+
421+ du1 = zero (rate_prototype)
422+
423+ tmp = zero (u)
424+ atmp = similar (u, uEltypeNoUnits)
425+ recursivefill! (atmp, false )
426+ jac_config = build_jac_config (alg, f, uf, du1, uprev, u, tmp, dw1)
427+
428+ linprob = LinearProblem (W1, _vec (ubuff); u0 = _vec (dw1))
429+ linsolve1 = init (linprob, alg. linsolve, alias_A = true , alias_b = true ,
430+ assumptions = LinearSolve. OperatorAssumptions (true ))
431+ # Pl = LinearSolve.InvPreconditioner(Diagonal(_vec(weight))),
432+ # Pr = Diagonal(_vec(weight)))
433+ linprob = LinearProblem (W2, _vec (cubuff); u0 = _vec (dw23))
434+ linsolve2 = init (linprob, alg. linsolve, alias_A = true , alias_b = true ,
435+ assumptions = LinearSolve. OperatorAssumptions (true ))
436+ # Pl = LinearSolve.InvPreconditioner(Diagonal(_vec(weight))),
437+ # Pr = Diagonal(_vec(weight)))
438+ linprob = LinearProblem (W3, _vec (cubuff); u0 = _vec (dw45))
439+ linsolve3 = init (linprob, alg. linsolve, alias_A = true , alias_b = true ,
440+ assumptions = LinearSolve. OperatorAssumptions (true ))
441+ # Pl = LinearSolve.InvPreconditioner(Diagonal(_vec(weight))),
442+ # Pr = Diagonal(_vec(weight)))
443+
444+
445+ rtol = reltol isa Number ? reltol : zero (reltol)
446+ atol = reltol isa Number ? reltol : zero (reltol)
447+
448+ RadauIIA7Cache (u, uprev,
449+ z1, z2, z3, z4, z5, w1, w2, w3, w4, w5,
450+ dw1, ubuff, dw23, dw45, cubuff, cont1, cont2, cont3, cont4,
451+ du1, fsalfirst, k, k2, k3, k4, k5, fw1, fw2, fw3, fw4, fw5,
452+ J, W1, W2, W3,
453+ uf, tab, κ, one (uToltype), 10000 ,
454+ tmp, atmp, jac_config, linsolve1, linsolve2, linsolve3, rtol, atol, dt, dt,
455+ Convergence)
456+
0 commit comments