def integral(arg, dd=None): import grudge.symbolic.primitives as prim if dd is None: dd = prim.DD_VOLUME dd = prim.as_dofdesc(dd) return NodalSum(dd)(arg * prim.cse( MassOperator(dd_in=dd)(prim.Ones(dd)), "mass_quad_weights", prim.cse_scope.DISCRETIZATION))
def h_max_from_volume(ambient_dim, dim=None, dd=None): """Defines a characteristic length based on the volume of the elements. This length may not be representative if the elements have very high aspect ratios. """ import grudge.symbolic.primitives as prim if dd is None: dd = prim.DD_VOLUME dd = prim.as_dofdesc(dd) if dim is None: dim = ambient_dim return NodalMax(dd_in=dd)(ElementwiseSumOperator(dd)( MassOperator(dd_in=dd)(prim.Ones(dd))))**(1.0 / dim)