# Single Particle Model with Electrolyte (SPMe)

## Dimensionless Model Equations

i) 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. 

ii) 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. 

iii) 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) = 0$.  


The model equations for the SPMe read: 


#### Particles: 
\begin{align}
\mathcal{C}_{\text{k}} \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{align}
$$
N_{\text{s,k}}\big|_{r_{\text{k}}=0} = 0, \quad \text{k} \in \text{n, p}, \quad \ \ - \frac{a_{\text{k}}\gamma_{\text{k}}}{\mathcal{C}_{\text{k}}} N_{\text{s,k}}\big|_{r_{\text{k}}=1} = 
\begin{cases}
		  \frac{I}{L_{\text{n}}}, \quad &\text{k}=\text{n}, \\ 
		  -\frac{I}{L_{\text{p}}}, \quad &\text{k}=\text{p}, 
\end{cases} \\
c_{\text{s,k}}(r_{\text{k}},0) = c_{\text{s,k,0}}, \quad \text{k} \in \text{n, p},$$
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,1]$ 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.


#### Electrolyte: 
\begin{align}
\mathcal{C}_{\text{e}} \epsilon_{\text{k}} \gamma_{\text{e}} \frac{\partial c_{\text{e,k}}}{\partial t} &= -\gamma_{\text{e}} \frac{\partial N_{\text{e,k}}}{\partial x} + 
\begin{cases} 
    \frac{I}{L_{\text{n}}}, \quad &\text{k}=\text{n}, \\ 
    0, \quad &\text{k}=\text{s}, \\ 
    -\frac{I}{L_{\text{p}}}, \quad &\text{k}=\text{p},
\end{cases} \\
N_{\text{e,k}} &= -\epsilon_{\text{k}}^{\text{b}} D_{\text{e}}(1) \frac{\partial c_{\text{e,k}}}{\partial x} +    
\begin{cases} 
	  \frac{x t^+I}{\gamma_{\text{e}} L_{\text{n}}}, \quad &\text{k}=\text{n} \\ 
     \frac{t^+I}{\gamma_{\text{e}}}, \quad &\text{k}=\text{s} \\ 
	 \frac{(1-x)t^+ I}{\gamma_{\text{e}} L_{\text{p}}}, \quad &\text{k}=\text{p}
\end{cases}
\end{align}
$$
N_{\text{e,n}}\big|_{x=0} = 0, \quad N_{\text{e,p}}\big|_{x=1}=0, \\
c_{\text{e,k}}(x,0) = 0, \quad \text{k} \in \text{n, s, p},$$
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,1]$ 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 terminal voltage is obtained from the expression: 
$$ 
V = U_{\text{eq}} + \eta_r + \eta_c + \Delta\Phi_{\text{Elec}} + \Delta\Phi_{\text{Solid}}
$$ 
where 
\begin{align}
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 \mathcal{C}_{\text{e}}(1-t^+)\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{align} 
where
\begin{equation} 
    \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_{1-L_{\text{p}}}^{1} c_{\text{e,p}} \, \text{d}x.
\end{equation} 

More details can be found in [[1]](#ref).

## Example solving SPMe using PyBaMM

Below we show how to solve the SPMe model, using the default geometry, mesh, parameters, discretisation and solver provided with PyBaMM. For a more detailed example, see the notebook on the [SPM](https://github.com/pybamm-team/PyBaMM/blob/master/examples/notebooks/models/SPM.ipynb).

First we need to import `pybamm`, and then change our working directory to the root of the pybamm folder.


```python
import pybamm
import numpy as np
import os
import matplotlib.pyplot as plt
os.chdir(pybamm.__path__[0]+'/..')
```

We then get the SPMe model equations, and process the model using default settings for the geometry and parameters.


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

# create geometry
geometry = model.default_geometry

# load parameter values and process model and geometry
param = model.default_parameter_values
param.process_model(model)
param.process_geometry(geometry)
```

The next step is to set the mesh and discretise the model. Again, we choose the default settings.


```python
# set mesh
mesh = pybamm.Mesh(geometry, model.default_submesh_types, model.default_var_pts)

# discretise model
disc = pybamm.Discretisation(mesh, model.default_spatial_methods)
disc.process_model(model);
```

The model is now ready to be solved. We select the default ODE solver for the SPMe.



```python
# solve model
solver = model.default_solver
t_eval = np.linspace(0, 3600, 250) # time in seconds
solution = solver.solve(model, t_eval)

```

To get a quick overview of the model outputs we can use the QuickPlot class, which plots a common set of useful outputs. The method `Quickplot.dynamic_plot` makes a slider widget.


```python
quick_plot = pybamm.QuickPlot(solution)
quick_plot.dynamic_plot();
```


    interactive(children=(FloatSlider(value=0.0, description='t', max=3599.9999999999995, step=35.99999999999999),…


## Dimensionless Parameters

In the table below, we provide the dimensionless parameters in the SPMe in terms of the dimensional parameters in LCO.csv. We use a superscript * to indicate dimensional quantities. 

| Parameter                 | Expression                              |Interpretation                             |
|:--------------------------|:----------------------------------------|:------------------------------------------|
| $L_{\text{k}}$            | $L_{\text{k}}^*/L^*$                    | Ratio of region thickness to cell thickness|
|$\mathcal{C}_{\text{k}}$   | $\tau_{\text{k}}^*/\tau_{\text{d}}^*$   | Ratio of solid diffusion and discharge timescales |
|$\mathcal{C}_{\text{e}}$   |$\tau_{\text{e}}^*/\tau_{\text{d}}^*$    |Ratio of electrolyte transport and discharge timescales|
|$\mathcal{C}_{\text{r,k}}$ |$\tau_{\text{r,k}}^*/\tau_{\text{d}}^*$  |Ratio of reaction and discharge timescales|
|$a_{\text{k}}$             |$a_{\text{k}}^* R_{\text{k}}^*$          | Product of particle radius and surface area to volume ratio|
|$\gamma_{\text{k}}$        |$c_{\text{k,max}}^*/c_{\text{n,max}}^*$  |Ratio of maximum lithium concentrations in solid|
|$\gamma_{\text{e}}$        |$c_{\text{e,typ}}^*/c_{\text{n,max}}^*$  |Ratio of maximum lithium concentration in the negative electrode solid and typical electrolyte concentration|

Note that the dimensionless parameters $\epsilon_{\text{k}}$, $\text{b}$, and $t^+$ are already provided in the parameter file LCO.csv.  

<a name="ref">[1]</a> 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


```python

```

0a7a73db5aac4eced4433f35e9ad7e035425933d
ipynb
Jupyter Notebook
examples/notebooks/models/SPMe.ipynb
felipe-salinas/PyBaMM
49a490c189d1896a7e845d585529c52c3e377554
BSD-3-Clause
examples/notebooks/models/SPMe.ipynb
felipe-salinas/PyBaMM
49a490c189d1896a7e845d585529c52c3e377554
BSD-3-Clause
examples/notebooks/models/SPMe.ipynb
felipe-salinas/PyBaMM
49a490c189d1896a7e845d585529c52c3e377554
BSD-3-Clause
Qwen/Qwen-72B
1. YES
2. YES