Currently there is no support for symbolic interpolation operations in FFCx.
Workarounds to this, by introducing intermediate variables to interpolate into first, break the AD toolchain and thus are not scalable to elaborate forms/problems.
Interface to enable/support:
import dolfinx
import ufl
from mpi4py import MPI
mesh = dolfinx.mesh.create_unit_square(comm := MPI.COMM_WORLD, n := 10, n)
V = dolfinx.fem.functionspace(mesh, ("CG", 1))
x = ufl.SpatialCoordinate(mesh)
f = x[0] ** 2
If = ufl.Interpolate(f, V)
expr = dolfinx.fem.Expression(f, V.element.interpolation_points)
expr_I = dolfinx.fem.Expression(If, V.element.interpolation_points) # not supported atm.
u,v = ufl.TrialFunction(V), ufl.TestFunction(V)
dolfinx.fem.form(f * ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx)
dolfinx.fem.form(If * ufl.inner(ufl.grad(u), ufl.grad(v)) * ufl.dx) # not supported atm.
Currently there is no support for symbolic interpolation operations in FFCx.
Workarounds to this, by introducing intermediate variables to interpolate into first, break the AD toolchain and thus are not scalable to elaborate forms/problems.
Interface to enable/support: