Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
11institutetext: Anton Pannekoek Institute for Astronomy, University of Amsterdam, Science Park 904, 1098 XH Amsterdam, The Netherlands 22institutetext: Center for Astrophysics — Harvard & Smithsonian, 60 Garden Street, MS-16, Cambridge, MA 02138, USA

The open-source sunbather code: Modeling escaping planetary atmospheres and their transit spectra

Dion Linssen E-mail: d.c.linssen@uva.nl11    Jim Shih ({CJK*}UTF8bsmi施震) 11    Morgan MacLeod 22    Antonija Oklopčić 11
(Received; accepted)

Atmospheric escape is thought to significantly influence the evolution of exoplanets, especially sub-Jupiter planets on short orbital periods. Theoretical models predict that hydrodynamic escape could erode the atmospheres of such gaseous planets, leaving only a rocky core. Deriving atmospheric mass-loss rates from observations is necessary to check these predictions. One of the ways to obtain mass-loss-rate estimates is to fit transit spectra of the 10830 Å helium or UV metal lines with Parker wind models. We aim to provide the community with a tool that enables this type of analysis, and present sunbather, an open-source Python code that can be used to model escaping exoplanet atmospheres and their transit spectra. sunbather incorporates the Parker wind code p-winds and the photoionization code Cloudy, with the ability to calculate any currently known spectral tracer, using an arbitrary atmospheric composition. With sunbather, we investigate how the atmospheric structure of a generic hot-Neptune planet depends on metallicity. We find that the mass-loss rate drops by roughly one order of magnitude as we increase the metallicity from solar to 50 times solar. Line cooling by metal species is already important for a solar composition, and is even more so at higher metallicity. We then demonstrate how sunbather can be used to interpret observations of spectral lines that form in the upper atmosphere. We fit the observed helium spectrum of the mini-Neptune TOI-2134 b and show how, even for helium data, the inferred mass-loss rate can change by a factor of up to three, depending on the assumed metallicity.

1 Introduction

Recent advances in the field of exoplanet research have identified a lack of sub-Jovian planets, as well as a bimodal distribution of the radii of sub-Neptune-sized planets, both at short orbital periods (Szabó & Kiss, 2011; Beaugé & Nesvorný, 2013; Owen & Wu, 2013; Lundkvist et al., 2016; Fulton et al., 2017). Atmospheric escape is thought to play a major role in sculpting these features. Theoretical works aiming to explain the observed demographic characteristics in this way typically prescribe analytical mass-loss-rate estimates based on the bulk parameters of planets (e.g., Owen & Wu, 2017; Ginzburg et al., 2018). However, the relative importance of atmospheric escape compared to other proposed mechanisms such as formation and migration is still a matter of debate (e.g., Owen & Lai, 2018; Lee et al., 2022; Burn et al., 2024). The same is true for the physical details of the atmospheric escape process, which can be due to photoevaporation or core-powered mass loss, or indeed both (e.g., Owen & Schlichting, 2024), with possible contributions from giant impacts (e.g., Chance et al., 2022; Zhong et al., 2024). Therefore, obtaining mass-loss rates that are based on observational measurements for a large sample of individual planets would allow us to benchmark the theoretical predictions and test the atmospheric escape hypothesis (Vissapragada et al., 2022b).

Observational evidence of atmospheric escape for individual planets is gathered through transit spectroscopy of specific spectral lines. In the early days of atmospheric characterization, this consisted of UV observations of the hydrogen Lyman-α𝛼\alphaitalic_α line and lines from metals such as oxygen, carbon, and magnesium (e.g., Vidal-Madjar et al., 2003, 2004; Fossati et al., 2010). In more recent years, the 10,830 Å line of metastable helium has additionally been identified as a tracer of atmospheric escape (Spake et al., 2018; Oklopčić & Hirata, 2018; Nortmann et al., 2018; Allart et al., 2018). Consequently, the number of atmospheric escape detections has rapidly grown to a few dozen (dos Santos, 2023), enabling the search for trends at the population level (e.g., Allart et al., 2023; Bennett et al., 2023; Krishnamurthy & Cowan, 2024).

Based on the specific spectral line considered, as well as the quality and complexity of the data, different types of models may be needed for their interpretation. Models ranging in complexity from a relatively simple 1D isothermal Parker wind (e.g., Mansfield et al., 2018) to expensive 3D coupled hydrodynamics-thermochemistry simulations (e.g., Wang & Dai, 2021) have been applied in the literature. With the goal being to infer a mass-loss rate from a spectral line measurement, the isothermal Parker wind prescription has been widely used because it treats the mass-loss rate as a free parameter (e.g., Mansfield et al., 2018; Lampón et al., 2020, 2021a, 2023; Kasper et al., 2020; Palle et al., 2020; Vissapragada et al., 2020, 2021, 2022b; Zhang et al., 2021, 2023a, 2023b; Krishnamurthy et al., 2021, 2023; Paragas et al., 2021; Czesla et al., 2022; dos Santos et al., 2022; Kirk et al., 2022; Spake et al., 2022; Allart et al., 2023; Bennett et al., 2023; Gaidos et al., 2023; Orell-Miquel et al., 2023; Gully-Santiago et al., 2024; Pérez-González et al., 2024). This prompted dos Santos et al. (2022) to release p-winds, an open-source implementation of the isothermal Parker wind model that includes a module to produce metastable helium transit spectra. Although the isothermal Parker wind model has thus far been mainly used for interpreting helium observations, it need not be limited to this spectral line, and the newest version of p-winds includes the ability to make carbon and oxygen spectra (dos Santos et al., 2023b). Indeed, in addition to the upsurge in the number of helium studies in this regard, there have been several recent detections of escaping metals in the UV (e.g., Sing et al., 2019; Cubillos et al., 2020, 2023; García Muñoz et al., 2021; Ben-Jaffel et al., 2022; Sreejith et al., 2023), which provide highly complementary data that would benefit from similar modeling strategies.

Here, we aim to address this need and present sunbather111www.github.com/dlinssen/sunbather, an open-source code to model the structure and transit spectra of escaping exoplanet atmospheres. The code couples p-winds to the detailed nonlocal thermodynamic equilibrium (NLTE) photoionization code Cloudy (Ferland et al., 1998, 2017; Chatzikos et al., 2023). This enables the calculation of atmospheres of arbitrary composition and of any currently known spectral line tracing escape (Linssen & Oklopčić, 2023). Starting from the isothermal Parker wind as produced by p-winds, sunbather calculates a more realistic nonisothermal temperature profile, which can have important consequences for the predicted transit spectrum. As shown in Linssen et al. (2022), the nonisothermal profile can additionally be used to restrain the model parameter space and yield more stringent mass-loss-rate constraints.

This paper is organized as follows. In Sect. 2, we describe the theory behind the model, and explain how it is implemented in three main Python modules. In Sect. 3, we use sunbather for a theoretical study of the effects of high metallicity on the upper atmospheric structure and transit signatures of a sub-Neptune planet. In Sect. 4, we demonstrate how sunbather can be used to constrain mass-loss rates from spectral-line observations. In Sect. 5, we summarize our findings. A reproduction package for all of the results of this manuscript is available online222https://doi.org/10.5281/zenodo.11202780.

2 The sunbather code

We model an exoplanet atmosphere that is escaping hydrodynamically. In this escape regime, gas particles obtain an average internal energy comparable to that needed to escape from the planet (Gronoff et al., 2020). Hence, thermal expansion of the atmosphere drives a bulk outflow, requiring that the gas is collisional up until the sonic point (Owen, 2019). The thermal energy required can either be supplied by stellar high-energy radiation (called photoevaporation) or the planet’s interior luminosity (called core-powered mass-loss). Hydrodynamic escape is expected to be the dominant mechanism for highly irradiated planets.

Following Murray-Clay et al. (2009), the Euler equations describing a steady-state hydrodynamic outflow in the planetary frame in 1D are as follows. Mass continuity can be written as

r(r2ρv)=0,𝑟superscript𝑟2𝜌𝑣0\frac{\partial}{\partial r}(r^{2}\rho v)=0,divide start_ARG ∂ end_ARG start_ARG ∂ italic_r end_ARG ( italic_r start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_ρ italic_v ) = 0 , (1)

where r𝑟ritalic_r is the distance to the planet center, ρ𝜌\rhoitalic_ρ the density and v𝑣vitalic_v the velocity. Momentum conservation implies

ρvvr+Pr+GMpρr2+3GMρra3=0,𝜌𝑣𝑣𝑟𝑃𝑟𝐺subscript𝑀𝑝𝜌superscript𝑟23𝐺subscript𝑀𝜌𝑟superscript𝑎30\rho v\frac{\partial v}{\partial r}+\frac{\partial P}{\partial r}+\frac{GM_{p}% \rho}{r^{2}}+\frac{3GM_{*}\rho r}{a^{3}}=0,italic_ρ italic_v divide start_ARG ∂ italic_v end_ARG start_ARG ∂ italic_r end_ARG + divide start_ARG ∂ italic_P end_ARG start_ARG ∂ italic_r end_ARG + divide start_ARG italic_G italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT italic_ρ end_ARG start_ARG italic_r start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG + divide start_ARG 3 italic_G italic_M start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT italic_ρ italic_r end_ARG start_ARG italic_a start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT end_ARG = 0 , (2)

where P𝑃Pitalic_P is pressure, G𝐺Gitalic_G the gravitational constant, Mpsubscript𝑀𝑝M_{p}italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT the planet mass, Msubscript𝑀M_{*}italic_M start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT the stellar mass, and a𝑎aitalic_a the semi-major axis. The last term on the left-hand side is the stellar tidal gravity term. It can be optionally excluded in sunbather. Energy balance reads

ρvr[kT(γ1)μ]+kTvμρr+Γ+Λ=0,𝜌𝑣𝑟delimited-[]𝑘𝑇𝛾1𝜇𝑘𝑇𝑣𝜇𝜌𝑟ΓΛ0-\rho v\frac{\partial}{\partial r}\Bigg{[}\frac{kT}{(\gamma-1)\mu}\Bigg{]}+% \frac{kTv}{\mu}\frac{\partial\rho}{\partial r}+\Gamma+\Lambda=0,- italic_ρ italic_v divide start_ARG ∂ end_ARG start_ARG ∂ italic_r end_ARG [ divide start_ARG italic_k italic_T end_ARG start_ARG ( italic_γ - 1 ) italic_μ end_ARG ] + divide start_ARG italic_k italic_T italic_v end_ARG start_ARG italic_μ end_ARG divide start_ARG ∂ italic_ρ end_ARG start_ARG ∂ italic_r end_ARG + roman_Γ + roman_Λ = 0 , (3)

where k𝑘kitalic_k is the Boltzmann constant, T𝑇Titalic_T the temperature, γ=5/3𝛾53\gamma=5/3italic_γ = 5 / 3 the adiabatic index for a perfect gas, μ𝜇\muitalic_μ the mean particle mass, ΓΓ\Gammaroman_Γ the radiative heating rate, and ΛΛ\Lambdaroman_Λ the radiative cooling rate. Solving this system of equations results in a “self-consistent” solution to the problem. One obtains the radial density, velocity, and temperature profiles, as well as the corresponding mass-loss rate of the planet. This exercise is performed by various open-source codes, such as TPCI (Salz et al., 2015), ATES (Caldiroli et al., 2021), and AIOLOS (Schulik & Booth, 2023). A useful asset of these self-consistent codes is that they have predictive power of the atmospheric mass-loss rate. However, the associated predicted transit spectrum may be inconsistent with observational data.

The isothermal Parker wind (Parker, 1958; Lamers & Cassinelli, 1999) is an alternative type of model that parametrizes the mass-loss rate and temperature of the atmosphere. The model thus does not aim to include all physics and solve the atmospheric structure from first principle. Rather, it assumes ignorance of some parameters and aims to infer those from data. Mathematically, the isothermal Parker wind description comes down to ignoring Eq. 3. Instead, the mass and momentum equations (Eqs. 1 and 2) are solved while assuming a constant sound speed

vs=kTμ.subscript𝑣𝑠𝑘𝑇𝜇v_{s}=\sqrt{\frac{kT}{\mu}}.italic_v start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT = square-root start_ARG divide start_ARG italic_k italic_T end_ARG start_ARG italic_μ end_ARG end_ARG . (4)

One then obtains the radial density and velocity profiles (see e.g., Lamers & Cassinelli, 1999), and a transit spectrum can be calculated. Using this model, an observed transit spectrum can virtually always be matched with some values of the mass-loss rate and temperature, allowing these parameters to be retrieved from observations. This is especially useful for the mass-loss rate, which is the quantity we are often most interested in.

A common practice in the literature is to fit isothermal Parker wind models with different mass-loss rates and temperatures to an observed transit spectrum (e.g., Lampón et al., 2020; Vissapragada et al., 2020; Allart et al., 2023). However, the best-fit models often show a degeneracy between the temperature and mass-loss rate, making it difficult to constrain them. Especially retrievals on data with low spectral resolution suffer from this degeneracy. It is less of a problem in higher resolution spectra, since the temperature can be constrained from the spectral line width.

In low-resolution spectra, an external constraint on the temperature of the atmosphere can help to break the degeneracy and hence constrain the mass-loss rate (Vissapragada et al., 2022a; Linssen et al., 2022). In sunbather, we provide a way to find a sensible temperature of the Parker wind and hence allow constraining the mass-loss rate. After having calculated the density and velocity profiles of the isothermal Parker wind, we plug them into Eq. 3 and solve for a new temperature profile that is nonisothermal. The density, velocity, and temperature profiles are thus not entirely self-consistent, given that the former two are calculated assuming an isothermal profile. That being said, exactly this fact can be leveraged to estimate a sensible Parker wind temperature. If the isothermal and nonisothermal temperature profiles are similar, the atmospheric structure and hence temperature is relatively self-consistent. Limiting the model parameter space to only those Parker wind models (for example by using a prior) means that effectively the mass-loss rate is the only free parameter left to fit to the data. We first demonstrated this method in Linssen et al. (2022). A second reason to calculate a nonisothermal temperature profile is that it should simply be more realistic than an assumed isothermal profile. Apart from affecting the atmospheric structure and line widths, the temperature also affects the chemical state of gas (i.e.,the ionization state and atomic level populations) and hence the transit spectrum.

sunbather includes the 30 lightest elements (up until zinc) and allows for an arbitrary composition. The inclusion of metal species compared to a pure hydrogen/helium composition manifests itself in the outflow properties and transit spectrum in various ways, which we explore in Sect. 3. The composition of the atmosphere is kept constant with radius in the atmosphere. Heavy metal particles are assumed to be dragged along efficiently in the outflow so that there is no mass fractionation. This assumption breaks down when the mass-loss rate is low and only the lighter elements are allowed to escape (Hunten et al., 1987). It is up to the user of the code to consider whether each species is expected to escape and if the chosen composition is sensible. This can for example be estimated using the crossover mass (Hunten et al., 1987). The cases in which heavier particles either escape efficiently or do not escape at all can be modeled well by choosing the appropriate (constant) composition. Only the intermediate case in which heavy particles do escape, but at a lower rate than the lighter elements, cannot be appropriately modeled as it requires abundance patterns that change with radius in the atmosphere.

