Using statistical mechanics, it can be shown that the Helmholtz free energy density $f(T)$ for photons (where the chemical potential is zero $\mu=0$) can be expressed as the following integral,
\begin{equation} f(T) = k_B T ~ \int\limits_0^{\infty}D(\omega) \ln \left[ 1- \exp \left( \frac{-\hbar\omega}{k_B T} \right) \right]d\omega. \end{equation}Here $\hbar\omega$ is the energy of photons with frequency $\omega$ and $D(\omega)$ is the density of states. This result is discussed in Statistical Physics, Part 1 by Landau and Lifshitz and in the notes on the thermodynamic properties of bosons.
The form below uses this formula to calculate the temperature dependence of the Helmholtz free energy density from tabulated data for the density of states. The density of states data is input as two columns in the textbox at the lower left. The first column is the angular-frequency $\omega$ in rad/s. The second column is the density of states. The units of the density of states depends on the dimensionality: s/m for 1d, s/m² for 2d, and s/m³ for 3d.
After the 'DoS → f(T)' button is pressed, the density of states is plotted on the left and $f(T)$ is plotted from temperature $T_{\text{min}}$ to temperature $T_{\text{max}}$ on the right. The data for the $f(T)$ plot also appear in tabular form in the lower right textbox. The first column is the temperature in Kelvin and the second column is the Helmholtz free energy density in units of J m-1, J m-2, or J m-3 depending on the dimensionality.
D(ω) | f(T) | |||
ω [1015 rad/s] | T [K] | |||
Input: [ω D(ω)] | Output: [T f(T)] | |||
Photons in vacuum: