|
447 | 447 | end
|
448 | 448 |
|
449 | 449 | # Evaluate condition slightly in future
|
450 |
| - abst = integrator.tprev+integrator.tdir*max(abs(integrator.dt/10000),100*eps(integrator.t)) |
| 450 | + abst = integrator.tprev+integrator.tdir*max(abs(integrator.dt/10000),100*eps(typeof(integrator.t))) |
451 | 451 | tmp_condition = get_condition(integrator, callback, abst)
|
452 | 452 |
|
453 | 453 | # Sometimes users may "switch off" the condition after crossing
|
|
525 | 525 | end
|
526 | 526 |
|
527 | 527 | # Evaluate condition slightly in future
|
528 |
| - abst = integrator.tprev+integrator.tdir*max(abs(integrator.dt/10000),100*eps(integrator.t)) |
| 528 | + abst = integrator.tprev+integrator.tdir*max(abs(integrator.dt/10000),100*eps(typeof(integrator.t))) |
529 | 529 | tmp_condition = get_condition(integrator, callback, abst)
|
530 | 530 |
|
531 | 531 | # Sometimes users may "switch off" the condition after crossing
|
@@ -633,7 +633,7 @@ function find_callback_time(integrator,callback::ContinuousCallback,counter)
|
633 | 633 | Θ = top_t
|
634 | 634 | else
|
635 | 635 | if integrator.event_last_time == counter &&
|
636 |
| - abs(zero_func(bottom_t)) < 100abs(integrator.last_event_error) && |
| 636 | + abs(zero_func(bottom_t)) <= 100abs(integrator.last_event_error) && |
637 | 637 | prev_sign_index == 1
|
638 | 638 |
|
639 | 639 | # Determined that there is an event by derivative
|
@@ -700,7 +700,7 @@ function find_callback_time(integrator,callback::VectorContinuousCallback,counte
|
700 | 700 | else
|
701 | 701 | if integrator.event_last_time == counter &&
|
702 | 702 | integrator.vector_event_last_time == event_idx &&
|
703 |
| - abs(zero_func(bottom_t)) < 100abs(integrator.last_event_error) && |
| 703 | + abs(zero_func(bottom_t)) <= 100abs(integrator.last_event_error) && |
704 | 704 | prev_sign_index == 1
|
705 | 705 |
|
706 | 706 | # Determined that there is an event by derivative
|
@@ -754,10 +754,11 @@ function find_callback_time(integrator,callback::VectorContinuousCallback,counte
|
754 | 754 | end
|
755 | 755 |
|
756 | 756 | function apply_callback!(integrator,callback::Union{ContinuousCallback,VectorContinuousCallback},cb_time,prev_sign,event_idx)
|
757 |
| - if cb_time == zero(typeof(integrator.t)) |
758 |
| - error("Event repeated at the same time. Please report this error") |
759 |
| - end |
| 757 | + |
760 | 758 | change_t_via_interpolation!(integrator,integrator.tprev+cb_time)
|
| 759 | + if integrator.opts.adaptive |
| 760 | + integrator.dtpropose = integrator.dt/10 |
| 761 | + end |
761 | 762 |
|
762 | 763 | # handle saveat
|
763 | 764 | _, savedexactly = savevalues!(integrator)
|
|
0 commit comments