  Cooling and heating functions of cosmic gas are a crucial ingredient for any
study of gas dynamics and thermodynamics in the interstellar and intergalactic
medium. As such, they have been studied extensively in the past under the
assumption of collisional ionization equilibrium. However, for a wide range of
applications, the local radiation field introduces a non-negligible, often
dominant, modification to the cooling and heating functions. In the most
general case, these modifications cannot be described in simple terms, and
would require a detailed calculation with a large set of chemical species using
a radiative transfer code (the well-known code Cloudy, for example). We show,
however, that for a sufficiently general variation in the spectral shape and
intensity of the incident radiation field, the cooling and heating functions
can be approximated as depending only on several photoionization rates, which
can be thought of as representative samples of the overall radiation field.
This dependence is easy to tabulate and implement in cosmological or
galactic-scale simulations, thus economically accounting for an important but
rarely-included factor in the evolution of cosmic gas. We also show a few
examples where the radiation environment has a large effect, the most
spectacular of which is a quasar that suppresses gas cooling in its host halo
without any mechanical or non-radiative thermal feedback.
