An interactive online version of this notebook is available, which can be accessed via Open this notebook in Google Colab

Alternatively, you may download this notebook and run it offline.


You are viewing this notebook on the latest version of the documentation, where these notebooks may not be compatible with the stable release of PyBaMM since they can contain features that are not yet released. We recommend viewing these notebooks from the stable version of the documentation. To install the latest version of PyBaMM that is compatible with the latest notebooks, build PyBaMM from source.

Single Particle Model with Electrolyte (SPMe)#

Model Equations#

  1. The SPMe comprises an equation for the lithium concentration in a representative particle in the negative electrode \(c_{\text{s,n}}\), an equation for the lithium concentration in a representative particle in the positive electrode \(c_{\text{s,p}}\), and an equation which governs the behaviour of the first-order correction to the lithium concentration in the electrolyte \(c_{\text{e,k}}\). Here we use a roman subscript \(\text{k} \in \text{n, s, p}\) is used to denote the regions negative electrode, separator, and positive electrode, respectively.

  2. At the centre of each particle the standard no-flux condition is imposed, and the flux on the surface of the particle is simply the current \(I\) divided by the thickness of the electrode \(L_{\text{k}}\), as in the SPM. Since lithium is transferred between the electrolyte and particles, the flux through the particle surface also enters the electrolyte diffusion equation as a source/sink term. There is no transfer of lithium between the electrolyte and current collectors, which leads to no flux boundary conditions on the lithium concentration in the electrolyte \(c_{\text{e,k}}\) at either end of the cell.

  3. We must also impose initial conditions which correspond to setting an initial concentration in each particle \(c_{\text{s,k}}(t=0) = c_{\text{s,k,0}}\), and to having no deviation from the initial (uniform) lithium concentration in the electrolyte \(c_{\text{e,k}}(t=0) = c_{\text{e,0}}\).

The model equations for the SPMe read:


\[\begin{split}\frac{\partial c_{\text{s,k}}}{\partial t} = -\frac{1}{r_{\text{k}}^2} \frac{\partial}{\partial r_{\text{k}}} \left(r_{\text{k}}^2 N_{\text{s,k}}\right), \\ N_{\text{s,k}} = -D_{\text{s,k}}(c_{\text{s,k}}) \frac{\partial c_{\text{s,k}}}{\partial r_{\text{k}}}, \quad \text{k} \in \text{n, p},\end{split}\]
\[\begin{split}N_{\text{s,k}}\big|_{r_{\text{k}}=0} = 0, \quad \text{k} \in \text{n, p}, \quad \ \ N_{\text{s,k}}\big|_{r_{\text{k}}=R_{\text{k}}} = \begin{cases} \frac{I}{Fa_{\text{n}}L_{\text{n}}}, \quad &\text{k}=\text{n}, \\ -\frac{I}{Fa_{\text{p}}L_{\text{p}}}, \quad &\text{k}=\text{p}, \end{cases} \\\end{split}\]

where \(D_{\text{s,k}}\) is the diffusion coefficient in the solid, \(N_{\text{s,k}}\) denotes the flux of lithium ions in the solid particle within the region \(\text{k}\), and \(r_{\text{k}} \in[0,R_{\text{k}}]\) is the radial coordinate of the particle in electrode \(\text{k}\). All other relevant parameters are given in the table at the end of this notebook.


\[\begin{split}\epsilon_{\text{k}} \frac{\partial c_{\text{e,k}}}{\partial t} = -\frac{\partial N_{\text{e,k}}}{\partial x} + \begin{cases} \frac{I}{FL_{\text{n}}}, \quad &\text{k}=\text{n}, \\ 0, \quad \\\text{k}=\text{s}, \\ -\frac{I}{FL_{\text{p}}}, \quad &\text{k}=\text{p}, \end{cases} \\ N_{\text{e,k}} = -\epsilon_{\text{k}}^{\text{b}} D_{\text{e}} \frac{\partial c_{\text{e,k}}}{\partial x} + \begin{cases} \frac{x t^+IRT}{F L_{\text{n}}}, \quad &\text{k}=\text{n} \\ \frac{t^+IRT}{F}, \quad &\text{k}=\text{s} \\ \frac{(1-x)t^+ IRT}{F L_{\text{p}}}, \quad &\text{k}=\text{p} \end{cases}\end{split}\]
\[\begin{split}N_{\text{e,n}}\big|_{x=0} = 0, \quad N_{\text{e,p}}\big|_{x=L}=0, \\ c_{\text{e,k}}(x,0) = 0, \quad \text{k} \in \text{n, s, p},\end{split}\]

where \(D_{\text{e}}\) is the diffusion coefficient in the solid, \(N_{\text{e,k}}\) denotes the flux of lithium ions in the electrolyte within the region \(\text{k}\), and \(x\in[0,L]\) is the macroscopic through-cell distance. This equation is also solved subject to continuity of concentration and flux at the electrode/separator interfaces.

