Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elementwise_integral doesn't respect quadrature rules #215

Open
inducer opened this issue Jan 26, 2022 · 1 comment · May be fixed by #216
Open

elementwise_integral doesn't respect quadrature rules #215

inducer opened this issue Jan 26, 2022 · 1 comment · May be fixed by #216

Comments

@inducer
Copy link
Owner

inducer commented Jan 26, 2022

As implemented here:

grudge/grudge/reductions.py

Lines 455 to 470 in f3d986b

if len(args) == 1:
vec, = args
dd = dof_desc.DOFDesc("vol", dof_desc.DISCR_TAG_BASE)
elif len(args) == 2:
dd, vec = args
else:
raise TypeError("invalid number of arguments")
dd = dof_desc.as_dofdesc(dd)
from grudge.op import _apply_mass_operator
ones = dcoll.discr_from_dd(dd).zeros(vec.array_context) + 1.0
return elementwise_sum(
dcoll, dd, vec * _apply_mass_operator(dcoll, dd, dd, ones)
)

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

cc @thomasgibson

@inducer
Copy link
Owner Author

inducer commented Jan 26, 2022

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
    ])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant