Time stepping does not work

Hi,

I am trying to implement a microscale battery electrochemical model on a simple geometry. Model is more or less based on the one from the following paper: A Segregated Approach for Modeling the Electrochemistry in the 3-D Microstructure of Li-Ion Batteries and Its Acceleration Using Block Preconditioners | Journal of Scientific Computing

Since first few time steps seem OK (at least qualitatively), and then everything goes into inf bc of the difference between phi_s and phi_e. I suspect that my implementation of time stepping is not OK.

I’ve attached a working example if someone wants to take a look.

microscale_ec_model.py (6.5 KB)

The problem wasn’t in the timestepping, but in the boudanry conditions on the electrolyte potential: I thought that constraining current flux to be zero at three boundaries (f += 0.0 * v_phi * ds(“right|top|bottom”)) and fixing potential to zero with dirichlet b.c. at the remaining boundary (“left”) is enough. But it seems that all boundaries need to be conreined with dirichelt b.c.