Skip to content

Commit 3a0dc1c

Browse files
committed
#644 tighter default tols for testing
1 parent 783d230 commit 3a0dc1c

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

tests/integration/test_models/standard_model_tests.py

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def test_solving(self, solver=None, t_eval=None):
7171
# Overwrite solver if given
7272
if solver is not None:
7373
self.solver = solver
74+
else:
75+
# use tighter default tolerances for testing
76+
self.solver.rtol = 1e-8
77+
self.solver.atol = 1e-8
7478
if t_eval is None:
7579
t_eval = np.linspace(0, 1, 100)
7680

tests/unit/test_processed_variable.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,7 @@ def test_processed_variable_ode_pde_solution(self):
383383
model.rhs = {c: -c}
384384
model.initial_conditions = {c: 1}
385385
model.variables = {"c": c}
386-
solver = model.default_solver
387-
solver.rtol = 1e-8
388-
solver.atol = 1e-8
389-
modeltest = tests.StandardModelTest(model, solver=solver)
386+
modeltest = tests.StandardModelTest(model)
390387
modeltest.test_all()
391388
t_sol, y_sol = modeltest.solution.t, modeltest.solution.y
392389
processed_vars = pybamm.post_process_variables(model.variables, t_sol, y_sol)
@@ -410,10 +407,7 @@ def test_processed_variable_ode_pde_solution(self):
410407
"c_s": c_s,
411408
"N_s": pybamm.grad(c_s),
412409
}
413-
solver = model.default_solver
414-
solver.rtol = 1e-8
415-
solver.atol = 1e-8
416-
modeltest = tests.StandardModelTest(model, solver=solver)
410+
modeltest = tests.StandardModelTest(model)
417411
modeltest.test_all()
418412
# set up testing
419413
t_sol, y_sol = modeltest.solution.t, modeltest.solution.y

0 commit comments

Comments
 (0)