This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

interpolation of test functions

+4 votes

Suppose that I need to compute a variation of the usual finite element method for the Poisson equation using Lagrange elements of degree one:

Find $u_h\in V_h$ such that
$$(\nabla u_h, \nabla v) = (f, I_h v), \forall v\in V_h,$$
where the unusual aspect is that instead of $(f, v)$ on the right hand side we have $(f, I_h v)$, where $I_h$ is the interpolant into the space of piecewise constants.

How could I implement this in Dolfin? The obvious code snippet

mesh = UnitSquareMesh(4, 4)
Vh = FunctionSpace(mesh, "Lagrange", 1)
Wh = FunctionSpace(mesh, "DG", 0)
f = Expression('x[0]')
uh = TrialFunction(Vh)
vh = TestFunction(Vh)
a = inner(grad(uh), grad(vh)) * dx
b = f * interpolate(vh, Wh) * dx

is not allowed, since one cannot apply interpolate to a test function. Is there another way?

BTW, this is not our real application, but rather a simplification, but interpolation on the test function does arise in real applications.

asked Sep 12, 2013 by dnarnold FEniCS User (2,360 points)

1 Answer

+2 votes

This is only possible if you can express the operator $I_h$ in UFL syntax. In earlier versions of FFC (very early, 2005-2006), there were operators for doing local projections so it would be possible to add such operators to be used on test functions (and other quantities).

The other option would be if there was a way to rewrite $(f, I_hv)$ and compute it via some sequence of global operations (computing projections, solving linear systems).

answered Sep 12, 2013 by logg FEniCS Expert (11,790 points)

In principle tho option of rewriting is guaranteed to be possibile by Frechet-Riesz representation theorem. There are its constructive proofs, aren't they? These should give you a procedure for a construction of $g\in V_h$ s.t.
$$(g,v) = (f,I_hv) \quad \forall v\in V_h.$$

That would still require that it's possible to express $I_h$ somehow in FEniCS.

I see. Just of a curiosity, is not $g$ precisely projection of $f$ onto degree 0 quadrature element?

Ah, sorry, this is not correct.

Thanks for the suggestions, which did lead to a solution. This can be done by taking $u_h\in V_h$ and $U_h=I_h u_h\in W_h$ as independent variables and enforcing the condition $U_h=I_h u_h$ with a Lagrange multiplier, $w_h\in W_h$. This leads to the following method, which has a straightforward Dolfin implementation:

Find $u_h\in V_h$, $U_h\in W_h$, $w_h\in W_h$ such that
$$
(\nabla u_h,\nabla v) + (w_h, v-V) = (f,V), \quad\forall v\in V_h,\ V\in W_h,
$$
$$(u_h-U_h, y) = 0, \quad\forall y\in W_h.
$$

This uses the fact that for $v$ piecewise linear, the interpolant $I_hv$ into piecewise constants is the same as the $L^2$ projection. I suppose that if $V_h$ were a bigger space, say piecewise quadratics, I could force the term $(w_h, v-V)$ to be computed with 1-point quadrature if I want the interpolant rather than the $L^2$ projection.

Thanks!

...