Skip to content

Commit

Permalink
setup autodiff on SciMLNLsolve
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Dec 28, 2022
1 parent 7d26a5e commit 3e9d58a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/initialize_dae.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ BrownFullBasicInit(abstol) = BrownFullBasicInit(; abstol = abstol, nlsolve = not
using SciMLNLSolve
default_nlsolve(alg, isinplace, u, autodiff = false) = alg
function default_nlsolve(::Nothing, isinplace, u, autodiff = false)
NLSolveJL()
NLSolveJL(autodiff = autodiff ? :forward : :central)
end
function default_nlsolve(::Nothing, isinplace::Val{false}, u::StaticArray, autodiff = false)
SimpleNewtonRaphson(autodiff = autodiff)
Expand Down Expand Up @@ -380,7 +380,7 @@ function _initialize_dae!(integrator, prob::ODEProblem,
nlsolve = default_nlsolve(alg.nlsolve, isinplace, u, isad)

nlfunc = NonlinearFunction(nlequation!; jac_prototype = J)
nlprob = NonlinearProblem(nlfunc, u[algebraic_vars], p)
nlprob = NonlinearProblem(nlfunc, alg_u, p)
r = solve(nlprob, nlsolve; abstol = alg.abstol, reltol = integrator.opts.reltol)

alg_u .= r
Expand Down

0 comments on commit 3e9d58a

Please sign in to comment.