From 2750870fa767d0cb5cfab5a744aeeabd10bdabb6 Mon Sep 17 00:00:00 2001 From: Robert Timms Date: Wed, 30 Oct 2019 10:24:40 +0000 Subject: [PATCH] #678 adding missing electrolyte temp dependence --- .../base_electrolyte_conductivity.py | 2 +- ...igher_order_stefan_maxwell_conductivity.py | 33 +++++++++++-------- .../full_stefan_maxwell_conductivity.py | 3 +- ...urface_form_stefan_maxwell_conductivity.py | 16 ++++++--- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/pybamm/models/submodels/electrolyte/base_electrolyte_conductivity.py b/pybamm/models/submodels/electrolyte/base_electrolyte_conductivity.py index cb3c49e64f..b282465c7b 100644 --- a/pybamm/models/submodels/electrolyte/base_electrolyte_conductivity.py +++ b/pybamm/models/submodels/electrolyte/base_electrolyte_conductivity.py @@ -258,7 +258,7 @@ def _get_domain_current_variables(self, i_e, domain=None): def _get_whole_cell_variables(self, variables): """ A private function to obtain the potential and current concatenated - across the whole cell. Note required 'variables' to contain the potential + across the whole cell. Note: requires 'variables' to contain the potential and current in the subdomains: 'negative electrode', 'separator', and 'positive electrode'. diff --git a/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/base_higher_order_stefan_maxwell_conductivity.py b/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/base_higher_order_stefan_maxwell_conductivity.py index 0b482ba956..b6c5bf756c 100644 --- a/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/base_higher_order_stefan_maxwell_conductivity.py +++ b/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/base_higher_order_stefan_maxwell_conductivity.py @@ -48,11 +48,10 @@ def get_coupled_variables(self, variables): eps_s_av = variables["Leading-order x-averaged separator porosity"] eps_p_av = variables["Leading-order x-averaged positive electrode porosity"] - # Note: here we want the average of the temperature over the negative - # electrode, separator and positive electrode (not including the current - # collectors) - T = variables["Cell temperature"] - T_av = pybamm.x_average(T) + T_av = variables["X-averaged cell temperature"] + T_av_n = pybamm.PrimaryBroadcast(T_av, "negative electrode") + T_av_s = pybamm.PrimaryBroadcast(T_av, "separator") + T_av_p = pybamm.PrimaryBroadcast(T_av, "positive electrode") c_e_n, c_e_s, c_e_p = c_e.orphans @@ -90,6 +89,7 @@ def get_coupled_variables(self, variables): + phi_s_n_av - ( chi_av + * (1 + param.Theta * T_av) * pybamm.x_average( self._higher_order_macinnes_function( c_e_n / pybamm.PrimaryBroadcast(c_e_av, "negative electrode") @@ -106,6 +106,7 @@ def get_coupled_variables(self, variables): pybamm.PrimaryBroadcast(phi_e_const, "negative electrode") + ( chi_av_n + * (1 + param.Theta * T_av_n) * self._higher_order_macinnes_function( c_e_n / pybamm.PrimaryBroadcast(c_e_av, "negative electrode") ) @@ -124,6 +125,7 @@ def get_coupled_variables(self, variables): pybamm.PrimaryBroadcast(phi_e_const, "separator") + ( chi_av_s + * (1 + param.Theta * T_av_s) * self._higher_order_macinnes_function( c_e_s / pybamm.PrimaryBroadcast(c_e_av, "separator") ) @@ -137,6 +139,7 @@ def get_coupled_variables(self, variables): pybamm.PrimaryBroadcast(phi_e_const, "positive electrode") + ( chi_av_p + * (1 + param.Theta * T_av_p) * self._higher_order_macinnes_function( c_e_p / pybamm.PrimaryBroadcast(c_e_av, "positive electrode") ) @@ -155,15 +158,19 @@ def get_coupled_variables(self, variables): phi_e_av = pybamm.x_average(phi_e) # concentration overpotential - eta_c_av = chi_av * ( - pybamm.x_average( - self._higher_order_macinnes_function( - c_e_p / pybamm.PrimaryBroadcast(c_e_av, "positive electrode") + eta_c_av = ( + chi_av + * (1 + param.Theta * T_av) + * ( + pybamm.x_average( + self._higher_order_macinnes_function( + c_e_p / pybamm.PrimaryBroadcast(c_e_av, "positive electrode") + ) ) - ) - - pybamm.x_average( - self._higher_order_macinnes_function( - c_e_n / pybamm.PrimaryBroadcast(c_e_av, "negative electrode") + - pybamm.x_average( + self._higher_order_macinnes_function( + c_e_n / pybamm.PrimaryBroadcast(c_e_av, "negative electrode") + ) ) ) ) diff --git a/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/full_stefan_maxwell_conductivity.py b/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/full_stefan_maxwell_conductivity.py index 536c989094..f4fae2f790 100644 --- a/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/full_stefan_maxwell_conductivity.py +++ b/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/full_stefan_maxwell_conductivity.py @@ -39,7 +39,8 @@ def get_coupled_variables(self, variables): phi_e = variables["Electrolyte potential"] i_e = (param.kappa_e(c_e, T) * (eps ** param.b) * param.gamma_e / param.C_e) * ( - param.chi(c_e) * pybamm.grad(c_e) / c_e - pybamm.grad(phi_e) + param.chi(c_e) * (1 + param.Theta * T) * pybamm.grad(c_e) / c_e + - pybamm.grad(phi_e) ) variables.update(self._get_standard_current_variables(i_e)) diff --git a/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/surface_potential_form/full_surface_form_stefan_maxwell_conductivity.py b/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/surface_potential_form/full_surface_form_stefan_maxwell_conductivity.py index 5059986287..0c49892b9a 100644 --- a/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/surface_potential_form/full_surface_form_stefan_maxwell_conductivity.py +++ b/pybamm/models/submodels/electrolyte/stefan_maxwell/conductivity/surface_potential_form/full_surface_form_stefan_maxwell_conductivity.py @@ -73,13 +73,17 @@ def set_boundary_conditions(self, variables): i_boundary_cc = variables["Current collector current density"] c_e = variables[self.domain + " electrolyte concentration"] delta_phi = variables[self.domain + " electrode surface potential difference"] + T = variables["Cell temperature"] if self.domain == "Negative": c_e_flux = pybamm.BoundaryGradient(c_e, "right") flux_left = -i_boundary_cc * pybamm.BoundaryValue(1 / sigma_eff, "left") flux_right = ( (i_boundary_cc / pybamm.BoundaryValue(conductivity, "right")) - - pybamm.BoundaryValue(param.chi(c_e) / c_e, "right") * c_e_flux + - pybamm.BoundaryValue( + (1 + param.Theta * T) * param.chi(c_e) / c_e, "right" + ) + * c_e_flux - i_boundary_cc * pybamm.BoundaryValue(1 / sigma_eff, "right") ) @@ -92,7 +96,10 @@ def set_boundary_conditions(self, variables): c_e_flux = pybamm.BoundaryGradient(c_e, "left") flux_left = ( (i_boundary_cc / pybamm.BoundaryValue(conductivity, "left")) - - pybamm.BoundaryValue(param.chi(c_e) / c_e, "left") * c_e_flux + - pybamm.BoundaryValue( + (1 + param.Theta * T) * param.chi(c_e) / c_e, "left" + ) + * c_e_flux - i_boundary_cc * pybamm.BoundaryValue(1 / sigma_eff, "left") ) flux_right = -i_boundary_cc * pybamm.BoundaryValue(1 / sigma_eff, "right") @@ -152,9 +159,10 @@ def _get_neg_pos_coupled_variables(self, variables): i_boundary_cc = variables["Current collector current density"] c_e = variables[self.domain + " electrolyte concentration"] delta_phi = variables[self.domain + " electrode surface potential difference"] + T = variables[self.domain + " temperature"] i_e = conductivity * ( - (param.chi(c_e) / c_e) * pybamm.grad(c_e) + ((1 + param.Theta * T) * param.chi(c_e) / c_e) * pybamm.grad(c_e) + pybamm.grad(delta_phi) + pybamm.PrimaryBroadcast(i_boundary_cc, self.domain_for_broadcast) / sigma_eff @@ -190,7 +198,7 @@ def _get_sep_coupled_variables(self, variables): phi_e_s = pybamm.PrimaryBroadcast( pybamm.boundary_value(phi_e_n, "right"), "separator" ) + pybamm.IndefiniteIntegral( - chi_e_s / c_e_s * pybamm.grad(c_e_s) + (1 + param.Theta * T) * chi_e_s / c_e_s * pybamm.grad(c_e_s) - param.C_e * pybamm.PrimaryBroadcast(i_boundary_cc, self.domain_for_broadcast) / kappa_s_eff,