Skip to content

Commit 1c32194

Browse files
#825 make transference number a function
1 parent f9d6143 commit 1c32194

File tree

15 files changed

+54
-40
lines changed

15 files changed

+54
-40
lines changed

pybamm/input/parameters/lead-acid/electrolytes/sulfuric_acid_Sulzer2019/parameters.csv

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Name [units],Value,Reference,Notes
44
# Electrolyte properties,,,
55
Typical electrolyte concentration [mol.m-3],5650,,
66
Cation transference number,0.7,,
7+
1 + dlnf/dlnc,1,,
78
Partial molar volume of water [m3.mol-1],1.75E-05,,
89
Partial molar volume of anions [m3.mol-1],3.15E-05,,
910
Partial molar volume of cations [m3.mol-1],1.35E-05,,

pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Kim2011/parameters.csv

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Name [units],Value,Reference,Notes
44
# Electrolyte properties,,,
55
Typical electrolyte concentration [mol.m-3],1200,,
66
Cation transference number,0.4,Reported as a function in Kim2011 (Implement later),
7+
1 + dlnf/dlnc,1,,
78
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Kim2011,,
89
Electrolyte conductivity [S.m-1],[function]electrolyte_conductivity_Kim2011,,
910
,,,

pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Marquis2019/parameters.csv

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Name [units],Value,Reference,Notes
44
# Electrolyte properties,,,
55
Typical electrolyte concentration [mol.m-3],1000,Scott Moura FastDFN,
66
Cation transference number,0.4,Scott Moura FastDFN,
7+
1 + dlnf/dlnc,1,,
78
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Capiglia1999,,
89
Electrolyte conductivity [S.m-1],[function]electrolyte_conductivity_Capiglia1999,,
910
,,,

pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Nyman2008/parameters.csv

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Name [units],Value,Reference,Notes
44
# Electrolyte properties,,,
55
Typical electrolyte concentration [mol.m-3],1000,Chen 2020,
66
Cation transference number,0.2594,Chen 2020,
7+
1 + dlnf/dlnc,1,,
78
Electrolyte diffusivity [m2.s-1],[function]electrolyte_diffusivity_Nyman2008,Nyman 2008," "
89
Electrolyte conductivity [S.m-1],[function]electrolyte_conductivity_Nyman2008,Nyman 2008," "
910
,,,

