diff --git a/grudge/eager.py b/grudge/eager.py index a1385685eabce917c75cfe2f49d379000ef33333..87368161e5045b2a7c1b508b89cf60ebb336053a 100644 --- a/grudge/eager.py +++ b/grudge/eager.py @@ -162,23 +162,32 @@ class EagerDGDiscretization(DGDiscretizationWithBoundaries): return self._bound_face_mass(dd)(u=vec) @memoize_method - def _norm(self, p): - return bind(self, sym.norm(p, sym.var("arg")), local_only=True) + def _norm(self, p, dd): + return bind(self, + sym.norm(p, sym.var("arg", dd=dd), dd=dd), + local_only=True) + + def norm(self, vec, p=2, dd=None): + if dd is None: + dd = "vol" + + dd = sym.as_dofdesc(dd) - def norm(self, vec, p=2): if (isinstance(vec, np.ndarray) and vec.dtype.char == "O" and not isinstance(vec, DOFArray)): if p == 2: return sum( - self.norm(vec[idx])**2 + self.norm(vec[idx], dd=dd)**2 for idx in np.ndindex(vec.shape))**0.5 elif p == np.inf: - return max(self.norm(vec[idx]) for idx in np.ndindex(vec.shape)) + return max( + self.norm(vec[idx], np.inf, dd=dd) + for idx in np.ndindex(vec.shape)) else: raise ValueError("unsupported norm order") - return self._norm(p)(arg=vec) + return self._norm(p, dd)(arg=vec) @memoize_method def _nodal_reduction(self, operator, dd): diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py index ef6ce5a7d38f92b3693b8132c305a500f7a8954f..78261d658e2871379f042ee0d714e2d8cd9e3547 100644 --- a/grudge/symbolic/primitives.py +++ b/grudge/symbolic/primitives.py @@ -662,7 +662,7 @@ def mv_normal(dd, ambient_dim, dim=None): return cse(mv, "normal", cse_scope.DISCRETIZATION) -def normal(dd, ambient_dim, dim=None, quadrature_tag=None): +def normal(dd, ambient_dim, dim=None): return mv_normal(dd, ambient_dim, dim).as_vector() # }}}