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

#936 remove some inputs #942

Merged
merged 6 commits into from
Apr 6, 2020
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

- Reformatted electrolyte submodels ([#927](https://github.com/pybamm-team/PyBaMM/pull/927))

## Breaking changes

- Removed some inputs like `T_inf`, `R_g` and activation energies to some of the standard function parameters. This is because each of those inputs is specific to a particular function (e.g. the reference temperature at which the function was measured). To change a property such as the activation energy, users should create a new function, specifying the relevant property as a `Parameter` or `InputParameter` ([#942](https://github.com/pybamm-team/PyBaMM/pull/942))

# [v0.2.1](https://github.com/pybamm-team/PyBaMM/tree/v0.2.1) - 2020-03-31

New expression tree node types, models, parameter sets and solvers, as well as general bug fixes and new examples.
Expand Down
1 change: 1 addition & 0 deletions pybamm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def version(formatted=False):
# Parameters class and methods
#
from .parameters.parameter_values import ParameterValues
from .parameters import constants
from .parameters import geometric_parameters
from .parameters import electrical_parameters
from .parameters import thermal_parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
from pybamm import exp
from pybamm import exp, constants


def graphite_LGM50_diffusivity_Chen2020(sto, T, T_inf, E_D_s, R_g):
def graphite_LGM50_diffusivity_Chen2020(sto, T):
"""
LG M50 Graphite diffusivity as a function of stochiometry, in this case the
diffusivity is taken to be a constant. The value is taken from [1].

References
----------
.. [1] Chang-Hui Chen, Ferran Brosa Planella, Kieran O’Regan, Dominika Gastol, W.
Dhammika Widanage, and Emma Kendrick. "Development of Experimental Techniques for
Parameterization of Multi-scale Lithium-ion Battery Models." Submitted for
publication (2020).

Parameters
----------
sto: :class: `numpy.Array`
sto: :class:`pybamm.Symbol`
Electrode stochiometry
T: :class: `numpy.Array`
T: :class:`pybamm.Symbol`
Dimensional temperature
T_inf: double
Reference temperature
E_D_s: double
Solid diffusion activation energy
R_g: double
The ideal gas constant

Returns
-------
: double
:class:`pybamm.Symbol`
Solid diffusivity
"""

D_ref = 3.3e-14
arrhenius = exp(E_D_s / R_g * (1 / T_inf - 1 / T))
E_D_s = 42770
arrhenius = exp(E_D_s / constants.R * (1 / 298.15 - 1 / T))

return D_ref * arrhenius
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
from pybamm import exp
from pybamm import exp, constants


def graphite_LGM50_electrolyte_reaction_rate_Chen2020(T, T_inf, E_r, R_g):
def graphite_LGM50_electrolyte_reaction_rate_Chen2020(T):
"""
Reaction rate for Butler-Volmer reactions between graphite and LiPF6 in EC:DMC.

References
----------
.. [1] Chang-Hui Chen, Ferran Brosa Planella, Kieran O’Regan, Dominika Gastol, W.
Dhammika Widanage, and Emma Kendrick. "Development of Experimental Techniques for
Parameterization of Multi-scale Lithium-ion Battery Models." Submitted for
publication (2020).

Parameters
----------
T: :class: `numpy.Array`
T: :class:`pybamm.Symbol`
Dimensional temperature
T_inf: double
Reference temperature
E_r: double
Reaction activation energy
R_g: double
The ideal gas constant

Returns
-------
:`numpy.Array`
:class:`pybamm.Symbol`
Reaction rate
"""

m_ref = 6.48e-7
arrhenius = exp(E_r / R_g * (1 / T_inf - 1 / T))
E_r = 35000
arrhenius = exp(E_r / constants.R * (1 / 298.15 - 1 / T))

return m_ref * arrhenius
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ Negative electrode specific heat capacity [J.kg-1.K-1],700,default,
Negative electrode thermal conductivity [W.m-1.K-1],1.7,default,
Negative electrode OCP entropic change [V.K-1],0,,
,,,
# Activation energies,,,
Reference temperature [K],298.15,25C,
Negative electrode reaction rate,[function]graphite_LGM50_electrolyte_reaction_rate_Chen2020,,
Negative reaction rate activation energy [J.mol-1],35000,Chen 2020,
Negative solid diffusion activation energy [J.mol-1],42770,default,
# Reaction rate,,,
Negative electrode reaction rate,[function]graphite_LGM50_electrolyte_reaction_rate_Chen2020,,
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp
from pybamm import exp, constants


def graphite_diffusivity_Ecker2015(sto, T, T_inf, E_D_s, R_g):
def graphite_diffusivity_Ecker2015(sto, T):
"""
Graphite diffusivity as a function of stochiometry [1, 2, 3].

Expand All @@ -19,24 +19,19 @@ def graphite_diffusivity_Ecker2015(sto, T, T_inf, E_D_s, R_g):

Parameters
----------
sto: :class: `numpy.Array`
sto: :class:`pybamm.Symbol`
Electrode stochiometry
T: :class: `numpy.Array`
T: :class:`pybamm.Symbol`
Dimensional temperature
T_inf: double
Reference temperature
E_D_s: double
Solid diffusion activation energy
R_g: double
The ideal gas constant

Returns
-------
: double
:class:`pybamm.Symbol`
Solid diffusivity
"""

D_ref = 8.4e-13 * exp(-11.3 * sto) + 8.2e-15
arrhenius = exp(-E_D_s / (R_g * T)) * exp(E_D_s / (R_g * 296))
E_D_s = 3.03e4
arrhenius = exp(-E_D_s / (constants.R * T)) * exp(E_D_s / (constants.R * 296))

return D_ref * arrhenius
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pybamm import exp
from scipy import constants
from pybamm import exp, constants


def graphite_electrolyte_reaction_rate_Ecker2015(T, T_inf, E_r, R_g):
def graphite_electrolyte_reaction_rate_Ecker2015(T):
"""
Reaction rate for Butler-Volmer reactions between graphite and LiPF6 in EC:DMC.

Expand All @@ -20,27 +19,21 @@ def graphite_electrolyte_reaction_rate_Ecker2015(T, T_inf, E_r, R_g):

Parameters
----------
T: :class: `numpy.Array`
T: :class:`pybamm.Symbol`
Dimensional temperature
T_inf: double
Reference temperature
E_r: double
Reaction activation energy
R_g: double
The ideal gas constant

Returns
-------
:`numpy.Array`
:class:`pybamm.Symbol`
Reaction rate
"""

k_ref = 1.995 * 1e-10

# multiply by Faraday's constant to get correct units
F = constants.physical_constants["Faraday constant"][0]
m_ref = F * k_ref
m_ref = constants.F * k_ref
E_r = 53400

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

return m_ref * arrhenius
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def graphite_ocp_Ecker2015_function(sto):

Parameters
----------
sto: :class: `numpy.Array`
sto: :class:`pybamm.Symbol`
Electrode stochiometry

Returns
-------
: double
:class:`pybamm.Symbol`
Open circuit potential
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@ Negative electrode electrons in reaction,1,,
# Thermal parameters,,,
Negative electrode OCP entropic change [V.K-1],0,,
,,,
# Activation energies,,,
Reference temperature [K],296.15,23C,
# Reaction rate,,,
Negative electrode reaction rate,[function]graphite_electrolyte_reaction_rate_Ecker2015,,
Negative reaction rate activation energy [J.mol-1],53400,,
Negative solid diffusion activation energy [J.mol-1],3.03E+04,,
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
from pybamm import exp
from pybamm import exp, constants


def graphite_diffusivity_Kim2011(sto, T, T_inf, E_D_s, R_g):
def graphite_diffusivity_Kim2011(sto, T):
"""
Graphite diffusivity [1].
Graphite diffusivity [1].

References
----------
.. [1] Kim, G. H., Smith, K., Lee, K. J., Santhanagopalan, S., & Pesaran, A.
(2011). Multi-domain modeling of lithium-ion batteries encompassing
multi-physics in varied length scales. Journal of The Electrochemical
Society, 158(8), A955-A969.
References
----------
.. [1] Kim, G. H., Smith, K., Lee, K. J., Santhanagopalan, S., & Pesaran, A.
(2011). Multi-domain modeling of lithium-ion batteries encompassing
multi-physics in varied length scales. Journal of The Electrochemical
Society, 158(8), A955-A969.

Parameters
----------
sto: :class: `numpy.Array`
Electrode stochiometry
T: :class: `numpy.Array`
Dimensional temperature
T_inf: double
Reference temperature
E_D_s: double
Solid diffusion activation energy
R_g: double
The ideal gas constant
Parameters
----------
sto: :class:`pybamm.Symbol`
Electrode stochiometry
T: :class:`pybamm.Symbol`
Dimensional temperature

Returns
-------
: double
Solid diffusivity
Returns
-------
:class:`pybamm.Symbol`
Solid diffusivity
"""

D_ref = 9 * 10 ** (-14)
arrhenius = exp(E_D_s / R_g * (1 / T_inf - 1 / T))
E_D_s = 4e3
arrhenius = exp(E_D_s / constants.R * (1 / 298.15 - 1 / T))

return D_ref * arrhenius
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pybamm import exp
from pybamm import exp, constants


def graphite_electrolyte_reaction_rate_Kim2011(T, T_inf, E_r, R_g):
def graphite_electrolyte_reaction_rate_Kim2011(T):
"""
Reaction rate for Butler-Volmer reactions between graphite and LiPF6 in EC:DMC
[1].
Expand All @@ -15,18 +15,11 @@ def graphite_electrolyte_reaction_rate_Kim2011(T, T_inf, E_r, R_g):

Parameters
----------
T: :class: `numpy.Array`
T: :class:`pybamm.Symbol`
Dimensional temperature
T_inf: double
Reference temperature
E_r: double
Reaction activation energy
R_g: double
The ideal gas constant

Returns
-------
:`numpy.Array`
:class:`pybamm.Symbol`
Reaction rate
"""

Expand All @@ -43,6 +36,7 @@ def graphite_electrolyte_reaction_rate_Kim2011(T, T_inf, E_r, R_g):
/ (c_e_ref ** alpha * (c_s_n_max - c_s_n_ref) ** alpha * c_s_n_ref ** alpha)
)

arrhenius = exp(E_r / R_g * (1 / T_inf - 1 / T))
E_r = 3e4
arrhenius = exp(E_r / constants.R * (1 / 298.15 - 1 / T))

return m_ref * arrhenius
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ Negative electrode specific heat capacity [J.kg-1.K-1],700,,
Negative electrode thermal conductivity [W.m-1.K-1],1.1339,1.7 * 0.667,
Negative electrode OCP entropic change [V.K-1],0,,
,,,
# Activation energies,,,
Reference temperature [K],298.15,25C,
# Reaction rate,,,
Negative electrode reaction rate,[function]graphite_electrolyte_reaction_rate_Kim2011,,
Negative reaction rate activation energy [J.mol-1],3E4,,
Negative solid diffusion activation energy [J.mol-1],4E3,,
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pybamm
from pybamm import exp, constants


def graphite_diffusivity_PeymanMPM(sto, T, T_inf, E_D_s, R_g):
def graphite_diffusivity_PeymanMPM(sto, T):
"""
Graphite diffusivity as a function of stochiometry, in this case the
diffusivity is taken to be a constant. The value is taken from Peyman MPM.
Expand All @@ -12,25 +12,20 @@ def graphite_diffusivity_PeymanMPM(sto, T, T_inf, E_D_s, R_g):

Parameters
----------
sto: :class: `numpy.Array`
sto: :class:`pybamm.Symbol`
Electrode stochiometry
T: :class: `numpy.Array`
T: :class:`pybamm.Symbol`
Dimensional temperature
T_inf: double
Reference temperature
E_D_s: double
Solid diffusion activation energy
R_g: double
The ideal gas constant

Returns
-------
: double
:class:`pybamm.Symbol`
Solid diffusivity
"""

D_ref = 5.0 * 10 ** (-15)
arrhenius = pybamm.exp(E_D_s / R_g * (1 / T_inf - 1 / T))
E_D_s = 42770
arrhenius = exp(E_D_s / constants.R * (1 / 298.15 - 1 / T))

# Removing the fudge factor 0 * sto requires different handling of either
# either simplifications or how sto is passed into this function.
Expand Down
Loading