Quadrature function space

Hello,

with the latest dolfinx (docker image from today), I realized that there must have been some change to Quadrature function spaces. If I now want to create a function space on a Quadrature element, i.e.

#!/usr/bin/env python3
from dolfinx import BoxMesh, FunctionSpace, VectorFunctionSpace, Function
from dolfinx.io import XDMFFile
import dolfinx.cpp.mesh
from mpi4py import MPI
import numpy as np
from ufl import TrialFunction, TestFunction, FiniteElement, VectorElement, TensorElement

comm = MPI.COMM_WORLD

mesh = BoxMesh(comm, [np.array([0.0, 0.0, 0.0]),np.array([2.0, 1.0, 1.0])], [5, 5, 5],
               dolfinx.cpp.mesh.CellType.tetrahedron, dolfinx.cpp.mesh.GhostMode.none)

P_q = FiniteElement("Quadrature", mesh.ufl_cell(), 1)
V_q = FunctionSpace(mesh, P_q)

I get a RuntimeError: Can’t find name Quadrature. However, the ufl type “Quadrature” still exists, so the FiniteElement command works.

Has the syntax for this changed? And, would it be equivalent to use a DG space instead, i.e.
FunctionSpace(mesh, ("DG", 0)) ?

Thanks for any help!

Best,
Marc

Hello,

Quadrature functions spaces are not supported in dolfinx yet, but fixing them is on my to do list so they shouldn’t be too far away.

All the best,
Matthew

Hi Matthew,

Thanks for pointing to this! And, maybe another thing: Can’t a DG function space be used equivalently instead? I.e., at least if I have a linear tet mesh with one Gauss point, shouldn’t FunctionSpace(mesh, ("DG", 0)) yield the same?

Best,
Marc

Yes, that would work for order 0, although I don’t think it generalises to Quadrature element with more than one point

Yes, I have the feeling that there is something wrong going on for higher order meshes…
I have a nonlinear solid material that needs to be iterated at Quadrature point level and for 2nd order displacement, hence using a DG1 for the internal variable, I’m running into convergence issues. :-/
So I’d be very happy if dolfinx will support the Quadrature function space again! :slight_smile:

Hello!

I’ve wanted to come back to Quadrature function spaces as I’ve seen that they are now enabled in latest dolfinx.

Nevertheless, I’ve used above MWE and tried to do a simple operation of interpolating a constant to the space, and get the error RuntimeError: Cannot get interpolation points - no Basix element available. Maybe this is a mixed element? if the last line of the following MWE is executed (dolfinx Docker image from today):

#!/usr/bin/env python3
from dolfinx import BoxMesh, FunctionSpace, Function
import dolfinx.cpp.mesh
from mpi4py import MPI
import numpy as np
from ufl import FiniteElement

comm = MPI.COMM_WORLD

mesh = BoxMesh(comm, [np.array([0.0, 0.0, 0.0]),np.array([2.0, 1.0, 1.0])], [5, 5, 5],
               dolfinx.cpp.mesh.CellType.tetrahedron, dolfinx.cpp.mesh.GhostMode.none)

P_q = FiniteElement("Quadrature", mesh.ufl_cell(), degree=1, quad_scheme="default")
V_q = FunctionSpace(mesh, P_q)

def expr(x): return 1.

x = Function(V_q)
x.interpolate(expr)

Is there any specific new syntax on how interpolation to Quadrature function spaces has to happen?

Thanks!

Best,
Marc

I would suggest bumping the following issue: Interpolation into Quadrature (non-basix) element · Issue #1546 · FEniCS/dolfinx · GitHub

Quite a while since this is broken now. Does anyone have a clue whether this is still under consideration?

Best,
Marc

I would bump the issue, or maybe ask Michal if he is willing to port his fix from DOLFINy to DOLFINx.