From b1eb67b1305f328f0f8975bfb275cd9b04758ff8 Mon Sep 17 00:00:00 2001 From: Scott Marquis Date: Wed, 19 Feb 2020 18:10:37 +0000 Subject: [PATCH] #729 made a number of corrections --- examples/scripts/ecker_set.py | 10 ++-- .../graphite_diffusivity_Ecker2015.py | 4 +- .../graphite_ocp_Ecker2015.csv | 17 +------ .../graphite_ocp_Ecker2015_function.py | 48 ++++++++++++++++++ .../anodes/graphite_Ecker2015/parameters.csv | 2 +- .../nco_diffusivity_Ecker2015.py | 3 +- .../LiNiCoO2_Ecker2015/nco_ocp_Ecker2015.csv | 1 - .../nco_ocp_Ecker2015_function.py | 50 +++++++++++++++++++ .../LiNiCoO2_Ecker2015/parameters.csv | 2 +- .../parameters.csv | 10 ++-- .../separator_Ecker2015/parameters.csv | 2 +- .../standard_parameters_lithium_ion.py | 2 - 12 files changed, 115 insertions(+), 36 deletions(-) create mode 100644 input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015_function.py create mode 100644 input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015_function.py diff --git a/examples/scripts/ecker_set.py b/examples/scripts/ecker_set.py index 37a6bab2fe..526b30eaa5 100644 --- a/examples/scripts/ecker_set.py +++ b/examples/scripts/ecker_set.py @@ -1,5 +1,4 @@ import pybamm as pb -import numpy as np pb.set_logging_level("INFO") @@ -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]"]) diff --git a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_diffusivity_Ecker2015.py b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_diffusivity_Ecker2015.py index bab3a1ff30..16eae77e65 100644 --- a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_diffusivity_Ecker2015.py +++ b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_diffusivity_Ecker2015.py @@ -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): @@ -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 diff --git a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015.csv b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015.csv index b414e0dc18..a578a7fa09 100644 --- a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015.csv +++ b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015.csv @@ -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 @@ -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 @@ -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 diff --git a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015_function.py b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015_function.py new file mode 100644 index 0000000000..606f145d55 --- /dev/null +++ b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/graphite_ocp_Ecker2015_function.py @@ -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 diff --git a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/parameters.csv b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/parameters.csv index a22776d17e..c77aa766cf 100644 --- a/input/parameters/lithium-ion/anodes/graphite_Ecker2015/parameters.csv +++ b/input/parameters/lithium-ion/anodes/graphite_Ecker2015/parameters.csv @@ -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,, diff --git a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_diffusivity_Ecker2015.py b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_diffusivity_Ecker2015.py index c8b4859d71..3f06ad3849 100644 --- a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_diffusivity_Ecker2015.py +++ b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_diffusivity_Ecker2015.py @@ -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 diff --git a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015.csv b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015.csv index 7cf1d11865..eb8776016f 100644 --- a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015.csv +++ b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015.csv @@ -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 diff --git a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015_function.py b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015_function.py new file mode 100644 index 0000000000..331fda3bc2 --- /dev/null +++ b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015_function.py @@ -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 diff --git a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/parameters.csv b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/parameters.csv index 955a116739..9091b0ad8b 100644 --- a/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/parameters.csv +++ b/input/parameters/lithium-ion/cathodes/LiNiCoO2_Ecker2015/parameters.csv @@ -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,, diff --git a/input/parameters/lithium-ion/experiments/1C_discharge_from_full_Ecker2015/parameters.csv b/input/parameters/lithium-ion/experiments/1C_discharge_from_full_Ecker2015/parameters.csv index 431a56ed98..d072ec6fd2 100644 --- a/input/parameters/lithium-ion/experiments/1C_discharge_from_full_Ecker2015/parameters.csv +++ b/input/parameters/lithium-ion/experiments/1C_discharge_from_full_Ecker2015/parameters.csv @@ -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,, diff --git a/input/parameters/lithium-ion/separators/separator_Ecker2015/parameters.csv b/input/parameters/lithium-ion/separators/separator_Ecker2015/parameters.csv index 3b23139927..bde09b5488 100644 --- a/input/parameters/lithium-ion/separators/separator_Ecker2015/parameters.csv +++ b/input/parameters/lithium-ion/separators/separator_Ecker2015/parameters.csv @@ -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,, diff --git a/pybamm/parameters/standard_parameters_lithium_ion.py b/pybamm/parameters/standard_parameters_lithium_ion.py index 99e983bf27..23b37fb258 100644 --- a/pybamm/parameters/standard_parameters_lithium_ion.py +++ b/pybamm/parameters/standard_parameters_lithium_ion.py @@ -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)