Skip to content

Commit

Permalink
#729 add experimental data
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimms committed Mar 27, 2020
1 parent 0f28a37 commit 5e9e3c9
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 92 deletions.
180 changes: 177 additions & 3 deletions examples/notebooks/compare-ecker-data.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pybamm/expression_tree/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def shape(self):
)
# Pick a y that won't cause RuntimeWarnings
y = np.linspace(0.1, 0.9, min_y_size)
evaluated_self = self.evaluate(0, y, y)
evaluated_self = self.evaluate(0, y, y, inputs="shape test")

# Return shape of evaluated object
if isinstance(evaluated_self, numbers.Number):
Expand Down
62 changes: 31 additions & 31 deletions pybamm/input/discharge_data/Ecker_1C.csv
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
0.042382325553453,4.10984760218981
0.286442281697757,4.06170981679401
0.516421855756812,4.02086563524606
0.821496800937191,3.98148017446767
1.10779790333724,3.94063599291972
1.39879246643237,3.91146157752832
1.71325433300291,3.87499355828908
1.99486197470788,3.84581914289769
2.29054999849809,3.81226856519758
2.59562494367847,3.79038775365404
2.8866195067736,3.76121333826264
3.19169445195398,3.73641508517996
3.47799555435403,3.7247453190234
3.77368357814424,3.70578194901899
4.06467814123938,3.69848834517114
4.35567270433451,3.68827729978416
4.6560541888198,3.67514881285803
4.96582259469527,3.66056160516233
5.26151061848548,3.63576335207965
5.54781172088553,3.60075405360997
5.84819320537082,3.55407498898374
6.13449430777087,3.51031336589665
6.43018233156108,3.47384534665741
6.73056381604638,3.43008372357031
6.97931723288577,3.38194593817451
7.2421510318104,3.30755117892646
7.41580907752846,3.21273432890442
7.54722597699078,3.11500003734325
7.62232134811211,3.01872446655165
7.69741671923343,2.89910936344693
7.75373824757442,2.76636577341609
20.3084233101775,4.10984760218981
137.255118370379,4.06170981679401
247.454888715569,4.02086563524606
393.638257540821,3.98148017446767
530.825726746058,3.94063599291972
670.262170856298,3.91146157752832
820.943489491555,3.87499355828908
955.88198379179,3.84581914289769
1097.56740280703,3.81226856519758
1243.75077163228,3.79038775365404
1383.18721574253,3.76121333826264
1529.37058456778,3.73641508517996
1666.55805377301,3.7247453190234
1808.24347278826,3.70578194901899
1947.6799168985,3.69848834517114
2087.11636100874,3.68827729978416
2231.05075492899,3.67514881285803
2379.48309865925,3.66056160516233
2521.16851767449,3.63576335207965
2658.35598687973,3.60075405360997
2802.29038079997,3.55407498898374
2939.47785000521,3.51031336589665
3081.16326902045,3.47384534665741
3225.0976629407,3.43008372357031
3344.29333290591,3.38194593817451
3470.23592758612,3.30755117892646
3553.44799907126,3.21273432890442
3616.41929641137,3.11500003734325
3652.40289489144,3.01872446655165
3688.3864933715,2.89910936344693
3715.37419223154,2.76636577341609
66 changes: 33 additions & 33 deletions pybamm/input/discharge_data/Ecker_5C.csv
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
-0.005659174238801,4.00772806063782
0.022016756115274,3.9630519063978
0.099509361106684,3.90466605332464
0.232353826806242,3.85148732048119
0.424855297935696,3.80418814691602
0.636268654807101,3.75781321732131
0.86305752854188,3.72697310974463
1.08215864384497,3.69851401469471
1.32047915522728,3.67723564231538
1.55879966660959,3.65476333775538
1.82787121171865,3.63351237271449
2.13538154898615,3.60393814158189
2.89262575450736,3.55566182788309
3.56146073806417,3.51924603989306
4.08422831141892,3.4910575923102
4.26873451377942,3.47331305363065
4.49167950829835,3.45679670630482
4.7415316573282,3.43791647603876
4.98369604792635,3.41067186867334
5.21432880087697,3.38938664445941
5.533370775792,3.35265909799465
5.75631577031094,3.32539736104271
5.99079240247741,3.29098230875862
6.20220575934881,3.25535276879001
6.41746299543606,3.214950926016
6.61734471465993,3.17572931175344
6.78647540015705,3.11737737526159
6.93254281035912,3.06736240853066
7.07092246212949,3.00540126815833
7.15164392566221,2.94219480684576
7.24005314762661,2.87660733300644
7.31693073194349,2.79787632742773
7.36690116174946,2.71195774734383
0,4.00772806063782
2.10996257174233,3.9630519063978
9.53641973294314,3.90466605332464
22.2674891521443,3.85148732048119
40.7157517827462,3.80418814691602
60.9764236014983,3.75781321732131
82.7105988252504,3.72697310974463
103.708022346502,3.69851401469471
126.547325124005,3.67723564231538
149.386627901507,3.65476333775538
175.172937489009,3.63351237271449
204.643005589013,3.60393814158189
277.21304828527,3.55566182788309
341.310446402776,3.51924603989306
391.409562172782,3.4910575923102
409.091603032784,3.47331305363065
430.457402405285,3.45679670630482
454.401832736538,3.43791647603876
477.60951136529,3.41067186867334
499.712062440292,3.38938664445941
530.287258094045,3.35265909799465
551.653057466548,3.32539736104271
574.123984392801,3.29098230875862
594.384656211552,3.25535276879001
615.013703881554,3.214950926016
634.169248146556,3.17572931175344
650.377785601557,3.11737737526159
664.37606794906,3.06736240853066
677.63759859406,3.00540126815833
685.373491470311,2.94219480684576
693.846136049062,2.87660733300644
701.213653074063,2.79787632742773
706.002539140314,2.71195774734383
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Electrode height [m],1.01E-01,,
Electrode width [m],8.50E-02,,
,,,
# Electrical,,,
Cell capacity [A.h], 0.15625,,
Cell capacity [A.h], 0.15625, 7.5/48 (parameter set for a single layer cell),
Typical current [A], 0.15652,,
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pybamm
from pybamm import exp
from scipy import constants


