Skip to content

(SteadyState/Nonlinear)Problems from ODEProblems ignore kwargs #204

New issue

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

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

Already on GitHub? # to your account

Closed
DanielVandH opened this issue Sep 8, 2023 · 0 comments · Fixed by SciML/SciMLBase.jl#524
Closed

Comments

@DanielVandH
Copy link
Member

When a SteadyStateProblem or a NonlinearProblem is created from an ODEProblem, the ODEProblem's keyword arguments don't get passed. For example, callbacks don't get passed:

using NonlinearSolve, SteadyStateDiffEq, OrdinaryDiffEq
f = (u, p, t) -> u - u^2 
cond = (u, t, integrator) -> true
aff = integrator -> @show integrator.t
cb = DiscreteCallback(cond, aff)
prob = ODEProblem(f, 1/2, (0.0, 1.0), callback=cb)
sprob = SteadyStateProblem(prob)
sol = solve(sprob, DynamicSS(Tsit5()))

nothing gets @shown since sprob's underlying ODEProblem didn't get any kwargs. The constructor

function SteadyStateProblem(prob::AbstractODEProblem)
    SteadyStateProblem{isinplace(prob)}(prob.f, prob.u0, prob.p)
end

needs to be (I think)

function SteadyStateProblem(prob::AbstractODEProblem)
    SteadyStateProblem{isinplace(prob)}(prob.f, prob.u0, prob.p; prob.kwargs...)
end

and similarly for NonlinearProblem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
1 participant