The transit spectrum can be calculated over any wavelength range between 1 Å and 10 μ𝜇\mathrm{\mu}italic_μm. It aims to include all atomic and ionic spectral lines present in the NIST Atomic Spectra Database333https://www.nist.gov/pml/atomic-spectra-database. Not all of these lines can be calculated (see Sect. 2.3 for more details), but the strongest lines are included. To quantify, 29,530 spectral lines are included, equal to 40% of the lines in the NIST database. Sources of continuum opacity, as well as molecular absorption lines cannot be calculated in the current version of sunbather, but molecules are also expected to be dissociated in the outflow. Our model is 1D and we assume spherical symmetry, and so we cannot produce asymmetric spectral line shapes or light curves. Spectral lines will always be symmetric around their rest-frame wavelength.

We now describe the setup of sunbather in more detail. This is divided into three sections that correspond to the modules of sunbather in which they are implemented. Fig. 1 presents a simplified visualization of the computational scheme.

Refer to caption
Figure 1: Simplified visualization of the modeling setup of sunbather. The variables are as follows: Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and Mpsubscript𝑀𝑝M_{p}italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT are the planet radius and mass, a𝑎aitalic_a is the orbital distance (only circular orbits are possible), Msubscript𝑀M_{*}italic_M start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT and F(λ)subscript𝐹𝜆F_{*}(\lambda)italic_F start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT ( italic_λ ) are the stellar mass and spectral energy distribution, T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG are the (constant) temperature and mass-loss rate of the Parker wind, Z𝑍Zitalic_Z denotes the atmospheric bulk composition, μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ), ρ(r)𝜌𝑟\rho(r)italic_ρ ( italic_r ), v(r),𝑣𝑟v(r),italic_v ( italic_r ) , and T(r)𝑇𝑟T(r)italic_T ( italic_r ) are the atmospheric mean particle mass, density, velocity, and (nonconstant) temperature profiles, nX(r)subscript𝑛𝑋𝑟n_{X}(r)italic_n start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT ( italic_r ) represents the number density of any “chemical species” (i.e., any energy level of an atom or ion), b𝑏bitalic_b and ϕitalic-ϕ\phiitalic_ϕ are the planet transit impact parameter and orbital phase, and Rsubscript𝑅R_{*}italic_R start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT, u1(λ)subscript𝑢1𝜆u_{1}(\lambda)italic_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( italic_λ ) and u2(λ)subscript𝑢2𝜆u_{2}(\lambda)italic_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ( italic_λ ) are the stellar radius and quadratic limb-darkening parameters.

2.1 Calculating the density and velocity structure: The construct_parker module

In this module, we calculate isothermal Parker wind density and velocity profiles using a combination of p-winds (dos Santos et al., 2022) and Cloudy (Ferland et al., 1998, 2017; Chatzikos et al., 2023). Despite what the name suggests, the wind is not strictly isothermal in this formalism. Instead, the sound speed and thus the ratio of T(r)/μ(r)𝑇𝑟𝜇𝑟T(r)/\mu(r)italic_T ( italic_r ) / italic_μ ( italic_r ) is constant. μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ) depends on the composition of the atmosphere (which we keep constant with radius), but also the ionization fractions, which do change with radius. μ𝜇\muitalic_μ therefore typically varies by a factor 2less-than-or-similar-toabsent2\lesssim 2≲ 2 throughout the atmosphere. If one calculates an appropriately averaged value μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG, a corresponding averaged isothermal value T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT can also be assigned (Appendix A of Lampón et al., 2020).

We use p-winds to calculate the density and velocity profiles of the atmosphere. This means it solves Eqs. 1 and 2; we refer the reader to dos Santos et al. (2022) for the details of this calculation. To run, p-winds needs the planet mass Mpsubscript𝑀𝑝M_{p}italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, the planet radius Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, and the stellar spectrum F(λ)subscript𝐹𝜆F_{*}(\lambda)italic_F start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT ( italic_λ ) at the planet orbital distance a𝑎aitalic_a as input. Additionally, the three free parameters of the model are the isothermal temperature T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, the bulk mass-loss rate M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG, and the composition of the atmosphere. These parameters cannot be predicted by the model - they have to be assumed. In p-winds, the atmosphere is assumed to be hydrogen/helium only, meaning that choosing the composition is equivalent to choosing a hydrogen abundance fraction fHsubscript𝑓𝐻f_{H}italic_f start_POSTSUBSCRIPT italic_H end_POSTSUBSCRIPT. The code calculates the ionization structures of hydrogen and helium, resulting in a μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ) profile and associated μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG. Together with T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG determines the speed of sound, which is needed for the calculation of the density and velocity profiles. If the user of sunbather chooses an atmospheric composition that is hydrogen/helium only, p-winds can be used standalone to obtain the density and velocity profiles. However, when the chosen atmospheric composition includes metals, the μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r )-structure as calculated by p-winds will not be correct. We therefore use Cloudy to calculate μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ) when metals are included.

Cloudy is a 1D NLTE photoionization code applicable to many different astrophysical problems. Currently, versions v17.02 and v23.01 are supported by sunbather, and the user may decide which version to install (no significant differences between the two versions were found). Cloudy calculates microphysical processes inside a gas cloud irradiated by a light source, predicting the ionization and energy level populations, as well as the emerging spectrum. It includes extensive databases of energy levels, transition probabilities, and collision rates for different molecular, atomic, and ionic species. This makes it very suitable for our purpose of predicting the physical state of upper exoplanet atmospheres, which due to their low densities are expected to show a complex chemical state governed by NLTE effects. In recent years, Cloudy has been increasingly applied to the study of exoplanet atmospheres (e.g., Salz et al., 2016; Fossati et al., 2020, 2021, 2023; Turner et al., 2020; Young et al., 2020, 2024; Zhang et al., 2021, 2022; Linssen et al., 2022; Linssen & Oklopčić, 2023; Kubyshkina et al., 2024).

The isothermal Parker wind density and velocity profiles are solved in an iterative manner when metals are included (visualized in the left part of Fig. 1). We start by running p-winds to calculate the density and velocity profile with hydrogen and helium only. We then simulate this density profile with Cloudy, while fixing an isothermal temperature profile T(r)=T0𝑇𝑟subscript𝑇0T(r)=T_{0}italic_T ( italic_r ) = italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, and using the full composition that includes metals. Cloudy calculates - amongst other things - the ionization profiles of all elements and the corresponding free electron number density profile. If we ignore molecules, we only need the electron density to calculate the mean particle mass as

μ(r)=sXsms1+ne(r)ρ(r)sXsms,𝜇𝑟subscript𝑠subscript𝑋𝑠subscript𝑚𝑠1subscript𝑛𝑒𝑟𝜌𝑟subscript𝑠subscript𝑋𝑠subscript𝑚𝑠\mu(r)=\frac{\sum_{s}X_{s}m_{s}}{1+\frac{n_{e}(r)}{\rho(r)}\sum_{s}X_{s}m_{s}},italic_μ ( italic_r ) = divide start_ARG ∑ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT italic_m start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT end_ARG start_ARG 1 + divide start_ARG italic_n start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT ( italic_r ) end_ARG start_ARG italic_ρ ( italic_r ) end_ARG ∑ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT italic_m start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT end_ARG , (5)

where Xssubscript𝑋𝑠X_{s}italic_X start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT and mssubscript𝑚𝑠m_{s}italic_m start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT are the abundance and mass of species s𝑠sitalic_s, respectively, and nesubscript𝑛𝑒n_{e}italic_n start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT is the free electron number density. The abundances are expressed as a dimensionless fraction and obey sXs=1subscript𝑠subscript𝑋𝑠1\sum_{s}X_{s}=1∑ start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT italic_s end_POSTSUBSCRIPT = 1. We use Eq. A.3 from Lampón et al. (2020) to find μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG from μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ). This completes the first iteration and we start the second. We run p-winds again and use the new μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG value, while bypassing its own calculation of μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG. This results in a new density and velocity profile. We simulate the density profile with Cloudy to obtain a new μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG, completing the second iteration. We repeat these steps until μ¯¯𝜇\bar{\mu}over¯ start_ARG italic_μ end_ARG is converged to (|μ¯iμ¯i1|)/μ¯i1<0.01subscript¯𝜇𝑖subscript¯𝜇𝑖1subscript¯𝜇𝑖10.01(|\bar{\mu}_{i}-\bar{\mu}_{i-1}|)/\bar{\mu}_{i-1}<0.01( | over¯ start_ARG italic_μ end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - over¯ start_ARG italic_μ end_ARG start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT | ) / over¯ start_ARG italic_μ end_ARG start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT < 0.01, where i𝑖iitalic_i is the iteration number. sunbather also stops if convergence is not reached after seven iterations (the user can change the convergence threshold and maximum iteration number).

The runtime of this module depends on the composition. For a pure hydrogen/helium composition, p-winds can calculate the density and velocity profiles in a second. When the p-winds/Cloudy iterative scheme is applied, the runtime is of order ten minutes. One could also still invoke the iterative scheme when calculating a pure hydrogen/helium composition, as Cloudy may report a different μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r )-structure from p-winds.

2.2 Calculating the temperature structure: The convergeT_parker module

In this module, we calculate a nonisothermal temperature structure using Cloudy. This means we now introduce Eq. 3 and solve it for T(r)𝑇𝑟T(r)italic_T ( italic_r ) while using ρ(r)𝜌𝑟\rho(r)italic_ρ ( italic_r ) and v(r)𝑣𝑟v(r)italic_v ( italic_r ) that were calculated before under the isothermal assumption. The four terms of Eq. 3 represent advection, expansion, radiative heating, and radiative cooling, respectively. The advection and expansion terms depend explicitly on the temperature profile. The radiative heating and cooling terms take a few minutes to calculate using Cloudy and implicitly depend on the temperature in a nontrivial manner. Therefore, we cannot instantly solve Eq. 3 for the temperature profile, but use an iterative algorithm instead. The middle part of Fig. 1 shows a simplified schematic of the iterative algorithm, and Fig. 2 shows an example case.

We start by running the density profile through Cloudy with an initial temperature profile. The user of sunbather can choose whether this initial temperature profile is

  1. i)

    the isothermal profile assumed when calculating the density and velocity profiles,

  2. ii)

    the temperature profile of a previously calculated model with a similar T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG,

  3. iii)

    unspecified, in which case Cloudy will calculate it assuming radiative equilibrium.

The chosen initial temperature profile does not affect the final nonisothermal profile, but it does affect the number of iterations needed to find the solution. The output of this first Cloudy simulation is Γ(r)Γ𝑟\Gamma(r)roman_Γ ( italic_r ), Λ(r)Λ𝑟\Lambda(r)roman_Λ ( italic_r ), μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ) (after applying Eq. 5), as well as T(r)𝑇𝑟T(r)italic_T ( italic_r ) if option iii) was chosen. For this initial temperature profile, Eq. 3 will not yet be satisfied. Therefore, we guess a new temperature structure and run Cloudy again to obtain new Γ(r)Γ𝑟\Gamma(r)roman_Γ ( italic_r ), Λ(r)Λ𝑟\Lambda(r)roman_Λ ( italic_r ), and μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ) profiles. This is repeated until Eq. 3 is respected. We use two complementary algorithms to guess the temperature structure of the next iteration, which we describe in the following two subsections.

2.2.1 Algorithm 1: “Relaxing” the temperature profile

In this algorithm, we guess a new temperature profile based on the heating/cooling inequality of the last iteration. We aim to find the temperature profile for which the total heating and cooling rate are equal and hence their ratio equal to 1, as that implies we have solved Eq. 3. After running Cloudy with the temperature profile of the last iteration, we have all the quantities needed to calculate the four different terms of Eq. 3. The advection term can be positive (heating) or negative (cooling), depending on the slope of T(r)/μ(r)𝑇𝑟𝜇𝑟T(r)/\mu(r)italic_T ( italic_r ) / italic_μ ( italic_r ), while expansion and Λ(r)Λ𝑟\Lambda(r)roman_Λ ( italic_r ) are always negative and Γ(r)Γ𝑟\Gamma(r)roman_Γ ( italic_r ) is always positive. Fig. 2b shows an example of these rates for the temperature profile of the second iteration. We sum the different heating and cooling rates into a total heating rate (r)𝑟\mathcal{H}(r)caligraphic_H ( italic_r ) and total cooling rate 𝒞(r)𝒞𝑟\mathcal{C}(r)caligraphic_C ( italic_r ) (which we define as positive here) as a function of radius. Fig. 2c shows the ratio (r)/𝒞(r)𝑟𝒞𝑟\mathcal{H}(r)/\mathcal{C}(r)caligraphic_H ( italic_r ) / caligraphic_C ( italic_r ) as a red line if heating is stronger or 𝒞(r)/(r)𝒞𝑟𝑟\mathcal{C}(r)/\mathcal{H}(r)caligraphic_C ( italic_r ) / caligraphic_H ( italic_r ) as a blue line if cooling is stronger. Based on this ratio, we guess a new temperature structure, assigning a higher temperature to radii where >𝒞𝒞\mathcal{H}>\mathcal{C}caligraphic_H > caligraphic_C, and a lower temperature to radii where 𝒞>𝒞\mathcal{C}>\mathcal{H}caligraphic_C > caligraphic_H. Specifically,

Ti+1(r)={Ti(r)11δi(r)log10((r)𝒞(r))if (r)>𝒞(r)Ti(r)[1δi(r)log10(𝒞(r)(r))]if (r)<𝒞(r),subscript𝑇𝑖1𝑟casessubscript𝑇𝑖𝑟11subscript𝛿𝑖𝑟subscriptlog10𝑟𝒞𝑟if 𝑟𝒞𝑟otherwiseotherwisesubscript𝑇𝑖𝑟delimited-[]1subscript𝛿𝑖𝑟subscriptlog10𝒞𝑟𝑟if 𝑟𝒞𝑟T_{i+1}(r)=\begin{cases}T_{i}(r)\dfrac{1}{1-\delta_{i}(r)\cdot\mathrm{log}_{10% }\left(\frac{\mathcal{H}(r)}{\mathcal{C}(r)}\right)}&\text{if }\mathcal{H}(r)>% \mathcal{C}(r)\\ \\ T_{i}(r)\left[1-\delta_{i}(r)\cdot\mathrm{log}_{10}\left(\frac{\mathcal{C}(r)}% {\mathcal{H}(r)}\right)\right]&\text{if }\mathcal{H}(r)<\mathcal{C}(r),\end{cases}italic_T start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ( italic_r ) = { start_ROW start_CELL italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_r ) divide start_ARG 1 end_ARG start_ARG 1 - italic_δ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_r ) ⋅ roman_log start_POSTSUBSCRIPT 10 end_POSTSUBSCRIPT ( divide start_ARG caligraphic_H ( italic_r ) end_ARG start_ARG caligraphic_C ( italic_r ) end_ARG ) end_ARG end_CELL start_CELL if caligraphic_H ( italic_r ) > caligraphic_C ( italic_r ) end_CELL end_ROW start_ROW start_CELL end_CELL start_CELL end_CELL end_ROW start_ROW start_CELL italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_r ) [ 1 - italic_δ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_r ) ⋅ roman_log start_POSTSUBSCRIPT 10 end_POSTSUBSCRIPT ( divide start_ARG caligraphic_C ( italic_r ) end_ARG start_ARG caligraphic_H ( italic_r ) end_ARG ) ] end_CELL start_CELL if caligraphic_H ( italic_r ) < caligraphic_C ( italic_r ) , end_CELL end_ROW (6)

