From 2ee8da23ee24e9e946a60b0dd9e64070b1244552 Mon Sep 17 00:00:00 2001 From: Simon O'Kane <42972513+DrSOKane@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:48:10 +0000 Subject: [PATCH] Issue 3339 dead lithium (#3485) * fixed tests * Added graphite half-cell parameter files * Revert "Added graphite half-cell parameter files" This reverts commit 78001e81eecc38919364190940e095e0e51fab76. * Revert "fixed tests" This reverts commit cf53ff1d9e74eda7e68bc65b5dea5c18f7fcf872. * ruff * changelog * coverage * Fixed minor error in example notebook * Removed duplicate entry from changelog --- CHANGELOG.md | 1 + .../notebooks/models/lithium-plating.ipynb | 4 ++-- .../interface/lithium_plating/plating.py | 22 +++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4403405f90..2eea9ed7c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed bug that made identical Experiment steps with different end times crash ([#3516](https://github.com/pybamm-team/PyBaMM/pull/3516)) - Fixed bug in calculation of theoretical energy that made it very slow ([#3506](https://github.com/pybamm-team/PyBaMM/pull/3506)) +- The irreversible plating model now increments `f"{Domain} dead lithium concentration [mol.m-3]"`, not `f"{Domain} lithium plating concentration [mol.m-3]"` as it did previously. ([#3485](https://github.com/pybamm-team/PyBaMM/pull/3485)) # [v23.9](https://github.com/pybamm-team/PyBaMM/tree/v23.9) - 2023-10-31 diff --git a/docs/source/examples/notebooks/models/lithium-plating.ipynb b/docs/source/examples/notebooks/models/lithium-plating.ipynb index 8969f237ef..1e14513620 100644 --- a/docs/source/examples/notebooks/models/lithium-plating.ipynb +++ b/docs/source/examples/notebooks/models/lithium-plating.ipynb @@ -194,8 +194,8 @@ " axs[0,0].set_ylabel(\"Voltage [V]\")\n", " axs[0,1].set_ylabel(\"Volumetric interfacial current density [A.m-3]\")\n", " axs[0,1].legend(('Deintercalation current','Stripping current','Total current'))\n", - " axs[1,0].set_ylabel(\"Plated lithium capacity [Ah]\")\n", - " axs[1,1].set_ylabel(\"Intercalated lithium capacity [Ah]\")\n", + " axs[1,0].set_ylabel(\"Plated lithium capacity [A.h]\")\n", + " axs[1,1].set_ylabel(\"Intercalated lithium capacity [A.h]\")\n", "\n", " for ax in axs.flat:\n", " ax.set_xlabel(\"Time [minutes]\")\n", diff --git a/pybamm/models/submodels/interface/lithium_plating/plating.py b/pybamm/models/submodels/interface/lithium_plating/plating.py index a1828dcaa2..9f4de08d2f 100644 --- a/pybamm/models/submodels/interface/lithium_plating/plating.py +++ b/pybamm/models/submodels/interface/lithium_plating/plating.py @@ -115,18 +115,26 @@ def set_rhs(self, variables): ] L_sei = variables[f"{Domain} total SEI thickness [m]"] - # In the partially reversible plating model, coupling term turns reversible - # lithium into dead lithium. In other plating models, it is zero. lithium_plating_option = getattr(self.options, domain)["lithium plating"] - if lithium_plating_option == "partially reversible": + if lithium_plating_option == "reversible": + # In the reversible plating model, there is no dead lithium + dc_plated_Li = -a_j_stripping / self.param.F + dc_dead_Li = pybamm.Scalar(0) + elif lithium_plating_option == "irreversible": + # In the irreversible plating model, all plated lithium is dead lithium + dc_plated_Li = pybamm.Scalar(0) + dc_dead_Li = -a_j_stripping / self.param.F + elif lithium_plating_option == "partially reversible": + # In the partially reversible plating model, the coupling term turns + # reversible lithium into dead lithium over time. dead_lithium_decay_rate = self.param.dead_lithium_decay_rate(L_sei) coupling_term = dead_lithium_decay_rate * c_plated_Li - else: - coupling_term = pybamm.Scalar(0) + dc_plated_Li = -a_j_stripping / self.param.F - coupling_term + dc_dead_Li = coupling_term self.rhs = { - c_plated_Li: -a_j_stripping / self.param.F - coupling_term, - c_dead_Li: coupling_term, + c_plated_Li: dc_plated_Li, + c_dead_Li: dc_dead_Li, } def set_initial_conditions(self, variables):