exo_k.atm_2band

@author: jeremy leconte

Module Contents

class exo_k.atm_2band.Atm_2band(k_database_stellar=None, cia_database_stellar=None, **kwargs)[source]

Bases: exo_k.atm.Atm

Class based on Atm that handles radiative trasnfer calculations when we want to use different radiative data to treat stellar absorption/scattering and the atmospheric emission.

Only the method that change are overloaded.

Initialization method that calls Atm_Profile().__init__() and links to Kdatabase and other radiative data.

set_k_database_stellar(k_database=None)[source]

Change the radiative database used by the Gas_mix object handling opacities inside Atm.

See gas_mix.Gas_mix.set_k_database for details.

Parameters:

k_database (Kdatabase object) – New Kdatabase to use.

set_cia_database_stellar(cia_database=None)[source]

Change the CIA database used by the Gas_mix object handling opacities inside Atm.

See gas_mix.Gas_mix.set_cia_database for details.

Parameters:

cia_database (CIAdatabase object) – New CIAdatabase to use.

set_gas(composition_dict, Mgas=None, compute_Mgas=True)[source]

Sets the composition of the atmosphere.

set_T_profile(tlay)[source]

Reset the temperature profile without changing the pressure levels

set_adiab_profile(Tsurf=None, Tstrat=None)[source]

Initializes the logP-T atmospheric profile with an adiabat with index R/cp=rcp

Parameters:
  • Tsurf (float) – Surface temperature.

  • Tstrat (float, optional) – Temperature of the stratosphere. If None is given, an isothermal atmosphere with T=Tsurf is returned.

spectral_integration_stellar(spectral_var)[source]

Spectrally integrate an array, taking care of whether we are dealing with corr-k or xsec data.

Parameters:

spectral_var (array, np.ndarray) – array to integrate

Returns:

var: array, np.ndarray

array integrated over wavenumber (and g-space if relevant)

opacity_stellar(rayleigh=False, **kwargs)[source]

Computes the opacity of each of the radiative layers (m^2/molecule).

Parameters:

rayleigh (bool) – If true, the rayleigh cross section is computed in self.kdata_scat and added to kdata(total extinction cross section)

See gas_mix.Gas_mix.cross_section for details.

source_function_stellar(**kwargs)[source]

Dummy function to have zero source in stellar channel

set_incoming_stellar_flux(flux=0.0, Tstar=5778.0, **kwargs)[source]

Sets the stellar incoming flux integrated in each wavenumber channel.

Important

If your simulated range does not include the whole spectral range where the star emits, the flux seen by the model will be smaller than the input one.

Parameters:
  • flux (float) – Bolometric Incoming flux (in W/m^2).

  • Tstar (float) – Stellar temperature (in K) used to compute the spectral distribution of incoming flux using a blackbody.

setup_emission_caculation_stellar(mu_eff=0.5, rayleigh=False, **kwargs)[source]

Computes all necessary quantities for emission calculations (opacity, source, etc.)

reflexion_spectrum_2stream(integral=True, mu0_stellar=0.5, method='toon', dtau_min=1e-10, flux_at_level=False, rayleigh=False, flux_top_dw=None, **kwargs)[source]

Returns the reflexion flux at the top of the atmosphere (in W/m^2/cm^-1)

Parameters:
  • integral (boolean, optional) –

    • If true, the black body is integrated within each wavenumber bin.

    • If not, only the central value is used. False is faster and should be ok for small bins, but True is the correct version.

  • mu0_stellar (float) – Cosine of the quadrature angle use to compute output flux

  • dtau_min (float) – If the optical depth in a layer is smaller than dtau_min, dtau_min is used in that layer instead. Important as too transparent layers can cause important numerical rounding errors.

Returns:

Spectrum object

A spectrum with the Spectral flux at the top of the atmosphere (in W/m^2/cm^-1)

flux_divergence_stellar(per_unit_mass=True, **kwargs)[source]

Computes the divergence of the net flux in the layers (used to compute heating rates).

emission_spectrum_2stream() needs to be ran first.

Parameters:

per_unit_mass (bool) – If True, the heating rates are normalized by the mass of each layer (result in W/kg).

Returns:

H: array, np.ndarray

Heating rate in each layer (Difference of the net fluxes). Positive means heating. The last value is the net flux impinging on the surface.

net: array, np.ndarray

Net fluxes at level surfaces

heating_rate(compute_kernel=False, dTmax_use_kernel=None, flux_top_dw=None, **kwargs)[source]

Computes the heating rates and net fluxes in the atmosphere.

Parameters:
  • compute_kernel (bool) – If True, the kernel (jacobian of the heat rates) is recomputed

  • dTmax_use_kernel (float) – Maximum temperature difference between the current temperature and the temperature of the last kernel computation before a new kernel is recomputed.

Returns:

H: array, np.ndarray

Heating rate in each layer (Difference of the net fluxes). Positive means heating. The last value is the net flux impinging on the surface + the internal flux.

net: array, np.ndarray

Net fluxes at level surfaces

bolometric_fluxes_stellar(per_unit_mass=True)[source]

Computes the bolometric fluxes at levels and the divergence of the net flux in the layers (used to compute heating rates).

emission_spectrum_2stream() needs to be ran first.

Parameters:

per_unit_mass (bool) – If True, the heating rates are normalized by the mass of each layer (result in W/kg).

Returns:

up: array, np.ndarray

Upward fluxes at level surfaces

dw: array, np.ndarray

Downward fluxes at level surfaces

net: array, np.ndarray

Net fluxes at level surfaces

H: array, np.ndarray

Heating rate in each layer (Difference of the net fluxes). Positive means heating. The last value is the net flux impinging on the surface.