How to avoid an integrator in Matlab to step out the domain of valid solutions?

64 views Asked by At

I use ode45 to solve a system of ODE's. The system describes a planar flow, for which I intend to draw trajectories. The flow covers a convex shape on a plane and theoretically never crosses its boundaries.

The problem is that the ODE system requires the evaluation of a function that has real value only inside the domain, but during the integration, ode45 tries to increase the time step in every turn so that the trajectory might exit the domain. (The function value is computed iteratively, and outside the domain, there is no solution at all, the iteration returns with an empty matrix.) In that case, the equations cannot be evaluated and the integration runs into and error. I cannot solve this problem with a termination event because the error occurs during the trial substeps. Moreover, I do not want to stop the integrator because the trajectory could be determined with smaller time steps.

Is there a suitable solution that allows me to let the integrator know that the time step is way too big and should be decreased instead of running into an error?

0

There are 0 answers