where i𝑖iitalic_i is the iteration number and δ(r)𝛿𝑟\delta(r)italic_δ ( italic_r ) is a scaling factor that sets how large the temperature changes are between iterations. In the first iteration, δ1(r)=0.3subscript𝛿1𝑟0.3\delta_{1}(r)=0.3italic_δ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ( italic_r ) = 0.3 at all radii. In some cases, the changes to the temperature structure are too aggressive and T(r)𝑇𝑟T(r)italic_T ( italic_r ) will fluctuate up and down between iterations. We check for radial bins in which such temperature fluctuations happen, and we lower the scaling factor there as δi+1(r)=2/3δi(r)subscript𝛿𝑖1𝑟23subscript𝛿𝑖𝑟\delta_{i+1}(r)=2/3\cdot\delta_{i}(r)italic_δ start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ( italic_r ) = 2 / 3 ⋅ italic_δ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_r ). This ensures smaller changes in temperature between iterations, preventing fluctuations and allowing the temperature structure to converge. Ti+1/Tisubscript𝑇𝑖1subscript𝑇𝑖T_{i+1}/T_{i}italic_T start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT / italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is furthermore bounded by 0.5 and 2 to prevent extremely large jumps in temperature. In Fig. 2a, the dotted line labeled “iteration 3” shows the newly guessed temperature profile after applying the algorithm described in this section. We do not immediately start the third iteration with this profile, however. First, we apply a second, complementary algorithm described in the next subsection to refine the guessed temperature profile of iteration 3 further.

2.2.2 Algorithm 2: “Constructing” the temperature profile

In this algorithm, we further modify the guessed temperature from the relaxation algorithm described in the previous section, before starting the next iteration. Contrary to the relaxation algorithm, we here do not use the temperature profile of the last iteration. Instead, we use only μ(r)𝜇𝑟\mu(r)italic_μ ( italic_r ), Γ(r)Γ𝑟\Gamma(r)roman_Γ ( italic_r ) and Λ(r)Λ𝑟\Lambda(r)roman_Λ ( italic_r ) of the last iteration as given by Cloudy. Together with ρ(r)𝜌𝑟\rho(r)italic_ρ ( italic_r ) and v(r)𝑣𝑟v(r)italic_v ( italic_r ), we can solve Eq. 3 for T(r)𝑇𝑟T(r)italic_T ( italic_r ), which is the only remaining variable. The reason that this does not immediately yield the correct temperature structure, is that ΓΓ\Gammaroman_Γ and ΛΛ\Lambdaroman_Λ implicitly depend on the temperature, meaning that the Γ(r,T)Γ𝑟𝑇\Gamma(r,T)roman_Γ ( italic_r , italic_T ) and Λ(r,T)Λ𝑟𝑇\Lambda(r,T)roman_Λ ( italic_r , italic_T ) values from the last iteration are not consistent anymore with the newly constructed Ti+1(r)subscript𝑇𝑖1𝑟T_{i+1}(r)italic_T start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ( italic_r ). Iterations are therefore still required to find the converged temperature structure.

This algorithm will not work well in parts of the atmosphere where the dominant heating and cooling terms are the radiation rates. This is because we solve Eq. 3 while keeping the radiation rates fixed at those from the last iteration, such that only the expansion and advection terms can change. If the latter are not the dominant terms, the algorithm will make huge adjustments to the temperature structure in order to change the expansion and advection terms enough to achieve heating/cooling balance. However, smaller changes to the temperature profile would actually already lead to energy balance, since Γ(r,T)Γ𝑟𝑇\Gamma(r,T)roman_Γ ( italic_r , italic_T ) and Λ(r,T)Λ𝑟𝑇\Lambda(r,T)roman_Λ ( italic_r , italic_T ) would change accordingly as well. Oppositely, this algorithm works well and achieves convergence quickly when radiation is relatively unimportant. In this case, the radiation rates are still fixed at those from the last iteration and will again not be fully consistent with the newly constructed temperature structure. However, this is not important for the total heating/cooling balance, which is dominated by advection and/or expansion. For these reasons, we always employ the relaxation algorithm of Sect. 2.2.1 first, and afterwards only employ the construction algorithm of this section over the region of the atmosphere where radiation is relatively unimportant (provided such a region exists).

We construct the new temperature profile as follows. Given a starting value T(rstart)𝑇subscript𝑟𝑠𝑡𝑎𝑟𝑡T(r_{start})italic_T ( italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT ) specified at one particular radial bin rstartsubscript𝑟𝑠𝑡𝑎𝑟𝑡r_{start}italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT, we calculate T𝑇Titalic_T in the next radial bin by minimizing the left-hand side of Eq. 3 with respect to T𝑇Titalic_T (using the minimize_scalar function from the scipy library). We can then calculate T𝑇Titalic_T in the following radial bin and proceed in this way until the full profile is found. The temperature profile constructed with this method is very sensitive to T(rstart)𝑇subscript𝑟𝑠𝑡𝑎𝑟𝑡T(r_{start})italic_T ( italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT ), and therefore we only apply the algorithm if there is a starting point where the temperature profile is already almost converged, through the use of the relaxation algorithm described in Sect. 2.2.1. Additionally, we only apply the algorithm if the whole region of the atmosphere that we construct (i.e., r>rstart𝑟subscript𝑟𝑠𝑡𝑎𝑟𝑡r>r_{start}italic_r > italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT) is dominated by expansion or advection, for the reasons discussed above. The exact criterion to find a suitable rstartsubscript𝑟𝑠𝑡𝑎𝑟𝑡r_{start}italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT is somewhat complex and we refer the interested reader to the sunbather source code. Roughly speaking, we require (rstart)/𝒞(rstart)subscript𝑟𝑠𝑡𝑎𝑟𝑡𝒞subscript𝑟𝑠𝑡𝑎𝑟𝑡\mathcal{H}(r_{start})/\mathcal{C}(r_{start})caligraphic_H ( italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT ) / caligraphic_C ( italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT ) or 𝒞(rstart)/(rstart)𝒞subscript𝑟𝑠𝑡𝑎𝑟𝑡subscript𝑟𝑠𝑡𝑎𝑟𝑡\mathcal{C}(r_{start})/\mathcal{H}(r_{start})caligraphic_C ( italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT ) / caligraphic_H ( italic_r start_POSTSUBSCRIPT italic_s italic_t italic_a italic_r italic_t end_POSTSUBSCRIPT ) (whichever is higher) to be smaller than 1.3, but this value is allowed to be higher if the contributions from radiative heating and cooling are sufficiently low.

2.2.3 Reaching convergence

Our complete method to calculate the nonisothermal temperature profile consists of iteratively running the temperature profile through Cloudy, updating the temperature profile using the described algorithms, and radially smoothing the temperature profile over small scales. We smooth the temperature profile mainly because the advection rate shows small discrete jumps that propagate to jumps in the newly guessed temperature profile. These jumps arise from the dependence of the advection rate on the temperature gradient and Cloudy’s limited precision in reporting the temperature. Without smoothing, small discrete jumps in the temperature profile would lead to much larger changes in the advection rate in the next iteration, quickly destabilizing the algorithm. We consider the temperature profile converged when 1/fc<(r)/𝒞(r)<fc1subscript𝑓𝑐𝑟𝒞𝑟subscript𝑓𝑐1/f_{c}<\mathcal{H}(r)/\mathcal{C}(r)<f_{c}1 / italic_f start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT < caligraphic_H ( italic_r ) / caligraphic_C ( italic_r ) < italic_f start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT at all radii. The default value of the convergence threshold fcsubscript𝑓𝑐f_{c}italic_f start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT is 1.1 and can be changed by the user of the code. In some cases, the smoothing of the temperature profile prevents it from reaching a convergence factor of fcsubscript𝑓𝑐f_{c}italic_f start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT, even though the profile does not change substantially anymore between iterations. These solutions are thus correct up to the level of the smoothing (typically 50less-than-or-similar-toabsent50\lesssim 50≲ 50 K), and we consider them valid as well. The runtime of this module is on the order of ten minutes.

We finally clarify that the advection term of Eq. 3 only accounts for the advective heat flow. In principle, the advective particle flow should also lead to the transport of atoms from the deeper layers of the atmosphere to the ionic upper layers of the atmosphere, thereby influencing the degree of ionization. This would in turn affect the mean particle mass that we calculate in Eq. 5, as well as the radiative heating and cooling rates through different ionization and recombination rates. Properly including the advective velocity component in Cloudy would require editing the source code (Salz et al., 2015) and drastically increase its computation time, and so we ignore these second-order effects on μ𝜇\muitalic_μ, ΓΓ\Gammaroman_Γ, and ΛΛ\Lambdaroman_Λ.

Refer to caption
Figure 2: Iterative method to solve for the nonisothermal temperature profile. a) Temperature profiles of the different iterations i𝑖iitalic_i. Convergence is reached after nine iterations. Upon each iteration, two algorithms are applied to guess the temperature profile. Dotted lines show the profile based on the relax algorithm of Sect. 2.2.1 and are labeled (r). Solid lines then show the profile after the construct algorithm of Sect. 2.2.2 has also been applied and are labeled (c). b) The different heating and cooling rates corresponding to the temperature profile of the second iteration. c) Ratio of the total heating rate to total cooling rate, for the rates shown in panel (b). If the ratio is <fc=1.1absentsubscript𝑓𝑐1.1<f_{c}=1.1< italic_f start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 1.1 everywhere, the temperature profile is considered converged. Based on the /𝒞𝒞\mathcal{H}/\mathcal{C}caligraphic_H / caligraphic_C and 𝒞/𝒞\mathcal{C}/\mathcal{H}caligraphic_C / caligraphic_H ratios shown here, the guessed i𝑖iitalic_i=3 (r) profile will be cooler at r<5Rp𝑟5subscript𝑅𝑝r<5R_{p}italic_r < 5 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and slightly hotter at r>5Rp𝑟5subscript𝑅𝑝r>5R_{p}italic_r > 5 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, as confirmed in panel (a).

2.3 Calculating the transmission spectrum: The RT module

In this module, we use the Cloudy output to calculate the transmission spectrum. We do not use the spectrum predicted by Cloudy. Cloudy is a hydrostatic code and thus does not include spectral line broadening due to the outflow velocity. Furthermore, instead of one simulation along the substellar direction, multiple simulations at different impact parameters from the planet would be needed to produce the correct transit geometry (see e.g., Young et al., 2020). Therefore, we instead postprocess the chemical state of the atmosphere that Cloudy calculates with a ray-tracing calculation as follows.

The user provides a wavelength region and a set of atomic and ionic species for which to calculate the transit spectrum. For each species, sunbather includes a downloaded table of all spectral line coefficients of the NIST database. This table is filtered to only those lines that fall within the requested wavelength range. Each absorption line corresponds to a transition from a lower energy level of an atom/ion to a higher energy level. To calculate a spectral line, the number density of the lower energy level as a function of radius in the atmosphere is needed. For a given line in the NIST database, sunbather therefore first tries to identify if the lower energy level can be matched to any of the energy levels used by Cloudy. This is not always possible, because we use the default Cloudy energy level selection, which for most species includes the 15 lowest levels. Additionally, Cloudy will sometimes “fold” multiple energy levels together into one, or include energy levels that simply cannot be matched to the levels reported by NIST. In those cases, the spectral line cannot be calculated. In practice, however, the strongest lines in a transit spectrum originate from the lowest few energy levels of an atom or ion, which are typically included in the default Cloudy selection. Therefore, we choose to not increase the number of energy levels included in Cloudy beyond the default selection, as this would increase the computation time. For the energy levels that can be matched to NIST, Cloudy provides the number density of that energy level as a function of radius in the atmosphere.

We then project the 1D number density of the energy level nX(r)subscript𝑛𝑋𝑟n_{X}(r)italic_n start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT ( italic_r ), temperature T(r),𝑇𝑟T(r),italic_T ( italic_r ) , and velocity v(r)𝑣𝑟v(r)italic_v ( italic_r ) profile onto a 2D semi-circle with the x𝑥xitalic_x-coordinate along the direction of the stellar light rays and the y𝑦yitalic_y-coordinate indicating the impact parameter of the light rays with respect to the planet surface. The velocity is directed radially outward, but only the vxsubscript𝑣𝑥v_{x}italic_v start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT-component affects the Doppler shift of the observed line. By default, sunbather uses 100 rays, but this number can be changed if higher or lower precision is needed. The code then loops over each individual spectral line and calculates the cumulative optical depth of each of the 100 rays as a function of frequency ν𝜈\nuitalic_ν as

τy(ν)=xnX(x,y)σ0Φ(Δν)dx,subscript𝜏𝑦𝜈subscript𝑥subscript𝑛𝑋𝑥𝑦subscript𝜎0ΦΔ𝜈differential-d𝑥\tau_{y}(\nu)=\int_{x}n_{X}(x,y)\sigma_{0}\Phi(\Delta\nu)\mathrm{d}x,italic_τ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_ν ) = ∫ start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT ( italic_x , italic_y ) italic_σ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT roman_Φ ( roman_Δ italic_ν ) roman_d italic_x , (7)

where σ0=2.654×102×f12subscript𝜎02.654superscript102subscript𝑓12\sigma_{0}=2.654\times 10^{-2}\times f_{12}italic_σ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 2.654 × 10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT × italic_f start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPT is the absorption cross-section of the given spectral line. f12subscript𝑓12f_{12}italic_f start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPT is the oscillator strength of the line given by the NIST database. ΦΦ\Phiroman_Φ is the Voigt line profile, which is a convolution of a Lorentzian line profile due to natural broadening and a Gaussian line profile due to thermal broadening. The Lorentzian profile has a (constant) half-width at half-maximum of γ=A21/4π𝛾subscript𝐴214𝜋\gamma=A_{21}/4\piitalic_γ = italic_A start_POSTSUBSCRIPT 21 end_POSTSUBSCRIPT / 4 italic_π, where A21subscript𝐴21A_{21}italic_A start_POSTSUBSCRIPT 21 end_POSTSUBSCRIPT is the Einstein coefficient of the line given by the NIST database. The Gaussian profile has a (temperature-dependent) half-width at half-maximum of

α=2ln2kT(x,y)mXν0c,𝛼2ln2𝑘𝑇𝑥𝑦subscript𝑚𝑋subscript𝜈0𝑐\alpha=\sqrt{\frac{2\mathrm{ln}2\;kT(x,y)}{m_{X}}}\frac{\nu_{0}}{c},italic_α = square-root start_ARG divide start_ARG 2 roman_l roman_n 2 italic_k italic_T ( italic_x , italic_y ) end_ARG start_ARG italic_m start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT end_ARG end_ARG divide start_ARG italic_ν start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_ARG start_ARG italic_c end_ARG , (8)

where mXsubscript𝑚𝑋m_{X}italic_m start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT is the mass of the absorbing species and v0subscript𝑣0v_{0}italic_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is the rest-frame frequency of the line (i.e., the line center). The line profile is dominated by thermal broadening around the line center, but natural broadening can dominate the absorption in the far wings of the line. If the Voigt profile itself is centered around zero, it is evaluated at

Δν=(νν0)vx(x,y)cν0Δ𝜈𝜈subscript𝜈0subscript𝑣𝑥𝑥𝑦𝑐subscript𝜈0\Delta\nu=(\nu-\nu_{0})-\frac{v_{x}(x,y)}{c}\nu_{0}roman_Δ italic_ν = ( italic_ν - italic_ν start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) - divide start_ARG italic_v start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT ( italic_x , italic_y ) end_ARG start_ARG italic_c end_ARG italic_ν start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT (9)

in order to take into account the deviation from the line center at the current frequency, as well as the Doppler shift due to the outflow velocity. We then sum the τy(ν)subscript𝜏𝑦𝜈\tau_{y}(\nu)italic_τ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_ν ) contributions of all spectral lines together.

The last step is to convert these optical depths of the 100 rays into a transit spectrum. First, sunbather adds 50 more rays between y=0𝑦0y=0italic_y = 0 and y=Rp𝑦subscript𝑅𝑝y=R_{p}italic_y = italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT with τy(ν)=subscript𝜏𝑦𝜈\tau_{y}(\nu)=\inftyitalic_τ start_POSTSUBSCRIPT italic_y end_POSTSUBSCRIPT ( italic_ν ) = ∞ to take into account the opaque planet core. Each ray i𝑖iitalic_i then corresponds to a projected annulus on the stellar disk (the yz𝑦𝑧y-zitalic_y - italic_z-plane) of area Si=π(yi+1yi)2subscript𝑆𝑖𝜋superscriptsubscript𝑦𝑖1subscript𝑦𝑖2S_{i}=\pi(y_{i+1}-y_{i})^{2}italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_π ( italic_y start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT - italic_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT. However, the background stellar flux varies across such an annulus, based on the stellar limb darkening and the projected planet position (determined by its impact parameter b𝑏bitalic_b and orbital phase ϕitalic-ϕ\phiitalic_ϕ). Each annulus is thus divided into 500 cells distributed spherically along the annulus. In each of these cells, the stellar intensity I(ν)𝐼𝜈I(\nu)italic_I ( italic_ν ) is evaluated according to the (frequency-dependent) quadratic limb darkening law. Taking the average of the 500 cells results in an average intensity I¯i(ν)subscript¯𝐼𝑖𝜈\bar{I}_{i}(\nu)over¯ start_ARG italic_I end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_ν ) per ray. We then calculate the average intensity of the complete stellar disk I¯(ν)subscript¯𝐼𝜈\bar{I}_{*}(\nu)over¯ start_ARG italic_I end_ARG start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT ( italic_ν ) by sampling it in 1000 annuli. Finally, the total transit spectrum can be calculated, defined as the ratio of the flux in-transit Fin(ν)subscript𝐹𝑖𝑛𝜈F_{in}(\nu)italic_F start_POSTSUBSCRIPT italic_i italic_n end_POSTSUBSCRIPT ( italic_ν ) and the flux out-of-transit Fout(ν)subscript𝐹𝑜𝑢𝑡𝜈F_{out}(\nu)italic_F start_POSTSUBSCRIPT italic_o italic_u italic_t end_POSTSUBSCRIPT ( italic_ν ):

Fin(ν)Fout(ν)=1iI¯i(ν)SiI¯(ν)πR2[1exp(τyi(ν))],subscript𝐹𝑖𝑛𝜈subscript𝐹𝑜𝑢𝑡𝜈1subscript𝑖subscript¯𝐼𝑖𝜈subscript𝑆𝑖subscript¯𝐼𝜈𝜋superscriptsubscript𝑅2delimited-[]1expsubscript𝜏subscript𝑦𝑖𝜈\frac{F_{in}(\nu)}{F_{out}(\nu)}=1-\sum_{i}\frac{\bar{I}_{i}(\nu)\cdot S_{i}}{% \bar{I}_{*}(\nu)\cdot\pi R_{*}^{2}}\Big{[}1-\mathrm{exp}(-\tau_{y_{i}}(\nu))% \Big{]},divide start_ARG italic_F start_POSTSUBSCRIPT italic_i italic_n end_POSTSUBSCRIPT ( italic_ν ) end_ARG start_ARG italic_F start_POSTSUBSCRIPT italic_o italic_u italic_t end_POSTSUBSCRIPT ( italic_ν ) end_ARG = 1 - ∑ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT divide start_ARG over¯ start_ARG italic_I end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_ν ) ⋅ italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_ARG start_ARG over¯ start_ARG italic_I end_ARG start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT ( italic_ν ) ⋅ italic_π italic_R start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG [ 1 - roman_exp ( - italic_τ start_POSTSUBSCRIPT italic_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_ν ) ) ] , (10)

where Rsubscript𝑅R_{*}italic_R start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT is the stellar radius.

Having discussed the main modules of sunbather, we provide a clarification of how the planet radius Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT is defined. The isothermal Parker wind keeps the mass-loss rate constant at all radii, from a singular point at r0𝑟0r\to 0italic_r → 0 until r𝑟r\to\inftyitalic_r → ∞. In reality, the planetary outflows are being launched at some finite altitude between the lower atmosphere, which is in hydrostatic equilibrium, and the upper atmosphere, which is well described by a Parker wind profile. Our models do not capture this transition, and so the Parker wind profile is truncated at a lower boundary of 1Rp1subscript𝑅𝑝1R_{p}1 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. In calculating the transmission spectrum, we assume that the planet is fully opaque at all wavelengths for r<Rp𝑟subscript𝑅𝑝r<R_{p}italic_r < italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT.

3 Escaping atmospheres at supersolar metallicity

We employ sunbather to investigate how atmospheric escape depends on the composition. The dependence on the helium abundance in hydrogen/helium outflows has been studied before, and the degeneracy with the extreme UV flux of the host star is well known (Lampón et al., 2021b; Khodachenko et al., 2021; Czesla et al., 2022; Fossati et al., 2022; Xing et al., 2023; Biassoni et al., 2024; Allan et al., 2024). Even though atmospheric escape models that incorporate metals have been employed in the literature (e.g., Salz et al., 2016; Shaikhislamov et al., 2020; Huang et al., 2023), a systematic exploration of the influence of metals has so far only been performed by Zhang et al. (2022) and Kubyshkina et al. (2024).

Studying how metals impact atmospheric mass-loss is especially important in the context of small gaseous planets. In the solar system, a clear anticorrelation between planet mass and atmospheric metallicity has been observed (Guillot et al., 2022). However, establishing a similar relationship for exoplanets proves more challenging. While there is evidence supporting an inverse correlation between planet mass and bulk metallicity (Thorngren et al., 2016), it is not yet clear how this relates to the atmospheric metallicity (e.g., Welbanks et al., 2019; Bean et al., 2023).

In this section, we investigate how the atmospheric bulk properties such as density, velocity and temperature respond to an increasing metal content. We also study how the changing atmospheric structure and abundances in turn affect the transit spectrum. A front-to-back reproduction script for the results of this section is available on Zenodo22{}^{\ref{fn:zenodo}}start_FLOATSUPERSCRIPT end_FLOATSUPERSCRIPT. The simulations presented here neglected the stellar tidal gravity term of Eq. 2, but we checked that the results are qualitatively the same as simulations including it. We simulate a generic hot-Neptune planet with Mp=0.1subscript𝑀𝑝0.1M_{p}=0.1italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = 0.1 MJsubscript𝑀𝐽M_{J}italic_M start_POSTSUBSCRIPT italic_J end_POSTSUBSCRIPT, Rp=0.5subscript𝑅𝑝0.5R_{p}=0.5italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = 0.5 RJsubscript𝑅𝐽R_{J}italic_R start_POSTSUBSCRIPT italic_J end_POSTSUBSCRIPT, orbiting a Sun analog at a=0.05𝑎0.05a=0.05italic_a = 0.05 AU. The solar spectrum that we use is a combination of different datasets. The 0.5-189.5 nm wavelength region consists of data from the SEE instrument aboard the TIMED spacecraft, which has been measuring the full solar disk irradiance since 2002 (Woods et al., 2005). We use the Level 3 data product, which constitutes one-day average spectra with flares removed. The data we use is from January 1st 2016. This date is in-between the maximum and minimum of the 11-year solar cycle and was thus assumed to represent a somewhat average spectrum. The 190-310 nm and 310-2412 nm wavelength regions consist of data from the SOLSTICE and SIM instruments, respectively, aboard the SORCE spacecraft that also continuously monitored the solar spectrum (Rottman, 2005). These components are again daily averages at January 1st 2016. We finally extrapolate the red end of the spectrum with a Rayleigh-Jeans power-law until 10,000 nm. The spectrum is shown in Fig. A.1 of Linssen & Oklopčić 2023.

We simulate the planet using six different atmospheric compositions: a pure hydrogen/helium mixture in the ratio 10:1 by number, a complete solar composition including metals, and three, ten, 30, and 50 times solar metallicity. A scaled solar metallicity Z𝑍Zitalic_Z in this case means we scale the metal/hydrogen abundance ratio relative to the solar ratio as

Z=(XmXH)/(Xm,XH,),𝑍subscript𝑋𝑚subscript𝑋𝐻subscript𝑋𝑚direct-productsubscript𝑋𝐻direct-productZ=\Bigg{(}\frac{X_{m}}{X_{H}}\Bigg{)}\;\Bigg{/}\;\Bigg{(}\frac{X_{m,\odot}}{X_% {H,\odot}}\Bigg{)},italic_Z = ( divide start_ARG italic_X start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT end_ARG start_ARG italic_X start_POSTSUBSCRIPT italic_H end_POSTSUBSCRIPT end_ARG ) / ( divide start_ARG italic_X start_POSTSUBSCRIPT italic_m , ⊙ end_POSTSUBSCRIPT end_ARG start_ARG italic_X start_POSTSUBSCRIPT italic_H , ⊙ end_POSTSUBSCRIPT end_ARG ) , (11)

where m𝑚mitalic_m runs over every metal element. With this definition, Z𝑍Zitalic_Z can take any value, but the increase in metal abundance becomes nonlinear at high Z𝑍Zitalic_Z. To illustrate, while the solar carbon abundance is XC=2.225×104subscript𝑋𝐶2.225superscript104X_{C}=2.225\times 10^{-4}italic_X start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT = 2.225 × 10 start_POSTSUPERSCRIPT - 4 end_POSTSUPERSCRIPT, at 50 times solar metallicity, the abundance increases to XC=1.063×102subscript𝑋𝐶1.063superscript102X_{C}=1.063\times 10^{-2}italic_X start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT = 1.063 × 10 start_POSTSUPERSCRIPT - 2 end_POSTSUPERSCRIPT, which is only a factor similar-to\sim48 increase. The carbon abundance converges towards XC=0.233subscript𝑋𝐶0.233X_{C}=0.233italic_X start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT = 0.233 as Z𝑍Z\to\inftyitalic_Z → ∞.

3.1 Assessing the validity of a constant composition

As explained in Sect. 2, sunbather does not treat mass fractionation but instead has a constant composition with altitude. To clarify, the ionization fractions and energy level populations of each element do change as a function of radius, but the overall abundance of the element does not. We can assess the validity of the assumption of constant composition in the high-metallicity outflows by using the concept of the crossover mass, as introduced by Hunten et al. (1987). In an atmosphere consisting of two constituents, the crossover mass is defined as

mc=m1+kTF10g0X1b,subscript𝑚𝑐subscript𝑚1𝑘𝑇superscriptsubscript𝐹10subscript𝑔0subscript𝑋1𝑏m_{c}=m_{1}+\frac{kTF_{1}^{0}}{g_{0}X_{1}b},italic_m start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = italic_m start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + divide start_ARG italic_k italic_T italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT end_ARG start_ARG italic_g start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_b end_ARG , (12)

where m1subscript𝑚1m_{1}italic_m start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is the mass of the first constituent, k𝑘kitalic_k is the Boltzmann constant, T𝑇Titalic_T is the temperature, F10superscriptsubscript𝐹10F_{1}^{0}italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT is the number outflow flux of the first constituent, g0=GMp/Rp2subscript𝑔0𝐺subscript𝑀𝑝superscriptsubscript𝑅𝑝2g_{0}=GM_{p}/R_{p}^{2}italic_g start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = italic_G italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT / italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT is the planet surface gravitational acceleration, X1subscript𝑋1X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is the abundance of the first constituent, and b𝑏bitalic_b is the diffusion parameter, given by (Cussler, 2009):

b=nAT3/2Pσ122Ω1M1+1M2,𝑏𝑛𝐴superscript𝑇32𝑃superscriptsubscript𝜎122Ω1subscript𝑀11subscript𝑀2b=n\cdot\frac{AT^{3/2}}{P\sigma_{12}^{2}\Omega}\sqrt{\frac{1}{M_{1}}+\frac{1}{% M_{2}}},italic_b = italic_n ⋅ divide start_ARG italic_A italic_T start_POSTSUPERSCRIPT 3 / 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_P italic_σ start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT roman_Ω end_ARG square-root start_ARG divide start_ARG 1 end_ARG start_ARG italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_ARG + divide start_ARG 1 end_ARG start_ARG italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_ARG end_ARG , (13)

where n𝑛nitalic_n is the number density, P𝑃Pitalic_P is the pressure, σ12=(σ1+σ2)/2subscript𝜎12subscript𝜎1subscript𝜎22\sigma_{12}=(\sigma_{1}+\sigma_{2})/2italic_σ start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPT = ( italic_σ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_σ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) / 2 is the average collision diameter of the two constituents, ΩΩ\Omegaroman_Ω is a dimensionless constant of order unity that we take to be 1 here (Hirschfelder et al., 1967), M1subscript𝑀1M_{1}italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and M2subscript𝑀2M_{2}italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT are the molar masses of the two constituents, and

A=38k3/2NA2π,𝐴38superscript𝑘32subscript𝑁𝐴2𝜋A=\frac{3}{8}k^{3/2}\sqrt{\frac{N_{A}}{2\pi}},italic_A = divide start_ARG 3 end_ARG start_ARG 8 end_ARG italic_k start_POSTSUPERSCRIPT 3 / 2 end_POSTSUPERSCRIPT square-root start_ARG divide start_ARG italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT end_ARG start_ARG 2 italic_π end_ARG end_ARG , (14)

where NAsubscript𝑁𝐴N_{A}italic_N start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT is the Avogadro constant. If we take atomic hydrogen as constituent 1, assuming it drives the outflow and drags along the second constituent (a metal species), the crossover mass can be understood as the particle mass above which the metal species is no longer effectively dragged along. In other words, if m2<<mcmuch-less-thansubscript𝑚2subscript𝑚𝑐m_{2}<<m_{c}italic_m start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT < < italic_m start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT, the metal species is dragged along efficiently, resulting in a constant composition with altitude. However, as m2subscript𝑚2m_{2}italic_m start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT approaches mcsubscript𝑚𝑐m_{c}italic_m start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT, the metal escape flux approaches 0.

We can thus check our model assumption of efficient metal drag by estimating the crossover mass at r=Rp𝑟subscript𝑅𝑝r=R_{p}italic_r = italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. We do this for the model that requires the most extreme metal drag, namely the 50 times solar metallicity case with Parker wind parameters T0=5000subscript𝑇05000T_{0}=5000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5000 K and M˙=109.9˙𝑀superscript109.9\dot{M}=10^{9.9}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.9 end_POSTSUPERSCRIPT g s-1 (see Sect. 3.2 for the choice of parameters). With such a composition, X1=0.87subscript𝑋10.87X_{1}=0.87italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = 0.87 and the hydrogen number flux is F10=1.3×1013superscriptsubscript𝐹101.3superscript1013F_{1}^{0}=1.3\times 10^{13}italic_F start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT = 1.3 × 10 start_POSTSUPERSCRIPT 13 end_POSTSUPERSCRIPT s-1. In principle, our atmosphere is a mixture of many different constituents, but Eq. 12 is derived under the assumption of only two constituents. We take the second constituent to be atomic iron, with M2=55.845subscript𝑀255.845M_{2}=55.845italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 55.845 g mol-1. The collision diameters are not readily available, and so we assume σ12=2.58subscript𝜎122.58\sigma_{12}=2.58italic_σ start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPT = 2.58 Å (similar to the value of various molecular gases, see Hirschfelder et al. 1967). Using the temperature, pressure and number density of the Parker wind profile at Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, we find b=1.44×1020𝑏1.44superscript1020b=1.44\times 10^{20}italic_b = 1.44 × 10 start_POSTSUPERSCRIPT 20 end_POSTSUPERSCRIPT cm-1 s-1 and mc=43subscript𝑚𝑐43m_{c}=43italic_m start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 43 amu. This means that the assumption of efficient metal drag and a constant composition with altitude is questionable for the heaviest metal species in this particular simulation (zinc is the most massive particle included, with a a mass of 65 amu). The simulations at lower metallicities have higher crossover masses (mc=127subscript𝑚𝑐127m_{c}=127italic_m start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 127 amu at 30 times solar metallicity) and metal drag can thus be assumed to be efficient in them. Even for the 50 times solar metallicity case however, our calculation used hydrogen and iron in atomic form as the two constituents. For ions, the collision diameter is much stronger (Hunten et al., 1987), and consequently the crossover mass is much larger. The Cloudy simulation shows that both hydrogen and iron (and other metal species for that matter) are indeed mostly ionized already at r=Rp𝑟subscript𝑅𝑝r=R_{p}italic_r = italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. If we re-calculate the crossover mass for an ionized outflow using the more generalized description given in Eq. 33 of Xing et al. (2023), we find mc5×105subscript𝑚𝑐5superscript105m_{c}\approx 5\times 10^{5}italic_m start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT ≈ 5 × 10 start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT amu. Hence, we consider the assumption of efficient metal drag to be reasonable for the 50 times solar metallicity simulations as well.

3.2 Effect of metallicity on the outflow structure

3.2.1 The model parameters

When comparing models with different metallicities, we have to choose appropriate values for the model free parameters T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG. We first explore how the atmospheric structure changes when using the same mass-loss rate of M˙=1011˙𝑀superscript1011\dot{M}=10^{11}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 11 end_POSTSUPERSCRIPT g s-1 in each model. To find a suitable T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, we perform a model self-consistency check. This means we run multiple models with different values for T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. For each, we calculate the average of the nonisothermal temperature profile between r=Rp𝑟subscript𝑅𝑝r=R_{p}italic_r = italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and r=2Rp𝑟2subscript𝑅𝑝r=2R_{p}italic_r = 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and compare it to T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. We select the model where the difference is the smallest, because the nonisothermal temperature profile is then most consistent with the density and velocity profiles which were derived under the isothermal approximation. We refer the interested reader to Linssen et al. (2022) and Linssen & Oklopčić (2023) for a more in-depth discussion on assessing the self-consistency of a Parker wind model. We find self-consistent values for T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT of 5100, 5000, 5000, 4900, 4700, 4100 K for the six models ordered by ascending metallicity.

Refer to caption
Figure 3: Atmospheric profiles for a generic hot-Neptune planet at different metallicities. The left column shows a set of models with a fixed mass-loss rate. The right column shows another set of models with a fixed density at the planet radius, leading to different mass-loss rates at different metallicities. For every model, the value of T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is chosen such that it is consistent with the mean of the nonisothermal temperature profile of panel (d) or (i) between 1Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and 2Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. Those values for T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT can be found in the text in Sect. 3.2.1 and Sect. 3.2.4. In panels (e) and (j), solid lines show the radiative heating rates and dashed lines show the radiative cooling rates.

3.2.2 Effect of metallicity on the hydrodynamics

The left column of Fig. 3 shows the bulk atmospheric properties of the six models. Panels a, b, and c show the density, velocity and mean particle mass profiles, respectively, which are calculated under the assumption of an isothermal Parker wind. Unsurprisingly, the mean particle mass increases with the metallicity of the atmosphere. This difference in mean particle mass then propagates into different density and velocity profiles through the sound speed (Eq. 4). As the sound speed becomes lower, the outflow velocity decreases and depends more steeply on radius. Since the mass-loss rate M˙=4πr2ρ(r)v(r)˙𝑀4𝜋superscript𝑟2𝜌𝑟𝑣𝑟\dot{M}=4\pi r^{2}\rho(r)v(r)over˙ start_ARG italic_M end_ARG = 4 italic_π italic_r start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_ρ ( italic_r ) italic_v ( italic_r ) is kept constant, the density shows the reverse behaviour and increases while also depending more steeply on radius. These changes only become substantial at metallicities higher than three times solar. The conclusion that the mean particle mass is the main driver of structural changes is in agreement with the findings of Kubyshkina et al. (2024), who compare a hydrogen, a hydrogen/helium, and a solar composition outflow.

3.2.3 Effect of metallicity on the temperature

Panel d shows the nonisothermal temperature profiles that we obtain by solving Eq. 3. We generally observe a radial flattening of the temperature profile with increasing metallicity. We can understand this by considering the “thermostat temperature”, which is the temperature that the gas would have in radiative equilibrium (in the absence of the expansion and advection terms). The thermostat temperature has a rather weak dependence on density (and hence atmospheric radius) and is similar-to\sim10,000 K for the pure hydrogen/helium atmospheric density profile of panel d (agreeing with the findings of Murray-Clay et al., 2009). Due to metal cooling, the thermostat temperature steadily decreases towards similar-to\sim5000 K at 50 times solar metallicity. For the pure hydrogen/helium and lower metallicity atmospheres, the thermostat temperature is not actually reached because of expansion cooling, and we instead find a temperature profile that decreases with radius. On the other hand, for the high metallicity atmospheres, the expansion cooling rates are much lower because of the lower outflow velocities. The high metallicity outflows therefore do reach their thermostat temperature, and we find a temperature profile that is similar-to\sim5000 K with little dependence on radius. This explanation is supported by the radiative heating and cooling rates shown in panel e. For the lower metallicity models, the radiative heating rate is roughly an order of magnitude higher than the radiative cooling rate. The radiative heating is instead balanced by expansion cooling. For the 50 times solar metallicity model, we see that radiative heating and cooling balance each other throughout the radial domain. The models at ten and 30 times solar metallicity are (almost) in radiative equilibrium only at lower radii, and this is indeed where their temperature profiles are relatively flat. We can thus comment on the thermal properties of the gas by looking at the difference between the radiative heating and cooling rates. At high metallicity, thermal balance between radiative processes indicates that chemistry plays a dominant part in governing the outflow. At lower metallicity, however, the onset of expansion cooling highlights the relevance of dynamics in affecting the atmosphere, especially at higher radii.

We also note that it is somewhat coincidental that the low metallicity models have a temperature of similar-to\sim5000 K at r2Rpless-than-or-similar-to𝑟2subscript𝑅𝑝r\lesssim 2R_{p}italic_r ≲ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, which is similar to the high metallicity thermostat temperature. This is because expansion cooling dominates throughout the atmosphere of the hot-Neptune planet that we simulate here. As identified in for example Salz et al. (2016); Caldiroli et al. (2021); Linssen et al. (2022), a higher gravity planet like a hot Jupiter is in radiative equilibrium at lower radii, and would therefore reach a temperature close to the thermostat value of similar-to\sim10,000 K.

3.2.4 Effect of metallicity on the mass-loss rate

It is interesting to examine how the mass-loss rate of the planet changes as a function of atmospheric metallicity. Unfortunately, we cannot easily answer this question, since the mass-loss rate is assumed, rather than predicted, in our model. However, under the assumption that the density at the planet radius stays the same irrespective of the outflow metallicity, we can adjust the mass-loss rate of the models with different compositions in such a way that we respect that density. This assumption can be debated, as modeling efforts have shown that metallicity affects the conditions at the photosphere (e.g., Mollière et al., 2015; Drummond et al., 2018). However, we are only aiming to do a simple exploration of the problem here. With this exercise, we are effectively imposing a boundary condition on ρ(Rp)𝜌subscript𝑅𝑝\rho(R_{p})italic_ρ ( italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) that our isothermal Parker wind model normally does not have. Other atmospheric escape models that treat the hydrodynamics and thermal balance self-consistently also have such a boundary condition. In those models, the chosen boundary conditions can affect the resulting mass-loss rate ranging from a few tens of percent up to a factor of a few, depending on the planet considered (e.g., Salz et al., 2016; Kubyshkina et al., 2024). We should thus take into account that changes to the mass-loss rate at that level could be attributed to the boundary condition rather than metallicity.

We keep the Parker wind parameters of the pure hydrogen/helium composition the same as before, that is, a self-consistent temperature of T0=5100subscript𝑇05100T_{0}=5100italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5100 K and a mass-loss rate of M˙=1011˙𝑀superscript1011\dot{M}=10^{11}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 11 end_POSTSUPERSCRIPT g s-1. For the simulations with different metallicity, we then find the mass-loss rate for which ρ(Rp)𝜌subscript𝑅𝑝\rho(R_{p})italic_ρ ( italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) is the same as that of the hydrogen/helium profile, while using a self-consistent T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. This yields the following values: T0=5100subscript𝑇05100T_{0}=5100italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5100 K and M˙=1010.95˙𝑀superscript1010.95\dot{M}=10^{10.95}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 10.95 end_POSTSUPERSCRIPT g s-1 for the model with a solar composition, T0=5100subscript𝑇05100T_{0}=5100italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5100 K and M˙=1010.95˙𝑀superscript1010.95\dot{M}=10^{10.95}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 10.95 end_POSTSUPERSCRIPT g s-1 for the model with three times solar metallicity, T0=5100subscript𝑇05100T_{0}=5100italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5100 K and M˙=1010.8˙𝑀superscript1010.8\dot{M}=10^{10.8}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 10.8 end_POSTSUPERSCRIPT g s-1 for the model with ten times solar metallicity, T0=5000subscript𝑇05000T_{0}=5000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5000 K and M˙=1010.3˙𝑀superscript1010.3\dot{M}=10^{10.3}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 10.3 end_POSTSUPERSCRIPT g s-1 for the model with 30 times solar metallicity, and T0=5000subscript𝑇05000T_{0}=5000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5000 K and M˙=109.9˙𝑀superscript109.9\dot{M}=10^{9.9}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.9 end_POSTSUPERSCRIPT g s-1 for the model with 50 times solar metallicity. Hence, for a fixed density ρ(Rp)𝜌subscript𝑅𝑝\rho(R_{p})italic_ρ ( italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ), the mass-loss rate is roughly an order of magnitude lower at high metallicity than at solar metallicity.

The right column of Fig. 3 presents the atmospheric structure of these models. Since the mass-loss rates of the lower metallicity models are close to 1011superscript101110^{11}10 start_POSTSUPERSCRIPT 11 end_POSTSUPERSCRIPT g s-1, their atmospheric structures are almost the same as in the left column of Fig. 3. The differences are larger for the higher metallicity models. The temperature profiles shown in panel i are now all remarkably similar. Like in Sect. 3.2.3, we can explain this with an argument based on the expansion cooling rate. The velocity and hence expansion cooling rate of the higher metallicity models is relatively low at radii r2Rpless-than-or-similar-to𝑟2subscript𝑅𝑝r\lesssim 2R_{p}italic_r ≲ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. As panel j confirms, the result is that these models are in radiative equilibrium at their thermostat temperatures of 5000 K in this region of the atmosphere. Contrary to the previous case at fixed M˙=1011˙𝑀superscript1011\dot{M}=10^{11}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 11 end_POSTSUPERSCRIPT g s-1, their velocities are now close to the velocities of the solar composition model at radii r2Rpgreater-than-or-equivalent-to𝑟2subscript𝑅𝑝r\gtrsim 2R_{p}italic_r ≳ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. Due to expansion cooling, their temperature profiles are therefore not flat, but decrease with radius.

3.2.5 Radiative heating and cooling by metals

We take a closer look at the different heating and cooling processes that make up the total radiation rates. For the simulations with a fixed density at Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT (right column of Fig. 3), Fig. 4 shows the contribution of each process, as given by Cloudy. We present these as a fraction of the total radiative heating or cooling rate. At solar composition, heating is dominated by hydrogen ionization, but helium ionization contributes significantly, especially at smaller radii. Metals only slightly affect the heating through line heating, which makes up 5less-than-or-similar-toabsent5\lesssim 5≲ 5%. Cooling is dominated by hydrogen recombination and free-free emission at radii r2Rpgreater-than-or-equivalent-to𝑟2subscript𝑅𝑝r\gtrsim 2R_{p}italic_r ≳ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. At smaller radii, line cooling from iron, magnesium, and calcium ions becomes important and comparable to the hydrogen recombination cooling rate. Interestingly, cooling through hydrogen Lyman-α𝛼\alphaitalic_α emission seems to be unimportant, contrary to the findings of other works both employing Cloudy (e.g., Salz et al., 2016; Zhang et al., 2022; Kubyshkina et al., 2024) and not employing Cloudy (e.g., Murray-Clay et al., 2009; Allan et al., 2024). It is not immediately clear to us why this is the case. As we go to ten times solar metallicity, heating is still mostly dominated by hydrogen and helium ionization, but metal line heating and oxygen ionization is becoming more important. Cooling below 2Rpless-than-or-similar-toabsent2subscript𝑅𝑝\lesssim 2R_{p}≲ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT is now completely dominated by iron, magnesium, and calcium line cooling. At 50 times solar metallicity, heating occurs through wealth of different agents. At smaller radii, hydrogen, helium, and carbon ionization still dominate, but above 2Rp2subscript𝑅𝑝2R_{p}2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, ionization of various metal atoms and ions all contribute a few % to 20 % of the heating. The cooling rate qualitatively shows roughly the same behaviour as at ten times solar metallicity. Iron, magnesium, and calcium line cooling dominate at smaller radii, while at larger radii cooling occurs through the lines of various metal ions, the strongest being Ne2+. These results show that metals are important in the radiative budget of the planet already at solar abundance through their line cooling. At enhanced metallicities of approximately ten times solar and above, their ionization and line heating also become important.

Since Fig. 4 shows the fractional contribution of each heating and cooling agent, we need to compare with Fig. 3j to get a sense for the absolute change in the heating and cooling rates of the different agents. This reveals that at radii 1.5Rpgreater-than-or-equivalent-toabsent1.5subscript𝑅𝑝\gtrsim 1.5R_{p}≳ 1.5 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, the lower hydrogen and helium ionization heating fractions at high metallicity indeed also correspond to a lower radiative heating rate. In other words, in those regions, the decrease in hydrogen/helium heating is not replaced by similar amounts of metal ionization heating. At radii 1.5Rpless-than-or-similar-toabsent1.5subscript𝑅𝑝\lesssim 1.5R_{p}≲ 1.5 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT however, the radiative heating rate does increase with metallicity due to O+ ionization. For the cooling rates, we see similar behaviour, but now at a dividing radius of 3Rpsimilar-toabsent3subscript𝑅𝑝\sim 3R_{p}∼ 3 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT. At radii 3Rpless-than-or-similar-toabsent3subscript𝑅𝑝\lesssim 3R_{p}≲ 3 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, the loss of hydrogen recombination cooling is not counterbalanced by metal cooling. However, at radii 3Rpless-than-or-similar-toabsent3subscript𝑅𝑝\lesssim 3R_{p}≲ 3 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, the onset of iron, magnesium, and calcium line cooling does lead to an overall much higher cooling rate.

Refer to caption
Figure 4: Radiative heating and cooling agents as given by Cloudy for models with a fixed density at the planet radius (right column of Fig. 3). The rates are expressed as a fraction of the total radiative heating or cooling rate. The grey dotted line labeled “other” is the sum of all other agents that are not plotted as they do not exceed a fraction of 0.01. For some processes such as heating by “metal lines”, we unfortunately cannot obtain more details from the Cloudy output about the specific elements responsible. Please note the log-scale when interpreting the relative importance of the different agents.

3.3 Effect of metallicity on the transit spectrum

To investigate the effect of the outflow metallicity on the transit spectrum, we calculated the transit depths of various atmospheric escape tracers. We first calculated the transit depths of all spectral lines identified and listed in Table C.1 of Linssen & Oklopčić (2023). From these, we selected the 18 strongest lines and supplemented this with the metastable helium line and calcium infrared triplet, to obtain a sample of 20 spectral lines. Fig. 5 presents the transit depths of these spectral lines as a function of outflow metallicity, for the simulations with a fixed photospheric density (right column of Fig. 3). The spectra were made at mid-transit and without stellar center-to-limb variations.

The hydrogen Lyman-α𝛼\alphaitalic_α line appears to have a transit depth independent of metallicity. This is an artifact of our atmospheric radial grid, which extends to 8Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT so that the maximum transit depth is (8Rp/R)2=16.9%superscript8subscript𝑅𝑝subscript𝑅2percent16.9(8R_{p}/R_{*})^{2}=16.9\%( 8 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT / italic_R start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT = 16.9 %. Even though there is certainly less absorption in the Lyman-α𝛼\alphaitalic_α line at high metallicity, the line is still optically thick and hence its transit depth does not decrease. A model that extends to larger radii (and takes into account interactions with the stellar environment) would be needed to properly explore the dependence of the Lyman-α𝛼\alphaitalic_α line on the outflow metallicity. Since the metastable helium line forms at smaller radii, it is seen to become weaker at high metallicity. This is not due to the decrease in helium abundance, which is only 4%similar-toabsentpercent4\sim 4\%∼ 4 %, but due to structural changes in the outflow. The dominant factor is that the total density (hence also helium density) decreases because the mass-loss rate gets lower. At the same time, Fig. 3 shows that the temperature decreases at radii r2Rpless-than-or-similar-to𝑟2subscript𝑅𝑝r\lesssim 2R_{p}italic_r ≲ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT and increases at radii r2Rpgreater-than-or-equivalent-to𝑟2subscript𝑅𝑝r\gtrsim 2R_{p}italic_r ≳ 2 italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT at higher metallicity, leading to an increase and decrease in the fraction of helium atoms in the metastable state, respectively (see Fig. 1 of Biassoni et al., 2024). The combined result turns out to be a weaker helium line.

For all the other lines that originate from metals, we notice an interesting response to an increasing metallicity. Spectral lines originating from atomic or singly ionized metals become stronger until ten to 30 times solar metallicity and then become weaker again at 50 times solar metallicity. In contrast, spectral lines originating from doubly or higher ionized metals keep growing stronger until 50 times solar metallicity. This behavior is the result of a decreasing number density of atoms and singly charged ions on the one hand and an increasing number density of doubly and higher charged ions on the other hand. We can understand why the ionization fractions change in this way as follows. If we temporarily consider a total density profile that is kept constant, increasing the metal content will lead to a lower free electron density. This is due to the fact that a metal particle generates fewer free electrons per unit mass than hydrogen or helium - assuming the metal particle is not completely ionized, which is indeed not the case in the conditions of an upper exoplanet atmosphere. The lower electron density leads to a lower recombination rate of the ions, as the radiative recombination rate depends linearly on the electron density (Rybicki & Lightman, 1991) and the three-body recombination rate depends on the electron density squared. The photoionization rate stays roughly the same, and as a consequence the degree of ionization increases. At 50 times solar metallicity, this effect is so strong that we get a lower number density of metal atoms and singly charged ions, even though the overall metal abundance is higher than in the 30 times solar metallicity case. Vice versa, the number density of doubly and higher charged ions grows faster than the increase in overall metal abundance. Finally, we can consider the case where the total density profile is not kept constant. As the top-right panel of Fig. 3 shows, the total density in fact decreases with metallicity, which adds to the weakening of the lines.

Refer to caption
Figure 5: Depths of the 18 strongest lines in the transit spectra, as well as the metastable helium and calcium infrared triplet lines. The results are shown for the models with a fixed density at the planet radius (right column of Fig. 3). Our computational radial domain extends to 8Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, corresponding to a maximum absorption of 16.9%, which is reached by various spectral lines. Lines originating from metal atoms (solid) and singly charged ions (dashed) tend to become stronger up to ten times solar metallicity, and then become weaker. Lines originating from doubly or higher charged metal ions (dotted and dash-dotted) keep growing stronger as the metallicity increases.

4 Constraining mass-loss rates from spectral line observations

In this section, we demonstrate one of the main use cases of sunbather: fitting an observed transit spectrum with a grid of models in order to constrain the planet’s mass-loss rate. Measuring the mass-loss rate is especially interesting as it is a fundamental parameter in the atmospheric evolution. Obtaining accurate mass-loss rates for individual planets will help to reveal the role of atmospheric escape in shaping the sub-Jovian desert and radius valley (e.g., Owen & Lai, 2018; Owen & Wu, 2013). Constraining the mass-loss rate with sunbather is enabled by the fact that it is a free parameter in the Parker wind description, and can thus be adjusted until the model fits the observations. With this in mind, many works have indeed used an isothermal Parker wind model to fit observations of the metastable helium line (see references in the introduction). In most cases, the fit is performed only for T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG while considering a hydrogen/helium outflow with some assumed helium abundance. However, some of these works have additionally fit for the helium abundance (e.g., Lampón et al., 2020; dos Santos et al., 2022), but it is typically degenerate with other model parameters. In Sect. 4.1, we start by demonstrating the method on a mock spectrum, which serves as a simple example. We then move on to an observed spectrum of a real planet in Sect. 4.2, which serves as a more complicated example. In Sect. 4.3, we explore the influence of the assumed metal abundance on the fit, and show that even though we keep the hydrogen/helium ratio the same, the presence of metals in the outflow still affects the mass-loss rate that is inferred from helium observations. A front-to-back reproduction script for the results of this section is available on Zenodo22{}^{\ref{fn:zenodo}}start_FLOATSUPERSCRIPT end_FLOATSUPERSCRIPT, and it can easily be modified to interpret other observations.

4.1 Fitting a mock spectrum

We start by generating a fake observed metastable helium spectrum. We take the generic hot-Neptune planet that we introduced in Sect. 3 and choose a solar composition atmosphere, T0=5100subscript𝑇05100T_{0}=5100italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5100 K and M˙=1010.95˙𝑀superscript1010.95\dot{M}=10^{10.95}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 10.95 end_POSTSUPERSCRIPT g s-1. We first use sunbather to calculate the metastable helium spectrum between 10,830 and 10,836 Å, shown as the purple line in Fig. 6a. We then turn this synthetic spectrum into a mock observed spectrum by introducing noise. We sample the synthetic spectrum at a spectral resolution of 80,000. At each wavelength point, we add random values drawn from a normal distribution with standard deviation 0.0025 to the model Fin/Foutsubscript𝐹𝑖𝑛subscript𝐹𝑜𝑢𝑡F_{in}/F_{out}italic_F start_POSTSUBSCRIPT italic_i italic_n end_POSTSUBSCRIPT / italic_F start_POSTSUBSCRIPT italic_o italic_u italic_t end_POSTSUBSCRIPT value. We then also assign an observed errorbar of 0.0025 to the drawn data points. This results in the mock spectrum shown in black in Fig. 6a.

Refer to caption
Figure 6: Demonstration of a retrieval of the mass-loss rate and temperature from the helium spectrum of the generic hot-Neptune introduced in Sect. 3. a) True model metastable helium spectrum and the mock observed spectrum. The best retrieved model from the resolved line fit is also shown. b) Results of the fit to the spectrally resolved line, without using a prior. c) Results of the fit to the EW of the line. As visible from the blue contours, the fit offers no tight constraints on its own. We thus place a normal prior on the parameter space based on the model temperature self-consistency, shown in orange. The posterior distribution shown in black then yields a precise and accurate constraint.

We now pretend that this is an observed spectrum of the planet and aim to fit for the mass-loss rate and temperature. We fix all other parameters (see Fig. 1 for the parameters that are needed) at the values that we used to create the mock spectrum, thus effectively assuming we know them precisely. For Rpsubscript𝑅𝑝R_{p}italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, a𝑎aitalic_a, and Rsubscript𝑅R_{*}italic_R start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT, this is a reasonable assumption as for real planets they are usually known well enough to not dominate the uncertainties of the analysis. The value of Mpsubscript𝑀𝑝M_{p}italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT typically has larger uncertainties. To get a sense for when the uncertainty in Mpsubscript𝑀𝑝M_{p}italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT may become significant, we ran an identical model as that used to generate the mock spectrum, but increased the planet mass by 30%. The resulting helium spectrum was within 1σ1𝜎1\sigma1 italic_σ of the original spectrum. When increasing the planet mass by 60%, the difference became more significant at 3σsimilar-toabsent3𝜎\sim 3\sigma∼ 3 italic_σ. The final two “parameters” that we fix at the real values are the stellar spectral energy distribution (SED) and the planet atmospheric composition, which are typically not known accurately for real planets, but may also significantly influence the results of the analysis. One may thus wish to also explore different SEDs and compositions, in addition to T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG (we explore this in more detail in Sect. 4.2 for the atmospheric composition).

We run a grid of models, with temperatures ranging from 4000 to 7000 K in steps of 100 K, and mass-loss rates ranging from 1010.5 to 1011.5 g s-1 in steps of 0.05 dex (totaling 651 models). Each model calculation consists of first calling the construct_parker.py routine to calculate the isothermal Parker wind density and velocity profiles (Sect. 2.1), then calling the convergeT_parker.py routine to calculate the nonisothermal temperature profile (Sect. 2.2), and finally using the RT.py module to calculate the metastable helium spectrum (Sect. 2.3).

With all model spectra calculated, we can turn to the statistics. We first resample each model spectrum onto the same wavelength grid as the observed spectrum. Assuming normally distributed errors, we can fit each model to the data using a χ2superscript𝜒2\chi^{2}italic_χ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT-statistic. In a Bayesian framework, these χ2superscript𝜒2\chi^{2}italic_χ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT-values are then related to the likelihood L𝐿Litalic_L as L=exp(χ2/2)𝐿expsuperscript𝜒22L=\mathrm{exp}(-\chi^{2}/2)italic_L = roman_exp ( - italic_χ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / 2 ), which we show in Fig. 6b. One could choose to also use a (nonflat) prior, but we abstain from doing so here since the fit itself is already quite constraining. The purple cross in Fig. 6b marks the true parameters that were used to generate the mock spectrum. It falls within the 2σ𝜎\sigmaitalic_σ contour of the likelihood, confirming that our retrieval has been successful.

To demonstrate a case in which we have spectrally unresolved data, we now repeat the analysis but fit only the equivalent width (EW) of the line. Observations with the James Webb Space Telescope (dos Santos et al., 2023a), the Hubble Space Telescope (Spake et al., 2018), and the Palomar/WIRC ultranarrowband filter (Vissapragada et al., 2020) would produce such low-resolution or unresolved metastable helium spectra. We integrate our true model spectrum to obtain its EW and then again randomly sample a value around it, obtaining a mock observed EW=13.5±1.8plus-or-minus13.51.813.5\pm 1.813.5 ± 1.8 mÅ (this value is thus not related to the mock resolved spectrum we generated before). We can then simply compare the EW of each model to this observed value, which directly gives the likelihood (shown in blue in Fig. 6c). As visible from the figure, the fit itself is not very constraining, and we instead find a degeneracy between T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG.

To mitigate this problem (which is common when fiting Parker wind models to spectrally unresolved data), we follow the approach outlined in Linssen et al. (2022). This comes down to now using a nonflat prior to break the degeneracy. We choose a prior that is based on the self-consistency of the atmospheric structure. Specifically, for each Parker wind model we compare the nonisothermal temperature profile T(r)𝑇𝑟T(r)italic_T ( italic_r ) to the isothermal value T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. A large difference between the two indicates that the model is not very self-consistent. To compare the T(r)𝑇𝑟T(r)italic_T ( italic_r ) profile to a single value T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, we need to somehow collapse T(r)𝑇𝑟T(r)italic_T ( italic_r ) into a single value as well. Since we are fitting metastable helium observations, we care most about the self-consistency of the model in the region where this line forms. Therefore, we calculate the mean and standard deviation of T(r)𝑇𝑟T(r)italic_T ( italic_r ) weighted by the metastable helium density, resulting in THesubscript𝑇𝐻𝑒T_{He}italic_T start_POSTSUBSCRIPT italic_H italic_e end_POSTSUBSCRIPT and σTsubscript𝜎𝑇\sigma_{T}italic_σ start_POSTSUBSCRIPT italic_T end_POSTSUBSCRIPT, respectively (Eqs. 4 and 5 of Linssen et al. 2022). Our prior value for the model is then given by a normal distribution centered on THesubscript𝑇𝐻𝑒T_{He}italic_T start_POSTSUBSCRIPT italic_H italic_e end_POSTSUBSCRIPT with standard deviation σTsubscript𝜎𝑇\sigma_{T}italic_σ start_POSTSUBSCRIPT italic_T end_POSTSUBSCRIPT evaluated at T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. The orange line in Fig. 6c show models for which THe=T0subscript𝑇𝐻𝑒subscript𝑇0T_{He}=T_{0}italic_T start_POSTSUBSCRIPT italic_H italic_e end_POSTSUBSCRIPT = italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, while the dark and light orange contours indicate models where T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT falls within 1σTsubscript𝜎𝑇\sigma_{T}italic_σ start_POSTSUBSCRIPT italic_T end_POSTSUBSCRIPT and 2σTsubscript𝜎𝑇\sigma_{T}italic_σ start_POSTSUBSCRIPT italic_T end_POSTSUBSCRIPT of THesubscript𝑇𝐻𝑒T_{He}italic_T start_POSTSUBSCRIPT italic_H italic_e end_POSTSUBSCRIPT.

The posterior distribution now follows by multiplying the prior and likelihood and normalizing it. In Fig. 6c, the solid and dashed black lines indicate the 1σ𝜎\sigmaitalic_σ and 2σ𝜎\sigmaitalic_σ contours, respectively. We see that the retrieval has been successful, which is in large part due to using the prior. Without it, the fit would have been quite unconstraining for both the temperature and mass-loss rate. We finally note that in the case of this mock spectrum, the temperature self-consistency prior that we used in the equivalent width fit is also consistent with the temperature that we constrained directly from the resolved line fit. As we show in the following section, this is not always the case for real spectra.

4.2 Fitting the helium spectrum of TOI-2134 b

We now turn to a real observed spectrum, which will prove to be more complicated to interpret. We use this example to illustrate how we can use sunbather to derive insights into outflow physics when our current modeling struggles to self-consistently match the data.

