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*}

  • $\begingroup$ Hi @AndreyShevlyakov and welcome to Scicomp! Is there a particular class of ODE that you're interested in? $\endgroup$
    – Paul
    Sep 16, 2012 at 0:42
  • $\begingroup$ Hi Paul! Yes, I'm currently trying to implement a kind of stick-slip friction model. $\endgroup$ Sep 16, 2012 at 19:14
  • $\begingroup$ Could you incorporate the equations you want to solve in your question? This will help narrow down the particular methods applicable to your problem. $\endgroup$
    – Paul
    Sep 16, 2012 at 19:46
  • $\begingroup$ I've added example to the post $\endgroup$ Sep 17, 2012 at 8:12
  • 1
    $\begingroup$ 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. $\endgroup$ Sep 18, 2012 at 13:43

3 Answers 3


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.

  • $\begingroup$ Great, thanks! Do you know if there are implementations available somewhere? $\endgroup$ Sep 17, 2012 at 16:54
  • $\begingroup$ Not that I know of, but implementation of simple schemes shouldn't be too hard if you have a solver for static variational inequalities. $\endgroup$
    – Jed Brown
    Sep 18, 2012 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.