Skip to content

Commit

Permalink
Merge pull request #1317 from brosaplanella/issue-1063-tplus-temperat…
Browse files Browse the repository at this point in the history
…ure-dependent

Issue 1063 tplus temperature dependent
  • Loading branch information
brosaplanella authored Jan 4, 2021
2 parents faa3167 + 17cbfb7 commit cd833d0
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features

- Added temperature dependence to the transference number (`t_plus`) ([1317](https://github.com/pybamm-team/PyBaMM/pull/1317))
- Added new functionality for `Interpolant` ([#1312](https://github.com/pybamm-team/PyBaMM/pull/1312))
- Added option to express experiments (and extract solutions) in terms of cycles of operating condition ([#1309](https://github.com/pybamm-team/PyBaMM/pull/1309))
- The event time and state are now returned as part of `Solution.t` and `Solution.y` so that the event is accurately captured in the returned solution ([#1300](https://github.com/pybamm-team/PyBaMM/pull/1300))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np


def electrolyte_TDF_EC_DMC_1_1_Landesfeind2019(c_e, T=298.15):
def electrolyte_TDF_EC_DMC_1_1_Landesfeind2019(c_e, T):
"""
Thermodynamic factor (TDF) of LiPF6 in EC:DMC (1:1 w:w) as a function of ion
concentration and temperature. The data comes from [1].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np


def electrolyte_transference_number_EC_DMC_1_1_Landesfeind2019(c_e, T=298.15):
def electrolyte_transference_number_EC_DMC_1_1_Landesfeind2019(c_e, T):
"""
Transference number of LiPF6 in EC:DMC (1:1 w:w) as a function of ion
concentration and temperature. The data comes from [1].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np


def electrolyte_TDF_EC_EMC_3_7_Landesfeind2019(c_e, T=298.15):
def electrolyte_TDF_EC_EMC_3_7_Landesfeind2019(c_e, T):
"""
Thermodynamic factor (TDF) of LiPF6 in EC:EMC (3:7 w:w) as a function of ion
concentration and temperature. The data comes from [1].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np


def electrolyte_transference_number_EC_EMC_3_7_Landesfeind2019(c_e, T=298.15):
def electrolyte_transference_number_EC_EMC_3_7_Landesfeind2019(c_e, T):
"""
Transference number of LiPF6 in EC:EMC (3:7 w:w) as a function of ion
concentration and temperature. The data comes from [1].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np


def electrolyte_TDF_EMC_FEC_19_1_Landesfeind2019(c_e, T=298.15):
def electrolyte_TDF_EMC_FEC_19_1_Landesfeind2019(c_e, T):
"""
Thermodyamic factor (TDF) of LiPF6 in EMC:FEC (19:1 w:w) as a function of ion
concentration and temperature. The data comes from [1].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np


def electrolyte_transference_number_EMC_FEC_19_1_Landesfeind2019(c_e, T=298.15):
def electrolyte_transference_number_EMC_FEC_19_1_Landesfeind2019(c_e, T):
"""
Transference number of LiPF6 in EMC:FEC (19:1 w:w) as a function of ion
concentration and temperature. The data comes from [1].
Expand Down
2 changes: 1 addition & 1 deletion pybamm/models/full_battery_models/lead_acid/basic_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def __init__(self, name="Basic full model"):
######################
N_e = (
-tor * param.D_e(c_e, T) * pybamm.grad(c_e)
+ param.C_e * param.t_plus(c_e) * i_e / param.gamma_e
+ param.C_e * param.t_plus(c_e, T) * i_e / param.gamma_e
+ param.C_e * c_e * v
)
s = pybamm.Concatenation(
Expand Down
3 changes: 2 additions & 1 deletion pybamm/models/full_battery_models/lithium_ion/basic_dfn.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ def __init__(self, name="Doyle-Fuller-Newman model"):
######################
N_e = -tor * param.D_e(c_e, T) * pybamm.grad(c_e)
self.rhs[c_e] = (1 / eps) * (
-pybamm.div(N_e) / param.C_e + (1 - param.t_plus(c_e)) * j / param.gamma_e
-pybamm.div(N_e) / param.C_e
+ (1 - param.t_plus(c_e, T)) * j / param.gamma_e
)
self.boundary_conditions[c_e] = {
"left": (pybamm.Scalar(0), "Neumann"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,11 @@ def __init__(self, name="Doyle-Fuller-Newman half cell model", options=None):
######################
N_e = -tor * param.D_e(c_e, T) * pybamm.grad(c_e)
self.rhs[c_e] = (1 / eps) * (
-pybamm.div(N_e) / param.C_e + (1 - param.t_plus(c_e)) * j / param.gamma_e
-pybamm.div(N_e) / param.C_e
+ (1 - param.t_plus(c_e, T)) * j / param.gamma_e
)
dce_dx = (
-(1 - param.t_plus(c_e))
-(1 - param.t_plus(c_e, T))
* i_cell
* param.C_e
/ (tor * param.gamma_e * param.D_e(c_e, T))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_coupled_variables(self, variables):
param = self.param

N_e_diffusion = -tor_0 * param.D_e(c_e_0_av, T_0) * pybamm.grad(c_e)
N_e_migration = param.C_e * param.t_plus(c_e) * i_e / param.gamma_e
N_e_migration = param.C_e * param.t_plus(c_e, T_0) * i_e / param.gamma_e
N_e_convection = param.C_e * c_e_0_av * v_box_0

N_e = N_e_diffusion + N_e_migration + N_e_convection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ def get_coupled_variables(self, variables):
]
rhs_n = (
d_epsc_n_0_dt
- (sum_s_j_n_0 - param.t_plus(c_e_0) * sum_j_n_0) / param.gamma_e
- (sum_s_j_n_0 - param.t_plus(c_e_0, T_0) * sum_j_n_0) / param.gamma_e
)
rhs_s = d_epsc_s_0_dt
rhs_p = (
d_epsc_p_0_dt
- (sum_s_j_p_0 - param.t_plus(c_e_0) * sum_j_p_0) / param.gamma_e
- (sum_s_j_p_0 - param.t_plus(c_e_0, T_0) * sum_j_p_0) / param.gamma_e
)

# Diffusivities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_coupled_variables(self, variables):
param = self.param

N_e_diffusion = -tor * param.D_e(c_e, T) * pybamm.grad(c_e)
N_e_migration = param.C_e * param.t_plus(c_e) * i_e / param.gamma_e
N_e_migration = param.C_e * param.t_plus(c_e, T) * i_e / param.gamma_e
N_e_convection = param.C_e * c_e * v_box

N_e = N_e_diffusion + N_e_migration + N_e_convection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def set_rhs(self, variables):

c_e_av = variables["X-averaged electrolyte concentration"]

T_av = variables["X-averaged cell temperature"]

eps_n_av = variables["X-averaged negative electrode porosity"]
eps_s_av = variables["X-averaged separator porosity"]
eps_p_av = variables["X-averaged positive electrode porosity"]
Expand All @@ -84,8 +86,8 @@ def set_rhs(self, variables):
"Sum of x-averaged positive electrode electrolyte reaction source terms"
]
source_terms = (
param.l_n * (sum_s_j_n_0 - param.t_plus(c_e_av) * sum_j_n_0)
+ param.l_p * (sum_s_j_p_0 - param.t_plus(c_e_av) * sum_j_p_0)
param.l_n * (sum_s_j_n_0 - param.t_plus(c_e_av, T_av) * sum_j_n_0)
+ param.l_p * (sum_s_j_p_0 - param.t_plus(c_e_av, T_av) * sum_j_p_0)
) / param.gamma_e

self.rhs = {
Expand Down
6 changes: 3 additions & 3 deletions pybamm/parameters/lead_acid_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _set_dimensional_parameters(self):
self.R_sei_dimensional = pybamm.Scalar(0)
self.beta_sei_n = pybamm.Scalar(0)

def t_plus(self, c_e):
def t_plus(self, c_e, T):
"Dimensionless transference number (i.e. c_e is dimensionless)"
inputs = {"Electrolyte concentration [mol.m-3]": c_e * self.c_e_typ}
return pybamm.FunctionParameter("Cation transference number", inputs)
Expand Down Expand Up @@ -440,7 +440,7 @@ def _set_dimensionless_parameters(self):
self.c_e_typ
* self.M_e
/ self.rho_typ
* (self.t_plus(1) + self.M_minus / self.M_e)
* (self.t_plus(1, self.T_ref) + self.M_minus / self.M_e)
)
# Migrative kinematic relationship coefficient (electrolyte)
self.omega_c_e = (
Expand Down Expand Up @@ -700,7 +700,7 @@ def chi(self, c_e, T, c_ox=0, c_hy=0):
"Thermodynamic factor"
return (
self.chi_dimensional(self.c_e_typ * c_e)
* (2 * (1 - self.t_plus(c_e)))
* (2 * (1 - self.t_plus(c_e, T)))
/ (
self.V_w
* self.c_T(self.c_e_typ * c_e, self.c_e_typ * c_ox, self.c_e_typ * c_hy)
Expand Down
12 changes: 8 additions & 4 deletions pybamm/parameters/lithium_ion_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,18 @@ def chi(self, c_e, T):
2*(1-t_plus) for Stefan-Maxwell,
see Bizeray et al (2016) "Resolving a discrepancy ...".
"""
return (2 * (1 - self.t_plus(c_e))) * (self.one_plus_dlnf_dlnc(c_e, T))
return (2 * (1 - self.t_plus(c_e, T))) * (self.one_plus_dlnf_dlnc(c_e, T))

def t_plus(self, c_e):
"Dimensionless transference number (i.e. c_e is dimensionless)"
inputs = {"Electrolyte concentration [mol.m-3]": c_e * self.c_e_typ}
def t_plus(self, c_e, T):
"Cation transference number (dimensionless)"
inputs = {
"Electrolyte concentration [mol.m-3]": c_e * self.c_e_typ,
"Temperature [K]": self.Delta_T * T + self.T_ref,
}
return pybamm.FunctionParameter("Cation transference number", inputs)

def one_plus_dlnf_dlnc(self, c_e, T):
"Thermodynamic factor (dimensionless)"
inputs = {
"Electrolyte concentration [mol.m-3]": c_e * self.c_e_typ,
"Temperature [K]": self.Delta_T * T + self.T_ref,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_public_functions(self):
"Sum of x-averaged negative electrode electrolyte reaction source terms": a,
"Sum of x-averaged positive electrode electrolyte reaction source terms": a,
"X-averaged separator transverse volume-averaged acceleration": a,
"X-averaged cell temperature": a,
}
submodel = pybamm.electrolyte_diffusion.LeadingOrder(param)
std_tests = tests.StandardSubModelTests(submodel, variables)
Expand Down

0 comments on commit cd833d0

Please sign in to comment.