Boundary-pressure correction to the virial theorem (source code)

= Boundary-pressure correction to the virial theorem
{title2=$2\langle K\rangle+\langle U\rangle=3\langle P_s\mathcal V\rangle$}

An external <pressure> changes the balance even if the system remains confined. For a material boundary acted on by spatially uniform inward <pressure> $P_s$, the surface <force> contributes $-P_s\int_{\partial\mathcal V}\mathbf r\cdot\mathbf n\,dS=-3P_s\mathcal V$, by the <divergence theorem>. For <Newtonian gravitational potential energy>, the finite-window identity becomes
$$
\frac{G(T)-G(0)}T=2\langle K\rangle_T+\langle U\rangle_T-3\langle P_s\mathcal V\rangle_T.
$$
Here $\mathcal V$ is the enclosed <volume>, $\mathbf n$ the outward <unit normal>, and $K$ includes the microscopic translational <kinetic energy> of the confined particles. Do not also add the same random motions as a separate internal <pressure> term. A nonuniform external stress needs its surface integral; a fixed observational boundary crossed by matter also needs flux terms.<Negative Specific Heat in Astronomy, Physics and Chemistry by D. Lynden-Bell>[Negative Specific Heat in Astronomy, Physics and Chemistry by D. Lynden-Bell, p. 2, §1: external-pressure virial relation]{ref}

With negligible surface <pressure>, the <negative heat capacity of a virialized gravitational system> follows from $E=-\langle K\rangle$: after a slow loss of total <energy> and readjustment to <virial equilibrium>, the average <kinetic energy> rises. For fixed $N$ classical particles with three translational <degrees of freedom>, define kinetic <temperature> $\Theta$ by $\langle K\rangle=3Nk_B\Theta/2$. Along this isolated equilibrium sequence, $dE/d\Theta=-3Nk_B/2$. The system contracts and its binding <potential energy> becomes more negative, supplying both the outgoing <energy> and the increased <kinetic energy>. This is an endpoint comparison, not a claim that every transient contraction obeys the average relation. A <collisionless stellar system> need not have a common thermodynamic <temperature>; a pressure-confined system instead has $E=-\langle K\rangle+3\langle P_s\mathcal V\rangle$. A stable <canonical ensemble> in contact with a large <thermal reservoir> does not support this negative <heat capacity> branch.<Negative Specific Heat in Astronomy, Physics and Chemistry by D. Lynden-Bell>[Negative Specific Heat in Astronomy, Physics and Chemistry by D. Lynden-Bell, pp. 2-3, §1: isolated-system energy, negative heat capacity and instability in a large heat bath]{ref}