# Is a product of grads a tensor in Fenics

Hi all,
I’m working with an equation that has a term like this

\dot u_i + ... = \nabla_j(\nabla_i\phi\nabla_j\phi)

where u_i is the function I want to solve for, hich is a vector, and \phi is a scalar function.

My question, is how does Fenics interpret the product of two grads? If the term on the right hand side would translate, for a test function w_i, as:

\nabla_i\phi\nabla_j\phi \nabla_j w_i

can I write that in Fenics as

inner(grad(\phi)*grad(\phi) , grad(w))*dx


or like

inner( outer(grad(\phi) , grad(\phi)) , grad(w) )*dx


Or are those two things the same for Fenics?

Thank you!

By simply trying such a code in dolfin, you obtain an error message:

from dolfin import *
mesh = UnitSquareMesh(10,10)
V = FunctionSpace(mesh, "CG", 1)
phi = Function(V)
W = VectorFunctionSpace(mesh, "CG", 1)
w = Function(W)

Invalid ranks 1 and 1 in product.
Traceback (most recent call last):
File "outer.py", line 10, in <module>