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

add temperature dependence to MSMR model #3832

Merged
merged 44 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4a7e409
Merge pull request #2739 from pybamm-team/develop
brosaplanella Feb 28, 2023
2c4bcea
Merge pull request #2821 from pybamm-team/develop
brosaplanella Apr 1, 2023
710a8d1
Merge pull request #2905 from pybamm-team/develop
brosaplanella Apr 30, 2023
563a73f
Merge pull request #2913 from pybamm-team/develop
valentinsulzer May 2, 2023
d3c6bc6
Merge pull request #3047 from pybamm-team/v23.5
brosaplanella Jul 3, 2023
8aa4ae7
Bump to v23.9rc0
Saransh-cpp Oct 5, 2023
50be8a5
Merge pull request #3412 from agriyakhetarpal/drop-i686-manylinux2014…
Saransh-cpp Oct 5, 2023
e00be74
Merge pull request #3413 from Saransh-cpp/improve-release-workflow
Saransh-cpp Oct 5, 2023
9da8892
Merge pull request #3436 from Saransh-cpp/fortnightly-wheels
Saransh-cpp Oct 11, 2023
211778b
Merge pull request #3445 from pybamm-team/issue-3428-rename-exchange
valentinsulzer Oct 16, 2023
320b2e5
Merge pull request #3449 from pybamm-team/i3431-windows-wheels
martinjrobins Oct 17, 2023
a941307
Merge pull request #3456 from abillscmu/issue-3224-initial_soc
valentinsulzer Oct 19, 2023
37dfe89
Merge pull request #3467 from abillscmu/bugfix/initial_soh
valentinsulzer Oct 26, 2023
e8e2ac5
Merge pull request #3423 from jsbrittain/jax_gpu
Saransh-cpp Oct 31, 2023
32ec458
Fix changelog
Saransh-cpp Oct 31, 2023
49cd4a8
Merge pull request #3475 from arjxn-py/fix-default-imports
Saransh-cpp Nov 14, 2023
1694cb8
Bump - `v23.9rc1`
Saransh-cpp Nov 14, 2023
fbcf22b
Fix date in CHANGELOG
Saransh-cpp Nov 14, 2023
e00b0d5
Bump version to v23.9
Saransh-cpp Nov 20, 2023
97ca773
Merge pull request #3538 from pybamm-team/v23.9
Saransh-cpp Nov 20, 2023
89b9420
Fix docs about Jax solver compatibility with Python versions (#3702)
agriyakhetarpal Jan 12, 2024
6ddd47e
Merge pull request #3706 from agriyakhetarpal/fix-pybamm-install-odes
agriyakhetarpal Jan 12, 2024
f22f547
#3690 fix issue with skipped steps (#3708)
rtimms Jan 15, 2024
adda336
#3611 use actual cell volume for average total heating (#3707)
rtimms Jan 16, 2024
a4be1a3
Improve the release workflow (#3737)
Saransh-cpp Jan 17, 2024
b84f7ad
Bump to v24.1rc1
Saransh-cpp Jan 17, 2024
cf43cfd
#3630 fix interpolant shape error (#3761)
rtimms Jan 24, 2024
7d83dc1
Bump to v24.1rc2
Saransh-cpp Jan 24, 2024
7cdb5ef
Bump to v24.1
Saransh-cpp Jan 29, 2024
5200e3b
Resolve conflicts
Saransh-cpp Jan 29, 2024
e0ac58a
Fix doctests failures in scheduled tests (#3784)
agriyakhetarpal Jan 30, 2024
e29dcc0
Resolve broken `scikits.odes` installation on self-hosted M-series ru…
agriyakhetarpal Jan 30, 2024
bb6fc9b
Merge pull request #3780 from pybamm-team/v24.1
Saransh-cpp Jan 31, 2024
d629f81
add temperature dependence to MSMR model
valentinsulzer Feb 21, 2024
73387a5
merge main
valentinsulzer Feb 22, 2024
552a121
changelog
valentinsulzer Feb 22, 2024
e510d16
merge develop
valentinsulzer Feb 22, 2024
bc34810
fix tests
valentinsulzer Feb 22, 2024
ffc87e1
fix example
valentinsulzer Feb 22, 2024
491f53e
merge develop
valentinsulzer Mar 1, 2024
3a39fda
rob comments
valentinsulzer Mar 1, 2024
0e51eef
merge develop
valentinsulzer May 13, 2024
afeba4b
update notebook
valentinsulzer May 13, 2024
81dc161
Merge branch 'develop' into msmr-temperature-dependence
rtimms May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features

- MSMR open-circuit voltage model now depends on the temperature ([#3832](https://github.com/pybamm-team/PyBaMM/pull/3832))
- Added support for macOS arm64 (M-series) platforms. ([#3789](https://github.com/pybamm-team/PyBaMM/pull/3789))
- Renamed "electrode diffusivity" to "particle diffusivity" as a non-breaking change with a deprecation warning ([#3624](https://github.com/pybamm-team/PyBaMM/pull/3624))
- Add support for BPX version 0.4.0 which allows for blended electrodes and user-defined parameters in BPX([#3414](https://github.com/pybamm-team/PyBaMM/pull/3414))
Expand Down Expand Up @@ -33,14 +34,15 @@
- Added a method, `insert_reference_electrode`, to `pybamm.lithium_ion.BaseModel` that insert a reference electrode to measure the electrolyte potential at a given position in space and adds new variables that mimic a 3E cell setup. ([#3573](https://github.com/pybamm-team/PyBaMM/pull/3573))
- Serialisation added so models can be written to/read from JSON ([#3397](https://github.com/pybamm-team/PyBaMM/pull/3397))
- Added a `get_parameter_info` method for models and modified "print_parameter_info" functionality to extract all parameters and their type in a tabular and readable format ([#3584](https://github.com/pybamm-team/PyBaMM/pull/3584))
- Mechanical parameters are now a function of stoichiometry and temperature ([#3576](https://github.com/pybamm-team/PyBaMM/pull/3576))
valentinsulzer marked this conversation as resolved.
Show resolved Hide resolved


## Bug fixes

- Fixed a bug that lead to a `ShapeError` when specifying "Ambient temperature [K]" as an `Interpolant` with an isothermal model ([#3761](https://github.com/pybamm-team/PyBaMM/pull/3761))
- Fixed a bug where if the first step(s) in a cycle are skipped then the cycle solution started from the model's initial conditions instead of from the last state of the previous cycle ([#3708](https://github.com/pybamm-team/PyBaMM/pull/3708))
- Fixed a bug where the lumped thermal model conflates cell volume with electrode volume ([#3707](https://github.com/pybamm-team/PyBaMM/pull/3707))
<<<<<<< HEAD
- # Fixed a bug where the lumped thermal model conflates cell volume with electrode volume ([#3707](https://github.com/pybamm-team/PyBaMM/pull/3707))
- Fixed a bug where the lumped thermal model conflates cell volume with electrode volume ([#3707](https://github.com/pybamm-team/PyBaMM/pull/3707))
> > > > > > > develop
- Reverted a change to the coupled degradation example notebook that caused it to be unstable for large numbers of cycles ([#3691](https://github.com/pybamm-team/PyBaMM/pull/3691))
- Fixed a bug where simulations using the CasADi-based solvers would fail randomly with the half-cell model ([#3494](https://github.com/pybamm-team/PyBaMM/pull/3494))
- Fixed bug that made identical Experiment steps with different end times crash ([#3516](https://github.com/pybamm-team/PyBaMM/pull/3516))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ MSMR Diffusion
.. autoclass:: pybamm.particle.MSMRDiffusion
:members:

.. autoclass:: pybamm.particle.MSMRStoichiometryVariables
:members:

.. footbibliography::
37 changes: 18 additions & 19 deletions docs/source/examples/notebooks/models/MSMR.ipynb

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pybamm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
from .logger import logger, set_logging_level, get_new_logger
from .settings import settings
from .citations import Citations, citations, print_citations

#
# Classes for the Expression Tree
#
Expand Down
11 changes: 11 additions & 0 deletions pybamm/models/full_battery_models/lithium_ion/dfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ def set_particle_submodel(self):
submod = pybamm.particle.MSMRDiffusion(
self.param, domain, self.options, phase=phase, x_average=False
)
# also set the submodel for calculating stoichiometry from
# potential
self.submodels[
f"{domain} {phase} stoichiometry"
] = pybamm.particle.MSMRStoichiometryVariables(
self.param,
domain,
self.options,
phase=phase,
x_average=False,
)
self.submodels[f"{domain} {phase} particle"] = submod
self.submodels[
f"{domain} {phase} total particle concentration"
Expand Down
24 changes: 13 additions & 11 deletions pybamm/models/full_battery_models/lithium_ion/electrode_soh.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def __init__(
x_n = param.n.prim.x
x_p = param.p.prim.x

T = param.T_ref
V_max = param.voltage_high_cut
V_min = param.voltage_low_cut
Q_n = pybamm.InputParameter("Q_n")
Expand All @@ -214,21 +215,21 @@ def __init__(
if "Un_0" in solve_for:
Un_0 = pybamm.Variable("Un(x_0)")
Up_0 = V_min + Un_0
x_0 = x_n(Un_0)
y_0 = x_p(Up_0)
x_0 = x_n(Un_0, T)
y_0 = x_p(Up_0, T)

# Define variables for 100% state of charge
# TODO: thermal effects (include dU/dT)
if "Un_100" in solve_for:
Un_100 = pybamm.Variable("Un(x_100)")
Up_100 = V_max + Un_100
x_100 = x_n(Un_100)
y_100 = x_p(Up_100)
x_100 = x_n(Un_100, T)
y_100 = x_p(Up_100, T)
else:
Un_100 = pybamm.InputParameter("Un(x_100)")
Up_100 = pybamm.InputParameter("Up(y_100)")
x_100 = x_n(Un_100)
y_100 = x_p(Up_100)
x_100 = x_n(Un_100, T)
y_100 = x_p(Up_100, T)

# Define equations for 100% state of charge
if "Un_100" in solve_for:
Expand Down Expand Up @@ -678,20 +679,20 @@ def get_initial_stoichiometries(self, initial_value, tol=1e-6):
soc = pybamm.Variable("soc")
x = x_0 + soc * (x_100 - x_0)
y = y_0 - soc * (y_0 - y_100)
T_ref = parameter_values["Reference temperature [K]"]
if self.options["open-circuit potential"] == "MSMR":
xn = param.n.prim.x
xp = param.p.prim.x
Up = pybamm.Variable("Up")
Un = pybamm.Variable("Un")
soc_model.algebraic[Up] = x - xn(Un)
soc_model.algebraic[Un] = y - xp(Up)
soc_model.algebraic[Up] = x - xn(Un, T_ref)
soc_model.algebraic[Un] = y - xp(Up, T_ref)
soc_model.initial_conditions[Un] = 0
soc_model.initial_conditions[Up] = V_max
soc_model.algebraic[soc] = Up - Un - V_init
else:
Up = param.p.prim.U
Un = param.n.prim.U
T_ref = parameter_values["Reference temperature [K]"]
soc_model.algebraic[soc] = Up(y, T_ref) - Un(x, T_ref) - V_init
# initial guess for soc linearly interpolates between 0 and 1
# based on V linearly interpolating between V_max and V_min
Expand Down Expand Up @@ -1043,14 +1044,15 @@ def _get_msmr_potential_model(parameter_values, param):
V_min = param.voltage_low_cut
x_n = param.n.prim.x
x_p = param.p.prim.x
T = param.T_ref
model = pybamm.BaseModel()
Un = pybamm.Variable("Un")
Up = pybamm.Variable("Up")
x = pybamm.InputParameter("x")
y = pybamm.InputParameter("y")
model.algebraic = {
Un: x_n(Un) - x,
Up: x_p(Up) - y,
Un: x_n(Un, T) - x,
Up: x_p(Up, T) - y,
}
model.initial_conditions = {
Un: 1 - x,
Expand Down
11 changes: 11 additions & 0 deletions pybamm/models/full_battery_models/lithium_ion/newman_tobias.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ def set_particle_submodel(self):
submod = pybamm.particle.MSMRDiffusion(
self.param, domain, self.options, phase=phase, x_average=True
)
# also set the submodel for calculating stoichiometry from
# potential
self.submodels[
f"{domain} {phase} stoichiometry"
] = pybamm.particle.MSMRStoichiometryVariables(
self.param,
domain,
self.options,
phase=phase,
x_average=True,
)
self.submodels[f"{domain} {phase} particle"] = submod
self.submodels[
f"{domain} {phase} total particle concentration"
Expand Down
11 changes: 11 additions & 0 deletions pybamm/models/full_battery_models/lithium_ion/spm.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ def set_particle_submodel(self):
submod = pybamm.particle.MSMRDiffusion(
self.param, domain, self.options, phase=phase, x_average=True
)
# also set the submodel for calculating stoichiometry from
# potential
self.submodels[
f"{domain} {phase} stoichiometry"
] = pybamm.particle.MSMRStoichiometryVariables(
self.param,
domain,
self.options,
phase=phase,
x_average=True,
)
self.submodels[f"{domain} {phase} particle"] = submod
self.submodels[
f"{domain} {phase} total particle concentration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _get_standard_exchange_current_by_reaction_variables(self, j0, index):
return variables

def _get_kinetics_by_reaction(self, j0, ne, eta_r, T, u, index):
alpha = self.phase_param.alpha_bv_j(index)
alpha = self.phase_param.alpha_bv_j(T, index)
Feta_RT = self.param.F * eta_r / (self.param.R * T)
return (
u
Expand Down
2 changes: 1 addition & 1 deletion pybamm/models/submodels/particle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from .polynomial_profile import PolynomialProfile
from .x_averaged_polynomial_profile import XAveragedPolynomialProfile
from .total_particle_concentration import TotalConcentration
from .msmr_diffusion import MSMRDiffusion
from .msmr_diffusion import MSMRDiffusion, MSMRStoichiometryVariables