From d5fa7b5c0091abc9ad124dc996d284dc9c001cc7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 29 Jul 2019 14:46:02 -0500 Subject: [PATCH] Set correct index for final nuclides in restart tests Many repetitions of the following change: - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) This causes many of the restart tests to fail, because all schemes but the predictor save repeated data under restart conditions. Performing one normal depletion event, non-restarted, and then one restart event, as these tests do, should produce vectors for time and densities like: t = [t0, t1, t2] a = [a0, a1, a2] | ^ after restart ^ non-restart run With this, the current tests would fail due to an IndexError, as the atom vectors should only have three elements. Instead, non-predictor schemes return vectors t = [t0, t1, t1, t2] a = [a0, a1, a1, a2] and one can access a[3] to obtain the desired EOS concentrations. --- tests/unit_tests/test_deplete_restart.py | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/unit_tests/test_deplete_restart.py b/tests/unit_tests/test_deplete_restart.py index 78a910d416..493828fd8c 100644 --- a/tests/unit_tests/test_deplete_restart.py +++ b/tests/unit_tests/test_deplete_restart.py @@ -90,8 +90,8 @@ def test_restart_cecm(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) def test_restart_predictor_cecm(run_in_tmpdir): @@ -211,8 +211,8 @@ def test_restart_cf4(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) def test_restart_epc_rk4(run_in_tmpdir): @@ -250,8 +250,8 @@ def test_restart_epc_rk4(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) def test_restart_celi(run_in_tmpdir): @@ -289,8 +289,8 @@ def test_restart_celi(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) def test_restart_leqi(run_in_tmpdir): @@ -328,8 +328,8 @@ def test_restart_leqi(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) def test_restart_si_celi(run_in_tmpdir): """Integral regression test of integrator algorithm using SI-CELI.""" @@ -366,8 +366,8 @@ def test_restart_si_celi(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1]) def test_restart_si_leqi(run_in_tmpdir): @@ -406,5 +406,5 @@ def test_restart_si_leqi(run_in_tmpdir): assert y1[1] == approx(s1[0]) assert y2[1] == approx(s1[1]) - assert y1[3] == approx(s2[0]) - assert y2[3] == approx(s2[1]) + assert y1[2] == approx(s2[0]) + assert y2[2] == approx(s2[1])