Tip

An interactive online version of this notebook is available, which can be accessed via

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

# Tutorial 7 - Model options#

In all of the previous tutorials, we have made use of the default forms of the inbuilt models in PyBaMM. However, PyBaMM provides a high-level interface for tweaking these models for your particular application.

```
[1]:
```

```
%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.
```

In this tutorial, we add a thermal model to the SPMe. From the documentation, we see that we have a choice of either a ‘x-full’ thermal model or a number of different lumped thermal models. For a deeper look at the thermal models see the thermal models notebook. We choose the full thermal model, which solves the spatially-dependent heat equation on our battery geometry, and couples the temperature with the electrochemistry. We set the model options by creating a Python dictionary:

```
[2]:
```

```
options = {"thermal": "x-full"}
```

and passing it to the model. Then, the model can be solved as shown in previous notebooks. We also increase the current to amplify the thermal effects:

```
[3]:
```

```
model = pybamm.lithium_ion.SPMe(options=options) # loading in options
sim = pybamm.Simulation(model)
sim.solve([0, 3600])
```

```
[3]:
```

```
<pybamm.solvers.solution.Solution at 0x139461520>
```

We now plot the cell temperature and the total heating by passing these variables to the `plot`

method as we saw in Tutorial 3:

```
[4]:
```

```
sim.plot(
["Cell temperature [K]", "Total heating [W.m-3]", "Current [A]", "Voltage [V]"]
)
```

```
[4]:
```

```
<pybamm.plotting.quick_plot.QuickPlot at 0x139461fd0>
```

In this tutorial we have seen how to adjust the model options. To see all of the options currently available in PyBaMM, please take a look at the documentation here.

In the next tutorial we show how to change the solver options.

## References#

The relevant papers for this notebook are:

```
[5]:
```

```
pybamm.print_citations()
```

```
[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). Journal of Open Research Software, 9(1):14, 2021. doi:10.5334/jors.309.
[5] Robert Timms, Scott G Marquis, Valentin Sulzer, Colin P. Please, and S Jonathan Chapman. Asymptotic Reduction of a Lithium-ion Pouch Cell Model. SIAM Journal on Applied Mathematics, 81(3):765–788, 2021. doi:10.1137/20M1336898.
```