:py:mod:`protoRT.disk_model` ============================ .. py:module:: protoRT.disk_model .. autoapi-nested-parse:: Created on Fri Aug 12 09:25:13 2022 @author: daniel Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: protoRT.disk_model.Model Functions ~~~~~~~~~ .. autoapisummary:: protoRT.disk_model._set_style_ .. py:class:: Model(r, r_c, M_star, M_disk, grain_size=0.1, grain_rho=1, T0=150, q=3.0 / 7, gamma=1, mmol=2.3, Z=0.01, stoke=None) Generate and visualize a 1D midplane model of a protoplanetary disk. This class defines a physically consistent disk structure, including gas and dust surface densities, temperature, and stability parameters. It enables proper unit conversion and parameter initialization for use in simulations and radiative transfer calculations. .. note:: All units are assumed to be in CGS. :param r: Disk radii where quantities are evaluated (cm). :type r: float or ndarray :param r_c: Characteristic disk radius (cm), typically ~30 AU (compact) to 300 AU (large). :type r_c: float :param M_star: Mass of the central star (g). :type M_star: float :param M_disk: Total disk mass (g). :type M_disk: float :param grain_size: Grain size (cm); used only if `stoke` is None. Default is 0.1. :type grain_size: float, optional :param grain_rho: Internal grain density (g/cm³). Default is 1. :type grain_rho: float, optional :param T0: Reference temperature at 1 AU (K). Default is 150. :type T0: float, optional :param q: Temperature power-law index. Default is 3/7. :type q: float, optional :param gamma: Adiabatic index. Default is 1 (isothermal). :type gamma: float, optional :param mmol: Mean molecular weight. Default is 2.3. :type mmol: float, optional :param Z: Global dust-to-gas mass ratio. Default is 0.01. :type Z: float, optional :param stoke: Stokes number. If provided, grain size is derived from it. :type stoke: float, optional .. attribute:: r Radial positions in the disk where quantities are evaluated (cm). :type: float or ndarray .. attribute:: r_c Characteristic radius of the disk (cm). :type: float .. attribute:: M_star Mass of the central star (g). :type: float .. attribute:: M_disk Total mass of the disk (g). :type: float .. attribute:: grain_size Grain size (cm); either input directly or derived from Stokes number. :type: float or ndarray .. attribute:: grain_rho Internal grain density (g/cm³). :type: float .. attribute:: T0 Reference temperature at 1 AU (K). :type: float .. attribute:: q Temperature power-law index. :type: float .. attribute:: gamma Adiabatic index. :type: float .. attribute:: mmol Mean molecular weight. :type: float .. attribute:: Z Dust-to-gas mass ratio. :type: float .. attribute:: stoke Stokes number; either input or calculated from grain size. :type: float or ndarray .. attribute:: omega Keplerian angular velocity (rad/s). :type: ndarray .. attribute:: sigma_g Gas surface density profile (g/cm²). :type: ndarray .. attribute:: sigma_d Dust surface density profile (g/cm²). :type: ndarray .. attribute:: T Temperature profile (K). :type: ndarray .. attribute:: cs Sound speed (cm/s). :type: ndarray .. attribute:: H Gas pressure scale height (cm). :type: ndarray .. attribute:: h Disk aspect ratio (H/r). :type: ndarray .. attribute:: Q Toomre Q parameter. :type: ndarray .. attribute:: G Self-gravity parameter (G-tilde). :type: ndarray .. attribute:: beta Dimensionless radial pressure gradient parameter. :type: ndarray .. attribute:: plot_stoke True if plotting Stokes number; False if plotting grain size. :type: bool .. py:method:: get_params(print_params=True) Compute all physical disk parameters and optionally print them. This method calculates the complete set of disk parameters including gas and dust surface densities, temperature, sound speed, disk thickness, and stability indicators like Toomre Q and the beta parameter. Depending on whether `stoke` is provided, it computes the corresponding grain size or Stokes number. :param print_params: If True, the computed parameters are printed to the console. Default is True. :type print_params: bool, optional :returns: Updates instance attributes in-place. :rtype: None .. py:method:: calc_sigma_g() Calculate the gas surface density profile. Follows the exponential tapering model from Drazkowska et al. (2022). :returns: Sets `self.sigma_g` as a function of radius (g/cm²). :rtype: None .. py:method:: calc_sigma_d() Calculate the dust surface density profile. Computed as a constant fraction of the gas surface density using the global dust-to-gas mass ratio `Z`. :returns: Sets `self.sigma_d` as a function of radius (g/cm²). :rtype: None .. py:method:: calc_stokes() Calculate the Stokes number from grain properties and gas density. Assumes Epstein drag regime, valid for small particles in low-density gas. :returns: Sets `self.stoke` as a function of radius (dimensionless). :rtype: None .. py:method:: calc_grain_sizes() Compute grain sizes from a fixed Stokes number. This inverts the Stokes number formula to recover grain size at each radius. :returns: Sets `self.grain_size` as a function of radius (cm). :rtype: None .. py:method:: calc_omega() Compute Keplerian angular velocity at each radius. :returns: Sets `self.omega` in units of rad/s. :rtype: None .. py:method:: calc_Q() Compute the Toomre Q parameter for gravitational stability. :returns: Sets `self.Q` (dimensionless). :rtype: None .. py:method:: calc_T() Compute the disk temperature profile from a power-law model. Follows Ida et al. (2016), applicable to outer disk regions where viscous heating is negligible. :returns: Sets `self.T` as a function of radius (K). :rtype: None .. py:method:: calc_h() Compute the disk aspect ratio h = H / r. :returns: Sets `self.h` (dimensionless). :rtype: None .. py:method:: calc_cs() Compute the sound speed based on local temperature and molecular weight (using hydrogen molecule mass) :returns: Sets `self.cs` as a function of radius (cm/s). :rtype: None .. py:method:: calc_H() Compute the gas pressure scale height of the disk. :returns: Sets `self.H` as a function of radius (cm). :rtype: None .. py:method:: calc_G() Compute the dimensionless self-gravity parameter G-tilde. Defined as G = sqrt(8 / pi) / Q. :returns: Sets `self.G` (dimensionless). :rtype: None .. py:method:: calc_beta() Compute the radial pressure gradient parameter β. The dimensionless β parameter accounts for the radial variation in pressure, and is defined as: β = h × dlnp/dlnr Assuming power-law profiles for surface density, temperature, and Keplerian rotation, the gradient simplifies to: dlnp/dlnr ≈ −1 − 0.5 × q − 1.5 For the default temperature index q = 3/7, this evaluates to: β ≈ h × (−2.2857) :returns: Updates the `self.beta` attribute (dimensionless). :rtype: None .. py:method:: plot(xticks=[5, 20, 40, 60, 80, 100], ax1_xlim=None, ax1_ylim=None, ax2_xlim=None, ax2_ylim=None, ax3_xlim=None, ax3_ylim=None, ax4_xlim=None, ax4_ylim=None, ax1_ylog=True, ax2_ylog=True, ax3_ylog=True, ax4_ylog=False, include_grid=False, savefig=False, path=None, box_index=None, plot_vertical=False, title='Protoplanetary Disk Model') Plot the radial structure of the disk model. Only plots four key model parameters: gas and dust density profiles, temperature profile, grain size or stokes number, and aspect ratio. :param xticks: Tick positions on the x-axis (AU). :type xticks: list of float :param ax{1..4}_xlim: Axis limits for each subplot. :type ax{1..4}_xlim: tuple or None :param ax{1..4}_ylim: Axis limits for each subplot. :type ax{1..4}_ylim: tuple or None :param ax{1..4}_ylog: Whether to use log scaling on the y-axis. :type ax{1..4}_ylog: bool :param include_grid: Add grid to all subplots. :type include_grid: bool :param savefig: If True, save the figure instead of displaying. :type savefig: bool :param path: Path to save the figure. Defaults to home directory. :type path: str or None :param box_index: Index of radius value to highlight. :type box_index: int or None :param plot_vertical: Arrange plots vertically if True; otherwise in 2x2 grid. :type plot_vertical: bool :param title: Title of the plot. :type title: str :rtype: None .. py:function:: _set_style_() Configure matplotlib style settings for consistent plot appearance. This function updates `matplotlib.pyplot.rcParams` to define a custom plotting style, which is used before saving figures. :returns: Applies changes to matplotlib's global `rcParams`. :rtype: None