atm_models_interp ================= .. py:module:: atm_models_interp Attributes ---------- .. autoapisummary:: atm_models_interp.O_to_H_sun atm_models_interp.mu_H atm_models_interp.mu_H2O Classes ------- .. autoapisummary:: atm_models_interp.atm_models_interp Functions --------- .. autoapisummary:: atm_models_interp.maxloc atm_models_interp.interp2d_opt atm_models_interp.vapor_pressure atm_models_interp.vapor_density atm_models_interp.O_to_H_molecular Module Contents --------------- .. py:function:: maxloc(array_in, value_in) This function locates the index of the element x <= value_in in an array i.e index_final = maxloc(array_in,value_in) is equivalent to Fortran's index_final = MAXLOC(array_in, DIM = 1, MASK=(array_in <= value_in)) Args: array_in: array with values value_in: value whose index we want to locate .. py:function:: interp2d_opt(x_in, y_in, x_array, y_array, z_array) 2d interpolation Args: x_in: Value to evaluate in x-axis y_in: Value to evaluate in y-axis x_array: Array of x-axis grid. This one is the one that always changes i.e [a,b,c,...,a,b,c...] Dimension is Nx. y_array: Array of y-axis grid. This one is the constant one i.e [d,d,d,...,e,e,e...] Dimension is Ny z_array: Array with the parameter to interpolate. Dimension is Nx*Ny Returns: z(x_in,y_in): final interpolated value .. py:function:: vapor_pressure(Tin) This function calculates the saturation curve for water (Wagner & Pruss 2002) Args: Tin: Temperature in K Returns: Pout: Saturation pressure at Tin in MPa .. py:function:: vapor_density(Tin) This function calculates the density of water vapour in the saturation limit (Wagner & Pruss 2002) Args: Tin: Temperature in K Returns: rhoout: Density in kg/m3 .. py:data:: O_to_H_sun :value: 0.0004898 .. py:data:: mu_H :value: 1.0 .. py:data:: mu_H2O :value: 18.0 .. py:function:: O_to_H_molecular(Z) This function converts metal mass fraction into metallicity (or O:H ratio). See Fortney et al. 2013 Args: Z: metal mass fraction in atmosphere Returns: OtoH: O:H ratio (metallicity [Fe/H]) .. py:class:: atm_models_interp(name_grid='gastli_default_atm_grid.hdf5') .. py:attribute:: T_int_pl :value: 0.0 .. py:attribute:: g_surf_pl :value: 0.0 .. py:attribute:: Zenv_pl :value: 0.0 .. py:attribute:: Rbulk_pl :value: 0.0 .. py:attribute:: npoints :value: 130 .. py:attribute:: path_to_file .. py:attribute:: data_set_atm .. py:attribute:: data_set_metal_mass_fractions .. py:attribute:: CO_atm .. py:attribute:: FeH_atm .. py:attribute:: Teq_atm .. py:attribute:: Tint_atm .. py:attribute:: logg_atm .. py:attribute:: temperature_func .. py:attribute:: metal_mass_fraction_func .. py:attribute:: logTinput .. py:attribute:: logPinput .. py:attribute:: logrho .. py:attribute:: rho_aqua .. py:attribute:: press_aqua .. py:attribute:: temp_aqua .. py:attribute:: V_mix .. py:attribute:: logP_Vmix .. py:attribute:: logT_Vmix .. py:method:: calc_interior_mass_fraction(Tint, g_surf, Teq, CO, log_FeH, P_surf=1000.0) Function that calculates the metal mass fraction for a given log10(metallicity) [x solar]. It uses data from easychem. Args: Tint: Internal temperature in K g_surf: Surface gravity in cm/s2 Teq: Equilibrium temperature in K (at Bond albedo zero) CO: atm. C-to-O ratio log_FeH: log10(metallicity), where the atm. metallicity is in x solar units P_surf: surface pressure in bar Returns: Pprofile: pressure profile in bar MMF_profile: metal mass fraction profile for atm. thickness calculation MMF_surf: metal mass fraction in the surface (1000 bars) for interior model input .. py:method:: calc_PTprofile(Tint, g_surf, Teq, Zenv=0.03, FeH_flag=True, CO_def=0.55, guillot=False, P_surf=1000.0, kappa_IR=0.01, gamma=0.4) Calculation of pressure-temperature atmospheric profile by interpolating the grid of data of atmospheric models Args: Tint: Internal temperature in K g_surf: Surface gravity in cm/s2 Teq: Equilibrium temperature in K (at Bond albedo zero) CO_def (optional): C-to-O ratio. Default value is 0.55 (solar) FeH_flag (optional): equals True if the amount of metals is specified as log10(metallicity) in x solar units. If specified as metal mass fraction, set FeH_flag = False. In the former case, the metal mass fraction profile is extracted from easychem data (calculated with calc_interior_mass_fraction). In the latter, it is set constant to Zenv, and converted to log10(metallicity) with Fortney+13 relation (appendix A1) to interpolate the PT profiles from atmospheric grid Zenv (optional): atmospheric metal mass fraction (for FeH_flag = False). Default value is 0.03. guillot (optional): False if you do not want to use Guillot 2010 atm. profile P_surf: Boundary pressure between interior and atmosphere. Default is 1000 bars. For models with high Tint you may need to decrease it to 9.5 bars (if using the default atm. grid) kappa_IR (float, optional): The infrared opacity in units of :math:`\\rm cm^2/s`. Default is 0.01. gamma (float, optional): The ratio between the visual and infrared opacity. Default is 0.4. Returns: Pprofile: atm. pressure profile in bar Tprofile: atm. temperature profile in K Tsurf: Temperature at bottom of atmosphere in K Psurf: Pressure at bottom of atmosphere in bar. Normally set to 1000 bars .. py:method:: calc_thickness(Rbulk, Matm_earthunits, Z_atm) Calculates thickness of atmosphere Args: Rbulk: Planet bulk radius (centre to Psurf) in Jupiter radii Matm_earthunits: Atmospheric mass in Earth units Returns: r: Radius atm. profile in m P_ode: Pressure atm. profile in Pa g_ode: Gravity atm. profile in m/s2 rho_ode: Density atm. profile in kg/m3 T_ode: Temperature atm. profile in K total_radius: Total planet radius in Jupiter radii z_ode: Atmospheric thickness in Jupiter radii