def test_log(self): a = pybamm.InputParameter("a") fun = pybamm.log(a) self.assertEqual(fun.evaluate(inputs={"a": 3}), np.log(3)) h = 0.0000001 self.assertAlmostEqual( fun.diff(a).evaluate(inputs={"a": 3}), ( pybamm.log(pybamm.Scalar(3 + h)).evaluate() - fun.evaluate(inputs={"a": 3}) ) / h, places=5, ) # Base 10 fun = pybamm.log10(a) self.assertEqual(fun.evaluate(inputs={"a": 3}), np.log10(3)) h = 0.0000001 self.assertAlmostEqual( fun.diff(a).evaluate(inputs={"a": 3}), ( pybamm.log10(pybamm.Scalar(3 + h)).evaluate() - fun.evaluate(inputs={"a": 3}) ) / h, places=5, )
def lead_dioxide_ocp_Bode1977(m): """ Dimensional open-circuit voltage in the positive (lead-dioxide) electrode [V], from [1]_, as a function of the molar mass m [mol.kg-1]. References ---------- .. [1] H Bode. Lead-acid batteries. John Wiley and Sons, Inc., New York, NY, 1977. """ U = ( 1.628 + 0.074 * log10(m) + 0.033 * log10(m) ** 2 + 0.043 * log10(m) ** 3 + 0.022 * log10(m) ** 4 ) return U
def lead_ocp_Bode1977(m): """ Dimensional open-circuit voltage in the negative (lead) electrode [V], from [1]_, as a function of the molar mass m [mol.kg-1]. References ---------- .. [1] H Bode. Lead-acid batteries. John Wiley and Sons, Inc., New York, NY, 1977. """ U = ( -0.294 - 0.074 * log10(m) - 0.030 * log10(m) ** 2 - 0.031 * log10(m) ** 3 - 0.012 * log10(m) ** 4 ) return U