hydrogen
- hydrogen.radiative_processes_exact(spectrum_at_planet, r_grid, density, f_h_r, h_fraction, f_he_r=None)[source]
Calculate the photoionization rate of hydrogen as a function of radius based on the EUV spectrum arriving at the planet and the neutral H density profile.
- Parameters:
- spectrum_at_planet
dict
Spectrum of the host star arriving at the planet covering fluxes at least up to the wavelength corresponding to the energy to ionize hydrogen (13.6 eV, or 911.65 Angstrom).
- r_grid
numpy.ndarray
Radius grid for the calculation, in units of cm.
- density
numpy.ndarray
Total density profile for the atmosphere, in units of g / cm ** 3.
- f_h_r
numpy.ndarray
orfloat
H ion fraction profile for the atmosphere.
- h_fraction
float
Hydrogen number fraction of the outflow.
- f_he_r
numpy.ndarray
orfloat
orNone
He ion fraction profile for the atmosphere. If
None
, then assume that the profile is the same asf_h_r
.
- spectrum_at_planet
- Returns:
- phi_prime
float
Ionization rate of hydrogen for each point on r_grid in unit of 1 / s.
- phi_prime
- hydrogen.radiative_processes(spectrum_at_planet)[source]
Calculate the photoionization rate of hydrogen at null optical depth based on the EUV spectrum arriving at the planet.
- Parameters:
- spectrum_at_planet
dict
Spectrum of the host star arriving at the planet covering fluxes at least up to the wavelength corresponding to the energy to ionize hydrogen (13.6 eV, or 911.65 Angstrom).
- spectrum_at_planet
- Returns:
- phi
float
Ionization rate of hydrogen at null optical depth in unit of 1 / s.
- a_0
float
Flux-averaged photoionization cross-section of hydrogen in unit of cm ** 2.
- phi
- hydrogen.radiative_processes_mono(flux_euv, average_photon_energy=20.0)[source]
Calculate the photoionization rate of hydrogen at null optical depth based on the monochromatic EUV flux arriving at the planet.
- Parameters:
- flux_euv
float
Monochromatic extreme-ultraviolet (0 - 912 Angstrom) flux arriving at the planet in unit of erg / s / cm ** 2.
- average_photon_energy
float
, optional Average energy of the photons ionizing H in unit of eV. Default is 20 eV (as in Murray-Clay et al 2009, Allan & Vidotto 2019).
- flux_euv
- Returns:
- phi
float
Ionization rate of hydrogen at null optical depth in unit of 1 / s.
- a_0
float
Flux-averaged photoionization cross-section of hydrogen in unit of cm ** 2.
- phi
- hydrogen.recombination(temperature)[source]
Calculates the case-B hydrogen recombination rate for a gas at a certain temperature.
- Parameters:
- temperature
float
Isothermal temperature of the upper atmosphere in unit of Kelvin.
- temperature
- Returns:
- alpha_rec
float
Recombination rate of hydrogen in units of cm ** 3 / s.
- alpha_rec
- hydrogen.ion_fraction(radius_profile, planet_radius, temperature, h_fraction, mass_loss_rate, planet_mass, mean_molecular_weight_0=1.0, star_mass=1.0, semimajor_axis=1.0, spectrum_at_planet=None, flux_euv=None, initial_f_ion=0.0, relax_solution=False, convergence=0.01, max_n_relax=10, exact_phi=False, return_mu=False, return_rates=False, **options_solve_ivp)[source]
Calculate the fraction of ionized hydrogen in the upper atmosphere in function of the radius in unit of planetary radius.
- Parameters:
- radius_profile
numpy.ndarray
Radius in unit of planetary radii.
- planet_radius
float
Planetary radius in unit of Jupiter radius.
- temperature
float
Isothermal temperature of the upper atmosphere in unit of Kelvin.
- h_fraction
float
Total (ion + neutral) H number fraction of the atmosphere.
- mass_loss_rate
float
Mass loss rate of the planet in units of g / s.
- planet_mass
float
Planetary mass in unit of Jupiter mass.
- mean_molecular_weight_0
float
Initial mean molecular weight of the atmosphere in unit of proton mass. Default value is 1.0 (100% neutral H). Since its final value depend on the H ion fraction itself, the mean molecular weight can be self-consistently calculated by setting relax_solution to True.
- star_mass
float
, optional Stellar mass in units of M_sun, needed for the tidal gravity calculation. Default is 1.
- semimajor_axis
float
, optional Planetary semimajor axis in units of au, needed for the tidal gravity calculation. Default is 1 (so the tidal gravity correction is minimal by default).
- spectrum_at_planet
dict
, optional Spectrum of the host star arriving at the planet covering fluxes at least up to the wavelength corresponding to the energy to ionize hydrogen (13.6 eV, or 911.65 Angstrom). Can be generated using
tools.make_spectrum_dict
. IfNone
, thenflux_euv
must be provided instead. Default isNone
.- flux_euv
float
, optional Extreme-ultraviolet (0-911.65 Angstrom) flux arriving at the planet in units of erg / s / cm ** 2. If
None
, thenspectrum_at_planet
must be provided instead. Default isNone
.- initial_f_ion
float
, optional The initial ionization fraction at the layer near the surface of the planet. Default is 0.0, i.e., 100% neutral.
- relax_solution
bool
, optional The first solution is calculating by initially assuming the entire atmosphere is in neutral state. If
True
, the solution will be re-calculated in a loop until it converges to a delta_f of 1%, or for a maximum of 10 loops (default parameters). Default isFalse
.- convergence
float
, optional Value of delta_f at which to stop the relaxation of the solution for
f_r
. Default is 0.01.- max_n_relax
int
, optional Maximum number of loops to perform the relaxation of the solution for
f_r
. Default is 10.- exact_phi
bool
, optional If set to
True
, the H photoionization is calculated exactly (using theradiative_processes_exact()
function). If set toFalse
, then calculate it using an approximation withradiative_processes()
. Default value isFalse
.- return_mu
bool
, optional If
True
, then this function returns a second variablemu_bar
, which is the self-consistent, density-averaged mean molecular weight of the atmosphere. Equivalent to themu_bar
of Eq. A.3 in Lampón et al. 2020.- return_rates
bool
, optional If
True
, then this function also returns adict
object containing the rates of photoionization and recombination in function of radius and in units of 1 / s. Default isFalse
.- **options_solve_ivp:
Options to be passed to the
scipy.integrate.solve_ivp()
solver. You may want to change the optionsmethod
(integration method; default is'RK45'
),atol
(absolute tolerance; default is 1E-6) orrtol
(relative tolerance; default is 1E-3). If you are having numerical issues, you may want to decrease the tolerance by a factor of 10 or 100, or 1000 in extreme cases.
- radius_profile
- Returns:
- f_r
numpy.ndarray
Values of the fraction of ionized hydrogen in function of the radius.
- mu_bar
float
Mean molecular weight of the atmosphere, in unit of proton mass, averaged across the radial distance using according to the function average_molecular_weight in the parker module. Only returned when
return_mu
is set toTrue
.- rates
dict
Dictionary containing the rates of photoionization and recombination in function of radius and in units of 1 / s. Only returned when
return_rates
is set toTrue
.
- f_r