Hello, I want to ask a question about how dolfinx calculate integral.
Say if I have a function f and I create the following form, where v is the test function:
a = f * f * v * dx
when it assemble the term, will the basis function of both f be integralled? or it just regard “f*f” as a single function and use the quadrature node of " f * f ".
As long as f is a dolfinx.fem.Function (not a TrialFunction where this wouldn’t make sense), this will generate an evaluation of f at the quadrature points for both instances.
This can be checked by looking at the generated code of the following MWE
import basix.ufl
import ufl
c_el = basix.ufl.element("Lagrange", "interval", 1, shape=(1,))
mesh = ufl.Mesh(c_el)
el = basix.ufl.element("Lagrange", "interval", 1)
V = ufl.FunctionSpace(mesh, el)
u = ufl.Coefficient(V)
v = ufl.TestFunction(V)
F = u * u * v * ufl.dx
executed with python3 -m ffcx name_of_script.py
which yields a name_of_script.c file with the following kernel:
where you see the evaluation of the f at quadrature points inside the Coefficient , and in section “Intermediates” you see the computation of f(x_q)**2*abs(detJ(x_q))*weight(x_q)