@@ -86,8 +86,8 @@ function CoupledODEs(f, u0, p = SciMLBase.NullParameters(); t0 = 0, diffeq = DEF
8686 prob = ODEProblem {IIP} (f, s, (T (t0), T (Inf )), p)
8787 return CoupledODEs (prob, diffeq)
8888end
89- # This preserves the referrenced MTK system
90- CoupledODEs (ds:: CoupledODEs , diffeq) = CoupledODEs (ODEProblem (ds), diffeq)
89+ # This preserves the referrenced MTK system and the originally passed diffeq kwargs
90+ CoupledODEs (ds:: CoupledODEs , diffeq) = CoupledODEs (ODEProblem (ds), merge (ds . diffeq, diffeq) )
9191# Below `special_kwargs` is undocumented internal option for passing `internalnorm`
9292function CoupledODEs (prob:: ODEProblem , diffeq = DEFAULT_DIFFEQ; special_kwargs... )
9393 if haskey (special_kwargs, :diffeq )
@@ -159,8 +159,17 @@ current_state(integ::DEIntegrator) = integ.u
159159current_time (integ:: DEIntegrator ) = integ. t
160160initial_time (integ:: DEIntegrator ) = integ. sol. prob. tspan[1 ]
161161
162- using SciMLBase: successful_retcode, check_error
163- successful_step (integ:: DEIntegrator ) = successful_retcode (check_error (integ))
162+ # For checking successful step, the `SciMLBase.step!` function checks
163+ # `integ.sol.retcode in (ReturnCode.Default, ReturnCode.Success) || break`.
164+ # But the actual API call would be `successful_retcode(check_error(integ))`.
165+ # The latter however is already used in `step!(integ)` so there is no reason to re-do it.
166+ # Besides, within DynamicalSystems.jl the integration is never expected to terminate.
167+ # Nevertheless here we extend explicitly only for ODE stuff because it may be that for
168+ # other type of DEIntegrators a different step interruption is possible.
169+ function successful_step (integ:: SciMLBase.AbstractODEIntegrator )
170+ rcode = integ. sol. retcode
171+ return rcode == SciMLBase. ReturnCode. Default || rcode == SciMLBase. ReturnCode. Success
172+ end
164173
165174function set_state! (integ:: DEIntegrator , u)
166175 if integ. u isa Array{<: Real }
0 commit comments