Skip to content

Commit

Permalink
#729 made a number of corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
Scottmar93 committed Feb 19, 2020
1 parent 04da9c7 commit b1eb67b
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 36 deletions.
10 changes: 4 additions & 6 deletions examples/scripts/ecker_set.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pybamm as pb
import numpy as np

pb.set_logging_level("INFO")

Expand All @@ -10,9 +9,8 @@
# chemistry = pb.parameter_sets.Marquis2019
parameter_values = pb.ParameterValues(chemistry=chemistry)

sim = pb.Simulation(model, parameter_values=parameter_values)
sim = pb.Simulation(model, parameter_values=parameter_values, C_rate=0.01)

solver = pb.IDAKLUSolver() # mode="fast")
t_eval = np.linspace(0, 1, 100)
sim.solve(t_eval=t_eval, solver=solver)
sim.plot()
solver = pb.CasadiSolver(mode="safe")
sim.solve(solver=solver)
sim.plot(["Discharge capacity [A.h]", "Terminal voltage [V]"])
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pybamm import exp
from pybamm import FunctionParameter


def graphite_diffusivity_Ecker2015(sto, T, T_inf, E_D_s, R_g):
Expand Down Expand Up @@ -34,7 +33,8 @@ def graphite_diffusivity_Ecker2015(sto, T, T_inf, E_D_s, R_g):
Solid diffusivity
"""

D_ref = FunctionParameter("Measured negative electrode diffusivity [m2.s-1]", sto)
# D_ref = FunctionParameter("Measured negative electrode diffusivity [m2.s-1]", sto)
D_ref = 8.4e-13 * exp(-11.3 * sto) + 8.2e-15
arrhenius = exp(E_D_s / R_g * (1 / T_inf - 1 / T))

return D_ref * arrhenius
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
0.07878787878787874, 0.24846625766871155
0.08939393939393936, 0.2239263803680982
0.10151515151515145, 0.22085889570552153
0.11515151515151523, 0.22085889570552153
0.12727272727272732, 0.21165644171779152
0.14242424242424245, 0.2024539877300613
0.15909090909090917, 0.19938650306748462
Expand All @@ -27,12 +26,6 @@
0.35151515151515156, 0.13496932515337412
0.3712121212121211, 0.13190184049079745
0.39242424242424234, 0.128834355828221
0.4196969696969697, 0.128834355828221
0.4439393939393941, 0.128834355828221
0.46818181818181825, 0.128834355828221
0.4939393939393939, 0.128834355828221
0.5166666666666666, 0.128834355828221
0.5424242424242425, 0.128834355828221
0.5681818181818183, 0.1257668711656441
0.5878787878787879, 0.12269938650306744
0.6060606060606062, 0.1165644171779141
Expand All @@ -42,15 +35,7 @@
0.6939393939393939, 0.08895705521472386
0.7181818181818183, 0.08895705521472386
0.7393939393939393, 0.08588957055214719
0.7621212121212122, 0.08588957055214719
0.7833333333333332, 0.08588957055214719
0.803030303030303, 0.08588957055214719
0.8257575757575757, 0.08588957055214719
0.8469696969696969, 0.08588957055214719
0.8696969696969699, 0.08588957055214719
0.8909090909090911, 0.08282208588957074
0.9121212121212123, 0.08588957055214719
0.9333333333333333, 0.08282208588957074
0.956060606060606, 0.08282208588957074
0.956060606060606, 0.08272208588957074
0.9772727272727273, 0.07975460122699385
1, 0.07055214723926384
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from pybamm import exp, tanh


def graphite_ocp_Ecker2015_function(sto):
"""
Graphite OCP as a function of stochiometry [1, 2].
References
----------
.. [1] Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of
a lithium-ion battery i. determination of parameters." Journal of the
Electrochemical Society 162.9 (2015): A1836-A1848.
.. [2] Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of
a lithium-ion battery ii. model validation." Journal of The Electrochemical
Society 162.9 (2015): A1849-A1857.
----------
.. [1] http://www.cchem.berkeley.edu/jsngrp/fortran.html
"""
a = 0.716502
b = 369.028
c = 0.12193
d = 35.6478
e = 0.0530947
g = 0.0169644
h = 27.1365
i = 0.312832
j = 0.0199313
k = 28.5697
m = 0.614221
n = 0.931153
o = 36.328
p = 1.10743
q = 0.140031
r = 0.0189193
s = 21.1967
t = 0.196176

u_eq = (
a * exp(-b * sto)
+ c * exp(-d * (sto - e))
- r * tanh(s * (sto - t))
- g * tanh(h * (sto - i))
- j * tanh(k * (sto - m))
- n * exp(o * (sto - p))
+ q
)

return u_eq
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Negative electrode conductivity [S.m-1],14,,
Maximum concentration in negative electrode [mol.m-3],31920,,
Measured negative electrode diffusivity [m2.s-1],[data]measured_graphite_diffusivity_Ecker2015,,
Negative electrode diffusivity [m2.s-1],[function]graphite_diffusivity_Ecker2015,,
Negative electrode OCP [V],[data]graphite_ocp_Ecker2015,,
Negative electrode OCP [V],[function]graphite_ocp_Ecker2015_function,,
,,,
# Microstructure,,,
Negative electrode porosity,0.329,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def nco_diffusivity_Ecker2015(sto, T, T_inf, E_D_s, R_g):
Solid diffusivity
"""