We model the helium line of the mini-Neptune TOI-2134 b as observed with Keck/NIRSPEC by Zhang et al. (2023a). The original spectrum showed a similar-to\sim5 km s-1 redshift from the rest-frame helium triplet wavelength. Such offsets can have valuable physical implications (e.g., Nail et al., 2024), but cannot be reproduced by sunbather, which by virtue of its 1D nature yields lines centered on the rest-frame wavelength. So as to not obtain biased fit results, we first shift the spectrum back to the rest-frame wavelength (shown in Fig. 7c). We then adopt the system parameters from Zhang et al. (2023a): Rp=0.24subscript𝑅𝑝0.24R_{p}=0.24italic_R start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = 0.24 RJsubscript𝑅𝐽R_{J}italic_R start_POSTSUBSCRIPT italic_J end_POSTSUBSCRIPT, Mp=0.0287subscript𝑀𝑝0.0287M_{p}=0.0287italic_M start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT = 0.0287 MJsubscript𝑀𝐽M_{J}italic_M start_POSTSUBSCRIPT italic_J end_POSTSUBSCRIPT, R=0.709subscript𝑅0.709R_{*}=0.709italic_R start_POSTSUBSCRIPT ∗ end_POSTSUBSCRIPT = 0.709 Rsubscript𝑅direct-productR_{\odot}italic_R start_POSTSUBSCRIPT ⊙ end_POSTSUBSCRIPT, a=0.078𝑎0.078a=0.078italic_a = 0.078 AU, b=0.2𝑏0.2b=0.2italic_b = 0.2, and use their stellar SED that is reconstructed from XMM-Newton observations.

We first run models assuming a pure hydrogen/helium composition in the solar ratio of 10:1 by number. The helium abundance is thus XHe=0.091subscript𝑋𝐻𝑒0.091X_{He}=0.091italic_X start_POSTSUBSCRIPT italic_H italic_e end_POSTSUBSCRIPT = 0.091. We run a grid with 2000<T0<80002000subscript𝑇080002000<T_{0}<80002000 < italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT < 8000 K and 108.5<M˙<1010superscript108.5˙𝑀superscript101010^{8.5}<\dot{M}<10^{10}10 start_POSTSUPERSCRIPT 8.5 end_POSTSUPERSCRIPT < over˙ start_ARG italic_M end_ARG < 10 start_POSTSUPERSCRIPT 10 end_POSTSUPERSCRIPT g s-1. The simulations excluded the stellar tidal gravity term of Eq. 2, but we verified that the differences with models including it are minimal for this planet. We calculate the helium spectrum for each model, convolve it to the instrument resolution of R=32,000𝑅32000R=32,000italic_R = 32 , 000, and fit this to the observed spectrum using a χ2superscript𝜒2\chi^{2}italic_χ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT-statistic. The associated likelihood contours are shown in blue in Fig. 7a. We find M˙=109.280.04+0.06˙𝑀superscript10subscriptsuperscript9.280.060.04\dot{M}=10^{9.28^{+0.06}_{-0.04}}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.28 start_POSTSUPERSCRIPT + 0.06 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT - 0.04 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT g s-1 and T0=5000±400subscript𝑇0plus-or-minus5000400T_{0}=5000\pm 400italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5000 ± 400 K and the best-fit model is shown as the solid blue line in Fig. 7c. Zhang et al. (2023a) also modeled their own observations using p-winds and found M˙=109.74±0.08˙𝑀superscript10plus-or-minus9.740.08\dot{M}=10^{9.74\pm 0.08}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.74 ± 0.08 end_POSTSUPERSCRIPT g s-1 and T0=4640±230subscript𝑇0plus-or-minus4640230T_{0}=4640\pm 230italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 4640 ± 230 K. The difference with our constraints likely stems from the fact that sunbather calculates a nonisothermal temperature structure. The best-fit models with T05000subscript𝑇05000T_{0}\approx 5000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ≈ 5000 K have nonisothermal profiles that are quite a bit colder than 5000 K. At those lower temperatures, the metastable helium fraction becomes higher, and a lower mass-loss rate is therefore needed to match the observed line (e.g., Biassoni et al., 2024).

Refer to caption
Figure 7: Two fits to the metastable helium data of the mini-Neptune TOI-2134 b from Zhang et al. (2023a) assuming different atmospheric compositions. In panel (a), we assume a pure hydrogen/helium atmosphere in the solar ratio. In panel (b), we assume a 100 times solar metallicity atmosphere. The colors are the same as in Fig. 6, but here we do not use the model temperature self-consistency as a prior as we did in Fig. 6c. c) Observations from Zhang et al. (2023b) shifted back to the rest-frame helium triplet wavelength (black). Solid lines show the best-fit models from the blue contours in panels (a) and (b). Dashed lines show models with self-consistent T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT-values from the orange contours in panels (a) and (b). The self-consistent models produce lines that are too narrow, indicating that an additional line broadening mechanism may be at play.

We also calculate the model self-consistency in the same way as in Sect. 4.1. We find a self-consistent temperature of T02600similar-tosubscript𝑇02600T_{0}\sim 2600italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∼ 2600 K, independent of the mass-loss rate (orange contours in Fig. 7a). This value is significantly lower and inconsistent with the temperature obtained from the spectral line fit. Because the difference is so large and the line fit itself already yields tight constraints, we do not use the model self-consistency as a prior here. However, it is interesting to discuss the implications and potential causes of the T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT-discrepancy. The dashed blue line in Fig. 7c shows the spectrum of a (self-consistent) model with T0=2600subscript𝑇02600T_{0}=2600italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 2600 K and M˙=108.8˙𝑀superscript108.8\dot{M}=10^{8.8}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 8.8 end_POSTSUPERSCRIPT g s-1 (the value of the mass-loss rate is manually chosen so that the peak absorption is matched). We see that the T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT-discrepancy in practice means that the observed spectral line is broader than expected from our self-consistent models.

The T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT-discrepancy can stem from a variety of factors. It may be partly due to the way in which we assess the self-consistent T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT in the first place. Using a different criterion than the metastable helium density could lead to a different temperature constraint. We can explore this line of thinking a little further by noting that we would obtain the highest possible self-consistent temperature if we were to compare the peak of the nonisothermal temperature profile to T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. With this criterion, we obtain a hard upper limit of T04000less-than-or-similar-tosubscript𝑇04000T_{0}\lesssim 4000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ≲ 4000 K, which is still somewhat inconsistent with the temperature preferred by the data. The next possibility to consider is that our models underestimate the temperature of the outflow. This may be due to uncertainties in the stellar SED, or additional heating from, for example, Joule heating (Cohen et al., 2024). If applicable, these additional heat sources might increase the self-consistent temperature of the outflow, leading to larger outflow velocities that broaden the line proportionately. Alternatively, it is also possible that the thermodynamics are modeled appropriately and the temperature is indeed around 2600 K, but there are additional kinematic components not considered by sunbather that broaden the velocity distribution of the line. Such extra velocity components could arise due to the stellar tidal gravity, the stellar radiation pressure (e.g., Bourrier & Lecavelier des Etangs, 2013), the stellar wind ram pressure (e.g., MacLeod & Oklopčić, 2022) and its interaction with a planetary magnetic field (e.g., Carolan et al., 2021), atmospheric turbulence and circulation, and the tidally locked rotation of the planet (e.g., Huang et al., 2023).

Ultimately, observing more spectral lines than only the metastable helium line would help to discriminate between the various hypotheses. Other spectral lines can probe different elements, complementary regions of the atmosphere where the temperature and velocity is different, and have varying natural and thermal line widths, all of which may help us understand the apparent inconsistency (Linssen & Oklopčić, 2023).

4.3 Assuming a 100 times solar metallicity composition

We repeat the previous analysis of TOI-2134 b while assuming a 100 times solar metallicity atmosphere. The helium abundance is XHe=0.083subscript𝑋𝐻𝑒0.083X_{He}=0.083italic_X start_POSTSUBSCRIPT italic_H italic_e end_POSTSUBSCRIPT = 0.083 in this case, which is roughly 10% lower than in Sect. 4.2. The results are presented in Fig. 7b. We find M˙=109.68±0.04˙𝑀superscript10plus-or-minus9.680.04\dot{M}=10^{9.68\pm 0.04}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.68 ± 0.04 end_POSTSUPERSCRIPT g s-1 and T0=9700±700subscript𝑇0plus-or-minus9700700T_{0}=9700\pm 700italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 9700 ± 700 K. We again also calculate the model self-consistent temperature, which is T04000similar-tosubscript𝑇04000T_{0}\sim 4000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∼ 4000 K.

We can use the findings of Sect. 3 to explain the changes relative to the pure hydrogen/helium fit. As visible from Fig. 7, the fit at 100 times solar metallicity prefers a much higher T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. A higher T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT leads to higher outflow velocities and it thus compensates for the otherwise lower velocities at high metallicity (see Sect. 3.2.2). The velocity must remain roughly the same because it is an important contributor to the spectral line broadening that we are fitting. The fit at 100 times solar metallicity also prefers a higher M˙˙𝑀\dot{M}over˙ start_ARG italic_M end_ARG. This is due to the well-known T0M˙subscript𝑇0˙𝑀T_{0}-\dot{M}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT - over˙ start_ARG italic_M end_ARG-degeneracy mechanism: at higher T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, the overall density and hence metastable helium density decreases, and a higher mass-loss rate is needed to compensate. Focusing on the self-consistent temperature, we see it has increased from T02600similar-tosubscript𝑇02600T_{0}\sim 2600italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∼ 2600 K for pure hydrogen/helium, to T04000similar-tosubscript𝑇04000T_{0}\sim 4000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∼ 4000 K at 100 times solar metallicity. This is because the temperature profile becomes flatter at higher metallicity and approaches the thermostat temperature (see Sect. 3.2.3) of similar-to\sim4000 K. We thus find a self-consistent T0subscript𝑇0T_{0}italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT of that value. We plot the helium spectrum of a model with M˙=109.1˙𝑀superscript109.1\dot{M}=10^{9.1}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.1 end_POSTSUPERSCRIPT g s-1 in Fig. 7c (this mass-loss rate is manually chosen to match the peak absorption of the data).

The results of this and the previous section show that the inferred mass-loss rate differs by up to half a dex depending on the assumed outflow metallicity. The helium abundance itself is hardly different, but changes in the outflow structure caused by the high metallicity still affect the metastable helium line. As shown by Lampón et al. (2021b), changing the assumed helium abundance can furthermore change the inferred mass-loss rate by orders of magnitude. Concluding, the retrieved mass-loss rate is degenerate with the helium abundance, and to a lesser extent, the metallicity. Given that we usually do not know the upper atmospheric composition of a given exoplanet, we again pose that we can achieve better mass-loss-rate constraints by combining observations of multiple spectral lines that trace atmospheric escape.

5 Summary

We present sunbather, an open-source11{}^{\ref{fn:github}}start_FLOATSUPERSCRIPT end_FLOATSUPERSCRIPT code that can be used to model escaping exoplanet atmospheres and their transit spectra. The code calculates the atmospheric density and velocity profiles assuming an isothermal Parker wind using the p-winds code. A refined nonisothermal temperature profile is then calculated using the photoionization code Cloudy. A radiative transfer module finally allows the calculation of the transit spectrum over an arbitrary wavelength range.

The assets of sunbather are:

  • It has a highly detailed NLTE treatment of the ionization and excitation state and temperature of the atmosphere through the use of Cloudy. The calculation of a nonisothermal temperature profile should produce transit spectra that are more accurate than those provided by an isothermal Parker wind model.

  • It allows an arbitrary composition that includes the 30 lightest elements. Metals are completely accounted for in both the hydrodynamics and thermodynamics. The transit spectrum includes metal lines, and enables joint modeling of multiple spectral lines.

  • It is highly suited to the interpretation of spectral line observations through a parametrized description of the atmosphere. The mass-loss rate is a free parameter of the model, allowing one to retrieve it from observations.

  • It has a reasonably fast runtime of a few minutes to an hour, depending on the composition and density of the atmosphere. This runtime supports parameter space exploration for individual planets and/or studies at the population level (but may require a computer cluster to do so).

The limitations of sunbather are:

  • It is a 1D code, while atmospheric escape is an inherently 3D process. For example, day-to-night variations, magnetic fields, and interaction with a stellar wind can significantly alter the outflow and observational signatures (e.g., Nail et al., 2024; Schreyer et al., 2024).

  • It keeps the composition of the atmosphere constant with radius. Every element escapes at the same rate, and it thus implicitly assumes efficient drag of heavier elements. This assumption may be invalid, particularly at low mass-loss rates.

  • It does not treat the hydrodynamics and thermodynamics self-consistently, but instead parametrizes the outflow with a chosen mass-loss rate. As pointed out when describing the assets of the code above, it is this feature that makes sunbather well suited to retrievals. The downside is that it is less suited to forward modeling and theoretical studies designed to predict the mass-loss rate.

One may prefer to use sunbather over p-winds when fitting spectrally unresolved data and/or metal lines that are not included in p-winds. Conversely, one may prefer to use p-winds when fitting lines included in it over a large parameter space, due to its significantly faster runtime.

We use sunbather to explore the effect of atmospheric metallicity on the escape process. We simulate a generic hot-Neptune planet orbiting the Sun, with different atmospheric compositions ranging from hydrogen/helium-only to 50 times solar metallicity. If we keep the mass-loss rate fixed, a higher metallicity leads to a denser but slower wind, while the temperature profile starts to become isothermal. However, if we instead keep the density at the planet radius fixed, we can gain insight into the effect of metallicity on the mass-loss rate. We then find that a higher metallicity leads to a more tenuous and slower wind, with little effect on the temperature profile. The mass-loss rate decreases by an order of magnitude as we move from solar-like to 50 times solar metallicity. We furthermore find that metals significantly contribute to the radiative cooling rate already at solar abundances. They become important in the radiative heating rate at approximately ten times solar metallicity and above. Regarding the planet’s transit spectrum, all metal lines become stronger up to ten times solar metallicity. At even higher metallicity, lines of atoms and singly charged ions generally become weaker owing to the lower mass-loss rate, while lines of doubly and higher charged ions generally continue to grow stronger. We do not investigate whether all of the described effects of high metallicity also pertain to other types of star–planet systems.

After validating sunbather’s ability to retrieve a known model from a mock spectrum, we used the code to interpret the metastable helium spectrum of mini-Neptune TOI-2134 b as observed by Zhang et al. (2023a). If we assume a pure hydrogen/helium composition in the ratio of 10:1 by number, we find a mass-loss rate of M˙=109.280.04+0.06˙𝑀superscript10subscriptsuperscript9.280.060.04\dot{M}=10^{9.28^{+0.06}_{-0.04}}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.28 start_POSTSUPERSCRIPT + 0.06 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT - 0.04 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT g s-1 and a temperature of T0=5000±400subscript𝑇0plus-or-minus5000400T_{0}=5000\pm 400italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 5000 ± 400 K. However, a model self-consistency check indicates a much cooler temperature of T02600similar-tosubscript𝑇02600T_{0}\sim 2600italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∼ 2600 K, which is hard to reconcile with the data, unless other types of line broadening not accounted for here (e.g., atmospheric turbulence and circulation) play a significant role. If we instead assume a 100 times solar metallicity composition, we find a mass-loss rate of M˙=109.68±0.04˙𝑀superscript10plus-or-minus9.680.04\dot{M}=10^{9.68\pm 0.04}over˙ start_ARG italic_M end_ARG = 10 start_POSTSUPERSCRIPT 9.68 ± 0.04 end_POSTSUPERSCRIPT g s-1 and a temperature of T0=9700±700subscript𝑇0plus-or-minus9700700T_{0}=9700\pm 700italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = 9700 ± 700 K. This temperature is significantly different from the self-consistent temperature of T04000similar-tosubscript𝑇04000T_{0}\sim 4000italic_T start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∼ 4000 K, which again potentially indicates additional physics. In order to constrain the composition, instead of assuming it, additional observations of other spectral lines would be valuable. Such observations would also help to elucidate the interesting temperature differences that we find.

