Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electrode soh from c #2508

Merged
merged 21 commits into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

## Features

- `initial_soc` can now be a string "x V", in which case the simulation is initialized to start from that voltage ([#2508](https://github.com/pybamm-team/PyBaMM/pull/2508))
- The `ElectrodeSOH` solver can now calculate electrode balance based on a target "cell capacity" (requires cell capacity "Q" as input), as well as the default "cyclable cell capacity" (requires cyclable lithium capacity "Q_Li" as input). Use the keyword argument `known_value` to control which is used. ([#2508](https://github.com/pybamm-team/PyBaMM/pull/2508))

## Bug fixes

- Fix installation on `Google Colab` (`pybtex` and `Colab` issue) ([#2526](https://github.com/pybamm-team/PyBaMM/pull/2526))

## Breaking changes

- Inputs for the `ElectrodeSOH` solver are now (i) "Q_Li", the total cyclable capacity of lithium in the electrodes (previously "n_Li", the total number of moles, n_Li = 3600/F \* Q_Li) (ii) "Q_n", the capacity of the negative electrode (previously "C_n"), and "Q_p", the capacity of the positive electrode (previously "C_p") ([#2508](https://github.com/pybamm-team/PyBaMM/pull/2508))

# [v22.11](https://github.com/pybamm-team/PyBaMM/tree/v22.11) - 2022-11-30

## Features
Expand Down
14 changes: 2 additions & 12 deletions docs/source/models/lithium_ion/electrode_soh.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
Electrode SOH models
====================

.. autoclass:: pybamm.lithium_ion.ElectrodeSOH
:members:

.. autoclass:: pybamm.lithium_ion.ElectrodeSOHx100
:members:

.. autoclass:: pybamm.lithium_ion.ElectrodeSOHx0
:members:

.. autoclass:: pybamm.lithium_ion.ElectrodeSOHSolver
:members:

.. autoclass:: pybamm.lithium_ion.ElectrodeSOHHalfCell
:members:

.. autofunction:: pybamm.lithium_ion.get_initial_stoichiometries

.. autofunction:: pybamm.lithium_ion.get_min_max_stoichiometries
380 changes: 293 additions & 87 deletions examples/notebooks/models/electrode-state-of-health.ipynb

Large diffs are not rendered by default.

2,296 changes: 1,100 additions & 1,196 deletions examples/notebooks/simulating-long-experiments.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pybamm/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def set_initial_conditions_from(self, solution, inplace=True, return_type="model
"To update a model from a solution, each variable in "
"model.initial_conditions must appear in the solution with "
"the same key as the variable name. In the solution provided, "
f"{e.args[0]}"
f"'{e.args[0]}' was not found."
)
if isinstance(solution, pybamm.Solution):
final_state = final_state.data
Expand Down
4 changes: 1 addition & 3 deletions pybamm/models/full_battery_models/lithium_ion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
#
from .base_lithium_ion_model import BaseModel
from .electrode_soh import (
ElectrodeSOH,
ElectrodeSOHx100,
ElectrodeSOHx0,
ElectrodeSOHSolver,
get_initial_stoichiometries,
get_min_max_stoichiometries,
)
from .electrode_soh_half_cell import ElectrodeSOHHalfCell
from .spm import SPM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ def set_degradation_variables(self):
)

# LAM
C_k = self.variables[f"{Domain} capacity [A.h]"]
Q_k = self.variables[f"{Domain} capacity [A.h]"]
domain_param = getattr(self.param, domain[0]) # param.n or param.p
LAM_k = (1 - C_k / domain_param.cap_init) * 100
LAM_k = (1 - Q_k / domain_param.Q_init) * 100
self.variables.update(
{
f"LAM_{domain[0]}e [%]": LAM_k,
Expand Down Expand Up @@ -164,6 +164,10 @@ def set_degradation_variables(self):
# Total lithium
"Total lithium [mol]": n_Li,
"Total lithium in particles [mol]": n_Li_particles,
"Total lithium capacity [A.h]": n_Li * param.F / 3600,
"Total lithium capacity in particles [A.h]": n_Li_particles
* param.F
/ 3600,
# Lithium lost
"Total lithium lost [mol]": param.n_Li_init - n_Li,
"Total lithium lost from particles [mol]": param.n_Li_particles_init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, options=None, name="Doyle-Fuller-Newman half cell model"):

# Particle diffusion parameters
D_w = param.p.prim.D
C_w = param.p.prim.cap_init
Q_w = param.p.prim.Q_init
a_R_w = param.p.prim.a_R
gamma_e = param.c_e_typ / param.p.prim.c_max
c_w_init = param.p.prim.c_init
Expand Down Expand Up @@ -175,14 +175,14 @@ def __init__(self, options=None, name="Doyle-Fuller-Newman half cell model"):
# The div and grad operators will be converted to the appropriate matrix
# multiplication at the discretisation stage
N_s_w = -D_w(c_s_w, T) * pybamm.grad(c_s_w)
self.rhs[c_s_w] = -(1 / C_w) * pybamm.div(N_s_w)
self.rhs[c_s_w] = -(1 / Q_w) * pybamm.div(N_s_w)

# Boundary conditions must be provided for equations with spatial
# derivatives
self.boundary_conditions[c_s_w] = {
"left": (pybamm.Scalar(0), "Neumann"),
"right": (
-C_w * j_w / a_R_w / gamma_w / D_w(c_s_surf_w, T),
-Q_w * j_w / a_R_w / gamma_w / D_w(c_s_surf_w, T),
"Neumann",
),
}
Expand Down
Loading