Does anyone understand how ode113 can throw multiple events when the isterminal flag is set in the event handler?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I am using the ode113 solver with the event handler function option. My difficulty is that I am finding for some inputs that two separate events are returned (in te, ye...) rather than a single event. This is happening despite the fact that the event handler function returns isterminal=1 for all inputs. This should cause the ode113 integration to stop and return the first of the two events. What happens subsequently is that my code crashes because it assumes only one event should ever be provided to it. The decision to not set the "stop" flag to 1 occurs down in odezero. My suspicion is some sort of numerical tolerance issue with the proximity of the first of the two events to the beginning of the integration interval but I am not sure. It just logically does not seem to make sense that a terminal-only event handler could yield 2 events if things are working they way they should.
I have not yet tried to create a cartoon level version of this case that would be easy to share but I may do so if needed.
Thoughts?
Thanks in advance for any insight.
2 commentaires
Steven Lord
le 31 Mai 2019
Please show your events function and state how many ODEs you have (the size of the y input) if it's not obvious but has an impact on the size of the outputs from your events function.
Réponses (2)
Steven Lord
le 3 Juin 2019
Not being able to see any of the code is going to make this difficult if not impossible to answer. As a guess, does your events function return a vector of events or a scalar? If a vector, does the events function detect two terminal events in the same call (and do those events occur at the same time?)
1 commentaire
Nick
le 16 Oct 2023
Modifié(e) : Nick
le 16 Oct 2023
I also experience this, but it is seemingly random and I don't have a reliable way to reproduce it. It happens when either one or multiple events are being detected. When it is multiple events, the event times are not the same. The way I am using event detection is stopping integration, changing a parameter, and then restarting integration from that point with the new parameter. Therefore the one common denominator is that it always happens when integration is started at an event point. However, sometimes it redetects the event point and then keeps integrating until the next event returning two events, or it works normally and doesn't redetect the inital event point and continues integrating.
Has this been addressed any lately? If not I can try to reliably reproduce it with simple code
Edit: I just found this line in the documentation after looking at another post, "If a terminal event occurs during the first step of the integration, then the solver registers the event as nonterminal and continues integrating." This must be what I am experiencing
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!