Skip to content

BUG: assign(0, subset=subset) fails #4148

Open
@pbrubeck

Description

@pbrubeck

Describe the bug
Failing to assign 0 on a subset.

Steps to Reproduce
Steps to reproduce the behavior:

from firedrake import *

mesh = UnitIntervalMesh(2)

M = FunctionSpace(mesh, "DG", 0)
m = Function(M)
m.dat.data[0] = 1

rmesh = RelabeledMesh(mesh, [m], [100])
V = FunctionSpace(rmesh, "DG", 0)
u = Function(V)

# this works
u.assign(1, subset=rmesh.cell_subset(100))
#this fails
u.assign(0, subset=rmesh.cell_subset(100))

Expected behavior
This should not throw errors.

Error message

Traceback (most recent call last):
  File "/home/pbrubeck/git/dphil_thesis/static_condensation/snippets/bug_subset.py", line 16, in <module>
    u.assign(0, subset=rmesh.cell_subset(100))
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/pbrubeck/firedrake/src/firedrake/firedrake/adjoint_utils/function.py", line 116, in wrapper
    ret = assign(self, other, *args, **kwargs)
  File "/home/pbrubeck/firedrake/src/firedrake/firedrake/function.py", line 458, in assign
    self.dat.zero(subset=subset)
  File "/home/pbrubeck/firedrake/src/firedrake/pyop2/types/dat.py", line 299, in zero
    raise ex.MapValueError("The subset and dataset are incompatible")
pyop2.exceptions.MapValueError: The subset and dataset are incompatible

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