I have a test function defined on a mesh and a function defined on a refined version of that mesh. I would like to be able to integrate my test function and refined function using quadrature defined on the refined mesh. So something like this:

It is my understanding that I need to introduce an interpolation operator to map the test function onto the same space as the the refined function, i.e.

However, fenics’ Interpolate function does not support test function inputs so this line throws an error. Is there any other way to handle interpolation of a test function in this context?

describes how you can get a matrix from these vectors. You may have to transpose the matrix.

Note also that this works for this example, as the function spaces on the fine and coarse mesh are hierarchical, and thus the interpolated function acting as test function has the same shape as the original function (see the heuristic assert() test in the loop).