# 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

1
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

## 3 Answers

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.

-

– J. M. May 8 at 9:05
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 6, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8933776617050171, "perplexity_flag": "middle"}