diff --git a/pybamm/input/parameters/lead-acid/anodes/lead_Sulzer2019/parameters.csv b/pybamm/input/parameters/lead-acid/anodes/lead_Sulzer2019/parameters.csv index 56fc70558f..e57bb5b5bd 100644 --- a/pybamm/input/parameters/lead-acid/anodes/lead_Sulzer2019/parameters.csv +++ b/pybamm/input/parameters/lead-acid/anodes/lead_Sulzer2019/parameters.csv @@ -34,3 +34,10 @@ Electrons in hydrogen reaction,2,, Negative electrode reference exchange-current density (hydrogen) [A.m-2],1.56E-11,srinivasan2003mathematical, Hydrogen reference OCP vs SHE [V],0,srinivasan2003mathematical, Negative electrode double-layer capacity [F.m-2],0.2,, +,,, +# Density,,, +Negative electrode density [kg.m-3],113400,CRC Handbook of Chemistry and Physics, +,,, +# Thermal parameters,,, +Negative electrode specific heat capacity [J.kg-1.K-1],130,CRC Handbook of Chemistry and Physics, +Negative electrode thermal conductivity [W.m-1.K-1],35,CRC Handbook of Chemistry and Physics, diff --git a/pybamm/input/parameters/lead-acid/cathodes/lead_dioxide_Sulzer2019/parameters.csv b/pybamm/input/parameters/lead-acid/cathodes/lead_dioxide_Sulzer2019/parameters.csv index cd38f78b40..eba7599301 100644 --- a/pybamm/input/parameters/lead-acid/cathodes/lead_dioxide_Sulzer2019/parameters.csv +++ b/pybamm/input/parameters/lead-acid/cathodes/lead_dioxide_Sulzer2019/parameters.csv @@ -34,3 +34,10 @@ Electrons in hydrogen reaction,2,, Positive electrode reference exchange-current density (hydrogen) [A.m-2],0,srinivasan2003mathematical, Hydrogen reference OCP vs SHE [V],0,srinivasan2003mathematical, Positive electrode double-layer capacity [F.m-2],0.2,, +,,, +# Density,,, +Positive electrode density [kg.m-3],9375,Pubchem, +,,, +# Thermal parameters,,, +Positive electrode specific heat capacity [J.kg-1.K-1],256,NIST Chemistry WebBook SRD69, +Positive electrode thermal conductivity [W.m-1.K-1],35,assume same as lead, diff --git a/pybamm/input/parameters/lead-acid/cells/BBOXX_Sulzer2019/parameters.csv b/pybamm/input/parameters/lead-acid/cells/BBOXX_Sulzer2019/parameters.csv index 85bebe1816..5a5f2bfb84 100644 --- a/pybamm/input/parameters/lead-acid/cells/BBOXX_Sulzer2019/parameters.csv +++ b/pybamm/input/parameters/lead-acid/cells/BBOXX_Sulzer2019/parameters.csv @@ -2,9 +2,11 @@ Name [units],Value,Reference,Notes # Empty rows and rows starting with ‘#’ will be ignored,,, ,,, # Macroscale geometry,,, +Negative current collector thickness [m],0,, Negative electrode thickness [m],0.0009,Manufacturer, Separator thickness [m],0.0015,Manufacturer, Positive electrode thickness [m],0.00125,Manufacturer, +Positive current collector thickness [m],0,, Electrode height [m],0.114,Manufacturer, Electrode width [m],0.065,Manufacturer, Negative tab width [m],0.04,,Estimated value @@ -17,3 +19,18 @@ Positive tab centre z-coordinate [m],0.114,Tab at top, # Electrical,,, Cell capacity [A.h],17,Manufacturer, Typical current [A],1,, + +,,, +# Density,,, +Negative current collector density [kg.m-3],11300, same as electrode, +Positive current collector density [kg.m-3],9375,same as electrode, + +,,, +# Specific heat capacity,,, +Negative current collector specific heat capacity [J.kg-1.K-1],130,CRC Handbook of Chemistry and Physics, +Positive current collector specific heat capacity [J.kg-1.K-1],256,NIST Chemistry WebBook SRD69, +,,, +# Thermal conductivity,,, +Negative current collector thermal conductivity [W.m-1.K-1],35,CRC Handbook of Chemistry and Physics, +Positive current collector thermal conductivity [W.m-1.K-1],35,assume same as lead, + diff --git a/pybamm/input/parameters/lead-acid/experiments/1C_discharge_from_full/parameters.csv b/pybamm/input/parameters/lead-acid/experiments/1C_discharge_from_full/parameters.csv index 40bbce3e54..063e70a78b 100644 --- a/pybamm/input/parameters/lead-acid/experiments/1C_discharge_from_full/parameters.csv +++ b/pybamm/input/parameters/lead-acid/experiments/1C_discharge_from_full/parameters.csv @@ -4,16 +4,16 @@ Name [units],Value,Reference,Notes # Temperature,,, Reference temperature [K],294.85,Room temperature, Maximum temperature [K],333.15,, -Ambient temperature [K], 298.15,, +Ambient temperature [K], 294.85,, Heat transfer coefficient [W.m-2.K-1],10,, - +Initial temperature [K],294.85,Room temperature, ,,, # Electrical Number of electrodes connected in parallel to make a cell,8,Manufacturer, Number of cells connected in series to make a battery,6,Manufacturer, -Lower voltage cut-off [V],1.73,,(just under) 10.5V across 6-cell battery -Upper voltage cut-off [V],2.44,,(just over) 14.5V across 6-cell battery +Lower voltage cut-off [V],1.73,(just under) 10.5V across 6-cell battery, +Upper voltage cut-off [V],2.44,(just over) 14.5V across 6-cell battery, C-rate,0.1,, ,,, # Initial conditions diff --git a/pybamm/input/parameters/lead-acid/separators/agm_Sulzer2019/parameters.csv b/pybamm/input/parameters/lead-acid/separators/agm_Sulzer2019/parameters.csv index 539bddd464..2b7f78e357 100644 --- a/pybamm/input/parameters/lead-acid/separators/agm_Sulzer2019/parameters.csv +++ b/pybamm/input/parameters/lead-acid/separators/agm_Sulzer2019/parameters.csv @@ -4,3 +4,6 @@ Name [units],Value,Reference,Notes Maximum porosity of separator,0.92,, Separator Bruggeman coefficient (electrolyte),1.5,, Separator Bruggeman coefficient (electrode),1.5,, +Separator density [kg.m-3],1680, Bulk density from Gigova 2006, +Separator specific heat capacity [J.kg-1.K-1],700, Electronics Cooling (fiberglass), +Separator thermal conductivity [W.m-1.K-1],0.04, University Physics Sears et al. 1999 (fiberglass), \ No newline at end of file diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1.py index 164382f1d3..2e9cf02686 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1.py @@ -21,11 +21,6 @@ def electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1(c_e, T, T_inf, E_k_e, R_ :`numpy.Array` Electrolyte diffusivity """ - coeffs = np.array([7.98e-1, - 2.28e2, - -1.22, - 5.09e-1, - -4e-3, - 3.79e-3]) + coeffs = np.array([7.98e-1, 2.28e2, -1.22, 5.09e-1, -4e-3, 3.79e-3]) return base.electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs) diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7.py index 40330ac1e0..978e9cf8c1 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7.py @@ -21,10 +21,5 @@ def electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7(c_e, T, T_inf, E_k_e, R_ :`numpy.Array` Electrolyte diffusivity """ - coeffs = np.array([5.21e-1, - 2.28e2, - -1.06, - 3.53e-1, - -3.59e-3, - 1.48e-3]) + coeffs = np.array([5.21e-1, 2.28e2, -1.06, 3.53e-1, -3.59e-3, 1.48e-3]) return base.electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs) diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1.py index 9c683adc94..fbeba02856 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1.py @@ -21,10 +21,5 @@ def electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1(c_e, T, T_inf, E_k_e, :`numpy.Array` Electrolyte diffusivity """ - coeffs = np.array([2.51e-2, - 1.75e2, - 1.23, - 2.05e-1, - -8.81e-2, - 2.83e-3]) + coeffs = np.array([2.51e-2, 1.75e2, 1.23, 2.05e-1, -8.81e-2, 2.83e-3]) return base.electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs) diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_base.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_base.py index 60fe7a1ed8..4a2e45b50b 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_base.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_base.py @@ -25,8 +25,8 @@ def electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs): c = c_e / 1000 # mol.m-3 -> mol.l p1, p2, p3, p4, p5, p6 = coeffs A = p1 * (1 + (T - p2)) - B = (1 + p3 * sqrt(c) + p4 * (1 + p5 * exp(1000 / T)) * c) - C = 1 + c**4 * (p6 * exp(1000 / T)) + B = 1 + p3 * sqrt(c) + p4 * (1 + p5 * exp(1000 / T)) * c + C = 1 + c ** 4 * (p6 * exp(1000 / T)) sigma_e = A * c * B / C # mS.cm-1 return sigma_e / 10 diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1.py index dbe94362ef..510cb02fb5 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1.py @@ -21,9 +21,6 @@ def electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1(c_e, T, T_inf, E_k_e, R_g :`numpy.Array` Electrolyte diffusivity """ - coeffs = np.array([1.47e3, - 1.33, - -1.69e3, - -5.63e2]) + coeffs = np.array([1.47e3, 1.33, -1.69e3, -5.63e2]) return base.electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs) diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7.py index 8af791f5df..108ffc1693 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7.py @@ -21,8 +21,5 @@ def electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7(c_e, T, T_inf, E_k_e, R_g :`numpy.Array` Electrolyte diffusivity """ - coeffs = np.array([1.01e3, - 1.01, - -1.56e3, - -4.87e2]) + coeffs = np.array([1.01e3, 1.01, -1.56e3, -4.87e2]) return base.electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs) diff --git a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1.py b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1.py index e83349fe46..871751e43e 100644 --- a/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1.py +++ b/pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1.py @@ -21,8 +21,5 @@ def electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1(c_e, T, T_inf, E_k_e, R :`numpy.Array` Electrolyte diffusivity """ - coeffs = np.array([5.86e2, - 1.33, - -1.38e3, - -5.82e2]) + coeffs = np.array([5.86e2, 1.33, -1.38e3, -5.82e2]) return base.electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs) diff --git a/pybamm/models/full_battery_models/base_battery_model.py b/pybamm/models/full_battery_models/base_battery_model.py index 60b2c77a98..80eda34696 100644 --- a/pybamm/models/full_battery_models/base_battery_model.py +++ b/pybamm/models/full_battery_models/base_battery_model.py @@ -43,8 +43,7 @@ class BaseBatteryModel(pybamm.BaseModel): Can be "Fickian diffusion" (default) or "fast diffusion". * "thermal" : str, optional Sets the thermal model to use. Can be "isothermal" (default), - "x-full", "x-lumped", "xyz-lumped" or "lumped". Must be "isothermal" for - lead-acid models. + "x-full", "x-lumped", "xyz-lumped" or "lumped". * "thermal current collector" : bool, optional Whether to include thermal effects in the current collector in one-dimensional models (default is False). Note that this option @@ -218,22 +217,21 @@ def options(self, extra_options): # Options that are incompatible with models if isinstance(self, pybamm.lithium_ion.BaseModel): - # if options["surface form"] is not False: - # raise pybamm.OptionError( - # "surface form not implemented for lithium-ion models" - # ) if options["convection"] is True: raise pybamm.OptionError( "convection not implemented for lithium-ion models" ) if isinstance(self, pybamm.lead_acid.BaseModel): - if options["thermal"] != "isothermal": + if options["thermal"] != "isothermal" and options["dimensionality"] != 0: raise pybamm.OptionError( - "thermal effects not implemented for lead-acid models" + "Lead-acid models can only have thermal " + "effects if dimensionality is 0." ) + if options["thermal current collector"] is True: raise pybamm.OptionError( - "thermal effects not implemented for lead-acid models" + "Thermal current collector effects are not implemented " + "for lead-acid models." ) self._options = options diff --git a/pybamm/parameters/standard_parameters_lead_acid.py b/pybamm/parameters/standard_parameters_lead_acid.py index be73bc36e0..9b950d5c79 100644 --- a/pybamm/parameters/standard_parameters_lead_acid.py +++ b/pybamm/parameters/standard_parameters_lead_acid.py @@ -164,10 +164,9 @@ Q_p_max_dimensional = pybamm.Parameter("Positive electrode volumetric capacity [C.m-3]") -# Fake thermal +# thermal Delta_T = pybamm.thermal_parameters.Delta_T - # -------------------------------------------------------------------------------------- "2. Dimensional Functions" @@ -277,18 +276,27 @@ def U_p_dimensional(c_e, T): # Electrolyte diffusion timescale tau_diffusion_e = L_x ** 2 / D_e_typ +# Thermal diffusion timescale +tau_th_yz = pybamm.thermal_parameters.tau_th_yz + # Choose discharge timescale timescale = tau_discharge # -------------------------------------------------------------------------------------- "4. Dimensionless Parameters" +# Timescale ratios +C_th = tau_th_yz / tau_discharge # Macroscale Geometry l_n = pybamm.geometric_parameters.l_n l_s = pybamm.geometric_parameters.l_s l_p = pybamm.geometric_parameters.l_p +l_x = pybamm.geometric_parameters.l_x l_y = pybamm.geometric_parameters.l_y l_z = pybamm.geometric_parameters.l_z +a_cc = pybamm.geometric_parameters.a_cc +l = pybamm.geometric_parameters.l +delta = pybamm.geometric_parameters.delta # In lead-acid the current collector and electrodes are the same (same thickness) l_cn = l_n l_cp = l_p @@ -403,7 +411,39 @@ def U_p_dimensional(c_e, T): Q_e_max_dimensional = Q_e_max * c_e_typ * F capacity = Q_e_max_dimensional * n_electrodes_parallel * A_cs * L_x +# Thermal +rho_cn = pybamm.thermal_parameters.rho_cn +rho_n = pybamm.thermal_parameters.rho_n +rho_s = pybamm.thermal_parameters.rho_s +rho_p = pybamm.thermal_parameters.rho_p +rho_cp = pybamm.thermal_parameters.rho_cp + +rho_k = pybamm.thermal_parameters.rho_k +rho = rho_n * l_n + rho_s * l_s + rho_p * l_p + +lambda_cn = pybamm.thermal_parameters.lambda_cn +lambda_n = pybamm.thermal_parameters.lambda_n +lambda_s = pybamm.thermal_parameters.lambda_s +lambda_p = pybamm.thermal_parameters.lambda_p +lambda_cp = pybamm.thermal_parameters.lambda_cp + +lambda_k = pybamm.thermal_parameters.lambda_k + +Theta = pybamm.thermal_parameters.Theta +h = pybamm.thermal_parameters.h +B = ( + i_typ + * R + * T_ref + * tau_th_yz + / (pybamm.thermal_parameters.rho_eff_dim * F * Delta_T * L_x) +) + +T_amb_dim = pybamm.thermal_parameters.T_amb_dim +T_amb = pybamm.thermal_parameters.T_amb + # Initial conditions +T_init = pybamm.thermal_parameters.T_init q_init = pybamm.Parameter("Initial State of Charge") c_e_init = q_init c_ox_init = c_ox_init_dim / c_ox_typ @@ -428,12 +468,6 @@ def c_p_init(x): return c_e_init -# Thermal effects not implemented for lead-acid, but parameters needed for consistency -T_init = pybamm.Scalar(0) -Theta = pybamm.Scalar(0) # ratio of typical temperature change to ambient temperature -T_amb_dim = pybamm.thermal_parameters.T_amb_dim -T_amb = pybamm.thermal_parameters.T_amb - # -------------------------------------------------------------------------------------- "5. Dimensionless Functions" diff --git a/pybamm/solvers/algebraic_solver.py b/pybamm/solvers/algebraic_solver.py index 35ed42f08a..191a987099 100644 --- a/pybamm/solvers/algebraic_solver.py +++ b/pybamm/solvers/algebraic_solver.py @@ -107,4 +107,3 @@ def jac(y): # Return solution object (no events, so pass None to t_event, y_event) return pybamm.Solution(t_eval, y, termination="success") - diff --git a/pybamm/solvers/casadi_algebraic_solver.py b/pybamm/solvers/casadi_algebraic_solver.py index 389b87c14f..56fbbc7d88 100644 --- a/pybamm/solvers/casadi_algebraic_solver.py +++ b/pybamm/solvers/casadi_algebraic_solver.py @@ -113,4 +113,3 @@ def _integrate(self, model, t_eval, inputs=None): # Return solution object (no events, so pass None to t_event, y_event) return pybamm.Solution(t_eval, y, termination="success") - diff --git a/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_composite.py b/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_composite.py index b8f5f3fe3a..3e20babeb3 100644 --- a/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_composite.py +++ b/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_composite.py @@ -63,6 +63,17 @@ def test_basic_processing_algebraic(self): modeltest = tests.StandardModelTest(model, parameter_values=param) modeltest.test_all() # solver=pybamm.CasadiSolver()) + # def test_thermal(self): + # options = {"thermal": "x-lumped"} + # model = pybamm.lead_acid.Composite(options) + # modeltest = tests.StandardModelTest(model) + # modeltest.test_all() + + # options = {"thermal": "x-full"} + # model = pybamm.lead_acid.Composite(options) + # modeltest = tests.StandardModelTest(model) + # modeltest.test_all() + class TestLeadAcidCompositeExtended(unittest.TestCase): def test_basic_processing(self): diff --git a/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_full.py b/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_full.py index 54529ed5fc..61a6afe67f 100644 --- a/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_full.py +++ b/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_full.py @@ -85,6 +85,17 @@ def test_set_up(self): optimtest.set_up_model(simplify=False, to_python=False) optimtest.set_up_model(simplify=True, to_python=False) + def test_thermal(self): + options = {"thermal": "x-lumped"} + model = pybamm.lead_acid.Full(options) + modeltest = tests.StandardModelTest(model) + modeltest.test_all() + + options = {"thermal": "x-full"} + model = pybamm.lead_acid.Full(options) + modeltest = tests.StandardModelTest(model) + modeltest.test_all() + if __name__ == "__main__": print("Add -v for more debug output") diff --git a/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_loqs.py b/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_loqs.py index 368cf5e97c..7d049f2e6c 100644 --- a/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_loqs.py +++ b/tests/integration/test_models/test_full_battery_models/test_lead_acid/test_loqs.py @@ -55,6 +55,17 @@ def test_basic_processing_with_convection(self): modeltest = tests.StandardModelTest(model) modeltest.test_all() + def test_thermal(self): + options = {"thermal": "x-lumped"} + model = pybamm.lead_acid.LOQS(options) + modeltest = tests.StandardModelTest(model) + modeltest.test_all() + + options = {"thermal": "x-full"} + model = pybamm.lead_acid.LOQS(options) + modeltest = tests.StandardModelTest(model) + modeltest.test_all() + if __name__ == "__main__": print("Add -v for more debug output") diff --git a/tests/unit/test_models/test_full_battery_models/test_lead_acid/test_base_lead_acid_model.py b/tests/unit/test_models/test_full_battery_models/test_lead_acid/test_base_lead_acid_model.py index 3dbee28979..43f02eae8f 100644 --- a/tests/unit/test_models/test_full_battery_models/test_lead_acid/test_base_lead_acid_model.py +++ b/tests/unit/test_models/test_full_battery_models/test_lead_acid/test_base_lead_acid_model.py @@ -29,13 +29,17 @@ def test_default_geometry(self): def test_incompatible_options(self): with self.assertRaisesRegex( - pybamm.OptionError, "thermal effects not implemented" + pybamm.OptionError, + "Thermal current collector effects are " + "not implemented for lead-acid models.", ): - pybamm.lead_acid.BaseModel({"thermal": "x-full"}) + pybamm.lead_acid.BaseModel({"thermal current collector": True}) + with self.assertRaisesRegex( - pybamm.OptionError, "thermal effects not implemented" + pybamm.OptionError, + "Lead-acid models can only have thermal " "effects if dimensionality is 0.", ): - pybamm.lead_acid.BaseModel({"thermal current collector": True}) + pybamm.lead_acid.BaseModel({"dimensionality": 1, "thermal": "x-full"}) if __name__ == "__main__": diff --git a/tests/unit/test_parameters/test_parameter_sets/test_Landesfeind2020.py b/tests/unit/test_parameters/test_parameter_sets/test_Landesfeind2020.py index 0e68ef7455..6a7e16e6b9 100644 --- a/tests/unit/test_parameters/test_parameter_sets/test_Landesfeind2020.py +++ b/tests/unit/test_parameters/test_parameter_sets/test_Landesfeind2020.py @@ -8,14 +8,15 @@ class TestLandesfeind(unittest.TestCase): - def test_electrolyte_conductivity(self): root = pybamm.root_dir() p = "pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019" k_path = os.path.join(root, p) - files = [f for f in os.listdir(k_path) if '.py' in f - and '_base' not in f - and 'conductivity' in f] + files = [ + f + for f in os.listdir(k_path) + if ".py" in f and "_base" not in f and "conductivity" in f + ] files.sort() funcs = [pybamm.load_function(os.path.join(k_path, f)) for f in files] T_ref = 298.15 @@ -29,7 +30,7 @@ def test_electrolyte_conductivity(self): chemistry = pybamm.parameter_sets.Chen2020 param = pybamm.ParameterValues(chemistry=chemistry) - param['Electrolyte conductivity [S.m-1]'] = funcs[0] + param["Electrolyte conductivity [S.m-1]"] = funcs[0] model = pybamm.lithium_ion.SPM() sim = pybamm.Simulation(model, parameter_values=param) sim.set_parameters() @@ -39,9 +40,11 @@ def test_electrolyte_diffusivity(self): root = pybamm.root_dir() p = "pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019" d_path = os.path.join(root, p) - files = [f for f in os.listdir(d_path) if '.py' in f - and '_base' not in f - and 'diffusivity' in f] + files = [ + f + for f in os.listdir(d_path) + if ".py" in f and "_base" not in f and "diffusivity" in f + ] files.sort() funcs = [pybamm.load_function(os.path.join(d_path, f)) for f in files] T_ref = 298.15 @@ -55,7 +58,7 @@ def test_electrolyte_diffusivity(self): chemistry = pybamm.parameter_sets.Chen2020 param = pybamm.ParameterValues(chemistry=chemistry) - param['Electrolyte diffusivity [m2.s-1]'] = funcs[0] + param["Electrolyte diffusivity [m2.s-1]"] = funcs[0] model = pybamm.lithium_ion.SPM() sim = pybamm.Simulation(model, parameter_values=param) sim.set_parameters()