Create a DOLFINx form for a quadrature element

Dear community,

I am trying to create the DOLFINx form for a right-hand side which contains a scalar quadrature element. However, an error appears as

File "/usr/local/lib/python3.10/dist-packages/ffcx/ir/representationutils.py", line 92, in map_integral_points
    assert points.shape[1] == tdim - 1

The MWE is as follows.

import numpy as np
from dolfinx.mesh import create_box, CellType
from mpi4py import MPI
from dolfinx.fem import VectorFunctionSpace, FunctionSpace, Function, Constant, form
import ufl


mesh = create_box(MPI.COMM_WORLD, [[0, 0, 0], [1, 1, 1]],
                  [1, 1, 1], CellType.hexahedron)
V = VectorFunctionSpace(mesh, ("CG", 1))
v = ufl.TestFunction(V)
elem = ufl.FiniteElement("Quadrature", mesh.ufl_cell(), 2, quad_scheme="default")
S = FunctionSpace(mesh, elem)
c = Function(S)

b = Constant(mesh, np.array([0.0, 0.0, 0.0]))
t = Constant(mesh, np.array([0.0, 0.0, 0.0]))
L = ufl.dot(c*b, v)*ufl.dx + ufl.dot(t, v)*ufl.ds
form(L)

The error disappears if we comment the term of ufl.dot(t, v)*ufl.ds or define c in a DG-0 function space. I am using FEniCSx v0.6.0 and would like to know how to fix it. Thanks!

The bug has been filed at: [BUG]: Assembling sum of quadrature form on volume and CG form on surface · Issue #2664 · FEniCS/dolfinx · GitHub
and I haven’t found an easy fix for it yet. Maybe @mscroggs has an idea.

1 Like

This may hopefully be fixed by Check for custom quadrature for each integral, not each form by mscroggs · Pull Request #622 · FEniCS/ffcx · GitHub

1 Like