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.
DFN model for sodium-ion batteries#
In this notebook we use the DFN model to simulate sodium-ion batteries. The parameters are based on the article > K. Chayambuka, G. Mulder, D.L. Danilov, P.H.L. Notten, Physics-based modeling of sodium-ion batteries part II. Model and validation, Electrochimica Acta 404 (2022) 139764. https://doi.org/10.1016/j.electacta.2021.139764.
However, the specific values (including the data for the interpolants) are taken from the COMSOL implementation presented in this example. As usual, we start by importing PyBaMM.
[1]:
import pybamm
An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
We now need to define the model. In this case we take the BasicDFN
model for sodium-ion batteries (note how it is called from the pybamm.sodium_ion
submodule). Note that, at the moment, the model is identical to the one for lithium-ion batteries, but uses different parameter values.
[2]:
model = pybamm.sodium_ion.BasicDFN()
In order to replicate the results in the COMSOL example, we discharge at different C-rates and compare the solutions. We loop over the C-rate dictionary and solve the model for each C-rate. We append the solutions into a list so we can later plots the results.
[3]:
C_rates = [1 / 12, 5 / 12, 10 / 12, 1]
solutions = []
for C_rate in C_rates:
sim = pybamm.Simulation(model, solver=pybamm.IDAKLUSolver(), C_rate=C_rate)
sol = sim.solve([0, 4000 / C_rate])
solutions.append(sol)
pybamm.dynamic_plot(solutions)
[3]:
<pybamm.plotting.quick_plot.QuickPlot at 0x7f9763ff3e90>
We can now perform a manual plot of voltage versus capacity, to compare the results with the COMSOL example.
[4]:
import matplotlib.pyplot as plt
for solution, C_rate in zip(solutions, C_rates):
capacity = [i * 1000 for i in solution["Discharge capacity [A.h]"].entries]
voltage = solution["Voltage [V]"].entries
plt.plot(capacity, voltage, label=f"{(12 * C_rate)} A.m-2")
plt.xlabel("Discharge Capacity [mA.h]")
plt.ylabel("Voltage [V]");
[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] Kudakwashe Chayambuka, Grietus Mulder, Dmitri L Danilov, and Peter HL Notten. Physics-based modeling of sodium-ion batteries part ii. model and validation. Electrochimica Acta, 404:139764, 2022.
[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] Alan C. Hindmarsh. The PVODE and IDA algorithms. Technical Report, Lawrence Livermore National Lab., CA (US), 2000. doi:10.2172/802599.
[5] Alan C. Hindmarsh, Peter N. Brown, Keith E. Grant, Steven L. Lee, Radu Serban, Dan E. Shumaker, and Carol S. Woodward. SUNDIALS: Suite of nonlinear and differential/algebraic equation solvers. ACM Transactions on Mathematical Software (TOMS), 31(3):363–396, 2005. doi:10.1145/1089014.1089020.
[6] 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.
[7] 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.
[ ]: