How to use a convective derivative

I am trying to figure out how to do a convective derivative in Mathematica in the context of the Navier-Stokes equation. The issue is, I have no clue how dot product a vector with the gradient operator. The below syntax doesn't work. Can anyone provide advice? The specific part of the Navier-Stokes equation I'm having trouble with is the term labeled "acceleration" in the link above.

\[Rho] (D[u, t] + Dot[u, \[Del]]*u)


Instead of the Del symbol (which has no built-in meaning) you need the gradient operator. What you're looking for can be achieved by using Map to apply the dot product of $\vec{u}$ and Grad to each row of the vector. I define this as the convective derivative dConvect and apply it to a test vector uVec:

uVec = Through[{Subscript[u, \[ScriptX]], Subscript[u, \[ScriptY]],
Subscript[u, \[ScriptZ]]}[x, y, z, t]];
dConvect[vec_] := D[vec, t] + ((vec.Grad[#, {x, y, z}]) & /@ vec)


The output is a little ugly, so I'll add some better formatting before displaying the result:

Derivative /:MakeBoxes[Derivative[\[Alpha]__][f1_][vars__?AtomQ],
Module[{bb, dd, sp},
MakeBoxes[dd, _] ^=
If[Length[{\[Alpha]}] == 1, "\[DifferentialD]", "\[PartialD]"];
MakeBoxes[sp, _] ^= "\[ThinSpace]";
bb /: MakeBoxes[bb[x__], _] := RowBox[Map[ToBoxes[#] &, {x}]];
TemplateBox[{ToBoxes[bb[dd^Plus[\[Alpha]], f1]],
ToBoxes[Apply[bb,
Riffle[Map[
bb[dd, #] &, (Pick[{vars}, #]^Pick[{\[Alpha]}, #] &[

• Not sure if I am supposed to do this - but dConvect won't find all the terms if I try it in Spherical Coordinates. I wonder how you'd do this? Commented Feb 3, 2021 at 17:56