Skip to content

Commit

Permalink
Merge pull request #2134 from pybamm-team/csmax-in-functions
Browse files Browse the repository at this point in the history
make c_s_max an input to functions
  • Loading branch information
valentinsulzer authored Jun 30, 2022
2 parents 7c5b44e + 3ebab55 commit e5714a9
Show file tree
Hide file tree
Showing 58 changed files with 483 additions and 1,198 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

## Breaking changes

- Exchange-current density functions (and some other functions) now take an additional argument, the maximum particle concentration for that phase ([#2134](https://github.com/pybamm-team/PyBaMM/pull/2134))

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

## Features
Expand Down
1,280 changes: 264 additions & 1,016 deletions examples/notebooks/parameterization/parameterization.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,Peyman MPM,from MPM code
Initial concentration in electrolyte [mol.m-3],1000,Peyman MPM,from MPM code
Cation transference number,0.38,Peyman MPM,
1 + dlnf/dlnc,1,,
Typical lithium ion diffusivity [m2.s-1],5.34E-10,Scott Moura FastDFN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,default,
Initial concentration in electrolyte [mol.m-3],1000,default,
Cation transference number,[function]electrolyte_transference_number_EC_DMC_1_1_Landesfeind2019,Landesfeind 2019,
1 + dlnf/dlnc,[function]electrolyte_TDF_EC_DMC_1_1_Landesfeind2019,Landesfeind 2019,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_EC_DMC_1_1_Landesfeind2019,Landesfeind 2019," "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,default,
Initial concentration in electrolyte [mol.m-3],1000,default,
Cation transference number,[function]electrolyte_transference_number_EC_EMC_3_7_Landesfeind2019,Landesfeind 2019,
1 + dlnf/dlnc,[function]electrolyte_TDF_EC_EMC_3_7_Landesfeind2019,Landesfeind 2019,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_EC_EMC_3_7_Landesfeind2019,Landesfeind 2019," "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,default,
Initial concentration in electrolyte [mol.m-3],1000,default,
Cation transference number,[function]electrolyte_transference_number_EMC_FEC_19_1_Landesfeind2019,Landesfeind 2019,
1 + dlnf/dlnc,[function]electrolyte_TDF_EMC_FEC_19_1_Landesfeind2019,Landesfeind 2019,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_EMC_FEC_19_1_Landesfeind2019,Landesfeind 2019," "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,,
Initial concentration in electrolyte [mol.m-3],1000,,
Cation transference number,0.26,,
1 + dlnf/dlnc,1,,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Ecker2015,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,Ai 2020,
Initial concentration in electrolyte [mol.m-3],1000,Ai 2020,
Cation transference number,0.38,Ai 2020,
1 + dlnf/dlnc,[function]dlnf_dlnc_Ai2020,,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Ai2020,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1200,,
Initial concentration in electrolyte [mol.m-3],1200,,
Cation transference number,0.4,Reported as a function in Kim2011 (Implement later),
1 + dlnf/dlnc,1,,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Kim2011,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,Scott Moura FastDFN,
Initial concentration in electrolyte [mol.m-3],1000,Scott Moura FastDFN,
Cation transference number,0.4,Scott Moura FastDFN,
1 + dlnf/dlnc,1,,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Capiglia1999,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,Chen 2020,
Initial concentration in electrolyte [mol.m-3],1000,Chen 2020,
Cation transference number,0.2594,Chen 2020,
1 + dlnf/dlnc,1,,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Nyman2008,Nyman 2008,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,Ramadass,
Initial concentration in electrolyte [mol.m-3],1000,Ramadass,
Cation transference number,0.363,Ramadass,
1 + dlnf/dlnc,1,,
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Ramadass2004,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Name [units],Value,Reference,Notes
,,,
# Electrolyte properties,,,
Typical electrolyte concentration [mol.m-3],1000,,By convention
Initial concentration in electrolyte [mol.m-3],1000,,By convention
Cation transference number,0.38,,Assumed to be constant
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Valoen2005,,
Electrolyte conductivity [S.m-1],[function]electrolyte_conductivity_Valoen2005,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ Upper voltage cut-off [V],4.2,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],48.8682,Peyman MPM, x0 (0.0017) * Csmax_n
Initial concentration in positive electrode [mol.m-3],31513.0,Peyman MPM, y0 (0.8907) * Csmax_p
Initial concentration in electrolyte [mol.m-3],1000,Peyman MPM,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ Upper voltage cut-off [V],4.2,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],24108,Ai 2020,
Initial concentration in positive electrode [mol.m-3],21725,Ai 2020,
Initial concentration in electrolyte [mol.m-3],1000,Ai 2020,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ Upper voltage cut-off [V],4.2,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],29866,Chen 2020,
Initial concentration in positive electrode [mol.m-3],17038,Chen 2020,
Initial concentration in electrolyte [mol.m-3],1000,Chen 2020,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ Upper voltage cut-off [V],4.2,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3], 26120.05,,
Initial concentration in positive electrode [mol.m-3], 12630.8,,
Initial concentration in electrolyte [mol.m-3],1000,,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ Upper voltage cut-off [V],4.2,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],18081,0.63*2.84E4,
Initial concentration in positive electrode [mol.m-3],20090,0.41*4.9E4,
Initial concentration in electrolyte [mol.m-3],1200,,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ Upper voltage cut-off [V],4.1,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],19986.609595075,Scott Moura FastDFN,
Initial concentration in positive electrode [mol.m-3],30730.7554385565,Scott Moura FastDFN,
Initial concentration in electrolyte [mol.m-3],1000,Scott Moura FastDFN,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ Upper voltage cut-off [V],4.4,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],28866,Chen 2020,
Initial concentration in positive electrode [mol.m-3],13975,Chen 2020,
Initial concentration in electrolyte [mol.m-3],1000,Chen 2020,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Upper voltage cut-off [V],4.2,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3],22610.7,Ramadass 2002,
Initial concentration in positive electrode [mol.m-3],25777.5,Ramadass 2002,
Initial concentration in electrolyte [mol.m-3],1000,Ramadass,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ Upper voltage cut-off [V],4.2,,
,,,
# Initial conditions
Initial concentration in positive electrode [mol.m-3],4631,48230*0.096 adjusted so that initial voltage is <4.2V,
Initial concentration in electrolyte [mol.m-3],1000,,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ Upper voltage cut-off [V],4.4,,
# Initial conditions,,,
Initial concentration in negative electrode [mol.m-3],28831.45783,Minimized to Severson Data,
Initial concentration in positive electrode [mol.m-3],35.3766672,Minimized to Severson Data,
Initial concentration in electrolyte [mol.m-3],1200,Lain,
Initial temperature [K],298.15,,
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from pybamm import exp, constants, Parameter
from pybamm import exp, constants


