diff --git a/firedrake/slate/static_condensation/la_utils.py b/firedrake/slate/static_condensation/la_utils.py index 48df04930c..f8e8dd5869 100644 --- a/firedrake/slate/static_condensation/la_utils.py +++ b/firedrake/slate/static_condensation/la_utils.py @@ -46,6 +46,7 @@ def condense_and_forward_eliminate(A, b, elim_fields, prefix, pc): raise ValueError("Left-hand operator must be a Slate Tensor") # Ensures field indices are in increasing order + id_0, id_1 = elim_fields[0], elim_fields[-1] elim_fields = list(as_tuple(elim_fields)) elim_fields.sort() @@ -73,8 +74,6 @@ def condense_and_forward_eliminate(A, b, elim_fields, prefix, pc): # where subscript `e` denotes the coupling with fields # that will be eliminated, and `f` denotes the condensed # fields. - id_0 = e_idx0 - id_1 = e_idx1 outer_id_0 = slice(e_idx0, e_idx1 + 1) outer_id_1 = slice(f_idx0, f_idx1 + 1) Aff = _A[outer_id_1, outer_id_1] diff --git a/tests/slate/test_variational_prb.py b/tests/slate/test_variational_prb.py index 0c87533f46..7cdeb0d601 100644 --- a/tests/slate/test_variational_prb.py +++ b/tests/slate/test_variational_prb.py @@ -4,8 +4,8 @@ from itertools import product -@pytest.mark.parametrize(('degree', 'nested'), list(product([1, 2], [True, False]))) -def test_lvp_equiv_hdg(degree, nested): +@pytest.mark.parametrize(('degree', 'nested', 'elimination'), list(product([1, 2], [True, False], ['0,1', '1,0']))) +def test_lvp_equiv_hdg(degree, nested, elimination): """Runs an HDG problem and checks that passing a Slate-defined problem into a variational problem produces the same result for the traces as solving @@ -47,7 +47,7 @@ def test_lvp_equiv_hdg(degree, nested): 'ksp_type': 'preonly', 'pc_type': 'python', 'pc_python_type': 'firedrake.SCPC', - 'pc_sc_eliminate_fields': '0, 1', + 'pc_sc_eliminate_fields': elimination, 'condensed_field': {'ksp_type': 'preonly', 'pc_type': 'lu', 'pc_factor_mat_solver_type': 'mumps',