Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable-step integrators (adaptive time step) #115

Merged
merged 8 commits into from
Mar 22, 2024

Conversation

diegoferigo
Copy link
Member

@diegoferigo diegoferigo commented Mar 21, 2024

This PR:

  • Introduces new variable-step integrator based on Embedded Runge-Kutta schemes (Section II.4 of Hairer93 1).
  • These integrators are a particular implementation of the Explicit Runge-Kutta schemes introduced in #88. Given the support of any explicit Butcher tableau, embedded schemes can be built from an ExplicitRungeKutta class just by passing a multi-row $\mathbf{b}^\top$ matrix, that was already supported.
  • The new EmbeddedRungeKutta class just calls the underlying explicit scheme in a while loop implementing a logic that either accepts or rejects an integration step based on an estimation of the integration error computed from two different outputs (corresponding to the $\mathbf{b}^\top$ rows) and corresponding to different integration orders (in other words, corresponding to a different number of terms considered in the Taylor expansion).
  • Contrarily to #72, the new variable-step integrators now support dynamic states modelled as generic pytrees as opposed to just flat arrays.
  • Note that contrarily to the fixed-step integrators, these variable step integrators use jax.lax.while_loop. As a consequence, these integrators are not reverse-mode differentiable.

📚 Documentation preview 📚: https://jaxsim--115.org.readthedocs.build//115/

Footnotes

  1. Hairer, Norsett, Wanner, Solving Ordinary Differential Equations I - Nonstiff Problems, 1993.

@diegoferigo
Copy link
Member Author

cc @S-Dafarra

@diegoferigo diegoferigo marked this pull request as ready for review March 22, 2024 12:01
@diegoferigo
Copy link
Member Author

I still need to port the logic to export the data of the actual variable steps, quite useful to debug these integrators. Since I want to move forward faster and this PR is not merging in main, I will add it in another PR.

@flferretti you can review the changes in #108.

@diegoferigo diegoferigo merged commit a5be7b4 into functional Mar 22, 2024
21 checks passed
@diegoferigo diegoferigo deleted the variable_step_integrators branch March 22, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant