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.
Simulating a 3E cell#
In this notebook we show how to insert a reference electrode to mimic a 3E cell.
[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.
We first load a model
[2]:
model = pybamm.lithium_ion.DFN()
Next we use the helper function insert_reference_electrode
to insert a reference electrode into the model. This function takes the position of the reference electrode as an optional argument. If no position is given, the reference electrode is inserted at the midpoint of the separator. The helper function adds the new variables “Reference electrode potential [V]”, “Negative electrode 3E potential [V]” and “Positive electrode 3E potential [V]” to the model.
In this example we will explicitly pass a position to show how it is done
[3]:
L_n = model.param.n.L # Negative electrode thickness [m]
L_s = model.param.s.L # Separator thickness [m]
L_ref = L_n + L_s / 2 # Reference electrode position [m]
model.insert_reference_electrode(L_ref)
Next we can set up a simulation and solve the model as usual
[4]:
sim = pybamm.Simulation(model)
sim.solve([0, 3600])
[4]:
<pybamm.solvers.solution.Solution at 0x169dc5950>
Let’s plot a comparison of the 3E potentials and the potential difference between the solid and electrolyte phases at the electrode/separator interfaces
[5]:
sim.plot(
[
[
"Negative electrode surface potential difference at separator interface [V]",
"Negative electrode 3E potential [V]",
],
[
"Positive electrode surface potential difference at separator interface [V]",
"Positive electrode 3E potential [V]",
],
"Voltage [V]",
]
)
[5]:
<pybamm.plotting.quick_plot.QuickPlot at 0x169816a90>
[6]:
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] Marc Doyle, Thomas F. Fuller, and John Newman. Modeling of galvanostatic charge and discharge of the lithium/polymer/insertion cell. Journal of the Electrochemical society, 140(6):1526–1533, 1993. doi:10.1149/1.2221597.
[3] 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.
[4] 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.
[5] 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.
[ ]: