Dear all,
A recent task that I had to perform involved rewriting a large number of
scripts and files from MATLAB to Python. In the process I noticed that
Scipy lacks a PDE solver. When I tried to find alternatives, the options
found were all unusable for various reasons.
I wrote a solver which solves slab symmetric problems with a similar PDE
form to that which MATLAB’s pdepe solves, namely c(x,u,t,du/dx)(du/dt) =
(d/dx)(f(x,u,t,du/dx) + s(x,u,t,du/dx) using the method of lines approach,
finite differences, and the BDF method provided by solve_ivp.
I was wondering whether there would be some interest in adding the solver
under scipy.integrate, to begin building a part of a collection. I feel
that for very simple problems such as the ones that my solver can solve,
users shouldn’t need to turn to overly complex packages.
If there is interest, I would need to clean up the code and add tests and
stability checks to it, help/advice would be appreciated. I believe BDF
already has stability in the time grid, so I would only need to check
stability in space grid? Can someone confirm? I’d also like to move a large
chunk of the code to Cython since I wrote it in native Python and used
Numba to speed it up, which still makes it rather slow. I’ve worked in C
and Python before but never in Cython, could someone provide me with a link
to get started?
As far as legal issues go, there should be no concern – I explicitly
avoided looking at and using the MATLAB source code as a reference since I
wanted to leave publishing the solver under Scipy an option. I did use
their solver to check some of the solutions that my solver produced though.
The solver was written while working for the ETH Zurich, where my
supervisor responded very enthusiastically to the possibility of providing
the solver to the public under Scipy, so there should be no issues there
either.
All the best,
Nicolas