diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py index b47611d7acdac3538bc4247952f78c42c090167e..b95575f6ee1dd21c91fb26d43c8f158f20f9c427 100644 --- a/grudge/symbolic/operators.py +++ b/grudge/symbolic/operators.py @@ -724,6 +724,9 @@ def norm(p, arg, dd=None): prim.fabs(arg * MassOperator()(arg))) if isinstance(norm_squared, np.ndarray): + if len(norm_squared.shape) != 1: + raise NotImplementedError("can only take the norm of vectors") + norm_squared = norm_squared.sum() return prim.sqrt(norm_squared) @@ -732,6 +735,9 @@ def norm(p, arg, dd=None): result = NodalMax(dd_in=dd)(prim.fabs(arg)) if isinstance(result, np.ndarray): + if len(result.shape) != 1: + raise NotImplementedError("can only take the norm of vectors") + from pymbolic.primitives import Max result = Max(result)