I have a vector field, say
def W(x,y,z):
return [x^2,y*z, 2*z]
I want to include the divergence in the statement of my problem, for example
F = inner(grad(u),grad(v))*dx - div(W(x[0], x[1], u)*v*dx
problem = NonlinearVariationalProblem(F, u_, bcs, J)
and so forth. My function space is two-dimensional, u is a function of x[0] and x[1]. I think that is my problem? The built in divergence function is expecting 2 variables, but my vector field has 3. I don't want to calculate it by hand because my actual vector field is much worse.