Skip to content

Commit

Permalink
use nonlinear func if present
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith committed Sep 27, 2024
1 parent 6eabcae commit d2ecb58
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,24 @@ function build_nlsolver(
if nlalg isa NonlinearSolveAlg
α = tTypeNoUnits(α)
dt = tTypeNoUnits(dt)
if isdae
nlf = (ztmp, z, p) -> begin
tmp, ustep, γ, α, tstep, k, invγdt, _p, dt, f = p
_compute_rhs!(tmp, ztmp, ustep, γ, α, tstep, k, invγdt, _p, dt, f, z)[1]
if isnothing(f.nlfunc)
if isdae
nlf = (ztmp, z, p) -> begin
tmp, ustep, γ, α, tstep, k, invγdt, _p, dt, f = p
_compute_rhs!(tmp, ztmp, ustep, γ, α, tstep, k, invγdt, _p, dt, f, z)[1]
end
nlp_params = (tmp, ustep, γ, α, tstep, k, invγdt, p, dt, f)
else
nlf = (ztmp, z, p) -> begin
tmp, ustep, γ, α, tstep, k, invγdt, method, _p, dt, f = p
_compute_rhs!(
tmp, ztmp, ustep, γ, α, tstep, k, invγdt, method, _p, dt, f, z)[1]
end
nlp_params = (tmp, ustep, γ, α, tstep, k, invγdt, DIRK, p, dt, f)
end
nlp_params = (tmp, ustep, γ, α, tstep, k, invγdt, p, dt, f)
else
nlf = (ztmp, z, p) -> begin
tmp, ustep, γ, α, tstep, k, invγdt, method, _p, dt, f = p
_compute_rhs!(
tmp, ztmp, ustep, γ, α, tstep, k, invγdt, method, _p, dt, f, z)[1]
end
nlp_params = (tmp, ustep, γ, α, tstep, k, invγdt, DIRK, p, dt, f)
nlf = f.nlfunc
nlp_params =()
end
prob = NonlinearProblem(NonlinearFunction(nlf), ztmp, nlp_params)
cache = init(prob, nlalg.alg)
Expand Down

0 comments on commit d2ecb58

Please sign in to comment.