The temperature is found by solving the equation of thermal equilibrium, which may be written schematically as This is solved simultaneously with the condition of charge conservation. We treat heating and cooling by calculating the rate of removal or addition of energy to local radiation field associated with each of the processes affecting level populations (this is in contrast to the method where these were calculated via their effects on the electron thermal bath as in KM82). Heating therefore includes photoionization heating and Compton heating. The cooling term includes radiative recombination, bremsstrahlung, and radiative deexcitation of bound levels. Cooling due to recombination and radiative deexcitation is included only for the escaping fraction, as described elsewhere in this section.

In the most highly ionized regions of our models, the dominant heating process is electron recoil following Compton scattering. In the non-relativistic approximation the net heating rate may be written (Ross 1979)

Here is the Thomson cross section, is the electron number density, T is the electron temperature, and is the local mean intensity in the radiation field. The first term in the brackets represents the heating of electrons by the X-rays, and the second term represents cooling of hot electrons by scattering with low energy photons. The treatment of Compton heating and cooling in versions prior to 2.3 were not accurate for hard spectra with significant flux above 100 keV. This has been updated in version 2.3 using rates from I. Khabibullin (private communication), based on the expressions given by Shestakov et al. (1988 JQSRT 40 577) The energy shift per scattering is calculated by interpolating in a table (coheat.dat).

The spectrum of photoelectron energies for each ion is found by convolving the radiation field, weighted by photoelectron energy, with the photoionization cross section (see, e.g., [Osterbrock 1974]). The integral of this quantity provides the photoelectric heating rate.

The cooling rate due to radiative recombination is calculated by explicitly evaluating the quadrature over the recombination continuum spectrum for each recombining level, weighted by the escape fraction for that transition. The bremsstrahlung cooling rate is ([Osterbrock 1974])

where T is the electron temperature, is the electron number density, z is the charge on the cooling ion, and is the ion density.