def graphite_electrolyte_exchange_current_density_Dualfoil1998(c_e, c_s_surf, T):
def graphite_electrolyte_exchange_current_density_Dualfoil1998(
c_e, c_s_surf, c_s_max, T
):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC.
Expand All @@ -16,6 +18,8 @@ def graphite_electrolyte_exchange_current_density_Dualfoil1998(c_e, c_s_surf, T)
Electrolyte concentration [mol.m-3]
c_s_surf : :class:`pybamm.Symbol`
Particle concentration [mol.m-3]
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Expand All @@ -30,8 +34,6 @@ def graphite_electrolyte_exchange_current_density_Dualfoil1998(c_e, c_s_surf, T)
E_r = 5000 # activation energy for Temperature Dependent Reaction Constant [J/mol]
arrhenius = exp(E_r / constants.R * (1 / 298.15 - 1 / T))

c_n_max = Parameter("Maximum concentration in negative electrode [mol.m-3]")

return (
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_n_max - c_s_surf) ** 0.5
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_s_max - c_s_surf) ** 0.5
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def graphite_entropy_Enertech_Ai2020_function(sto):
def graphite_entropy_Enertech_Ai2020_function(sto, c_s_max):
"""
Lithium Cobalt Oxide (LiCO2) entropic change in open circuit potential (OCP) at
a temperature of 298.15K as a function of the stochiometry. The fit is taken
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def graphite_volume_change_Ai2020(sto):
def graphite_volume_change_Ai2020(sto, c_s_max):
"""
Graphite particle volume change as a function of stochiometry [1, 2].
Expand All @@ -17,6 +17,9 @@ def graphite_volume_change_Ai2020(sto):
sto: :class:`pybamm.Symbol`
Electrode stochiometry, dimensionless
should be R-averaged particle concentration
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
Returns
-------
t_change:class:`pybamm.Symbol`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from pybamm import exp, constants, Parameter
from pybamm import exp, constants


