:py:mod:`protoRT.compute_opacities` =================================== .. py:module:: protoRT.compute_opacities .. autoapi-nested-parse:: Created on Fri Nov 29 12:01:01 2024 @author: daniel Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: protoRT.compute_opacities.dsharp_model .. py:function:: dsharp_model(p, wavelength, grain_sizes, bin_approx=False) Compute dust absorption and scattering opacities using the DSHARP model. This function supports both monodisperse and polydisperse grain size distributions, allowing for either a full grain size integration or a binned approximation (`bin_approx`). Opacities are computed using the DSHARP dust opacity tables (Birnstiel et al. 2018) and are valid for wavelengths in the range 1e-5 to 10 cm and grain sizes from 1e-5 to 100 cm. It assumes a constant internal density across all grain sizes of 1.675 (g/cm³), as per the adopted dust model. .. rubric:: Notes When `bin_approx=True`, the grain size distribution is discretized into bins such that: - The first bin always starts at 1e-5 cm (minimum DSHARP grain size). - Each bin's `a_max` is given by the input `grain_sizes`. - Each subsequent bin begins slightly above the previous bin edge (offset by 1e-10 cm) to avoid overlap and mass overestimation. If `bin_approx=False`, a single grain size is assumed (monodisperse case). .. warning:: Opacities cannot be computed for exactly 1e-5 cm unless a small positive offset is applied (e.g., `1e-5 + 1e-10` cm), due to our binning strategy. :param p: Power-law index of the grain size distribution; n(a) ∝ a^(-p). :type p: float :param wavelength: Wavelength at which to evaluate the opacities [cm]. :type wavelength: float :param grain_sizes: Array of maximum grain sizes for each bin [cm]. :type grain_sizes: list or ndarray :param bin_approx: If True, enables the binned approximation for polydisperse models. Default is False (monodisperse case). :type bin_approx: bool, optional :returns: * **absorption_opacities** (*np.ndarray*) -- Absorption opacities (cm²/g) for each grain bin. * **scattering_opacities** (*np.ndarray*) -- Scattering opacities (cm²/g) for each grain bin. * **grain_size_bins** (*np.ndarray*) -- Array of (a_min, a_max) tuples for each grain size bin [cm].