Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion firedrake/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def restructure_base_form(expr, visited=None):
# If F: V3 x V2 -> R, then
# Interpolate(TestFunction(V1), F) <=> Action(Interpolate(TestFunction(V1), TrialFunction(V2.dual())), F).
# The result is a two-form V3 x V1 -> R.
if isinstance(expr, ufl.Interpolate) and isinstance(expr.argument_slots()[0], ufl.form.Form):
if isinstance(expr, ufl.Interpolate) and isinstance(expr.argument_slots()[0], ufl.form.Form) and len(expr.argument_slots()[0].arguments()) == 2:
form, operand = expr.argument_slots()
vstar = firedrake.Argument(form.arguments()[0].function_space().dual(), 1)
expr = expr._ufl_expr_reconstruct_(operand, v=vstar)
Expand Down
7 changes: 5 additions & 2 deletions tests/firedrake/regression/test_interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ def test_adjoint_dg():


@pytest.mark.parametrize("degree", range(1, 4))
def test_function_cofunction(degree):
@pytest.mark.parametrize("cofunc", [True, False])
Comment thread
leo-collins marked this conversation as resolved.
def test_zeroform(degree, cofunc):
mesh = UnitSquareMesh(10, 10)
Pkp1 = FunctionSpace(mesh, "CG", degree+1)
Pk = FunctionSpace(mesh, "CG", degree)
Expand All @@ -400,7 +401,9 @@ def test_function_cofunction(degree):
x = SpatialCoordinate(mesh)
f = assemble(interpolate(sin(2*pi*x[0])*sin(2*pi*x[1]), Pk))

fhat = assemble(f*v1*dx)
fhat = f * v1 * dx
if cofunc:
fhat = assemble(fhat)
norm_i = assemble(interpolate(f, fhat))
norm = assemble(f*f*dx)

Expand Down