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

added check_error to atsit5 #53

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 20 additions & 0 deletions src/tsit5/atsit5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -681,3 +681,23 @@ end
@inline function DiffEqBase.set_t!(integrator::SimpleATsit5Integrator, t::Real)
reinit!(integrator; t0 = t)
end

#######################################################################################
# chech_error
#######################################################################################

function check_error(integrator::SimpleATsit5Integrator)
# This implementation is intended to be used for SimpleDiffEq.SimpleATsit5Integrator
if isnan(integrator.dt)
@warn("NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome.")
return :DtNaN
end

if DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK(integrator.dt, integrator.u, integrator.p, integrator.t)
@warn("Instability detected. Aborting")
return :Unstable
end

return :Success
end