AU-BCE-EE / tric-fil-mod

A trickling filter model to simulate air treatment, written in Python
GNU General Public License v3.0
0 stars 0 forks source link

Select `solve_ivp` algorithm #3

Closed sashahafner closed 1 year ago

sashahafner commented 1 year ago

The default is surprisingly unstable around steady-state:

image

Details on options here https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html @afeilberg has already found that method = 'LSODA' is better. It seems it is from ODEPACK, as are the solvers in the R package deSolve, and presumably it is the same as the deSolve::lsoda() function, which we use in ABM and in general seems to work well. So maybe we should just switch to LSODA.

sashahafner commented 1 year ago

method = 'LSODA' looks like this:

image

I just happened to try method = 'DOP853' and it is terrible here:

image

sashahafner commented 1 year ago

LSODA used in 4598f714c926a6c05528674636cdbcb1565da10e