# Numerical methods for discontinuous r.s. ODEs

what are state of art methods for numerical solution of ODEs with discontinuous right side? I'm mostly interested piecewise-smooth right side functions, e.g. sign.

I'm trying to solve the equation of a following type:

\begin{align*} \dot x &= v\\ \dot v &= \begin{cases} (|F_\text{external}| - |F_\text{friction}|) \mathop{\rm sign} (F_\text{external}) & :|F_\text{external}| < |F_\text{friction}|\\ 0 & : \text{otherwise} \end{cases} \end{align*}

• Hi @AndreyShevlyakov and welcome to Scicomp! Is there a particular class of ODE that you're interested in? – Paul Sep 16 '12 at 0:42
• Hi Paul! Yes, I'm currently trying to implement a kind of stick-slip friction model. – Andrey Shevlyakov Sep 16 '12 at 19:14
• Could you incorporate the equations you want to solve in your question? This will help narrow down the particular methods applicable to your problem. – Paul Sep 16 '12 at 19:46
• I've added example to the post – Andrey Shevlyakov Sep 17 '12 at 8:12
• When I worked on ACSL, it included a root-finder, so you could make it search for the time when velocity equaled zero, and then start up fresh from that point with the new rhs. – Mike Dunlavey Sep 18 '12 at 13:43

See David Stewart's new (2011) book on this topic, Dynamics with Inequalities: Impacts and Hard Constraints. Coulomb friction problems are mentioned several times in the analysis chapters.

Chapter 8 is devoted to numerical methods for non-smooth ODEs and DAEs. It mostly advocates fully implicit Runge-Kutta methods with special treatment of nonsmoothness. Note Section 8.4.4 which points out that if you do not accurately locate the points of non-smoothness, all methods degrade to first order $\mathcal{O}(h)$ accuracy, therefore implicit Euler (with modifications for nonsmoothness) are popular in practice. Furthermore, solutions of problems with infinite dimensional inequalities are generally not piecewise smooth, therefore the theory provides only $\mathcal{O}(h^{1/2})$ convergence, though in practice, $\mathcal{O}(h)$ is often observed.

• Great, thanks! Do you know if there are implementations available somewhere? – Andrey Shevlyakov Sep 17 '12 at 16:54
• Not that I know of, but implementation of simple schemes shouldn't be too hard if you have a solver for static variational inequalities. – Jed Brown Sep 18 '12 at 4:24

The most significant reference I know of is David Stewart's thesis, which is more than 20 years old:

High Accuracy Numerical Methods for Ordinary Differential Equations with Discontinuous Right-hand Side

The abstract references several significant earlier works. A keyword here is differential inclusion.

As Mike Dunlavey already pointed out in a comment, this is often done using so-called zero-crossing functions, i.e. functions $g(t, x(t)) \in \mathbb{R}$ that cross from $>0$ to $<0$ (or vice versa) when the RHS has a discontinuity.

For example if you have a moving mass with a block then the distance between the mass and the block can be used as a zero-crossing function.

Many ODE solvers (e.g. SUNDIALS CVODE) automatically check if any of the zero-crossing functions changed its sign during the last time step. If this is the case then a root finding method is used to determine the exact location of the root. The solver can then be restarted at that particular position. This is either done automatically by the solver itself or manually by the calling code.

• For searching purposes: one can also speak of "event location"; Hairer/Nørsett/Wanner has a nice discussion of this. – J. M. May 8 '13 at 9:05