def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(c_e, c_s_surf, T):
def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(
c_e, c_s_surf, c_s_max, T
):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC.
Expand All @@ -19,6 +21,8 @@ def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(c_e, c_s_surf,
Electrolyte concentration [mol.m-3]
c_s_surf : :class:`pybamm.Symbol`
Particle concentration [mol.m-3]
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Expand All @@ -27,13 +31,10 @@ def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(c_e, c_s_surf,
:class:`pybamm.Symbol`
Exchange-current density [A.m-2]
"""

m_ref = 6.48e-7 # (A/m2)(mol/m3)**1.5 - includes ref concentrations
E_r = 35000
arrhenius = exp(E_r / constants.R * (1 / 298.15 - 1 / T))

c_n_max = Parameter("Maximum concentration in negative electrode [mol.m-3]")

return (
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_n_max - c_s_surf) ** 0.5
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_s_max - c_s_surf) ** 0.5
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from pybamm import exp, constants, Parameter
from pybamm import exp, constants


def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(c_e, c_s_surf, T):
def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(
c_e, c_s_surf, c_s_max, T
):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC.
Expand All @@ -19,6 +21,8 @@ def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(c_e, c_s_surf,
Electrolyte concentration [mol.m-3]
c_s_surf : :class:`pybamm.Symbol`
Particle concentration [mol.m-3]
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Expand All @@ -32,8 +36,6 @@ def graphite_LGM50_electrolyte_exchange_current_density_Chen2020(c_e, c_s_surf,
E_r = 35000
arrhenius = exp(E_r / constants.R * (1 / 298.15 - 1 / T))

c_n_max = Parameter("Maximum concentration in negative electrode [mol.m-3]")

return (
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_n_max - c_s_surf) ** 0.5
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_s_max - c_s_surf) ** 0.5
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp, constants, Parameter
from pybamm import exp, constants


def graphite_electrolyte_exchange_current_density_Ecker2015(c_e, c_s_surf, T):
def graphite_electrolyte_exchange_current_density_Ecker2015(c_e, c_s_surf, c_s_max, T):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC.
Expand All @@ -24,6 +24,8 @@ def graphite_electrolyte_exchange_current_density_Ecker2015(c_e, c_s_surf, T):
Electrolyte concentration [mol.m-3]
c_s_surf : :class:`pybamm.Symbol`
Particle concentration [mol.m-3]
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Expand All @@ -41,8 +43,6 @@ def graphite_electrolyte_exchange_current_density_Ecker2015(c_e, c_s_surf, T):

arrhenius = exp(-E_r / (constants.R * T)) * exp(E_r / (constants.R * 296.15))

c_n_max = Parameter("Maximum concentration in negative electrode [mol.m-3]")

return (
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_n_max - c_s_surf) ** 0.5
m_ref * arrhenius * c_e ** 0.5 * c_s_surf ** 0.5 * (c_s_max - c_s_surf) ** 0.5
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp, constants, Parameter


def graphite_electrolyte_exchange_current_density_Kim2011(c_e, c_s_surf, T):
def graphite_electrolyte_exchange_current_density_Kim2011(c_e, c_s_surf, c_s_max, T):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC
Expand All @@ -20,6 +20,8 @@ def graphite_electrolyte_exchange_current_density_Kim2011(c_e, c_s_surf, T):
Electrolyte concentration [mol.m-3]
c_s_surf : :class:`pybamm.Symbol`
Particle concentration [mol.m-3]
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Expand All @@ -31,13 +33,12 @@ def graphite_electrolyte_exchange_current_density_Kim2011(c_e, c_s_surf, T):

i0_ref = 36 # reference exchange current density at 100% SOC
sto = 0.36 # stochiometry at 100% SOC
c_s_n_max = Parameter("Maximum concentration in negative electrode [mol.m-3]")
c_s_n_ref = sto * c_s_n_max # reference electrode concentration
c_s_n_ref = sto * c_s_max # reference electrode concentration
c_e_ref = Parameter("Typical electrolyte concentration [mol.m-3]")
alpha = 0.5 # charge transfer coefficient

m_ref = i0_ref / (
c_e_ref ** alpha * (c_s_n_max - c_s_n_ref) ** alpha * c_s_n_ref ** alpha
c_e_ref ** alpha * (c_s_max - c_s_n_ref) ** alpha * c_s_n_ref ** alpha
)

E_r = 3e4
Expand All @@ -48,5 +49,5 @@ def graphite_electrolyte_exchange_current_density_Kim2011(c_e, c_s_surf, T):
* arrhenius
* c_e ** alpha
* c_s_surf ** alpha
* (c_s_n_max - c_s_surf) ** alpha
* (c_s_max - c_s_surf) ** alpha
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from pybamm import exp, constants, Parameter


def graphite_LGM50_electrolyte_exchange_current_density_ORegan2021(c_e, c_s_surf, T):
def graphite_LGM50_electrolyte_exchange_current_density_ORegan2021(
c_e, c_s_surf, c_s_max, T
):
"""
Exchange-current density for Butler-Volmer reactions between graphite and LiPF6 in
EC:DMC.
Expand All @@ -19,6 +21,8 @@ def graphite_LGM50_electrolyte_exchange_current_density_ORegan2021(c_e, c_s_surf
Electrolyte concentration [mol.m-3]
c_s_surf : :class:`pybamm.Symbol`
Particle concentration [mol.m-3]
c_s_max : :class:`pybamm.Symbol`
Maximum particle concentration [mol.m-3]
T : :class:`pybamm.Symbol`
Temperature [K]
Expand All @@ -33,13 +37,12 @@ def graphite_LGM50_electrolyte_exchange_current_density_ORegan2021(c_e, c_s_surf
E_r = 4e4
arrhenius = exp(E_r / constants.R * (1 / 298.15 - 1 / T))

c_n_max = Parameter("Maximum concentration in negative electrode [mol.m-3]")
c_e_ref = Parameter("Typical electrolyte concentration [mol.m-3]")

return (
i_ref
* arrhenius
* (c_e / c_e_ref) ** (1 - alpha)
* (c_s_surf / c_n_max) ** alpha
* (1 - c_s_surf / c_n_max) ** (1 - alpha)
* (c_s_surf / c_s_max) ** alpha
* (1 - c_s_surf / c_s_max) ** (1 - alpha)
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp, tanh


def graphite_LGM50_entropic_change_ORegan2021(sto):
def graphite_LGM50_entropic_change_ORegan2021(sto, c_s_max):
"""
LG M50 Graphite entropic change in open circuit potential (OCP) at a temperature of
298.15K as a function of the stochiometry. The fit is taken from [1].
Expand Down
Loading

0 comments on commit e5714a9

Please sign in to comment.