Voltage Expression#

The voltage is obtained from the expression:

\[V = U_{\text{eq}} + \eta_r + \eta_c + \Delta\Phi_{\text{Elec}} + \Delta\Phi_{\text{Solid}}\]


\[\begin{split}U_{\text{eq}} = U_{\text{p}}(c_{\text{p}})\big|_{r_{\text{p}}=1} - U_{\text{n}}(c_{\text{n}})\big|_{r_{\text{n}}=1}, \\ \eta_{r} = -2\sinh^{-1}\left(\frac{I}{\bar{j}_{\text{0,p}} L_{\text{p}}}\right) - 2\sinh^{-1}\left(\frac{I}{\bar{j}_{\text{0,n}} L_{\text{n}}}\right), \\ \eta_c = 2 (1-t^+)\frac{RT}{F}\left(\bar{c}_{\text{e,p}} - \bar{c}_{\text{e,n}}\right), \\ \bar{j}_{\text{0,n}} = \frac{1}{L_{\text{n}}}\int_0^{L_{\text{n}}} \frac{\gamma_{\text{n}}}{\mathcal{C}_{\text{r,n}}} (c_{\text{n}})^{1/2}(1-c_{\text{n}})^{1/2} (1+\mathcal{C}_{\text{e}} c_{\text{e,n}})^{1/2} \, \text{d}x,\\ \bar{j}_{\text{0,p}} = \frac{1}{L_{\text{p}}}\int_{1-L_{\text{p}}}^1 \frac{\gamma_{\text{p}}}{\mathcal{C}_{\text{r,p}}} (c_{\text{p}})^{1/2}(1-c_{\text{p}})^{1/2} (1+\mathcal{C}_{\text{e}} c_{\text{e,p}})^{1/2} \, \text{d}x,\\ \Delta \Phi_{\text{Elec}} = -\frac{\mathcal{C}_{\text{e}}I}{\gamma_{\text{e}} \kappa_{\text{e}}(1)} \left(\frac{L_{\text{n}}}{3\epsilon_{\text{n}}^{\text{b}}} + \frac{L_{\text{s}}}{\epsilon_{\text{s}}^{\text{b}}} + \frac{L_{\text{p}}}{3\epsilon_{\text{p}}^{\text{b}}} \right), \\ \Delta \Phi_{\text{Solid}} = -\frac{I}{3}\left(\frac{L_{\text{p}}}{\sigma_{\text{p}}} + \frac{L_{\text{n}}}{\sigma_{\text{n}}} \right),\end{split}\]


\[\bar{c}_{\text{e,n}} = \frac{1}{L_{\text{n}}}\int_0^{L_{\text{n}}} c_{\text{e,n}} \, \text{d}x, \quad \bar{c}_{\text{e,p}} = \frac{1}{L_{\text{p}}}\int_{L-L_{\text{p}}}^{L} c_{\text{e,p}} \, \text{d}x.\]

More details can be found in [3].

Example solving SPMe using PyBaMM#

Below we show how to solve the SPMe model using the Simulation class with all the default settings. For a more detailed example, see the notebook on the SPM.

First we need to import pybamm

%pip install "pybamm[plot,cite]" -q    # install PyBaMM if it is not installed
import pybamm
Note: you may need to restart the kernel to use updated packages.

We then load the SPMe model and create a simulation

# load model
model = pybamm.lithium_ion.SPMe()

# create simulation
simulation = pybamm.Simulation(model)

The simulation is now ready to be solved

# solve simulation
simulation.solve([0, 3600])  # time interval in seconds
<pybamm.solvers.solution.Solution at 0x7f2774bea390>

To get a quick overview of the model outputs we can use the built-in plot method of the simulation



The relevant papers for this notebook are:

[1] Joel A. E. Andersson, Joris Gillis, Greg Horn, James B. Rawlings, and Moritz Diehl. CasADi – A software framework for nonlinear optimization and optimal control. Mathematical Programming Computation, 11(1):1–36, 2019. doi:10.1007/s12532-018-0139-4.
[2] Charles R. Harris, K. Jarrod Millman, Stéfan J. van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, and others. Array programming with NumPy. Nature, 585(7825):357–362, 2020. doi:10.1038/s41586-020-2649-2.
[3] Scott G. Marquis, Valentin Sulzer, Robert Timms, Colin P. Please, and S. Jon Chapman. An asymptotic derivation of a single particle model with electrolyte. Journal of The Electrochemical Society, 166(15):A3693–A3706, 2019. doi:10.1149/2.0341915jes.
[4] Valentin Sulzer, Scott G. Marquis, Robert Timms, Martin Robinson, and S. Jon Chapman. Python Battery Mathematical Modelling (PyBaMM). ECSarXiv. February, 2020. doi:10.1149/osf.io/67ckj.