Runge Kutta Methods and Discontinuities

integrationnumerical methodsordinary differential equationsrunge-kutta-methods

Given a second order ODE
\begin{equation*}
\ddot x(t) = \begin{cases}
a_1 \text{ for } [t_k, t_{k+1})
\\
a_2 \text{ for } [t_{k+1}, t_{k+2}]
\end{cases}
\end{equation*}

Thus, there is a discontinuity at $t_{k+1}$. Integrating the first interval using a Dormand and Prince 4(3) integrator, the ODE is evaluated at $t_k$, $t_{k+1/2}$ and $t_{k+1}$, thus using both accelerations $a_1$ and $a_2$, which I suspect to be wrong.

What is the usual way to deal with discontinuities? Provide two overlapping ODEs like:
\begin{equation*}
\ddot x(t) = \begin{cases}
a_1 \text{ for } [t_k, t_{k+1}]
\\
a_2 \text{ for } [t_{k+1}, t_{k+2}]
\end{cases}
\end{equation*}

and integrating $t_k$, $t_{k+1/2}$ and $t_{k+1}$ with $a_1$ and afterwards $t_{k+1}$, $t_{k+3/2}$ and $t_{k+2}$ with $a_2$?

This would cause the ODE to provide different values, when evaluating it at $t_{k+1}$, depending on if the left or the right side of the discontinuity is of interest. This would cause me to implement some overhead in my solver which I would like to avoid. Is there another way to handle it?

I searched a while for a solution but couldn't find anything that adresses my problem. Maybe I am missing something obvious

Best Answer

Yes, that is usually the best way to proceed. If you have a multi-phase model with different smooth ODE functions on parts of the domain, then it is best to integrate using these smooth functions and use an event mechanism to stop at phase boundaries. Or use some continuous "cross-fading bridge" to cross a somewhat thickened phase boundary.

Take care that if the vector fields at both sides of the phase boundary point towards the boundary, then any solution in a conventional sense stops there. In some extended sense you can have the solution enter a "sliding mode". This again would happen automatically with a continuous bridge across the boundary.

Related Question