Balanced shallow-water energy as a signed potential-vorticity pairing (source code)

= Balanced shallow-water energy as a signed potential-vorticity pairing
{title2=$E_b=-\dfrac{gH}{2f}\int\eta q\,dA$}

With constant density divided out, a decaying or periodic <geostrophic balance> on an <f-plane> has
$$
E_b=\frac12\int(H|\mathbf u_g|^2+g\eta^2)\,dA=-\frac{gH}{2f}\int\eta q\,dA,
$$
where $q=\zeta-f\eta/H$ is the signed <linearized shallow-water potential-vorticity anomaly>. The stationary height equation and <integration by parts> prove the identity. Replacing $q$ by $|q|$ destroys it: an odd height paired with symmetric opposite-sign sheets would then misleadingly give zero.