Skip to content

Commit

Permalink
Update callbacks.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jan 8, 2018
1 parent df4fea8 commit 23da7db
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ function find_callback_time(integrator,callback)
end
callback.condition(integrator.tprev+Θ*integrator.dt,tmp,integrator)
end
Θ = prevfloat(prevfloat(find_zero(zero_func,(bottom_θ,top_Θ),FalsePosition(),abstol = callback.abstol/10)))
# 2 prevfloat guerentees that the new time is either 1 or 2 floating point
# numbers just before the event, but not after. If there's a barrier
# which is never supposed to be crossed, then this will ensure that
Θ = prevfloat(find_zero(zero_func,(bottom_θ,top_Θ),FalsePosition(),abstol = callback.abstol/10))
#Θ = prevfloat(...)
# prevfloat guerentees that the new time is either 1 floating point
# numbers just before the event or directly at zero, but not after.
# If there's a barrier which is never supposed to be crossed,
# then this will ensure that
# The item never leaves the domain. Otherwise Roots.jl can return
# a float which is slightly after, making it out of the domain, causing
# havoc.
Expand Down

0 comments on commit 23da7db

Please sign in to comment.