pybamm/models/full_battery_models/lead_acid/base_lead_acid_model.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ def set_reactions(self):
6363
icd = " interfacial current density"
6464
self.reactions = {
6565
"main": {
66-
"Negative": {"s": param.s_n, "aj": "Negative electrode" + icd},
67-
"Positive": {"s": param.s_p, "aj": "Positive electrode" + icd},
66+
"Negative": {"s": -param.s_plus_n_S, "aj": "Negative electrode" + icd},
67+
"Positive": {"s": -param.s_plus_p_S, "aj": "Positive electrode" + icd},
6868
}
6969
}
7070
if "oxygen" in self.options["side reactions"]:
7171
self.reactions["oxygen"] = {
7272
"Negative": {
73-
"s": -(param.s_plus_Ox + param.t_plus),
73+
"s": -param.s_plus_Ox,
7474
"s_ox": -param.s_ox_Ox,
7575
"aj": "Negative electrode oxygen" + icd,
7676
},
7777
"Positive": {
78-
"s": -(param.s_plus_Ox + param.t_plus),
78+
"s": -param.s_plus_Ox,
7979
"s_ox": -param.s_ox_Ox,
8080
"aj": "Positive electrode oxygen" + icd,
8181
},

pybamm/models/full_battery_models/lithium_ion/base_lithium_ion_model.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ def set_reactions(self):
4343
icd = " interfacial current density"
4444
self.reactions = {
4545
"main": {
46-
"Negative": {
47-
"s": 1 - self.param.t_plus,
48-
"aj": "Negative electrode" + icd,
49-
},
50-
"Positive": {
51-
"s": 1 - self.param.t_plus,
52-
"aj": "Positive electrode" + icd,
53-
},
46+
"Negative": {"s": 1, "aj": "Negative electrode" + icd},
47+
"Positive": {"s": 1, "aj": "Positive electrode" + icd},
5448
}
5549
}

pybamm/models/full_battery_models/lithium_ion/basic_dfn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def __init__(self, name="Doyle-Fuller-Newman model"):
264264
######################
265265
N_e = -tor * param.D_e(c_e, T) * pybamm.grad(c_e)
266266
self.rhs[c_e] = (1 / eps) * (
267-
-pybamm.div(N_e) / param.C_e + (1 - param.t_plus) * j / param.gamma_e
267+
-pybamm.div(N_e) / param.C_e + (1 - param.t_plus(c_e)) * j / param.gamma_e
268268
)
269269
self.boundary_conditions[c_e] = {
270270
"left": (pybamm.Scalar(0), "Neumann"),

pybamm/models/submodels/electrolyte/stefan_maxwell/diffusion/composite_stefan_maxwell_diffusion.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,16 @@ def set_rhs(self, variables):
7373
}
7474

7575
def _get_source_terms_leading_order(self, variables):
76+
param = self.param
77+
c_e_n = variables["Negative electrolyte concentration"]
78+
c_e_p = variables["Positive electrolyte concentration"]
79+
7680
return sum(
7781
pybamm.Concatenation(
78-
reaction["Negative"]["s"]
82+
(reaction["Negative"]["s"] - param.t_plus(c_e_n))
7983
* variables["Leading-order " + reaction["Negative"]["aj"].lower()],
8084
pybamm.FullBroadcast(0, "separator", "current collector"),
81-
reaction["Positive"]["s"]
85+
(reaction["Positive"]["s"] - param.t_plus(c_e_p))
8286
* variables["Leading-order " + reaction["Positive"]["aj"].lower()],
8387
)
8488
/ self.param.gamma_e

pybamm/models/submodels/electrolyte/stefan_maxwell/diffusion/first_order_stefan_maxwell_diffusion.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ def get_coupled_variables(self, variables):
5757

5858
# Right-hand sides
5959
rhs_n = d_epsc_n_0_dt - sum(
60-
reaction["Negative"]["s"]
60+
(reaction["Negative"]["s"] - param.t_plus(c_e_0))
6161
* variables[
6262
"Leading-order x-averaged " + reaction["Negative"]["aj"].lower()
6363
]
6464
for reaction in self.reactions.values()
6565
)
6666
rhs_s = d_epsc_s_0_dt
6767
rhs_p = d_epsc_p_0_dt - sum(
68-
reaction["Positive"]["s"]
68+
(reaction["Positive"]["s"] - param.t_plus(c_e_0))
6969
* variables[
7070
"Leading-order x-averaged " + reaction["Positive"]["aj"].lower()
7171
]

pybamm/models/submodels/electrolyte/stefan_maxwell/diffusion/full_stefan_maxwell_diffusion.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@ def set_rhs(self, variables):
5959
deps_dt = variables["Porosity change"]
6060
c_e = variables["Electrolyte concentration"]
6161
N_e = variables["Electrolyte flux"]
62-
# i_e = variables["Electrolyte current density"]
62+
c_e_n = variables["Negative electrolyte concentration"]
63+
c_e_p = variables["Positive electrolyte concentration"]
6364

64-
# source_term = ((param.s - param.t_plus) / param.gamma_e) * pybamm.div(i_e)
65-
# source_term = pybamm.div(i_e) / param.gamma_e # lithium-ion
6665
source_terms = sum(
6766
pybamm.Concatenation(
68-
reaction["Negative"]["s"] * variables[reaction["Negative"]["aj"]],
67+
(reaction["Negative"]["s"] - param.t_plus(c_e_n))
68+
* variables[reaction["Negative"]["aj"]],
6969
pybamm.FullBroadcast(0, "separator", "current collector"),
70-
reaction["Positive"]["s"] * variables[reaction["Positive"]["aj"]],
70+
(reaction["Positive"]["s"] - param.t_plus(c_e_p))
71+
* variables[reaction["Positive"]["aj"]],
7172
)
7273
/ param.gamma_e
7374
for reaction in self.reactions.values()

pybamm/models/submodels/electrolyte/stefan_maxwell/diffusion/leading_stefan_maxwell_diffusion.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ def set_rhs(self, variables):
6060

6161
source_terms = sum(
6262
param.l_n
63-
* rxn["Negative"]["s"]
63+
* (rxn["Negative"]["s"] - param.t_plus(c_e_av))
6464
* variables["X-averaged " + rxn["Negative"]["aj"].lower()]
6565
+ param.l_p
66-
* rxn["Positive"]["s"]
66+
* (rxn["Positive"]["s"] - param.t_plus(c_e_av))
6767
* variables["X-averaged " + rxn["Positive"]["aj"].lower()]
6868
for rxn in self.reactions.values()
6969
)

pybamm/parameters/standard_parameters_lead_acid.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
# Electrolyte properties
5151
c_e_typ = pybamm.Parameter("Typical electrolyte concentration [mol.m-3]")
52-
t_plus = pybamm.Parameter("Cation transference number")
5352
V_w = pybamm.Parameter("Partial molar volume of water [m3.mol-1]")
5453
V_plus = pybamm.Parameter("Partial molar volume of cations [m3.mol-1]")
5554
V_minus = pybamm.Parameter("Partial molar volume of anions [m3.mol-1]")
@@ -171,6 +170,11 @@
171170
"2. Dimensional Functions"
172171

173172

173+
def t_plus(c_e):
174+
"Dimensionless transference number (i.e. c_e is dimensional)"
175+
return pybamm.FunctionParameter("Cation transference number", c_e * c_e_typ)
176+
177+
174178
def D_e_dimensional(c_e, T):
175179
"Dimensional diffusivity in electrolyte"
176180
return pybamm.FunctionParameter("Electrolyte diffusivity [m2.s-1]", c_e)
@@ -310,7 +314,7 @@ def U_p_dimensional(c_e, T):
310314
centre_z_tab_p = pybamm.geometric_parameters.centre_z_tab_p
311315

312316
# Diffusive kinematic relationship coefficient
313-
omega_i = c_e_typ * M_e / rho_typ * (t_plus + M_minus / M_e)
317+
omega_i = c_e_typ * M_e / rho_typ * (t_plus(1) + M_minus / M_e)
314318
# Migrative kinematic relationship coefficient (electrolyte)
315319
omega_c_e = c_e_typ * M_e / rho_typ * (1 - M_w * V_e / V_w * M_e)
316320
C_e = tau_diffusion_e / tau_discharge
@@ -347,12 +351,10 @@ def U_p_dimensional(c_e, T):
347351
# Main
348352
s_plus_n_S = s_plus_n_S_dim / ne_n_S
349353
s_plus_p_S = s_plus_p_S_dim / ne_p_S
350-
s_n = -(s_plus_n_S + t_plus) # Dimensionless rection rate (neg)
351-
s_p = -(s_plus_p_S + t_plus) # Dimensionless rection rate (pos)
352-
s = pybamm.Concatenation(
353-
pybamm.FullBroadcast(s_n, ["negative electrode"], "current collector"),
354+
s_plus_S = pybamm.Concatenation(
355+
pybamm.FullBroadcast(s_plus_n_S, ["negative electrode"], "current collector"),
354356
pybamm.FullBroadcast(0, ["separator"], "current collector"),
355-
pybamm.FullBroadcast(s_p, ["positive electrode"], "current collector"),
357+
pybamm.FullBroadcast(s_plus_p_S, ["positive electrode"], "current collector"),
356358
)
357359
j0_n_S_ref = j0_n_S_ref_dimensional / interfacial_current_scale_n
358360
j0_p_S_ref = j0_p_S_ref_dimensional / interfacial_current_scale_p
@@ -407,7 +409,9 @@ def U_p_dimensional(c_e, T):
407409
) / potential_scale
408410

409411
# Electrolyte volumetric capacity
410-
Q_e_max = (l_n * eps_n_max + l_s * eps_s_max + l_p * eps_p_max) / (s_p - s_n)
412+
Q_e_max = (l_n * eps_n_max + l_s * eps_s_max + l_p * eps_p_max) / (
413+
s_plus_n_S - s_plus_p_S
414+
)
411415
Q_e_max_dimensional = Q_e_max * c_e_typ * F
412416
capacity = Q_e_max_dimensional * n_electrodes_parallel * A_cs * L_x
413417

@@ -490,7 +494,7 @@ def kappa_e(c_e, T):
490494
def chi(c_e, c_ox=0, c_hy=0):
491495
return (
492496
chi_dimensional(c_e_typ * c_e)
493-
* (2 * (1 - t_plus))
497+
* (2 * (1 - t_plus(c_e)))
494498
/ (V_w * c_T(c_e_typ * c_e, c_e_typ * c_ox, c_e_typ * c_hy))
495499
)
496500

pybamm/parameters/standard_parameters_lithium_ion.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,24 @@ def U_p_dimensional(sto, T):
326326
alpha_prime = alpha / delta
327327

328328
# Electrolyte Properties
329-
t_plus = pybamm.Parameter("Cation transference number")
329+
330+
331+
def t_plus(c_e):
332+
return pybamm.FunctionParameter("Cation transference number", c_e)
333+
334+
335+
def one_plus_dlnf_dlnc(c_e):
336+
return pybamm.FunctionParameter("1 + dlnf/dlnc", c_e)
337+
338+
330339
beta_surf = pybamm.Scalar(0)
331-
s = 1 - t_plus
332340

333341

334342
# (1-2*t_plus) is for Nernst-Planck
335343
# 2*(1-t_plus) for Stefan-Maxwell
336344
# Bizeray et al (2016) "Resolving a discrepancy ..."
337-
# note: this is a function for consistancy with lead-acid
338345
def chi(c_e):
339-
return 2 * (1 - t_plus)
346+
return (2 * (1 - t_plus(c_e))) * (one_plus_dlnf_dlnc(c_e))
340347

341348

342349
# Electrochemical Reactions

tests/unit/test_models/test_submodels/test_electrolyte/test_stefan_maxwell/test_diffusion/test_leading_stefan_maxwell_diffusion.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def test_public_functions(self):
1313
reactions = {
1414
"main": {
1515
"Negative": {
16-
"s": param.s_n,
16+
"s": -param.s_plus_n_S,
1717
"aj": "Negative electrode interfacial current density",
1818
},
1919
"Positive": {
20-
"s": param.s_p,
20+
"s": -param.s_plus_p_S,
2121
"aj": "Positive electrode interfacial current density",
2222
},
2323
}

tests/unit/test_parameters/test_standard_parameters_lead_acid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_parameters_defaults_lead_acid(self):
5050

5151
def test_concatenated_parameters(self):
5252
# create
53-
s_param = pybamm.standard_parameters_lead_acid.s
53+
s_param = pybamm.standard_parameters_lead_acid.s_plus_S
5454
self.assertIsInstance(s_param, pybamm.Concatenation)
5555
self.assertEqual(
5656
s_param.domain, ["negative electrode", "separator", "positive electrode"]

0 commit comments

Comments
 (0)