DiffEqBase.jl icon indicating copy to clipboard operation
DiffEqBase.jl copied to clipboard

Ensure initial tstops are unique

Open isaacsas opened this issue 2 years ago • 4 comments

As shown in https://github.com/SciML/DiffEqJump.jl/issues/239, a user might accidentally double include some tstops when using callbacks. Maybe it would make sense for DiffEqBase.initialize! to call unique! on the tstops?

isaacsas avatar Jun 19 '22 16:06 isaacsas

Or alternatively to give a useful error about double including tstops.

isaacsas avatar Jun 19 '22 16:06 isaacsas

Shouldn't these cases be handled by the algorithm that pops tstops? Even if the initial tstops are unique callbacks might add tstops that introduce non-uniqueness later during the integration process (this is done eg by the callbacks in DelayDiffEq). It seems safer to ensure that all tstops of (approximately) the same value are removed if a tstop is hit.

devmotion avatar Jun 19 '22 18:06 devmotion

Is there a use case for having non-unique initial tstops or is that always a user setup error?

isaacsas avatar Jun 19 '22 20:06 isaacsas

I'd be willing to put a warning on this. My guess is that there is no valid use case. If there is, we can create an opt-out, but I think there's a 99% chance that any time this happens it's a user setup error.

ChrisRackauckas avatar Jun 21 '22 10:06 ChrisRackauckas