.. _physics-haloSpinDistribution: Dark Matter Halo Spin Parameter Distributions ============================================= Class providing the distribution :math:`p(\lambda)` of the dark matter halo spin parameter :math:`\lambda \equiv J |E|^{1/2} / \mathrm{G} M^{5/2}`, where :math:`J` is the angular momentum, :math:`E` the total energy, and :math:`M` the halo mass. The spin distribution, sometimes approximated by a log-normal, determines the range of galaxy disk sizes that form from cooling gas conserving the specific angular momentum of the halo. Implementations return both the distribution function :math:`p(\lambda)` and random samples from it, enabling Monte Carlo assignment of spins to halos. **Default implementation:** ``haloSpinDistributionBett2007`` Methods ------- ``sample`` → ``double precision`` Samples a spin parameter from the distribution for the given ``node``. * ``type(treeNode), intent(inout) :: node`` ``distribution`` → ``double precision`` Return the spin distribution function, :math:`p(\lambda)`, for the given ``node``. It is assumed that ``node`` provides the value of the spin at which the distribution function should be evaluated. * ``type(treeNode), intent(inout) :: node`` .. _physics-haloSpinDistributionBett2007: ``haloSpinDistributionBett2007`` -------------------------------- A halo spin distribution in which the spin is drawn from the distribution found by :cite:t:`bett_spin_2007`. The :math:`\lambda_0` and :math:`\alpha` parameter of :cite:t:`bett_spin_2007`'s distribution are set by the ``[lambda0]`` and ``[alpha]`` input parameters. **(Default implementation)** **Parameters** * ``[lambda0]`` (default ``0.04326d0``) — The parameter :math:`\lambda_0` in the halo spin distribution of :cite:t:`bett_spin_2007`. * ``[alpha]`` (default ``2.509d0``) — The parameter :math:`\alpha` in the halo spin distribution of :cite:t:`bett_spin_2007`. * ``[errorTolerant]`` (default ``.false.``) — Error tolerance for the N-body spin distribution operator. * ``[logNormalRange]`` (default ``100.0d0``) — The multiplicative range of the log-normal distribution used to model the distribution of the mass and energy terms in the spin parameter. Specifically, the lognormal distribution is truncated outside the range :math:`(\lambda_\mathrm{m}/R,\lambda_\mathrm{m} R`, where :math:`\lambda_\mathrm{m}` is the measured spin, and :math:`R=`\ ``[logNormalRange]`` .. _physics-haloSpinDistributionDeltaFunction: ``haloSpinDistributionDeltaFunction`` ------------------------------------- A halo spin distribution class in which the spin is drawn from a :math:`\delta`-function distribution, :math:`P(\lambda) = \delta(\lambda-\lambda_0)`, where :math:`\lambda_0=`\ ``[spin]``, i.e. a fixed value of spin equal to :math:`\lambda_0` is returned. **Parameters** * ``[densityHydrogen]`` (default ``100.0d0``) — The density of hydrogen, :math:`n_\mathrm{H}`, in HII regions (in units of cm\ :math:`^{-3}`). * ``[spin]`` (default ``0.03687d0``) — The fixed value of spin in a :math:`\delta`-function spin distribution. .. _physics-haloSpinDistributionLogNormal: ``haloSpinDistributionLogNormal`` --------------------------------- A halo spin distribution class in which the spin is drawn from a lognormal distribution with median :math:`\bar{\lambda}=`\ ``[median]`` and width :math:`\sigma=`\ ``[sigma]``. Specifically, the distribution function for spin, :math:`\lambda`, is .. math:: p(\lambda) = \frac{1}{\sqrt{2 \pi} \sigma \lambda} \exp\left[ - \frac{1}{2} \left(\frac{\log\lambda-\log\bar{\lambda}}{\sigma}\right)^2\right]. **Parameters** * ``[median]`` (default ``0.03687d0``) — The median value of the dimensionless Bullock spin parameter :math:`\lambda` in the log-normal distribution, representing the typical angular momentum content of dark matter halos at the present day. * ``[sigma]`` (default ``0.5102d0``) — The standard deviation :math:`\sigma` of :math:`\ln\lambda` in the log-normal spin distribution, controlling the spread of spin parameters across the halo population; larger values produce a broader distribution of angular momenta. * ``[mean]`` — The mean of the log-normal distribution (*ignoring* any imposed upper and lower limits). * ``[variance]`` — The variance of the log-normal distribution (*ignoring* any imposed upper and lower limits). * ``[x0]`` — The median (geometric mean) :math:`x_0 > 0` of the log-normal distribution; the distribution peaks at :math:`x_0 \exp(-\sigma^2)` and has median :math:`x_0`. * ``[sigma]`` — The logarithmic width (standard deviation of :math:`\ln x`) :math:`\sigma > 0` of the log-normal distribution; the distribution becomes more skewed and broader as :math:`\sigma` increases. * ``[limitLower]`` — The lower truncation limit :math:`x_\mathrm{min}` of the log-normal distribution; when set, the distribution is renormalized over :math:`[x_\mathrm{min}, x_\mathrm{max}]` rather than :math:`(0, \infty)`. * ``[limitUpper]`` — The upper truncation limit :math:`x_\mathrm{max}` of the log-normal distribution; when set, the distribution is renormalized over :math:`[x_\mathrm{min}, x_\mathrm{max}]` rather than :math:`(0, \infty)`. * ``[radiusEnvironment]`` (default ``7.0d0``) — The radius of the sphere used to determine the variance in the environmental density. .. _physics-haloSpinDistributionNbodyErrors: ``haloSpinDistributionNbodyErrors`` ----------------------------------- A halo spin distribution which modifies another spin distribution to account for the effects of particle noise errors in spins measured in N-body simulations. **Methods** * ``distributionAveraged`` — Return the spin distribution function averaged over all halos above the given ``massLimit``. * ``distributionFixedPoint`` — Return the spin distribution function at a fixed point in intrinsic mass and spin. * ``tabulate`` — Tabulate the spin distribution as a function of spin and halo mass. Ensure that the table spans the ``massRequired`` and ``spinRequireed`` if provided. **Parameters** * ``[massParticle]`` — The mass (in :math:`\mathrm{M}_\odot`) of a single N-body simulation particle, used together with the halo particle count to estimate measurement errors in the halo spin parameter arising from discrete particle sampling. * ``[particleCountMinimum]`` — Minimum number of particles per halo in the N-body simulation. * ``[energyEstimateParticleCountMaximum]`` — Maximum number of particles used in estimating the potential energy of halos. Set to a very large number if no such maximum was used. * ``[redshift]`` — Redshift at which the spin distribution should be evaluated. * ``[logNormalRange]`` (default ``100.0d0``) — The multiplicative range of the log-normal distribution used to model the distribution of the mass and energy terms in the spin parameter. Specifically, the lognormal distribution is truncated outside the range :math:`(\lambda_\mathrm{m}/R,\lambda_\mathrm{m} R`, where :math:`\lambda_\mathrm{m}` is the measured spin, and :math:`R=`\ ``[logNormalRange]``