FEniCS/basix

Different ordering of quadrature points and dofs in 1d

Closed this issue · 2 comments

On spectral/collocation methods we want dofs and quadrature points to be collocated. This is possible now with a carefull selection of Lagrange variant and quadrature rule.

However dofs and quadrature points on the reference interval are numbered differently:

[Top: quadrature points, Bottom: dofs]
MicrosoftTeams-image

So it's not currently possible to implement withou indirect memory access patterns in the kernels.

Proposed solution:
Reorder quadrature points and weights so they match the degrees of freedom.

Simple test:

import basix

P = 2
Q = 3

cell_type = basix.CellType.interval
element = basix.create_element(basix.ElementFamily.P, cell_type, P, basix.LagrangeVariant.gll_warped)
points, w = basix.make_quadrature(basix.QuadratureType.gll, cell_type, Q)

phi = element.tabulate(0, points)[0, :, :, 0]
phi[phi<1e-9] = 0

# FAIL
assert numpy.count_nonzero(phi - numpy.diag(numpy.diagonal(phi))) == 0

Resolves in #355