Solution (source code)

= Solution

\b[Origin of <diffusion>.] In a material near local <thermal equilibrium>, microscopic carriers transfer <energy> from hotter regions to colder regions. On distances long compared with their <mean free path> and times long compared with relaxation times, the local constitutive law is <Fourier's law>,
$$
\mathbf J_Q=-\kappa\nabla T.
$$
Combining this temperature-gradient-driven flux with local <conservation of energy> produces a <diffusion equation>. This description assumes diffusive <thermal conduction>; it is not generally valid for <ballistic transport>, and flow would add advective transport.

\b[<Energy> balance with heating.] Choose any fixed <volume (thermodynamics)> $V$, let $c$ be its uniform <volumetric heat capacity> and $H$ its <heat> generation rate per unit <volume (thermodynamics)>. The rate of increase of <internal energy> equals <heat> generation minus outward <heat flux>:
$$
\int_V c\frac{\partial T}{\partial t}\,dV
=-\oint_{\partial V}\mathbf J_Q\cdot\widehat{\mathbf n}\,dA+\int_VH\,dV
=\int_V\left[\nabla\cdot(\kappa\nabla T)+H\right]dV.
$$
Since $V$ is arbitrary, for constant <thermal conductivity>
$$
\boxed{\frac{\partial T}{\partial t}=\frac{\kappa}{c}\nabla^2T+\frac{H}{c}.}
$$
The ratio $\kappa/c$ is the <thermal diffusivity> in $\mathrm{m^2\,s^{-1}}$. Here $c$ is in $\mathrm{J\,m^{-3}K^{-1}}$, $\kappa$ in $\mathrm{W\,m^{-1}K^{-1}}$ and $H$ in $\mathrm{W\,m^{-3}}$, so both right-hand terms have units $\mathrm{K\,s^{-1}}$. If <thermal conductivity> varies with position or <temperature>, the <divergence> $\nabla\cdot(\kappa\nabla T)$ must be retained rather than replacing it by $\kappa\nabla^2T$.