# Divergence of a tensor product

I am working on deriving the Navier-Stokes equation in spherical coordinates for a homework assignment, but I've hit a serious math roadblock. My background in tensors is very minimal and a crucial term in the Navier-Stokes equation involves the divergence of a tensor product, \begin{equation*} \nabla \cdot \big(\rho \vec{v}\,\otimes\,\vec{v}\big). \end{equation*}

I saw on Wikipedia that, \begin{equation*} \nabla\cdot\big(\vec{B}\,\otimes\,\hat{A}\big) = \hat{A}\big(\nabla\cdot\vec{B}\big) + \big(\vec{B}\cdot\nabla\big)\hat{A}. \end{equation*} I am honestly not sure what $\hat{A}$ means, but I assume it's just another notation for $\vec{A}$. If so, this places me in a predicament because I now have to compute the gradient of a vector, $\nabla\vec{A}$, which I don't know how to do and cannot find any online resources describing how to do this in a way I can understand.

It would help me tremendously to have some kind of example of a tensor product and/or divergence of a tensor product that uses simple cartesian coordinates $x$, $y$, and $z$. I am confident that I can produce the equivalent in spherical coordinates, but as of now I am mathematically (not physically) stumped. Please help!

• Try writing the term in parenthesis in terms of unit vectors (in spherical coordinates), and apply the del operator to it (taking into account the partial derivatives of the unit vectors with respect to the spatial coordinates), and then, with each partial derivative, dotting with the corresponding leading unit vector of del. – Chet Miller Oct 1 '17 at 1:33
• Vector notation definitely reaches the limit of its usefulness in the NS equations - better to just write expressions that complicated out in index notation, otherwise people spend more time deciphering the notation than they do thinking about what the equation means. – tparker Oct 1 '17 at 2:54

$\mathbf{v} \cdot \mathbf{u} = \mathbf{v}^{T} \mathbf{u}$ = scalar.

$\mathbf{v} \otimes \mathbf{u} = \mathbf{v} \mathbf{u}^T$ = matrix.

So if $$\mathbf{v} = \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right),$$

$$\mathbf{v} \cdot \mathbf{v} = (v_x \,v_y \, v_z) \times \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right) = v_x^2 + v_y^2 + v_z^2,$$

$$\mathbf{v} \otimes \mathbf{v} = \left( \begin{array}{c} v_x\\ v_y\\ v_z \end{array} \right) \times (v_x \,v_y \, v_z) = \left (\begin{array}{c c c} v_x^2 & v_xv_y & v_xv_z \\ v_y v_x & v_y^2 & v_y v_z\\ v_z v_x & v_z v_y & v_z^2 \end{array} \right).$$

Now, the gradient operator $\nabla$ is just a vector:

$$\nabla = \left( \begin{array}{c} \frac{\partial}{\partial x}\\ \frac{\partial}{\partial y}\\ \frac{\partial}{\partial z} \end{array} \right),$$

so

$$\nabla(\rho \mathbf{v} \otimes \mathbf{v}) = \rho \nabla^T(\mathbf{v} \otimes \mathbf{v}) = \rho \left (\frac{\partial}{\partial x} \, \frac{\partial}{\partial y} \, \frac{\partial}{\partial z} \right) \cdot \left (\begin{array}{c c c} v_x^2 & v_xv_y & v_xv_z \\ v_y v_x & v_y^2 & v_y v_z\\ v_z v_x & v_z v_y & v_z^2 \end{array} \right) ,$$

which gives you a vector.

Here I assumed $\rho$ is constant, but it can be easily generalised to the case of it being a function $x, y$ and $z$.

-

The identity you provided can be proved via index notation, let us know whether you need help with that.

• This is a really great answer and I really appreciate your expeditious response, thank you! I am a bit confused on some of the final equations, though. Should $\nabla(\rho\vec{v}\otimes\vec{v})$ actually be $\nabla\cdot(\rho\vec{v}\otimes\vec{v})$ and will this change any of the above? Writing the gradient as a vector is a brilliant idea! – boof Oct 1 '17 at 2:06
• Yes, the key thing is that there is a product involved. Writing the dot product symbol $\cdot$ usually assumes that you end up with a scalar. Which is why, for the sake of clarity, I sometiles avoid it. But provided you know what it means, then you can do whatever you want. – SuperCiocia Oct 1 '17 at 2:08
• Oh! One more thing, in this problem $\rho$ is not constant. Does this just mean $\rho$ follows through in all the components with its own spacial components? – boof Oct 1 '17 at 2:21
• You just keep $\rho$ inside the big matrix, and when the differentiation operators come in, you use the product rule and differentiate it. E.g. $\partial/ \partial x (\rho v_x^2) = \partial \rho / \partial x \, v_x^2 + \rho (x,y,z)\,\partial(v_x^2)/ \partial x$. – SuperCiocia Oct 1 '17 at 2:23
• All of this can be made simpler with index notation, as the guy below has showed. You have to familiarise yourself with it first, though, and before that I guess that full out matrices are best. – SuperCiocia Oct 1 '17 at 2:29

The equation, $$\nabla\cdot (\rho \textbf v \otimes \textbf v),$$ can be written in index notation as, $$\partial_i (\rho v_i v_j),$$ where the dot product becomes an inner product, summing over two indices, $$\textbf a \cdot \textbf b = a_i b_i,$$ and the tensor product yields an object with two indices, making it a matrix, $$\textbf c \otimes \textbf d = c_i d_j =: M_{ij}.$$ Now we differentiate using the product rule, $$\partial_i (\rho v_i v_j)=(\partial_i \rho) v_i v_j + \rho (\partial_i v_i) v_j + \rho v_i (\partial_i v_j).$$ Let’s look at the terms separately:

$\bullet (\partial_i \rho) v_i v_j$: assuming $\rho=\rho(\textbf x)$, the expression within the brackets is the vector $(\partial_x\rho, \partial_y\rho, \partial_z\rho)$, which then gets dot multiplied with the vector $\textbf v$. This yields a number, say $c_1$, which gets multiplied to every component of the vector $v_j$. So the result here is a vector. If $\rho$ is constant, this term vanishes.

$\bullet\rho (\partial_i v_i) v_j$: Here we calculate the divergence of $\textbf v$, $$\partial_i a_i = \nabla \cdot \textbf a = \text{div }\textbf a,$$ and multiply this number with $\rho$, yielding another number, say $c_2$. This gets multiplied onto every component of $v_j$. The resulting thing here is again a vector.

$\bullet\rho v_i (\partial_i v_j)$: Here we construct a matrix with the composition rule, $$M_{ij} := \partial_i v_j,$$ that is for example $M_{13}=\partial_x v_z$. We then multiply a (row)vector $v_i$ to this matrix, yielding a different vector. Finally, every component of this new vector gets multiplied by $\rho$, so we have a vector again.

• In the step after we differentiate using the product rule, how do we get a vector result? The vector $(\partial_x \rho, \partial_y\rho, \partial_z\rho)$ is created, which is then dotted with the vector $\vec{v}$, which is then dotted again with the vector $\vec{v}$. This result should be a scalar since $\vec{v}\cdot\vec{v} = |\vec{v}|^2$ – boof Oct 2 '17 at 18:13
• Yes, you dot the vector $(\partial_x \rho, \partial_y\rho, \partial_z\rho)_i$ with the vector $v_i$, which yields a scalar. This scalar gets multiplied to the vector $v_j$. But this is no dot product, since the result from $(\partial_x \rho, \partial_y\rho, \partial_z\rho)_i v_i$ is a scalar. – Stephan Oct 3 '17 at 1:41