diff --git a/grudge/reductions.py b/grudge/reductions.py index 5e8b4da70a7a4df78facd458261c97b26bc167ae..2cde556d8570e898c147e937c9e369d5e90fa5ab 100644 --- a/grudge/reductions.py +++ b/grudge/reductions.py @@ -80,14 +80,14 @@ def _norm(dcoll: DiscretizationCollection, vec, p, dd): return np.fabs(vec) if p == 2: from grudge.op import _apply_mass_operator - # Quantities being summed are real up to rounding error, so abs() can go on - # the outside - return abs( - nodal_sum( - dcoll, - dd, - vec.conj() * _apply_mass_operator(dcoll, dd, dd, vec)) - )**(1/2) + return vec.array_context.np.sqrt( + # Quantities being summed are real up to rounding error, so abs() can + # go on the outside + abs( + nodal_sum( + dcoll, + dd, + vec.conj() * _apply_mass_operator(dcoll, dd, dd, vec)))) elif p == np.inf: return nodal_max(dcoll, dd, abs(vec)) else: