Solution (source code)

= Solution

Write $D_t=\partial_t+\mathbf u\cdot\nabla$ and $\mathbf L=(\nabla\times\mathbf B)\times\mathbf B/\mu_0$. The <continuity equation> converts a material specific-energy balance into a conservative <energy density> balance. Dot the <ideal magnetohydrodynamic momentum equation> with $\mathbf u$, and use the time independence of the <Newtonian gravitational potential>:
$$
\partial_t\!\left[\rho\left(\frac{u^2}{2}+\Phi\right)\right]+\nabla\cdot\!\left[\rho\mathbf u\left(\frac{u^2}{2}+\Phi\right)\right]=-\mathbf u\cdot\nabla p+\mathbf u\cdot\mathbf L.
$$
For the <energy density> $U=p/(\gamma-1)$ associated with <internal energy>, the adiabatic <pressure> equation gives
$$
\partial_tU+\nabla\cdot(U\mathbf u)=-p\nabla\cdot\mathbf u.
$$
The <ideal magnetohydrodynamic induction equation> and the cross-product <divergence> identity give the <magnetic energy> balance
$$
\partial_t\frac{B^2}{2\mu_0}=\frac1{\mu_0}\nabla\cdot[(\mathbf u\times\mathbf B)\times\mathbf B]-\mathbf u\cdot\mathbf L.
$$
Indeed $(\mathbf u\times\mathbf B)\cdot(\nabla\times\mathbf B)=-\mu_0\mathbf u\cdot\mathbf L$. The magnetic work cancels the kinetic magnetic work. The remaining <pressure> terms are $-\nabla\cdot(p\mathbf u)$. Adding all three balances proves <ideal magnetohydrodynamic energy conservation>:
$$
\boxed{\partial_t\mathcal E+\nabla\cdot\mathbf F=0,\quad \mathcal E=\frac{\rho u^2}{2}+\rho\Phi+\frac{p}{\gamma-1}+\frac{B^2}{2\mu_0},}
$$
where
$$
\mathbf F=\rho\mathbf u\left(\frac{u^2}{2}+\Phi+\frac{\gamma p}{(\gamma-1)\rho}\right)-\frac{(\mathbf u\times\mathbf B)\times\mathbf B}{\mu_0}.
$$
The last term is the <Poynting vector> with the ideal electric field $\mathbf E=-\mathbf u\times\mathbf B$. A time-dependent imposed potential would instead supply the source $\rho\partial_t\Phi$.