patrick-kidger / patrick-kidger/diffrax

Support for modified Semi-implicit euler solver

Open
#269 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
2.1k
Forks
189
Avg merge
3d 18h
Merged PRs (30d)
1

Description

Hello! I'm trying to include diffrax to my wave simulation library as @patrick-kidger kindly suggested a while ago (and by the way, thanks a lot for this and lineax!) as I really would like to use the advanced checkpointing features 😄

However, my library also features a pseudo-spectral solver that requires a slight modification of the semi-implicit euler solver, where the discrete update equations also feature an extra $\alpha$ factor, that is:

$$
\begin{cases}
u_{n+1} = \alpha(\alpha u_n + \Delta t f(v_n)) \
v_{n+1} = \alpha(\alpha v_n + \Delta t g(u_{n+1}))
\end{cases}
$$

For the interested reader, this kind of integrator appears in equation 2.27 of this manual, and it uses the $\alpha$ term to correct the time-stepping error when absorption is added.

I don't think there's a way to do this with the current SemiImplicitEuler solver, so I wrote the modified version here: https://github.com/astanziola/diffrax/blob/semi-implicit-corrected/diffrax/solver/semi_implicit_euler_corrected.py

I'm very happy to make a PR, but before writing proper tests etc. I wanted to check first if this is really something that can't be done with the current solvers, and most importantly if it is of interest to add such a solver to the library.

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the proposed diffrax/solver/semi_implicit_euler_corrected.py branch file with the existing SemiImplicitEuler solver and its tests. Confirm whether the extra alpha factor requires a distinct public solver and identify the relevant solver test entry points. Done means maintainers agree on the API and the solver has proper tests for the stated update equations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.