Use petitRADTRANS for OLR

In this chapter, you will learn how to use petitRATRANS to calculate the radiative flux through a convecting atmosphere. If you are not familiar with this code, don’t worry! There is a great documentation for it, right here. It is recommended to read it before going through this chapter (at least the part on emission spectra).eet

First, let’s create a convective atmosphere. We will consider A case similar to the one implemented in the chapter on atmospheres:

[6]:
from chemistry.molecules import H2O,CO2
from atmospheres import multi_species_single_condensible_convective_atmosphere
atm = multi_species_single_condensible_convective_atmosphere([H2O,CO2], # The condensible species is the first of the list
                                                             [1e5,1e5], # with one bar of each species
                                                             2500)     # with a surface temperature of 2500 K

Create pRT object

Now, let’s gear our atmosphere with a Radtrans object. It will need the following inputs from our atmosphere: - gas species present - their mass fraction profiles - the pressure levels - the temperature profile - the average molecular weight profile

The pRT object is initialized with the species (and the wavelength span that you are interested in - if you want to calculate the OLR, you’ll need to take the full span available)

[7]:
from petitRADTRANS import Radtrans
atm.radiation = Radtrans(line_species = ['H2O','CO2'],
                         wlen_bords_micron = [0.1, 251.])
  Read line opacities of H2O...
 Done.
  Read line opacities of CO2...
 Done.

We then need to pass the pressure grid to the Radtrans object. Pay attention that pRT reads pressure in bar, and in decreasing order!

[10]:
from numpy import flipud
atm.radiation.setup_opa_structure(flipud(atm.profiles['pressure'])*1e-5) # pRT reads pressures in bar! (and equidistant in pressure log-space)

pRT will also need the mass fractions of each gas (the keys of the mass_fractions ditionnary must match the opacity lines names fed into pRT):

[13]:
mass_fractions = {}
mass_fractions['H2O'] = flipud(atm.profiles['mass fraction']['H2O']) # To be consistent with the pressure,
mass_fractions['CO2'] = flipud(atm.profiles['mass fraction']['CO2']) # be sure to flip the mass fraction distributions

Finally, we can pass the mass fractions, temperature, and average molecular weight profiles to calculate the infrared flux:

[17]:
atm.radiation.calc_flux(flipud(atm.profiles['temperature']),            # again, flip the profile!
                        mass_fractions,
                        atm.gravity*100,                                # WARNING! pRT reads gravity in cgs!
                        flipud(atm.profiles['average molecular mass'])) # again, flip the profile!

OLR

Now that pRT has calculated the flux for each wavelength, you can integrate it to obtin the OLR:

[20]:
from numpy import trapz
erg2J  = 1e-7 # ergs to Joules conversion factor
cm22m2 = 1e-4 # cm² to m² converion factor
OLR    = -trapz(atm.radiation.flux,atm.radiation.freq)*erg2J/cm22m2
print('OLR =',OLR,'W/m²')
OLR = 100607.72872979775 W/m²

As a comparison, the model for a gray atmosphere at radiative equilibrium was predicting 535000 W/m\(^2\) for the same atmosphere. This difference is significant, highlighting the shortcoming of the simple gray atmosphere at radiative equilibrium model, where all the radiation physics is boiled down into a single opacity coefficient for each gas. While here the simple model yields higher OLR, as the pressure increases, it eventually underestimates the OLR because it assumes that pressure broadening goes on indefinitely, ignoring band saturation. Furthermore, it does not account for water condensation, which buffers the temperature in the higher atmosphere, making the OLR effectively independent of the surface temperature when pressure is high enough.

Now you might want to automate all these steps in a fnew functin to add to the multi_species_single_condensible_convective_atmosphere class (like getOLR()). Or you can also add it as a parametrization if you are using a magma ocean workflow. All possibilities are open, be creative, and check out the example setup to be inspired!