Basically:

d = TrialFunction(D.function_space())
e = TestFunction(D.function_space())

solve(d * e * dx == div(q) * e * dx, D)

One might have to think a little about what value this gives at the boundary, but I think it's OK.

On Thu, 12 Nov 2015 at 11:00 Justin Chang <jychang48@gmail.com> wrote:
Hi all,

Perhaps this may be a simple question, but say I have this bilinear and linear form:

a = grad(u)*D*grad(v)*dx
L = F*v*dx

where u,v is trial/test function on CG1 space, and D and F are coefficients that live in DG0 space.

Say I have a velocity vector function q (CG1) on the same mesh and want D to be the element-wise divergence of said velocity.

How would I formulate D in Firedrake? 

Thanks,
Justin