inducer / grudge

Grand Unified Discontinuous Galerkin Environment? A DG code in training.
14 stars 17 forks source link

`elementwise_integral` doesn't respect quadrature rules #215

Open inducer opened 2 years ago

inducer commented 2 years ago

As implemented here:

https://github.com/inducer/grudge/blob/f3d986bb790dcfdfffd6cbeb2ccaff446440315b/grudge/reductions.py#L455-L470

It always falls into the mass-matrix logic, which is valid for nodal-interpolatory grids, but not quadrature grids.

cc @thomasgibson

inducer commented 2 years ago

Could implement, per group, as:

res = DOFArray(
    dof_array.array_context,
    tuple([
        actx.np.einsum("ei,i,ei->e",
            dof_array.data[i], quad_weights, area_elements.data[i]
            ).reshape(-1, 1)
        for grp, vec_grp_ary, ae_grp_ary in zip(
            discr.groups, vec.data, area_elements.data
    ])