Skip to content

Commit 078e445

Browse files
#1456 fix tests
1 parent 865c32e commit 078e445

File tree

7 files changed

+9
-29
lines changed

7 files changed

+9
-29
lines changed

tests/integration/test_models/test_full_battery_models/test_lithium_ion/test_compare_basic_models.py

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def test_compare_dfns(self):
2525
sol = sim.solution
2626

2727
# Compare solution data
28-
np.testing.assert_array_almost_equal(basic_sol.y, sol.y, decimal=4)
2928
np.testing.assert_array_almost_equal(basic_sol.t, sol.t, decimal=4)
3029
# Compare variables
3130
for name in basic_dfn.variables:

tests/integration/test_solvers/test_idaklu.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_set_tol_by_variable(self):
3131
t_eval = np.linspace(0, 3600, 100)
3232
solver = pybamm.IDAKLUSolver()
3333

34-
variable_tols = {"Electrolyte concentration": 1e-3}
34+
variable_tols = {"Porosity times concentration": 1e-3}
3535
solver.set_atol_by_variable(variable_tols, model)
3636

3737
solver.solve(model, t_eval)

tests/unit/test_expression_tree/test_symbol.py

+3
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ def test_symbol_visualise(self):
373373

374374
variables = {
375375
"Porosity": param.epsilon,
376+
"Negative electrode porosity": param.epsilon_n,
377+
"Separator porosity": param.epsilon_s,
378+
"Positive electrode porosity": param.epsilon_p,
376379
"Electrolyte tortuosity": param.epsilon ** 1.5,
377380
"Porosity change": zero_nsp,
378381
"Electrolyte current density": zero_nsp,

tests/unit/test_models/test_base_model.py

-25
Original file line numberDiff line numberDiff line change
@@ -420,24 +420,6 @@ def test_check_well_posedness_initial_boundary_conditions(self):
420420
with self.assertRaisesRegex(pybamm.ModelError, "initial condition"):
421421
model.check_well_posedness()
422422

423-
# Model with bad boundary conditions - Dirichlet (expect assertion error)
424-
d = pybamm.Variable("d", domain=whole_cell)
425-
model.initial_conditions = {c: 3}
426-
model.boundary_conditions = {
427-
d: {"left": (0, "Dirichlet"), "right": (0, "Dirichlet")}
428-
}
429-
with self.assertRaisesRegex(pybamm.ModelError, "boundary condition"):
430-
model.check_well_posedness()
431-
432-
# Model with bad boundary conditions - Neumann (expect assertion error)
433-
d = pybamm.Variable("d", domain=whole_cell)
434-
model.initial_conditions = {c: 3}
435-
model.boundary_conditions = {
436-
d: {"left": (0, "Neumann"), "right": (0, "Neumann")}
437-
}
438-
with self.assertRaisesRegex(pybamm.ModelError, "boundary condition"):
439-
model.check_well_posedness()
440-
441423
# Algebraic well-posed model
442424
whole_cell = ["negative electrode", "separator", "positive electrode"]
443425
model = pybamm.BaseModel()
@@ -451,13 +433,6 @@ def test_check_well_posedness_initial_boundary_conditions(self):
451433
}
452434
model.check_well_posedness()
453435

454-
# Algebraic model with bad boundary conditions
455-
model.boundary_conditions = {
456-
d: {"left": (0, "Dirichlet"), "right": (0, "Dirichlet")}
457-
}
458-
with self.assertRaisesRegex(pybamm.ModelError, "boundary condition"):
459-
model.check_well_posedness()
460-
461436
def test_check_well_posedness_output_variables(self):
462437
model = pybamm.BaseModel()
463438
whole_cell = ["negative electrode", "separator", "positive electrode"]

tests/unit/test_models/test_full_battery_models/test_lithium_ion/test_spme.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_external_variables(self):
1717
model = pybamm.lithium_ion.SPMe(model_options)
1818
self.assertEqual(
1919
model.external_variables[0].id,
20-
model.variables["Electrolyte concentration"].id,
20+
model.variables["Porosity times concentration"].id,
2121
)
2222

2323
# a variable

tests/unit/test_models/test_submodels/test_electrolyte_diffusion/test_full_diffusion.py

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ def test_public_functions(self):
1818
)
1919
variables = {
2020
"Porosity": a,
21+
"Negative electrode porosity": a,
22+
"Separator porosity": a,
23+
"Positive electrode porosity": a,
2124
"Electrolyte tortuosity": a,
2225
"Porosity change": a,
2326
"Volume-averaged velocity": a,

tests/unit/test_solvers/test_idaklu_solver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_set_atol(self):
5757
disc.process_model(model)
5858
solver = pybamm.IDAKLUSolver(root_method="lm")
5959

60-
variable_tols = {"Electrolyte concentration": 1e-3}
60+
variable_tols = {"Porosity times concentration": 1e-3}
6161
solver.set_atol_by_variable(variable_tols, model)
6262

6363
def test_failures(self):

0 commit comments

Comments
 (0)