diff --git a/firedrake/mg/ufl_utils.py b/firedrake/mg/ufl_utils.py index c2e8ab69c9..bbc0086f11 100644 --- a/firedrake/mg/ufl_utils.py +++ b/firedrake/mg/ufl_utils.py @@ -180,9 +180,15 @@ def coarsen_function(expr, self, coefficient_mapping=None): coefficient_mapping = {} new = coefficient_mapping.get(expr) if new is None: - V = self(expr.function_space(), self) - new = firedrake.Function(V, name="coarse_%s" % expr.name()) + Vf = expr.function_space() + Vc = self(Vf, self) + new = firedrake.Function(Vc, name="coarse_%s" % expr.name()) expr._child = weakref.proxy(new) + manager = firedrake.dmhooks.get_transfer_manager(Vf.dm) + if isinstance(expr, firedrake.Cofunction): + manager.restrict(expr, new) + elif isinstance(expr, firedrake.Function): + manager.inject(expr, new) return new