def electrolyte_diffusivity_Ecker2015(c_e, T, T_inf, E_D_e, R_g):
Expand Down Expand Up @@ -37,29 +37,16 @@ def electrolyte_diffusivity_Ecker2015(c_e, T, T_inf, E_D_e, R_g):
Solid diffusivity
"""

# Depends on electrolyte conductivity. Have just hard coded in now for
# convinience, but should be able to call the conductivity directly

# mol/m^3 to mol/l
cm = 1e-3 * c_e

# value at T = 296K
sigma_e_296 = 0.2667 * cm ** 3 - 1.2983 * cm ** 2 + 1.7919 * cm + 0.1726

# add temperature dependence
C = 296 * exp(E_D_e / (R_g * 296))
sigma_e = C * sigma_e_296 * exp(-E_D_e / (R_g * T)) / T

## Depends on the electrolyte conductivity
# E_k_e = pybamm.Parameter("Electrolyte conductivity activation energy [J.mol-1]")
# sigma_e = pybamm.FunctionParameter(
# "Electrolyte conductivity [S.m-1]", c_e, T, T_inf, E_k_e, R_g
# )
# The diffusivity epends on the electrolyte conductivity
E_k_e = pybamm.Parameter("Electrolyte conductivity activation energy [J.mol-1]")
sigma_e = pybamm.FunctionParameter(
"Electrolyte conductivity [S.m-1]", c_e, T, T_inf, E_k_e, R_g
)

# constants
k_b = 1.38 * 1e-23
F = 96487
q_e = 1.602 * 1e-19
k_b = constants.physical_constants["Boltzmann constant"][0]
F = constants.physical_constants["Faraday constant"][0]
q_e = constants.physical_constants["electron volt"][0]

D_c_e = (k_b / (F * q_e)) * sigma_e * T / c_e

Expand Down
3 changes: 2 additions & 1 deletion pybamm/parameters_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_parser(description):
"""
parser = argparse.ArgumentParser(description=description)
parser.add_argument(
"parameter_dir", type=str, help="Name of the parameter directory",
"parameter_dir", type=str, help="Name of the parameter directory"
)
parser.add_argument("battery_type", choices=["lithium-ion", "lead-acid"])
parser.add_argument(
Expand Down Expand Up @@ -150,6 +150,7 @@ def list_parameters(arguments=None):
Available package parameters:
* graphite_Chen2020
* graphite_mcmb2528_Marquis2019
* graphit_Ecker2015
* graphite_Kim2011
Available local parameters:
"""
Expand Down
2 changes: 2 additions & 0 deletions pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ def solve(
# to correspond to a single discharge
elif t_eval is None:
C_rate = self._parameter_values["C-rate"]
if isinstance(C_rate, pybamm.InputParameter):
C_rate = inputs["C-rate"]
try:
t_end = 3600 / C_rate
except TypeError:
Expand Down

0 comments on commit 5e9e3c9

Please sign in to comment.