Filter löschen
Filter löschen

Does anyone understand how ode113 can throw multiple events when the isterminal flag is set in the event handler?

3 Ansichten (letzte 30 Tage)
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 Kommentare
Steven Lord
Steven Lord am 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.
Seth Trotz
Seth Trotz am 3 Jun. 2019
Repeating this response (which I think I inadvertently gave as a direct answer to my original posting instead):
My events function is rather lengthy and calls a number of other functions so I don't expect that would be very useful. I can say, at least, that my y input is about 90,000 long. (position, velocity, and mass of a large number of objects in 3D)

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Seth Trotz
Seth Trotz am 31 Mai 2019
My events function is rather lengthy and calls a number of other functions so I don't expect that would be very useful. I can say, at least, that my y input is about 90,000 long. (position, velocity, and mass of a large number of objects in 3D)

Steven Lord
Steven Lord am 3 Jun. 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 Kommentar
Nick
Nick am 16 Okt. 2023
Bearbeitet: Nick am 16 Okt. 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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by