Given a vector $\mathbf{F}$,
I want to evaluate the scalar $\Phi(\mathbf{r})$.
$\displaystyle \Phi\left(\mathbf{r}\right)=\frac{1}{4\pi}\int_{V}\frac{\boldsymbol{\nabla}'\cdot\mathbf{F}\left(\mathbf{r}'\right)}{\left|\mathbf{r}-\mathbf{r}'\right|}\mathrm{d}V'$
Over a unit square and interpolate/project it into u0 in the code below.
from dolfin import *
mesh = UnitSquareMesh(42, 42)
V = FunctionSpace(mesh, "CG", 1)
M = VectorFunctionSpace(mesh, "CG", 1, dim=2)
F = Function(M)
f = Expression(x[0], "x[0]*x[1]")
F.interpolate(f) # example for F
u = TrialFunction(V)
u0 = Function(V)
v_u = TestFunction(V)
r and r' are 3d vectors and dV is the volume element.
How can I do this?