@@ -14,6 +14,10 @@ isnewton(nlsolver::AbstractNLSolver) = isnewton(nlsolver.cache)
1414isnewton (:: AbstractNLSolverCache ) = false
1515isnewton (:: Union{NLNewtonCache, NLNewtonConstantCache} ) = true
1616
17+ isnonlinearsolve (nlsolver:: AbstractNLSolver ) = isnonlinearsolve (nlsolver. cache)
18+ isnonlinearsolve (:: AbstractNLSolverCache ) = false
19+ isnonlinearsolve (:: NonlinearSolveCache ) = true
20+
1721is_always_new (nlsolver:: AbstractNLSolver ) = is_always_new (nlsolver. alg)
1822check_div (nlsolver:: AbstractNLSolver ) = check_div (nlsolver. alg)
1923check_div (alg) = isdefined (alg, :check_div ) ? alg. check_div : true
@@ -32,9 +36,9 @@ getnfails(_) = 0
3236getnfails (nlsolver:: AbstractNLSolver ) = nlsolver. nfails
3337
3438set_new_W! (nlsolver:: AbstractNLSolver , val:: Bool ):: Bool = set_new_W! (nlsolver. cache, val)
35- set_new_W! (nlcache:: Union{NLNewtonCache, NLNewtonConstantCache} , val:: Bool ):: Bool = nlcache. new_W = val
39+ set_new_W! (nlcache:: Union{NLNewtonCache, NLNewtonConstantCache, NonlinearSolveCache } , val:: Bool ):: Bool = nlcache. new_W = val
3640get_new_W! (nlsolver:: AbstractNLSolver ):: Bool = get_new_W! (nlsolver. cache)
37- get_new_W! (nlcache:: Union{NLNewtonCache, NLNewtonConstantCache} ):: Bool = nlcache. new_W
41+ get_new_W! (nlcache:: Union{NLNewtonCache, NLNewtonConstantCache, NonlinearSolveCache } ):: Bool = nlcache. new_W
3842get_new_W! (:: AbstractNLSolverCache ):: Bool = true
3943
4044get_W (nlsolver:: AbstractNLSolver ) = get_W (nlsolver. cache)
@@ -239,7 +243,7 @@ function build_nlsolver(
239243 NonlinearProblem (NonlinearFunction {true} (nlf), ztmp, nlp_params)
240244 end
241245 cache = init (prob, nlalg. alg)
242- nlcache = NonlinearSolveCache (ustep, tstep, k, atmp, invγdt, prob, cache)
246+ nlcache = NonlinearSolveCache (ustep, tstep, k, atmp, invγdt, prob, cache, true )
243247 else
244248 nlcache = NLNewtonCache (ustep, tstep, k, atmp, dz, J, W, true ,
245249 true , true , tType (dt), du1, uf, jac_config,
@@ -327,7 +331,7 @@ function build_nlsolver(
327331 prob = NonlinearProblem (NonlinearFunction {false} (nlf), copy (ztmp), nlp_params)
328332 cache = init (prob, nlalg. alg)
329333 nlcache = NonlinearSolveCache (
330- nothing , tstep, nothing , nothing , invγdt, prob, cache)
334+ nothing , tstep, nothing , nothing , invγdt, prob, cache, true )
331335 else
332336 nlcache = NLNewtonConstantCache (tstep, J, W, true , true , true , tType (dt), uf,
333337 invγdt, tType (nlalg. new_W_dt_cutoff), t)
0 commit comments