diff --git a/firedrake/external_operators/abstract_external_operators.py b/firedrake/external_operators/abstract_external_operators.py index 3afc09f318..d653b25f4d 100644 --- a/firedrake/external_operators/abstract_external_operators.py +++ b/firedrake/external_operators/abstract_external_operators.py @@ -194,6 +194,8 @@ def assemble(self, assembly_opts=None): # Will also catch the case where wrong fct space if not isinstance(result, (Function, Cofunction)): raise ValueError('External operators with one argument must result in a firedrake.Function or firedrake.Cofunction object!') + if not result.function_space() == self.arguments()[0].function_space().dual(): + raise ValueError('External operator assembly result is in the wrong function space.') elif len(self.arguments()) == 2: if not isinstance(result, MatrixBase): raise ValueError('External operators with two arguments must result in a firedrake.MatrixBase object!')