Open
Description
Describe the bug
Dof-wise assignment u1.assign(u2)
is only well defined if u1
and u2
belong to the same FunctionSpace
. However we do not check for the boundary_set
of a RestrictedFunctionSpace
, and here we ignore the fact that RestrictedFunctionSpace
has a different DOF ordering. The assignment across different DOF orderings results in unexpected behavior.
Steps to Reproduce
Steps to reproduce the behavior:
from firedrake import *
mesh = UnitSquareMesh(3, 3)
V = FunctionSpace(mesh, "CG", 1)
Vres = RestrictedFunctionSpace(V, ["on_boundary"])
u = Function(V)
u.dat.data[:] = range(V.dim())
ures = Function(Vres)
ures.assign(u)
print("ures.assign(u)", ures.dat.data_ro)
ures.interpolate(u)
print("ures.interpolate(u)", ures.dat.data_ro)
The output is:
ures.assign(u) [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.]
ures.interpolate(u) [ 3. 6. 7. 11. 0. 1. 2. 4. 5. 8. 9. 10. 12. 13. 14. 15.]
Expected behavior
Either the assignment ures.assign(u)
should throw an exception, or it should apply the dof permutation and return the same output as ures.interpolate(u)
.
Error message
No error message.