.. _physics-coolingFunction: Cooling Function ================ Class providing radiative cooling functions of gas, :math:`\Lambda(\rho,T,\mathbf{Z})`, in units of erg cm\ :math:`^{-3}` s\ :math:`^{-1}`. The cooling function encodes the rate at which gas loses energy per unit volume through line emission, bremsstrahlung, and other radiative processes, as a function of hydrogen number density, temperature, and metal abundances. Implementations may assume collisional ionization equilibrium (CIE) or account for photoionization by a radiation field. The logarithmic slopes with respect to density and temperature are also provided. **Default implementation:** ``coolingFunctionAtomicCIECloudy`` Methods ------- ``coolingFunction`` → ``double precision`` Return the cooling function at the given temperature and hydrogen density for the specified set of abundances and radiation field. Units of the returned cooling function are the traditional ergs cm\ :math:`^{-3}` s\ :math:`^{-1}`. Note that the cooling function here is defined per unit volume, rather than per unit hydrogen as is often the case. * ``type (treeNode ), intent(inout) :: node`` * ``double precision , intent(in ) :: numberDensityHydrogen, temperature`` * ``type (abundances ), intent(in ) :: gasAbundances`` * ``type (chemicalAbundances ), intent(in ) :: chemicalDensities`` * ``class (radiationFieldClass), intent(inout) :: radiation`` ``coolingFunctionFractionInBand`` → ``double precision`` Return the fraction of the total cooling function due to emission in the the given energy range, specified by ``energyLow`` and ``energyHigh`` (in units of keV). * ``type (treeNode ), intent(inout) :: node`` * ``double precision , intent(in ) :: numberDensityHydrogen, temperature`` * ``type (abundances ), intent(in ) :: gasAbundances`` * ``type (chemicalAbundances ), intent(in ) :: chemicalDensities`` * ``class (radiationFieldClass), intent(inout) :: radiation`` * ``double precision , intent(in ) :: energyLow , energyHigh`` ``coolingFunctionDensityLogSlope`` → ``double precision`` Return :math:`\d\ln\Lambda/\d\ln\rho` for a cooling function at the given temperature and hydrogen density for the specified set of abundances and radiation field. * ``type (treeNode ), intent(inout) :: node`` * ``double precision , intent(in ) :: numberDensityHydrogen, temperature`` * ``type (abundances ), intent(in ) :: gasAbundances`` * ``type (chemicalAbundances ), intent(in ) :: chemicalDensities`` * ``class (radiationFieldClass), intent(inout) :: radiation`` ``coolingFunctionTemperatureLogSlope`` → ``double precision`` Return :math:`\d\ln\Lambda/\d\ln T` for a cooling function at the given temperature and hydrogen density for the specified set of abundances and radiation field. * ``type (treeNode ), intent(inout) :: node`` * ``double precision , intent(in ) :: numberDensityHydrogen, temperature`` * ``type (abundances ), intent(in ) :: gasAbundances`` * ``type (chemicalAbundances ), intent(in ) :: chemicalDensities`` * ``class (radiationFieldClass), intent(inout) :: radiation`` .. _physics-coolingFunctionAtomicCIECloudy: ``coolingFunctionAtomicCIECloudy`` ---------------------------------- A cooling function class that computes the cooling function using the Cloudy code and under the assumption of collisional ionization equilibrium with no molecular contribution. Abundances are Solar, except for zero metallicity calculations which use Cloudy's ``primordial`` metallicity. The helium abundance for non-zero metallicity is scaled between primordial and Solar values linearly with metallicity. The Cloudy code will be downloaded and run to compute the cooling function as needed, which will then be stored for future use. As this process is slow, a precomputed table is provided with Galacticus. If metallicities outside the range tabulated in this file are required it will be regenerated with an appropriate range. **(Default implementation)** **Methods** * ``tabulate`` — Run Cloudy to tabulate the cooling function as necessary. .. _physics-coolingFunctionCIEFile: ``coolingFunctionCIEFile`` -------------------------- A cooling function class providing a cooling function interpolated from a table read from file. The HDF5 file containing the table should have the following form: .. code-block:: none HDF5 "coolingFunction.hdf5" { GROUP "/" { ATTRIBUTE "fileFormat" { DATATYPE H5T_STRING { STRSIZE 1; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } DATASPACE SCALAR DATA { (0): "1" } } DATASET "coolingRate" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 7, 8 ) / ( 7, 8 ) } } DATASET "metallicity" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 8 ) / ( 8 ) } ATTRIBUTE "extrapolateHigh" { DATATYPE H5T_STRING { STRSIZE 3; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } DATASPACE SCALAR DATA { (0): "fix" } } ATTRIBUTE "extrapolateLow" { DATATYPE H5T_STRING { STRSIZE 3; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } DATASPACE SCALAR DATA { (0): "fix" } } } DATASET "temperature" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 7 ) / ( 7 ) } ATTRIBUTE "extrapolateHigh" { DATATYPE H5T_STRING { STRSIZE 8; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } DATASPACE SCALAR DATA { (0): "powerLaw" } } ATTRIBUTE "extrapolateLow" { DATATYPE H5T_STRING { STRSIZE 8; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } DATASPACE SCALAR DATA { (0): "powerLaw" } } } DATASET "energyContinuum" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 7 ) / ( 7 ) } } DATASET "powerEmittedFractionalCumulative" { DATATYPE H5T_IEEE_F64LE DATASPACE SIMPLE { ( 7, 8, 10 ) / ( 7, 8, 10 ) } } } } The ``temperature`` dataset should specify temperature (in Kelvin), while the ``metallicity`` dataset should give the logarithmic metallicity relative to Solar (a value of -999 or less is taken to imply zero metallicity). The ``coolingRate`` dataset should specify the cooling function (in ergs cm\ :math:`^3` s\ :math:`^{-1}` computed for a hydrogen density of 1 cm\ :math:`^{-3}`) respectively at each temperature/metallicity pair. The ``extrapolateLow`` and ``extrapolateHigh`` attributes of the ``temperature`` and ``metallicity`` datasets specify how the cooling rate should be extrapolated in the low and high vale limits. Allowed options for these attributes are: ``zero`` The cooling function is set to zero beyond the relevant limit. ``fixed`` The cooling function is held fixed at the value at the relevant limit. ``powerLaw`` The cooling function is extrapolated assuming a power-law dependence beyond the relevant limit. This option is only allowed if the cooling function is everywhere positive. If the cooling function is everywhere positive the interpolation will be done in the logarithm of temperature, metallicity\footnoteThe exception is if the first cooling function is tabulated for zero metallicity. In that case, a linear interpolation in metallicity is always used between zero and the first non-zero tabulated metallicity. and cooling function. Otherwise, interpolation is linear in these quantities. The cooling function is scaled assuming a quadratic dependence on hydrogen density. The ``energyContinuum`` and ``powerEmittedFractionalCumulative`` are optional. If present, ``powerEmittedFractionalCumulative`` gives the cumulative emitted power as a function of energy for each tabulated metallicity and temperature. The energies at which the emitted power is tabulated are given by ``energyContinuum``. **Methods** * ``readFile`` — Read the named chemical state file. * ``interpolatingFactors`` — Compute interpolating factors in a CIE chemical state file. * ``interpolate`` — Interpolate in the given density table. **Parameters** * ``[fileName]`` — The name of the file containing a tabulation of the collisional ionization equilibrium cooling function. * ``[fileName]`` — The name of the file containing a tabulation of the collisional ionization equilibrium chemical state. .. _physics-coolingFunctionCMBCompton: ``coolingFunctionCMBCompton`` ----------------------------- A cooling function class that computes the cooling function due to Compton scattering off of :term:`CMB` photons: .. math:: \Lambda = {4 \sigma_\mathrm{T} \mathrm{a} \mathrm{k}_\mathrm{B} n_\mathrm{e } \over m_\mathrm{e} \clight} T_\mathrm{CMB}^4 \left( T - T_\mathrm{CMB} \right), where :math:`\sigma_\mathrm{T}` is the Thompson cross-section, :math:`a` is the radiation constant, :math:`\mathrm{k}_\mathrm{B}` is Boltzmann's constant, :math:`n_\mathrm{e}` is the number density of electrons, :math:`m_\mathrm{e}` is the electron mass, :math:`\clight` is the speed of light, :math:`T_\mathrm{CMB}` is the :term:`CMB` temperature at the current cosmic epoch and :math:`T` is the temperature of the gas. The electron density is computed from the selected chemical state method (see :galacticus-class:`chemicalState`). .. _physics-coolingFunctionMolecularHydrogenGalliPalla: ``coolingFunctionMolecularHydrogenGalliPalla`` ---------------------------------------------- A cooling function class that computes the cooling function due to molecular hydrogen using the results of :cite:t:`galli_chemistry_1998`. For the H--H\ :math:`_2` cooling function, the fitting functions from :cite:t:`galli_chemistry_1998` are used. For the H\ :math:`_2^+`--e\ :math:`^-` and H--H\ :math:`_2^+` cooling functions fitting functions to the results plotted in :cite:t:`suchkov_cooling_1978` are used: .. math:: :label: eq-H2CoolingFunction \log_{10}\left({\Lambda(T) \over \hbox{erg s}^{-1} \hbox{cm}^3}\right) = C_0 + C_1 \log_{10} \left({T\over\hbox{K}}\right) + C_2 \left[\log_{10} \left({T\over\hbox{K}}\right)\right]^2, where the coefficients :math:`C_{0-2}` are given in Table :numref:`{number} `. .. list-table:: Coefficients of H\ :math:`_2^+` cooling functions as appearing in the fitting function, eq. :eq:`eq-H2CoolingFunction`. :name: tb-H2CoolingFunctionCoefficients :header-rows: 2 * - ​ - Coefficient - ​ - ​ * - Interaction - :math:`C_0` - :math:`C_1` - :math:`C_2` * - H\ :math:`_2^+`--e\ :math:`^-` - -33.33 - 5.565 - -0.4675 * - H--H\ :math:`_2^+` - -35.28 - 5.862 - -0.5124 **Methods** * ``coolingFunctionH_H2`` — Compute the cooling function due to H--H\ :math:`_2`. * ``coolingFunctionH2Plus_Electron`` — Compute the cooling function due to H\ :math:`_2^+`--e\ :math:`^-`. * ``coolingFunctionH_H2Plus`` — Compute the cooling function due to H--H\ :math:`_2^+`. * ``commonFactors`` — Compute common factors. .. _physics-coolingFunctionSummation: ``coolingFunctionSummation`` ---------------------------- Computes the total cooling function as a sum over multiple :galacticus-class:`coolingFunctionClass` objects, enabling construction of composite cooling functions from individual contributions (e.g., atomic cooling plus CMB Compton scattering). **Methods** * ``list`` — Return a list of all sub-components. .. _physics-coolingFunctionVelocityCutOff: ``coolingFunctionVelocityCutOff`` --------------------------------- A cooling function class which suppresses the cooling function of another class in halos with virial velocities below ``[velocityCutOff]`` and at redshifts before or after ``[redshiftCutOff]``, as selected by ``[whenCutOff]``. The formation or current node virial velocity is used depending on ``[useFormationNode]``. **Methods** * ``isCutOff`` — Returns true if the cooling function is cut off. **Parameters** * ``[useFormationNode]`` (default ``.false.``) — Specifies whether to use the virial velocity of the formation node or current node in the cooling rate "cut-off" modifier. * ``[velocityCutOff]`` (default ``0.0d0``) — The velocity below which cooling is suppressed in the "cut-off" cooling rate modifier method. * ``[redshiftCutOff]`` (default ``0.0d0``) — The redshift below which cooling is suppressed in the "cut-off" cooling rate modifier method. * ``[whenCutOff]`` (default ``var_str('after')``) — Specifies whether cooling is cut off before or after ``[redshiftCutOff]``.