Kinetic-energy balance for an incompressible Newtonian fluid (source code)

= Kinetic-energy balance for an incompressible Newtonian fluid

For a fixed domain $\mathcal D$, body-force density $f$, and stress tensor $\sigma$, the kinetic energy satisfies
$$
\frac d{dt}\int_{\mathcal D}\frac12\rho|u|^2dV
+\int_{\partial\mathcal D}\frac12\rho|u|^2u\cdot n\,dS
=\int_{\mathcal D}u\cdot f\,dV
+\int_{\partial\mathcal D}u\cdot\sigma\cdot n\,dS
-2\mu\int_{\mathcal D}e:e\,dV.
$$
The last term is the nonnegative rate at which viscosity converts mechanical energy into heat.