From 021b53012bb28e06015206e4e2e9bbf06405ea16 Mon Sep 17 00:00:00 2001 From: Daiane Iglesia Dolci <63597005+Ig-dolci@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:16:59 +0000 Subject: [PATCH] Fix rf. (#3890) * Fix rf --- tests/firedrake/output/test_adjoint_disk_checkpointing.py | 2 +- tests/firedrake/regression/test_adjoint_operators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/firedrake/output/test_adjoint_disk_checkpointing.py b/tests/firedrake/output/test_adjoint_disk_checkpointing.py index 2f4b15e9f7..c1cf3daaa0 100644 --- a/tests/firedrake/output/test_adjoint_disk_checkpointing.py +++ b/tests/firedrake/output/test_adjoint_disk_checkpointing.py @@ -104,6 +104,6 @@ def test_disk_checkpointing_successive_writes(): J = assemble(v*dx) Jhat = ReducedFunctional(J, Control(u)) - assert np.allclose(J, Jhat(1)) + assert np.allclose(J, Jhat(Function(cg_space).interpolate(1.))) pause_disk_checkpointing() tape.clear_tape() diff --git a/tests/firedrake/regression/test_adjoint_operators.py b/tests/firedrake/regression/test_adjoint_operators.py index a8f5149657..8d4c0ab796 100644 --- a/tests/firedrake/regression/test_adjoint_operators.py +++ b/tests/firedrake/regression/test_adjoint_operators.py @@ -717,7 +717,7 @@ def test_init_constant(): c2.assign(c1) J = assemble(c2*dx(domain=mesh)) rf = ReducedFunctional(J, Control(c1)) - assert np.isclose(rf(-1.0), -1.0) + assert np.isclose(rf(Function(R, val=-1.0)), -1.0) @pytest.mark.skipcomplex # Taping for complex-valued 0-forms not yet done