Acknowledgements.
We thank the anonymous referee for their comments which helped improve this paper. We are grateful to G. Ferland, M. Chatzikos and the rest of the Cloudy team, as well as L. dos Santos and the rest of the p-winds team, for making their codes freely available. We appreciate the helpful discussions with F. Nail and N. Bollemeijer regarding the contents of this manuscript. We thank H. Linssen for designing the sunbather logo. This work has made use of the Snellius Supercomputer operated by SURF. A. Oklopčić gratefully acknowledges support from the Dutch Research Council NWO Veni grant.

References

  • Allan et al. (2024) Allan, A. P., Vidotto, A. A., Villarreal D’Angelo, C., Dos Santos, L. A., & Driessen, F. A. 2024, MNRAS, 527, 4657
  • Allart et al. (2018) Allart, R., Bourrier, V., Lovis, C., et al. 2018, Sci, 362, 1384
  • Allart et al. (2023) Allart, R., Lemée-Joliecoeur, P.-B., Jaziri, A. Y., et al. 2023, A&A, 677, A164
  • Bean et al. (2023) Bean, J. L., Xue, Q., August, P. C., et al. 2023, Nat, 618, 43
  • Beaugé & Nesvorný (2013) Beaugé, C. & Nesvorný, D. 2013, ApJ, 763, 12
  • Ben-Jaffel et al. (2022) Ben-Jaffel, L., Ballester, G. E., Muñoz, A. G., et al. 2022, Nat Astron, 6, 141
  • Bennett et al. (2023) Bennett, K. A., Redfield, S., Oklopčić, A., et al. 2023, AJ, 165, 264
  • Biassoni et al. (2024) Biassoni, F., Caldiroli, A., Gallo, E., et al. 2024, A&A, 682, A115
  • Bourrier & Lecavelier des Etangs (2013) Bourrier, V. & Lecavelier des Etangs, A. 2013, A&A, 557, A124
  • Burn et al. (2024) Burn, R., Mordasini, C., Mishra, L., et al. 2024, Nat Astron, 8, 463
  • Caldiroli et al. (2021) Caldiroli, A., Haardt, F., Gallo, E., et al. 2021, A&A, 655, A30
  • Carolan et al. (2021) Carolan, S., Vidotto, A. A., Hazra, G., Villarreal D’Angelo, C., & Kubyshkina, D. 2021, MNRAS, 508, 6001
  • Chance et al. (2022) Chance, Q., Ballard, S., & Stassun, K. 2022, ApJ, 937, 39
  • Chatzikos et al. (2023) Chatzikos, M., Bianchi, S., Camilloni, F., et al. 2023, Rev. Mex. Astron. Astrofis., 59, 327
  • Cohen et al. (2024) Cohen, O., Glocer, A., Garraffo, C., et al. 2024, ApJ, 962, 157
  • Cubillos et al. (2023) Cubillos, P. E., Fossati, L., Koskinen, T., et al. 2023, A&A, 671, A170
  • Cubillos et al. (2020) Cubillos, P. E., Fossati, L., Koskinen, T., et al. 2020, AJ, 159, 111
  • Cussler (2009) Cussler, E. 2009, Diffusion: Mass Transfer in Fluid Systems, 3rd edn. (Cambridge University Press)
  • Czesla et al. (2022) Czesla, S., Lampón, M., Sanz-Forcada, J., et al. 2022, A&A, 657, A6
  • dos Santos (2023) dos Santos, L. A. 2023, Proc. IAU, 17, 56
  • dos Santos et al. (2023a) dos Santos, L. A., Alam, M. K., Espinoza, N., & Vissapragada, S. 2023a, AJ, 165, 244
  • dos Santos et al. (2023b) dos Santos, L. A., García Muñoz, A., Sing, D. K., et al. 2023b, AJ, 166, 89
  • dos Santos et al. (2022) dos Santos, L. A., Vidotto, A. A., Vissapragada, S., et al. 2022, A&A, 659, A62
  • Drummond et al. (2018) Drummond, B., Mayne, N. J., Baraffe, I., et al. 2018, A&A, 612, A105
  • Ferland et al. (1998) Ferland, G., Korista, K., Verner, D., et al. 1998, PASP, 110, 761
  • Ferland et al. (2017) Ferland, G. J., Chatzikos, M., Guzman, F., et al. 2017, Rev. Mex. Astron. Astrofis., 53, 385
  • Fossati et al. (2023) Fossati, L., Biassoni, F., Cappello, G. M., et al. 2023, A&A, 676, A99
  • Fossati et al. (2022) Fossati, L., Guilluy, G., Shaikhislamov, I. F., et al. 2022, A&A, 658, A136
  • Fossati et al. (2010) Fossati, L., Haswell, C. A., Froning, C. S., et al. 2010, ApJ, 714, L222
  • Fossati et al. (2020) Fossati, L., Shulyak, D., Sreejith, A. G., et al. 2020, A&A, 643, A131
  • Fossati et al. (2021) Fossati, L., Young, M. E., Shulyak, D., et al. 2021, A&A, 653, A52
  • Fulton et al. (2017) Fulton, B. J., Petigura, E. A., Howard, A. W., et al. 2017, AJ, 154, 109
  • Gaidos et al. (2023) Gaidos, E., Hirano, T., Lee, R. A., et al. 2023, MNRAS, 518, 3777
  • García Muñoz et al. (2021) García Muñoz, A., Fossati, L., Youngblood, A., et al. 2021, ApJ, 907, L36
  • Ginzburg et al. (2018) Ginzburg, S., Schlichting, H. E., & Sari, R. 2018, MNRAS, 476, 759
  • Gronoff et al. (2020) Gronoff, G., Arras, P., Baraka, S., et al. 2020, JGR (Space Phys.), 125, e2019JA027639
  • Guillot et al. (2022) Guillot, T., Fletcher, L. N., Helled, R., et al. 2022, arXiv:2205.04100
  • Gully-Santiago et al. (2024) Gully-Santiago, M., Morley, C. V., Luna, J., et al. 2024, AJ, 167, 142
  • Hirschfelder et al. (1967) Hirschfelder, J. O., Curtiss, C. F., & Bird, R. B. 1967, Molecular Theory of Gases and Liquids, 4th edn. (John Wiley & Sons)
  • Huang et al. (2023) Huang, C., Koskinen, T., Lavvas, P., & Fossati, L. 2023, ApJ, 951, 123
  • Hunten et al. (1987) Hunten, D. M., Pepin, R. O., & Walker, J. C. 1987, Icarus, 69, 532
  • Kasper et al. (2020) Kasper, D., Bean, J. L., Oklopčić, A., et al. 2020, AJ, 160, 258
  • Khodachenko et al. (2021) Khodachenko, M. L., Shaikhislamov, I. F., Fossati, L., et al. 2021, MNRAS, 503, L23
  • Kirk et al. (2022) Kirk, J., Dos Santos, L. A., López-Morales, M., et al. 2022, AJ, 164, 24
  • Krishnamurthy & Cowan (2024) Krishnamurthy, V. & Cowan, N. B. 2024, arXiv:2403.15575
  • Krishnamurthy et al. (2023) Krishnamurthy, V., Hirano, T., Gaidos, E., et al. 2023, MNRAS, 521, 1210
  • Krishnamurthy et al. (2021) Krishnamurthy, V., Hirano, T., Stefánsson, G., et al. 2021, AJ, 162, 82
  • Kubyshkina et al. (2024) Kubyshkina, D., Fossati, L., & Erkaev, N. V. 2024, A&A, 684, A26
  • Lamers & Cassinelli (1999) Lamers, H. J. G. L. M. & Cassinelli, J. P. 1999, Introduction to Stellar Winds (Cambridge University Press)
  • Lampón et al. (2021a) Lampón, M., López-Puertas, M., Czesla, S., et al. 2021a, A&A, 648, L7
  • Lampón et al. (2020) Lampón, M., López-Puertas, M., Lara, L. M., et al. 2020, A&A, 636, A13
  • Lampón et al. (2023) Lampón, M., López-Puertas, M., Sanz-Forcada, J., et al. 2023, A&A, 673, A140
  • Lampón et al. (2021b) Lampón, M., López-Puertas, M., Sanz-Forcada, J., et al. 2021b, A&A, 647, A129
  • Lee et al. (2022) Lee, E. J., Karalis, A., & Thorngren, D. P. 2022, ApJ, 941, 186
  • Linssen & Oklopčić (2023) Linssen, D. C. & Oklopčić, A. 2023, A&A, 675, A193
  • Linssen et al. (2022) Linssen, D. C., Oklopčić, A., & MacLeod, M. 2022, A&A, 667, A54
  • Lundkvist et al. (2016) Lundkvist, M. S., Kjeldsen, H., Albrecht, S., et al. 2016, Nat Commun, 7, 11201
  • MacLeod & Oklopčić (2022) MacLeod, M. & Oklopčić, A. 2022, ApJ, 926, 226
  • Mansfield et al. (2018) Mansfield, M., Bean, J. L., Oklopčić, A., et al. 2018, ApJ, 868, L34
  • Mollière et al. (2015) Mollière, P., Boekel, R. V., Dullemond, C., Henning, T., & Mordasini, C. 2015, ApJ, 813, 47
  • Murray-Clay et al. (2009) Murray-Clay, R. A., Chiang, E. I., & Murray, N. 2009, ApJ, 693, 23
  • Nail et al. (2024) Nail, F., Oklopčić, A., & MacLeod, M. 2024, A&A, 684, A20
  • Nortmann et al. (2018) Nortmann, L., Pallé, E., Salz, M., et al. 2018, Sci, 362, 1388
  • Oklopčić & Hirata (2018) Oklopčić, A. & Hirata, C. M. 2018, ApJ, 855, L11
  • Orell-Miquel et al. (2023) Orell-Miquel, J., Lampón, M., López-Puertas, M., et al. 2023, A&A, 677, A56
  • Owen (2019) Owen, J. E. 2019, Annu. Rev. Earth Planet. Sci., 47, 67
  • Owen & Lai (2018) Owen, J. E. & Lai, D. 2018, MNRAS, 479, 5012
  • Owen & Schlichting (2024) Owen, J. E. & Schlichting, H. E. 2024, MNRAS, 528, 1615
  • Owen & Wu (2013) Owen, J. E. & Wu, Y. 2013, ApJ, 775, 105
  • Owen & Wu (2017) Owen, J. E. & Wu, Y. 2017, ApJ, 847, 29
  • Palle et al. (2020) Palle, E., Nortmann, L., Casasayas-Barris, N., et al. 2020, A&A, 638, A61
  • Paragas et al. (2021) Paragas, K., Vissapragada, S., Knutson, H. A., et al. 2021, ApJ, 909, L10
  • Parker (1958) Parker, E. N. 1958, ApJ, 128, 664
  • Pérez-González et al. (2024) Pérez-González, J., Greklek-McKeon, M., Vissapragada, S., et al. 2024, AJ, 167, 214
  • Rottman (2005) Rottman, G. 2005, Solar Physics, 230, 7
  • Rybicki & Lightman (1991) Rybicki, G. B. & Lightman, A. P. 1991, Radiative Processes in Astrophysics (Weinheim: John Wiley & Sons)
  • Salz et al. (2015) Salz, M., Banerjee, R., Mignone, A., et al. 2015, A&A, 576, A21
  • Salz et al. (2016) Salz, M., Czesla, S., Schneider, P. C., & Schmitt, J. H. M. M. 2016, A&A, 586, A75
  • Schreyer et al. (2024) Schreyer, E., Owen, J. E., Spake, J. J., Bahroloom, Z., & Di Giampasquale, S. 2024, MNRAS, 527, 5117
  • Schulik & Booth (2023) Schulik, M. & Booth, R. A. 2023, MNRAS, 523, 286
  • Shaikhislamov et al. (2020) Shaikhislamov, I. F., Khodachenko, M. L., Lammer, H., et al. 2020, MNRAS, 491, 3435
  • Sing et al. (2019) Sing, D. K., Lavvas, P., Ballester, G. E., et al. 2019, AJ, 158, 91
  • Spake et al. (2022) Spake, J. J., Oklopčić, A., Hillenbrand, L. A., et al. 2022, ApJL, 939, L11
  • Spake et al. (2018) Spake, J. J., Sing, D. K., Evans, T. M., et al. 2018, Nat, 557, 68
  • Sreejith et al. (2023) Sreejith, A. G., France, K., Fossati, L., et al. 2023, ApJL, 954, L23
  • Szabó & Kiss (2011) Szabó, G. M. & Kiss, L. L. 2011, ApJ, 727, L44
  • Thorngren et al. (2016) Thorngren, D. P., Fortney, J. J., Murray-Clay, R. A., & Lopez, E. D. 2016, ApJ, 831, 64
  • Turner et al. (2020) Turner, J. D., de Mooij, E. J. W., Jayawardhana, R., et al. 2020, ApJ, 888, L13
  • Vidal-Madjar et al. (2003) Vidal-Madjar, A., des Etangs, A. L., Désert, J.-M., et al. 2003, Nat, 422, 143
  • Vidal-Madjar et al. (2004) Vidal-Madjar, A., Désert, J.-M., Etangs, A. L. d., et al. 2004, ApJ, 604, L69
  • Vissapragada et al. (2022a) Vissapragada, S., Knutson, H. A., dos Santos, L. A., Wang, L., & Dai, F. 2022a, ApJ, 927, 96
  • Vissapragada et al. (2022b) Vissapragada, S., Knutson, H. A., Greklek-McKeon, M., et al. 2022b, AJ, 164, 234
  • Vissapragada et al. (2020) Vissapragada, S., Knutson, H. A., Jovanovic, N., et al. 2020, AJ, 159, 278
  • Vissapragada et al. (2021) Vissapragada, S., Stefánsson, G., Greklek-McKeon, M., et al. 2021, AJ, 162, 222
  • Wang & Dai (2021) Wang, L. & Dai, F. 2021, ApJ, 914, 98
  • Welbanks et al. (2019) Welbanks, L., Madhusudhan, N., Allard, N. F., et al. 2019, ApJL, 887, L20
  • Woods et al. (2005) Woods, T. N., Eparvier, F. G., Bailey, S. M., et al. 2005, JGR (Space Phys.), 110
  • Xing et al. (2023) Xing, L., Yan, D., & Guo, J. 2023, ApJ, 953, 166
  • Young et al. (2020) Young, M. E., Fossati, L., Koskinen, T. T., et al. 2020, A&A, 641, A47
  • Young et al. (2024) Young, M. E., Spring, E. F., & Birkby, J. L. 2024, MNRAS, 530, 4356
  • Zhang et al. (2023a) Zhang, M., Dai, F., Bean, J. L., Knutson, H. A., & Rescigno, F. 2023a, ApJL, 953, L25
  • Zhang et al. (2023b) Zhang, M., Knutson, H. A., Dai, F., et al. 2023b, AJ, 165, 62
  • Zhang et al. (2022) Zhang, M., Knutson, H. A., Wang, L., Dai, F., & Barragán, O. 2022, AJ, 163, 67
  • Zhang et al. (2021) Zhang, M., Knutson, H. A., Wang, L., et al. 2021, AJ, 161, 181
  • Zhong et al. (2024) Zhong, W., Yu, C., Jia, S., & Liu, S.-F. 2024, ApJ, 967, 38