Skip to content

BUG: assemble(Constant * Cofunction(Function)) fails #4530

@jrmaddison

Description

@jrmaddison

Describe the bug
Assembly of a multiple of a cofunction action fails.

Steps to Reproduce

import firedrake as fd

mesh = fd.UnitIntervalMesh(1)
space = fd.FunctionSpace(mesh, "DG", 0)
u = fd.Function(space, name="u")
b = fd.assemble(fd.conj(fd.TestFunction(space)) * fd.dx)

fd.assemble(b(u))  # OK
fd.assemble(2 * b(u))  # OK
fd.assemble(fd.Constant(2) * b(u))  # Fails

leads to

Traceback (most recent call last):
  File "/home/jmaddis2/build/firedrake/examples/assemble_bug.py", line 10, in <module>
    fd.assemble(fd.Constant(2) * b(u))  # Fails
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/jmaddis2/build/firedrake/firedrake/firedrake/adjoint_utils/assembly.py", line 58, in wrapper
    output.form = form
    ^^^^^^^^^^^
AttributeError: 'Zero' object has no attribute 'form'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions