Entropy production by Fourier heat conduction (source code)

= Entropy production by Fourier heat conduction
{title2=$\rho\frac{DS}{Dt}=\nabla\cdot\frac{k\nabla T}{T}+\frac{k|\nabla T|^2}{T^2}$}

For an <ideal gas> with specific internal energy $c_vT$ and <Fourier's law> heat flux $\mathbf q=-k\nabla T$, subtraction of the kinetic-energy balance from total energy gives $\rho c_v DT/Dt+p\nabla\cdot\mathbf u=\nabla\cdot(k\nabla T)$. The <thermodynamic entropy> satisfies $TDS/Dt=c_vDT/Dt+p\nabla\cdot\mathbf u/\rho$, so
$$
\rho\frac{DS}{Dt}=\frac1T\nabla\cdot(k\nabla T)=\nabla\cdot\left(\frac{k\nabla T}{T}\right)+\frac{k|\nabla T|^2}{T^2}.
$$
The divergence describes entropy transport by heat; the final term is local irreversible production. For $T>0$ and $k\geq0$ it is nonnegative. In a fixed impermeable thermally insulated container, boundary entropy flux vanishes and mass conservation gives $d\int\rho S\,dV/dt=\int k|\nabla T|^2/T^2\,dV$. Insulation conserves total energy while permitting entropy to increase as temperature gradients relax.