Skip to content

Commit dc5f05f

Browse files
committed
Try using fancier initial guess for implicit solver
1 parent f1bb4e1 commit dc5f05f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/solvers/ark_algorithm.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ function init_cache(prob::DiffEqBase.AbstractODEProblem, alg::ARKAlgorithm; kwar
274274
ΔU_imp_nz = dense_tuple(ΔU_imp_nz_sparse, s + 1, nothing),
275275
u_on_stage = similar(u0),
276276
u_plus_Δu_lim = similar(u0),
277+
T_imp_estimate = similar(u0),
277278
)
278279

279280
newtons_method_cache = if !iszero(Γ) && !isnothing(T_imp!)
@@ -315,6 +316,7 @@ function step_u!(integrator, cache::ARKAlgorithmCache)
315316
ΔU_imp_nz,
316317
u_on_stage,
317318
u_plus_Δu_lim,
319+
T_imp_estimate,
318320
) = cache.timestepper_cache
319321

320322
Δt = integrator.dt
@@ -382,8 +384,11 @@ function step_u!(integrator, cache::ARKAlgorithmCache)
382384
# Compute the state on the current stage. Apply post_stage! if it is
383385
# different from the previous state.
384386
if !isnothing(T_imp!) && !iszero(Δtγ)
387+
@. u_on_stage = u_minus_Δu_imp_from_solve
388+
# T_imp!(T_imp_estimate, u_on_stage, p, t_imp)
389+
# @. u_on_stage += Δtγ * T_imp_estimate
390+
385391
# Solve u′ ≈ u_minus_Δu_imp_from_solve + Δtγ * T_imp(u′, p, t_imp).
386-
@. u_on_stage = u # TODO: Is this a good idea?
387392
solve_newton!(
388393
newtons_method,
389394
newtons_method_cache,

0 commit comments

Comments
 (0)