Solution (source code)

= Solution

The spherical <stellar structure equations> apply to a planet as well, with its appropriate <equation of state>:
$$
\frac{dm}{dr}=4\pi r^2\rho,\qquad
\frac{dP}{dr}=-\frac{Gm\rho}{r^2},\qquad
\frac{\partial L}{\partial m}=\epsilon_{\rm nuc}-T\frac{\partial s}{\partial t}.
$$
The last equation is the local first law, including gravitational contraction through the <specific entropy> change. For an isolated non-burning planet, $\epsilon_{\rm nuc}\simeq0$, so
$$
\boxed{L_{\rm int}=-\int_0^M T\frac{\partial s}{\partial t}\,dm.}
$$
If the convective interior has nearly uniform <specific entropy> $s(t)$, positive outgoing luminosity gives $\dot s=-L_{\rm int}/\int T\,dm<0$. This <entropy loss of an isolated convective planet> describes its secular cooling.

During assembly, the gravitational energy scale $GM^2/R$ provides a source of heat. Integrating <hydrostatic equilibrium> gives the <virial theorem>, $\Omega+3\int P\,dV=0$, neglecting the surface-pressure term. For a monatomic <ideal gas> this becomes $2U+\Omega=0$, hence $E=U+\Omega=\Omega/2$. Contraction makes $\Omega$ more negative, releases radiation, and heats part of the gas. A characteristic formation temperature has scale $k_BT\sim\mu m_HGM/R$ up to structure factors. The retained fraction depends on the accretion shock, producing <hot and cold starts of a giant planet>.

\b[Formation releases heat, and an isolated planet subsequently loses <specific entropy> and intrinsic luminosity as it approaches a cooler, more degenerate state.] The structure equations alone do not fix one initial temperature, and the early contraction of an <ideal gas> can increase its central temperature while its total energy decreases. “Cools” therefore need not mean that every depth becomes colder at every instant. Once degeneracy limits contraction, the thermal reservoir declines more directly; the emergent <effective temperature> usually falls along a fixed-mass cooling track.

This makes young giant planets attractive for <exoplanet direct imaging>: their thermal near/mid-infrared emission can be far brighter than that of old planets of the same mass. Imaging and spectroscopy measure projected separation, astrometry, luminosity, an <exoplanet emission spectrum>, temperatures and atmospheric molecular and <exoplanet cloud> signatures. Radius follows from luminosity and fitted temperature; mass and initial <specific entropy> generally require age/evolutionary information, or an independent dynamical mass measurement. A detected luminosity alone is not a model-independent planet mass.