exo_k.atm_profile
@author: jeremy leconte
This module contain classes to handle atmospheric profiles. Radiative properties are handled in atm.py which contains a daughter class.
The nomenclature for layers, levels, etc., can be found in atm.py.
Module Contents
- class exo_k.atm_profile.Atm_profile(composition=None, psurf=None, ptop=None, logplay=None, tlay=None, Tsurf=None, Tstrat=None, grav=None, Rp=None, Mgas=None, Rstar=None, rcp=None, Nlay=20, logplev=None, aerosols=None, Nlev=None, tlev=None, **kwargs)[source]
Bases:
object
A class defining an atmospheric PT profile with some global data (gravity, etc.)
The derived class
Atm
handles radiative transfer calculations.Initializes atmospheric profiles
- Parameters:
composition (
dict
) – Keys are molecule names and values the vmr. Vmr can be arrays of size Nlev-1 (i.e. the number of layers).grav (
float
) – Planet surface gravity (gravity constant with altitude for now).Rp (
float
orAstropy.unit quantity
) – Planet radius. If float, meters are assumed.rcp (
float
) – Adiabatic lapse rate for the gas (R/cp)Mgas (
float
, optional) – Molar mass of the gas (kg/mol). If given, overrides the molar mass computed from composition.
There are two ways to define the profile. You can define:
Nlay: int Number of layers
psurf, Tsurf: float Surface pressure (Pa) and temperature
ptop: float Pressure at the top of the model (Pa)
Tstrat: float Stratospheric temperature
This way you will have an adiabatic atmosphere with Tsurf at the ground that becomes isothermal wherever T=<Tstrat. You can also specify:
logplay or play: array, np.ndarray
tlay: array, np.ndarray (same size) These will become the pressures (Pa; the log10 if you give logplay) and temperatures of the layers. This will be used to define the surface and top pressures. Nlay becomes the size of the arrays.
Warning
Layers are counted from the top down (increasing pressure order). All methods follow the same convention.
- gas_mix = None
- aerosols = None
- logplev = None
- set_logPT_profile(logplay, tlay, logplev=None)[source]
Set the logP-T profile of the atmosphere with a new one
- Parameters:
logplay (
array
,np.ndarray
) – Log pressure (in Pa) of the layertlay (
array
,np.ndarray (same size)
) – temperature of the layers.logplev (
array
,np.ndarray (size Nlay+1)
) – If provided, allows the user to choose the location of the level surfaces separating the layers.
- update_pressure_profile(play=None, plev=None)[source]
Updates pressure levels without changing temperatures.
To be used in Atm_evolution class.
- extend_upper_atmosphere(logptop=None, Nlev=5)[source]
Extend upper atmosphere to a given pressure without changing temperatures. Only the Nlev upper layers will be changed.
To be used before computing the transit spectrum of a model with low top.
- interpolate_profile(logplay, logplev=None, adiabatic_extrapolation=True, **kwargs)[source]
Re interpolates the current profile on a new log pressure grid.
Extrapolation is isothermal at the top and can be adiabatic at the bottom
- Parameters:
logplay (
array
) – New log pressure gridlogplev (
array
, optional) – New level pressure gridadiabatic_extrapolation (
bool
) – Whether or not to extrapolate using the adiabat below the bottom
- set_adiab_profile(Tsurf=None, Tstrat=None)[source]
Initializes the logP-T atmospheric profile with an adiabat with index R/cp=rcp
- set_grav(grav=None)[source]
Sets the surface gravity of the planet
- Parameters:
grav (
float
) – surface gravity (m/s^2)
- set_gas(composition_dict, Mgas=None, compute_Mgas=True)[source]
Sets the composition of the atmosphere.
The composition_dict gives the composition in the layers, but we will need the composition in the radiative layers, so the interpolation is done here. For the moment we do a geometrical average.
Important
For the first initialization, compute_Mgas must be False because we need Gas_mix to be initialized before we know the number of layers in the atmosphere, but the number of layers is needed by set_Mgas! So set_Mgas needs to be called at the end of the initialization.
- Parameters:
composition_dict (
dictionary
) – Keys are molecule names, and values are volume mixing ratios. A ‘background’ value means that the gas will be used to fill up to vmr=1 If they do not add up to 1 and there is no background gas_mix, the rest of the gas_mix is considered transparent.compute_Mgas (
bool
) – If False, the molar mass of the gas is not updated.
- set_Mgas(Mgas=None)[source]
Sets the mean molar mass of the atmosphere.
- Parameters:
Mgas (
float
orarray
ofsize Nlay-1
) – Mean molar mass in the radiative layers (kg/mol). If None is given, the mmm is computed from the composition.
- set_rcp(rcp=None)[source]
Sets the adiabatic index of the atmosphere
- Parameters:
rcp (
float
) – R/c_p
- set_aerosols(aerosols)[source]
Sets the aerosols dictionary
performs the interlayer averaging so that we only have properties at the middle of radiative layers
- set_Rstar(Rstar)[source]
Sets the radius of the star
- Parameters:
Rstar (
float
) – radius of the star (m)
- compute_number_density()[source]
Computes the number density (m^-3) profile of the atmosphere in the radiative layers
- compute_mass_density()[source]
Computes the mass density (kg/m^-3) profile of the atmosphere in the radiative layers
- compute_layer_col_density()[source]
Computes the column number density (molecules/m^2) per radiative layer of the atmosphere.
There are Nlay-1 radiative layers as they go from the middle of a layer to the next.
- compute_altitudes(constant_Mgas=None)[source]
Compute altitudes of the level surfaces (zlev) and mid layers (zlay).
- compute_area()[source]
Computes the area of the annulus covered by each radiative layer (from a mid layer to the next) in a transit setup.
- compute_tangent_path()[source]
Computes a triangular array of the tangent path length (in m) spent in each radiative layer.
self.tangent_path[ilay][jlay] is the length that the ray that is tangent to the ilay radiative layer spends in the jlay>=ilay layer (accounting for a factor of 2 due to symmetry)
- plot_T_profile(ax, invert_p=True, use_altitudes=False, xscale=None, yscale=None, **kwarg)[source]
Plot the T P profile
- Parameters:
ax (
pyplot.Axes
) – A pyplot axes instance where to put the plot.x/yscale (
str
, optional) – If ‘log’ log axes are used.