D_ref = FunctionParameter("Measured positive electrode diffusivity [m2.s-1]", sto)
# D_ref = FunctionParameter("Measured positive electrode diffusivity [m2.s-1]", sto)
D_ref = 3.7e-13 - 3.4e-13 * exp(-12 * (sto - 0.62) * (sto - 0.62))
arrhenius = exp(E_D_s / R_g * (1 / T_inf - 1 / T))

return D_ref * arrhenius
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
0.5566982201390807, 3.923972898265999
0.5782380602273078, 3.919624967236581
0.598182356605296, 3.913016558585964
0.6189244248384036, 3.91091236089907
0.6484419834778261, 3.911118873669402
0.6723751391314119, 3.9112863164561573
0.6971060666401172, 3.897963452056645
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from pybamm import tanh


def nco_ocp_Ecker2015_function(sto):
"""
NCO OCP as a function of stochiometry [1, 2].
References
----------
.. [1] Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of
a lithium-ion battery i. determination of parameters." Journal of the
Electrochemical Society 162.9 (2015): A1836-A1848.
.. [2] Ecker, Madeleine, et al. "Parameterization of a physico-chemical model of
a lithium-ion battery ii. model validation." Journal of The Electrochemical
Society 162.9 (2015): A1849-A1857.
Parameters
----------
sto: double
Stochiometry of material (li-fraction)
"""
a = -2.35211
c = 0.0747061
d = 31.886
e = 0.0219921
g = 0.640243
h = 5.48623
i = 0.439245
j = 3.82383
k = 4.12167
m = 0.176187
n = 0.0542123
o = 18.2919
p = 0.762272
q = 4.23285
r = -6.34984
s = 2.66395
t = 0.174352

u_eq = (
a * sto
- c * tanh(d * (sto - e))
- r * tanh(s * (sto - t))
- g * tanh(h * (sto - i))
- j * tanh(k * (sto - m))
- n * tanh(o * (sto - p))
+ q
)
return u_eq
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Positive electrode conductivity [S.m-1],68.1,,
Maximum concentration in positive electrode [mol.m-3],48580,,
Measured positive electrode diffusivity [m2.s-1],[data]measured_nco_diffusivity_Ecker2015,,
Positive electrode diffusivity [m2.s-1],[function]nco_diffusivity_Ecker2015,,
Positive electrode OCP [V],[data]nco_ocp_Ecker2015,,
Positive electrode OCP [V],[function]nco_ocp_Ecker2015_function,,
,,,
# Microstructure,,,
Positive electrode porosity,0.296,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Heat transfer coefficient [W.m-2.K-1],1, dummy value,
# Electrical
Number of electrodes connected in parallel to make a cell,1,,
Number of cells connected in series to make a battery,1,,
Lower voltage cut-off [V],0,,
Upper voltage cut-off [V],10,,
C-rate,0.1,,
Lower voltage cut-off [V],3,,
Upper voltage cut-off [V],4.2,,
C-rate,1,,
,,,
# Initial conditions
Initial concentration in negative electrode [mol.m-3], 26356,
Initial concentration in positive electrode [mol.m-3], 2197,,
Initial concentration in negative electrode [mol.m-3], 29148,(util-C_SEI)cpmax,
Initial concentration in positive electrode [mol.m-3], 21630,(1-util)cpmax,
Initial concentration in electrolyte [mol.m-3],1000,,
Initial temperature [K],296.15,,
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name [units],Value,Reference,Notes
# Empty rows and rows starting with ‘#’ will be ignored,,,
,,,
Separator porosity,50.8,,
Separator porosity,0.508,,
Separator Bruggeman coefficient (electrolyte),1.5,Ecker set uses measured tortuosity,
Separator Bruggeman coefficient (electrode),1.5,,
2 changes: 0 additions & 2 deletions pybamm/parameters/standard_parameters_lithium_ion.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,6 @@ def chi(c_e):

# Initial conditions
c_e_init = c_e_init_dimensional / c_e_typ
c_n_init = c_n_init_dimensional / c_n_max
c_p_init = c_p_init_dimensional / c_p_max
T_init = pybamm.thermal_parameters.T_init

U_n_ref = U_n_dimensional(pybamm.Scalar(0.7), T_ref)
Expand Down

0 comments on commit b1eb67b

Please sign in to comment.