Skip to content

Commit

Permalink
fix callback algorithm and event at dt
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Aug 14, 2018
1 parent d23e13e commit 51086e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,13 @@ function find_callback_time(integrator,callback)
end
callback.condition(tmp,integrator.tprev+Θ*integrator.dt,integrator)
end
Θ = prevfloat(find_zero(zero_func,(bottom_θ,top_Θ),FalsePosition(),abstol = callback.abstol/10))

if zero_func(top_Θ) == 0
Θ = top_Θ
else
Θ = prevfloat(find_zero(zero_func,(bottom_θ,top_Θ),Roots.AlefeldPotraShi(),atol = callback.abstol/10))
end

#Θ = prevfloat(...)
# prevfloat guerentees that the new time is either 1 floating point
# numbers just before the event or directly at zero, but not after.
Expand Down

0 comments on commit 51086e2

Please sign in to comment.