Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: use nlprob func if present #2479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading