Issue 
A&A
Volume 627, July 2019



Article Number  A157  
Number of page(s)  8  
Section  Numerical methods and codes  
DOI  https://doi.org/10.1051/00046361/201935723  
Published online  16 July 2019 
Opacity distribution functions for stellar spectra synthesis
^{1}
MaxPlanckInstitut für Sonnensystemforschung, JustusvonLiebigWeg 3, 37077 Göttingen, Germany
email: cernetic@mps.mpg.de
^{2}
School of Space Research, Kyung Hee University, Yongin, Gyeonggi 446701, Republic of Korea
^{3}
Astrophysics Group, Imperial College London, London SW7 2AZ, UK
Received:
16
April
2019
Accepted:
6
June
2019
Context. Stellar spectra synthesis is essential for the characterization of potential planetary hosts. In addition, comprehensive stellar variability calculations with fast radiative transfer are needed to disentangle planetary transits from stellar magnetically driven variability. The planethunting space telescopes, such as CoRoT, Kepler, and TESS, bring vast quantities of data, rekindling the interest in fast calculations of the radiative transfer.
Aims. We revisit the opacity distribution functions (ODF) approach routinely applied to speed up stellar spectral synthesis. To achieve a considerable speedup relative to the state of the art, we further optimize the approach and search for the best ODF configuration. Furthermore, we generalize the ODF approach for fast calculations of flux in various filters often used in stellar observations.
Methods. In a parametersweep fashion, we generated ODF in the spectral range from UV to IR with different setups. The most accurate ODF configuration for each spectral interval was determined. We adapted the wavelength grid based on the transmission curve for calculations of the radiative fluxes through filters before performing the normal ODF procedure.
Results. Our optimum ODF configuration allows for a threefold speedup, compared to the previously used ODF configurations. The ODF generalization to calculate fluxes through filters results in a speedup of more than two orders of magnitude.
Key words: radiative transfer / opacity / methods: numerical / Sun: atmosphere / stars: atmospheres / line: formation
© M. Cernetic et al. 2019
Open Access article, published by EDP Sciences, under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Open Access funding provided by Max Planck Society.
1. Introduction
Radiative transfer calculations over broad spectral intervals are important for modeling stellar and planetary atmospheres. One of the main challenges in these calculations is the treatment of a large number of atomic and molecular lines typically found in a stellar or planetary spectrum. Atomic and molecular lines contribute immensely to the total opacity in the solar atmosphere, and even more in stars cooler than the Sun. The linelists that are currently employed to model and interpret the solar spectrum contain more than hundreds of millions of spectral lines (Kurucz 2005). To properly account for all of these lines, it is necessary to perform calculations on a fine wavelength grid (typically with a resolution of just a few mÅ, which results in millions of grid points). This is computationally demanding.
Fortunately, many applications only need information about the amount of energy emitted in comparatively broad spectral intervals (e.g., a few Å in width). Such applications include interpretation of solar observations with filter imagers (see Tsuneta et al. 2008; Solanki et al. 2017, and references therein), modeling solar and stellar brightness variations (Ermolli et al. 2013; Solanki et al. 2013; Yeo et al. 2016), and analysis and interpretation of lowresolution spectra in most cases. The analysis of lowresolution spectra will be even more important with the third Gaia data release in early 2021, providing hundreds of millions of lowresolution spectra (Gaia Collaboration 2016).
A straightforward approach for obtaining a lowresolution spectrum is to first calculate the spectrum at highresolution directly accounting for all important lines, and then to convolve it with a given spectral response function (see, e.g., Fig. 1 in Riethmüller et al. 2014). An obvious disadvantage of this approach is that calculations still have to be performed on a fine wavelength grid. An alternative to the straightforward approach is the employment of opacity distribution functions (ODF, see e.g., Hubeny & Mihalas 2015). ODF accounts for the effects from an arbitrary number of spectral lines while calculations are done on a coarser wavelength grid. This is done by approximating the complex structure of opacity, although with some loss of accuracy. In order to obtain the ODF, the entire spectral domain is split into bins. All wavelength information within a bin is lost and only the binaveraged intensity values are calculated. For that to occur, the line opacity in each of the bins is approximated by several representative values, typically a dozen or less. The total opacity in the bin is then the sum of the line opacity described by the ODF and the continuum opacity, for which the change within the bin is neglected.
In regions where local thermodynamic equilibrium (LTE) is valid, the opacity only depends on the wavelength, the local conditions (namely the temperature and the pressure), and on the velocity distribution in the atmosphere to some extent. In 1D calculations, the velocity distribution is quantified by the microturbulence velocity. This allows the ODF to be pretabulated on a grid of temperatures and pressures. Interpolation is used to get the ODF values for a specific temperature and pressure. The interpolated ODF are then used for radiative transfer, and opacity calculations are not required. In the nonLTE case, opacity depends on the nonlocal radiation field making it unsuitable for such a pretabulation. Several nonLTE investigations (see, e.g., Sect. 6 in Werner & Dreizler 1999) made use of pretabulated photon crosssections instead of opacities.
The ODF approach had been actively developed until the late 1980s (Labs 1951; Kurucz 1979; Anderson 1989), and a number of algorithms for the optimal approximation of the opacity distributions within the bins were proposed. Kurucz (1979) approximated ODF by ten values, paying special attention to the accurate sampling of the high opacity tail of the distribution. Later, Castelli & Kurucz (2004) used a modification of this approach employing 12 values for approximating opacity within the bin to synthesize spectra over a broad range of stellar fundamental parameters. Due to the increased speed of computers in recent years, ODF have not been further developed since single 1D model calculations do not require any further acceleration.
Recently, 3D magnetohydrodynamic (MHD) simulations of solar and stellar atmospheres have reached a new degree of realism (Stein 2012; Nordlund et al. 2009; Beeck et al. 2015a,b), which led to the development of the 1.5D radiative transfer approach. In the 1.5D approach, the emerging spectra are calculated along many rays passing through a 3D MHD cube. The resulting intensity in a given direction is then calculated by averaging the intensities along multiple parallel rays, which sample the whole simulation cube (Holzreuter & Solanki 2012, 2013; Riethmüller et al. 2014; Norris et al. 2017). For example, for a 512 × 512 MHD cube at eight viewing angles, radiative transfer calculations on more than two million (512*512*8) 1D atmospheres have to be performed. It is therefore crucial for the 1D calculations to be as fast as possible, providing the motivation for further improvement to ODF. We note that while the 1.5D approach does not account for the effects of “crosstalk” between different rays, it has been shown to yield accurate results with the exception of cores of very strong lines (Holzreuter & Solanki 2013; Pereira & Uitenbroek 2015).
Thus, in this paper we build on previous work regarding the ODF and search for an optimal setup for the desired tradeoff between speed and accuracy in the case of the quiet sun model atmosphere. The qualitative conclusions are also valid for other stars. In addition, the ODF approach is extended to intensity calculations through broadband filters.
This paper is structured as follows. In Sect. 2 we give a detailed description of ODF and the setup used to perform this investigation. In Sect. 3 we analyze the performance of ODF using an example atmosphere model for different subbin sizes and different subbin combinations. Moreover, we investigate how the optimal choice of subbins changes for different spectral intervals. Finally, a discussion and our conclusion are presented in Sect. 4.
2. Problem description and method
The opacity in stellar atmospheres has a particularly complicated wavelength dependence in spectral lines; changes within a narrow wavelength interval reach up to several orders of magnitude, as illustrated in Fig. 1a. As a result, opacity calculations require a fine wavelength grid. While some applications need calculations of highresolution spectra, lowresolution spectra are sufficient for many applications. Such lowresolution spectra can be obtained by using accelerated methods.
Fig. 1.
Opacity variation within 10 Å (panel a) in addition to sorted opacity and the corresponding mean values over individual subbins (blue and orange lines in panel b, respectively). 
There are two conceptionally different methods to approximate lowresolution opacities, opacity sampling (OS) and ODF (Hubeny & Mihalas 2015). With OS, the high resolution opacity is simply resampled at a lower resolution. It is crucial that the sample preserve the original statistics of the high resolution opacity. ODF, introduced in Sect. 1, achieve a similar level of approximation, but with fewer representative opacity values. This work solely focuses on the ODF.
To calculate ODF, the highresolution wavelength grid is divided into bins. In each bin the opacities are sorted in ascending order, as illustrated in Fig. 1b. Each bin is further divided into subbins and the mean value of the opacities is obtained for each of the subbins. For example, Fig. 1b shows one 10 Å wide bin, subdivided into ten subbins. Figure 1a shows the original distribution of opacities on a highresolution grid, while Fig. 1b illustrates the ODF.
All calculations and the technical implementation presented in this paper are performed with the Nonlocal thermodynamic Equilibrium Spectral SYnthesis code (NESSY, Tagirov et al. 2017), which is a further development of the COde for Solar Irradiance (COSI, Shapiro et al. 2010). NESSY utilizes an atmosphere model, abundances, and linelists for elements from hydrogen to zinc as input and calculates emergent spectra in the range from UV to radio. All spectra in this work are diskintegrated and as such correspond to radiative flux.
We added support for ODF in the spectral synthesis part of NESSY. In the original version, the SahaBolzmann equation is first used to compute the electron level populations and then opacities from them. Then the radiative transfer (RT) is solved on a fine wavelength grid. In the new version, we first synthesize ODF from the highresolution opacity and then solve the radiative transfer equation for each of the ODF subbins. Fluxes from individual subbins are summed together to get the flux of the whole bin
where ℱ_{i} and Δλ_{i} are the flux from and the width of the subbin, respectively, while Δλ is the width of the bin. Whereas the fine wavelength grid shown in Fig. 1a has 2000 points per nm, the stepwise grid in Fig. 1b has only 10 points per nm. This results in RT calculations that are 200 times faster. We note that this is only the speedup for the spectral synthesis calculations. The RT calculations account for most of the computational time, since generating the ODF only has to be performed once for the given ODF configuration, linelist, and abundances. We therefore do not consider any speedup in the ODF generation itself. In the next section we investigate how the accuracy and speed of the ODF approximation depends on the size of the subbins and their distribution within the bins.
3. Optimal ODF for spectral synthesis
An optimal ODF setup for spectral synthesis is a compromise between the speed of the computations and the accuracy of the result, which also depends on the specific task. In this section, we analyze how the resulting accuracy depends on the size and the distribution of the subbins. As an example of this, we used the FALC atmospheric structure of the quiet Sun from Fontenla et al. (2006). The molecular and atomic linelists used in NESSY were taken from Shapiro et al. (2010). To analyze the performance of ODF, we used the flux computed with various ODF setups (i.e., on a coarse wavelength grid, hereafter ODF spectra). Then we took the flux computed on a fine wavelength grid and averaged it within each ODF bin (hereafter detailed spectra). Such a detailed spectrum represents the case where the line opacity is taken into account without any approximation. We then compared the ODF and detailed spectra to study the performance of various ODF configurations.
3.1. Mean opacity
To illustrate the power of the ODF approach, we started by comparing its performance to a straightforward method of employing mean opacities (i.e., ODF using only one subbin). We performed these calculations for two bin sizes, 10 Å and 100 Å. Figure 2 illustrates that calculations using mean opacities cannot adequately reproduce the spectrum for bin sizes greater than the highresolution grid (with a resolution of 200 points per Å). In particular, they lead to the underestimation of the intensity by up to an order of magnitude in the UV part of the spectrum. This can be explained by the wide range of opacity values within the bins (see Fig. 1a) and the mean value which is skewed by the extreme values in the sample. A large number of photons escape the atmosphere at wavelengths where the opacity is low. When opacity is replaced there with the higher mean opacity, it becomes more difficult for photons to escape. The emergent flux thereby decreases (in other words, averaging closes “opacity windows”).
Fig. 2.
Ratio of spectra calculated using mean opacity to detailed spectra. Bin size of 10 Å (orange) and bin size of 100 Å (blue). 
Figure 2 clearly indicates that a better solution than the mean opacity is needed. This can be achieved by sorting the opacity within each bin, splitting the bin into several subbins, and then individually averaging the values within each of the subbins. This procedure prevents very high opacity values from skewing the averages of other subbins, as it groups opacity together with similar values.
3.2. Uniform subbins
In this section, we investigate the effect the number of subbins has on the accuracy of the spectrum calculations. We first consider the case of subbins of uniform width.
Calculations with different numbers of subbins are presented in Fig. 3. As expected, an increase in the number of subbins improves the accuracy of spectral synthesis, but this comes at the cost of increased computational time. Comparing the brown and violet lines in Fig. 3, we can see that the introduction of only one additional subbin (i.e., splitting the bin into two subbins) significantly improves the accuracy of the calculations. Additionally, the continuum only spectra (black line) illustrate the total effect of spectral lines on the emergent spectrum. The simultaneous comparison between the continuum, ODF, and detailed spectra calculations shows how well the ODF approach accounts for the effect of spectral lines. It is worth noting that the continuum spectrum provides a better approximation for the emergent spectrum than calculations with one to five uniform subbins longward of about 6000 Å. Furthermore, including lines with a suboptimal ODF configuration might be worse than not treating lines at all. It is interesting to note that the black curve has been inverted around unity (continuumonly computations overestimate the emergent flux, while uniform ODF typically underestimate it). The uniform ODF in general allow adequate treatment of the large number of spectral lines in the UV, where lines completely dominate the continuum, forming the UV line haze. At the same time, the accuracy of the calculations remains low longward of about 5000 Å compared to the continuum only. Interestingly, more than five uniform subbins are needed to reach better accuracy as opposed to neglecting lines completely (i.e., taking only continuum opacity into account). The reason for such behavior is the small number of spectral lines longward of 5000 Å. In most bins, only a small fraction of wavelengths have opacity with values much higher than that of the continuum. Only those opacities can noticeably affect the intensity. If the width of the last subbin (i.e., the subbin containing the greatest opacity values) is larger than this fraction of high opacities, the calculation becomes erroneous. The very high values skew the mean opacity of that subbin toward larger values, which results in inaccuracy in the intensity calculations. Another way to understand this is to consider a hypothetical case where one line in the bin is significantly stronger than all other lines. If the width of the last subbin is larger than the width of this line, the mean opacity in this subbin will be skewed toward larger values, thus introducing an error, which then increases with the size of the last subbin. We note that the same effect, albeit amplified by the fact that it appears over the whole bin and not only in the last subbin, causes inaccuracy in the calculations using only mean opacity values (see Sect. 3.1). The solution is to consider nonuniform subbins and pay special attention to the relative size of the last subbin.
Fig. 3.
Ratio of ODF based spectra to the detailed one for different uniform subbin sizes, as given by the legend in the plot. The black curve is calculated with continuum opacity only. It is plotted on an inverted scale to enable a better comparison. Bin size is 10 Å. Convolved with a Gaussian, σ = 30 Å. 
3.3. Nonuniform subbins
In this section, we expand upon the analysis in Sect. 3.2 by considering nonuniform subbins. We note that nonuniform subbins have already been employed by Kurucz et al. (1974) and more recently by Castelli & Kurucz (2004), who used an improved version of ODF with 12 subbins. They used the following relative widths of the subbins in Eq. (1): 1/10 for the first nine subbins (i.e., subbins with the lowest opacity values) and 1/20, 1/30, and 1/60 for the 10th, 11th, and 12th subbin respectively, which have the highest opacity values. For our subbin combinations, we also used an ascending order of opacity.
Figure 4 shows the ratio of the spectra computed for three different subbin distributions to the detailed spectrum. The last subbin is kept at 12.5% of the total bin size. One of the subbin distributions (red line in Fig. 4) attributes all the remaining 87.5% of opacities to a single subbin, while the other two (orange and green) split them between two additional subbins in two different ways. We can see that all three subbin distributions return roughly the same accuracy longward of 4500 Å, even the distribution with two subbins. This is in line with the discussion in Sect. 3.2. The last subbin is able to account for all strong lines whose opacity should not be mixed with the opacities of the other lines. At the same time, the opacity of the remaining weak lines affects the intensity linearly to the first order so that it can be averaged without losing accuracy. All in all, just two subbins (albeit of different sizes) are sufficient to achieve an accuracy of 95% longward 4500 Å. This finding is very important for modeling stellar brightness variations since they are often observed in the visible and infrared parts of the spectrum, for instance the Kepler telescope measures brightness longward of 4000 Å.
Fig. 4.
Ratio of ODFbased spectra using nonuniform bins to the detailed one. Legend shows subbin widths in parts of the bin size for each colored curve. The averaged value of opacity in the subbins increases from left to right. The black curve is calculated with continuum opacity only, inverted to allow for a better comparison. Bin size is 10 Å. Convolved with a Gaussian, σ = 30 Å. 
In all cases, the accuracy significantly drops in the UV part of the spectrum, where the last subbin alone is insufficient to account for the larger range of opacities affecting intensity in a nonlinear way. The worst performance of the considered subbin distributions is between 2000 and 3000 Å.
In Fig. 5 we compared a nonuniform distribution with four subbins to uniform distributions with six and more subbins. The last subbin of the nonuniform distribution is the same size as the subbins of the uniform distribution with 10 subbins. Because of this the nonuniform distribution results in a high accuracy with fewer subbins longward of 4200 Å. Shortward of 4200 Å, the nonuniform subbin distribution is not as accurate. The superior performance of the nonuniform subbinning in the visible and infrared is promising, and below we study it more closely.
Fig. 5.
Ratio of ODF based spectra to the detailed one. The colored curves are for uniform subbins (see legend for the description), while the black curve shows the result of using just four nonuniform subbins. Bin size is 10 Å. Convolved with a Gaussian, σ = 30 Å. 
3.4. Best combination of four and ten subbins
In the previous two sections we showed that different wavelength domains require vastly different subbining to achieve high accuracy. We also demonstrated that uniform subbins worked relatively well in the UV, while nonuniform subbins were better for the IR. To investigate this further, we calculated the ODF spectra for all possible combinations of four subbins in the range from 1000 Å to 9000 Å with 10 Å bins. For this, we considered 28 possible locations of subbin borders within each bin. The number 28 was chosen as a good tradeoff between the number of subbins that have to be considered: 23 possible locations of subbin borders from 4% to 92% of the bin size (with a uniform step of 4% of the bin size) and five additional borders at 94%, 96%, 97%, 98%, and 99% of the bin size. Each selection of three borders from the 28 possible values corresponds to one subbinning so that there are = 3276 possible subbin combinations. We calculated fluxes for each of them and searched for the best subbin combination depending on the wavelength. Results are presented in Fig. 6. The upper panel shows the best subbin distribution for each of the 10 Å bins. When reading the upper panel, for example, a column around 3500 Å can be interpreted as follows: the first subbin starts at the beginning of the bin and extends to up to 35%, the second ends at 60%, the third ends at 80%, and the fourth ends at the end of the bin. Since the opacity found in each bin is sorted by its value, the colors also tell which opacity values fall in a subbin. The 35th percentile of opacity falls in the first subbin, opacity values from the 35th to the 60th percentile fall in the second subbin, and so forth. It confirms our previous findings that the UV part of the spectra requires approximately uniform subbins, while a small last subbin works best longward of ∼4500 Å.
Fig. 6.
Results of the optimal subbin combination search with four subbins. Top panel: optimal configuration of four 10 Å bins as a function of wavelength for the FALC atmosphere model. The colorcoding shows how subbins are distributed relative to the bin length (see text for details). Middle panel: ratio of ODF to detailed spectra using the best combination of subbins for each bin from the upper panel (blue). For comparison we also show accuracy using Kurucz subbins (orange). Bottom panel: ratio of ODF to detailed spectra using the best subbins for each bin from the upper panel applied to the FALP atmosphere model (blue) and using Kurucz subbins on the FALP atmosphere model (orange). The values of the ratio in the middle and bottom panels greater than one were mirrored over the abscissa y = 1. 
Various model atmospheres differ in structure and it is not obvious whether an optimal subbin combination found for one structure would lead to adequate results for another. To test this, we considered two atmosphere models by Fontenla et al. (2006), FALC (model of the quiet sun) and FALP (model of the faculae). An optimal subbin combination that was found for FALC was then used to calculate the ODF spectra for FALP. The lower panel of Fig. 6 shows how the FALC optimal subbin combination performs on the FALP atmosphere. With a few exceptions around strong lines, the ODF reproduce the detailed spectral computations even better, mainly due to the weaker spectral lines in the FALP model.
The middle and lower panels in Fig. 6 together show that using three times fewer subbins than in the recent setup by Kurucz, we can achieve the same accuracy longward of 4500 Å. The accuracy of the 4bin setup below 4500 Å is somewhat lower than but still comparable to that of Kurucz. Such optimized ODF are very valuable for applications where time is the main constraint. It is interesting to note that our simple test suggests that the choice of the subbins can be frozen for typical solar atmospheres. Subsequently, the optimization only needs to be done once and tested for a few extreme atmospheres that may appear in a solar MHD simulation. After that, subbins can be applied unchanged for solar applications (with the possible exception of sunspots, which we have not been tested so far).
Next we address applications where very high accuracy and some acceleration are important. This is achieved by increasing the number of subbins to ten. More importantly, having 2.5 times more subbins than we had in the first case should bring considerably better accuracy. To make the number of possible subbin combinations suitable for the computing power at hand, we split the bin more finely than before. Possible subbin borders are now set at 4%, 10%, 17%, 24%, 31%, 38%, 45%, 52%, 59%, 66%, 73%, 80%, 84%, 88%, 92%, 96%, 98%, and 99%. This results in = 48620 possible subbin combinations. To reduce the computation time we only considered a narrow wavelength range, namely from 3000 Å to 3600 Å. We chose this range because it is one of the trickiest spectral domains for ODF (see, e.g., Fig. 7).
Fig. 7.
Results of the optimal subbin combination search with ten subbins. Top panel: best subbin distribution for each bin as a function of wavelength for the FALC atmosphere model. For the description of colors confer Fig. 6. Bottom panel: ratio of ODF to detailed spectra showing the single unique subbin combination with the lowest cumulative least squares error in all bins (blue), using Kurucz subbins (orange). The curve showing best subbins for each bin from the upper panel has such a low error that it is indistinguishable from the yaxis. 
The result using ten subbins are plotted in Fig. 7. The upper panel shows the optimal subbin combination for each bin. Compared to the upper panel of Fig. 6 it is seemingly random. The reason is the large number of subbin distributions considered for each bin, and typically there is more than one possible subbin combination that allows high accuracy. This is further confirmed in the lower panel. The blue line shows the performance of the single unique subbin combination, that is one subbin combination for all bins, with the lowest cumulative least squares error in all bins. The boundaries of the subbins was kept fixed at 4%, 10%, 17%, 38%, 52%, 66%, 80%, 84%, and 88%. The single unique subbin combination with the lowest cumulative least squares error in all bins performs better than Kurucz standard subbins plotted in green. This shows that our method of optimizing ODF can be tuned to provide very high accuracy but still provide a 20% speedup.
3.5. Different bin sizes
In previous sections we investigated how to speedup calculations by decreasing the number of subbins per bin to either four or ten subbins. Another possible approach is to keep a fixed number of subbins per bin but increase the bin size, thus the number of bins for a given wavelength range, although at the cost of lower spectral resolution. ODF performance using Kurucz subbins with different bin sizes is presented in Fig. 8.
Fig. 8.
Ratio of ODF to detailed spectra with different bin sizes, as listed in the legend, using Kurucz subbins. All lines smoothed using a Gaussian. 
Above ≈5200 Å, the accuracy of the calculations barely depends on the bin size. This is important for applications that deal with instruments observing in that regime, like Kepler or TESS, as it allows us to use broad bins. Below 5000 Å, however, an increase in the size of the bins leads to poorer accuracy. This is because the large number of UV lines cannot be sufficiently treated by such ODF. Knowing the behavior of ODF in larger bins is useful for calculations of spectra in, for example, the Kepler band. Treating such broadbands will be considered in the next section.
3.6. Fluxes through filters
Broadband filter systems (e.g., UBV photometric system) have been a staple of stellar astronomy for a long time. The interest in accurate calculations of fluxes through filters is being rekindled by the advent of planetary hunting missions like Kepler, TESS, PLATO, and others. In this section, we introduce a more efficient method for computing fluxes through filters employing ODF.
The filter is characterized by the transmission curve, which describes the fraction of the transmitted spectral flux as a function of wavelength. The direct way of calculating flux in a given filter is to use the detailed opacity, calculate the detailed flux ℱ_{λ}, then multiply it with the transmission curve 𝒞_{λ}, and finally integrate over wavelengths:
where the integral runs over the filter passband spanning from λ_{L} to λ_{R}.
The highresolution opacity must be computed to find ℱ_{λ} so that such a direct approach has exactly the same disadvantages as calculating the detailed spectra. At the same time the application of the ODF is not straightforward since we cannot account for the filter wavelength dependence within the bin. In principle, this can be circumvented by making bins sufficiently small, which is not optimal because of the increase in computational time.
A way around this is to incorporate the effect of the transmission function into the wavelength grid before the ODF procedure is applied. Namely, by transforming the wavelength grid using the following substitution:
Flux ℱ is then obtained by the integration over the new wavelength grid as
where and .
The described wavelength transformation is schematically illustrated in Fig. 9. The height and width of each column represent the flux value and the corresponding wavelength range, respectively. Our method boils down to multiplying the column width with the corresponding value of the transmission curve (as in Eq. (4)), instead of multiplying the height (as in Eq. (2)). The main advantage of Eq. (4) is that, in contrast to Eq. (2), it does not explicitly contain the transmission curve, and consequently the ODF approach can be applied.
Fig. 9.
Illustration of the wavelength transformation according to Eq. (3). Upper panel: schematic representation of flux dependence on wavelengths. Middle panel: exemplary stepwise transmission curve. Lower panel: resulting detailed flux on a transformed wavelength grid. Colors indicate to which of the three values of the transmission curve the fluxes are associated to. 
In our investigation, we applied a filter ODF approach to the exemplary case of the Strömgren b filter. The filter transmission curve is plotted in Fig. 10 and has its effective central wavelength at 4666 Å with FWHM 156 Å. For numerical reasons we only considered wavelengths where the filter transmission curve is above 1%, which is the interval from 4506 Å to 4836 Å, 330 Å in width. We treat the entire 4506–4836 Å range as one bin and search for the optimal configuration of subbins. The results are presented in Fig. 11. One can see that a very high level of accuracy is achievable with only four subbins. The best performing subbin distribution splits the bin at 80%, 92%, and 97% of bin size. We note that the accuracy of the filter ODF approach should be compared to the total contribution of lines (see Fig. 10), which, according to our calculations, stands at ≈15%.
Fig. 10.
Normalized flux in Strömgren b filter. Spectra synthesized using the full linelist (blue, plotted with decreased line width) and continuum only (orange). 
Fig. 11.
Performance of the ODF procedure for the Strömgren b filter. Each column represents one subbin distribution. The colors correspond to the left yaxis. For the description of colors confer to Fig. 6. The distributions are sorted in a descending order according to the accuracy of the Strömgren b filter, shown by the black line and associated with the right yaxis. 
The speedup we achieve by using four subbins compared to calculations using detailed opacity with a resolution of 80 points per Å is 330 × 80/4 = 6600. To calculate the Strömgren b flux with standard Kurucz ODF setup, one needs 33 bins with 12 subbins, which results in 396 frequencies. Consequently, our approach gives us a speedup of roughly 100 times.
We note that in the ODF approach, the Planck function change within a bin is neglected. In the case of a relatively narrow Strömgren b filter, such a change can be neglected and thus the entire passband can be treated as one bin. This is not the case for broader filters used in planetaryhunting missions for instance. The application of the ODF approach on such filters will be considered in a forthcoming publication.
4. Conclusions
In this paper we have studied the optimal ODF setup for fast and reliable spectral synthesis. We find that the main factor determining the accuracy longward of 4500 Å is the width of the last subbin (i.e., the subbin representing the strongest opacities within a given wavelength bin), at least for solar spectra. This important finding implies that two subbins return reasonably accurate results at these wavelengths for the Sun.
Furthermore, the importance of smaller last subbins allowed us to optimize the ODF for the cases where speed of calculations is the main concern. A speedup of three times compared to the standard method by Kurucz was achieved by using four nonuniform subbins. In addition to the speedup, our method matches the accuracy of Kurucz longward of 4500 Å and maintains a comparable level of accuracy shortward.
For cases where accuracy is the main concern, such as shortward of 4500 Å, we find that 10 nonuniform subbins are enough to reach a considerably higher level of accuracy compared to the standard subbins by Kurucz. That is two subbins fewer for calculations with the model of the quiet Sun atmosphere.
We also generalized our method for calculations of fluxes through filters typically used for stellar observations. The main idea is to scale the wavelength grid of the detailed opacity by the chosen filter transmission curve before the ODF procedure is applied to the changed grid. It is interesting to note that detailed opacity values are not modified in any way, but the grid over which these opacities are averaged is changed. As an example, this procedure allows the whole Strömgren b filter to be accurately represented by using only 4 subbins. So instead of having many bins for the whole filter which contain 12 subbins each, we achieve the same result with just four, resulting in a speedup of about two orders of magnitude. The accuracy achieved is better than 0.1%.
Acknowledgments
We thank Remo Collet for the encouraging and useful discussions. This work has received funding from the European Research Council under the European Union’s Horizon 2020 research and innovation program (grant agreement No. 715947). It also received financial support from the BK21 plus program through the National Research Foundation (NRF) funded by the Ministry of Education of Korea.
References
 Anderson, L. S. 1989, ApJ, 339, 558 [NASA ADS] [CrossRef] [Google Scholar]
 Beeck, B., Schüssler, M., Cameron, R. H., & Reiners, A. 2015a, A&A, 581, A42 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Beeck, B., Schüssler, M., Cameron, R. H., & Reiners, A. 2015b, A&A, 581, A43 [Google Scholar]
 Castelli, F., & Kurucz, R. L. 2004, ArXiv eprints [arXiv:astroph/0405087] [Google Scholar]
 Ermolli, I., Matthes, K., Dudok de Wit, T., et al. 2013, Atmos. Chem. Phys., 13, 3945 [Google Scholar]
 Fontenla, J. M., Avrett, E., Thuillier, G., & Harder, J. 2006, ApJ, 639, 441 [NASA ADS] [CrossRef] [Google Scholar]
 Gaia Collaboration (Prusti, T., et al.) 2016, A&A, 595, A1 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Holzreuter, R., & Solanki, S. K. 2012, A&A, 547, A46 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Holzreuter, R., & Solanki, S. K. 2013, A&A, 558, A20 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Hubeny, I., & Mihalas, D. 2015, Theory of Stellar Atmospheres: An Introduction to Astrophysical Nonequilibrium Quantitative Spetroscopic Analysis (Princeton, NJ: Princeton Univ. Press) [Google Scholar]
 Kurucz, R. L. 1979, ApJS, 40, 1 [NASA ADS] [CrossRef] [Google Scholar]
 Kurucz, R. L. 2005, Mem. Soc. Astron. It. Suppl., 8, 86 [Google Scholar]
 Kurucz, R. L., Peytremann, E., & Avrett, E. H. 1974, Blanketed Model Atmospheres for Earlytype Stars (Washington, DC: Smithsonian Institute Press) [Google Scholar]
 Labs, D. 1951, Z. Astrophys., 29, 199 [NASA ADS] [Google Scholar]
 Nordlund, Å., Stein, R. F., & Asplund, M. 2009, Sol. Phys., 6, 2 [Google Scholar]
 Norris, C. M., Beeck, B., Unruh, Y. C., et al. 2017, A&A, 605, A45 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Pereira, T. M. D., & Uitenbroek, H. 2015, A&A, 574, A3 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Riethmüller, T. L., Solanki, S. K., Berdyugina, S. V., et al. 2014, A&A, 568, A13 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Shapiro, A. I., Schmutz, W., Schoell, M., Haberreiter, M., & Rozanov, E. 2010, A&A, 517, A48 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Solanki, S. K., Krivova, N. A., & Haigh, J. D. 2013, ARA&A, 51, 311 [NASA ADS] [CrossRef] [Google Scholar]
 Solanki, S. K., Riethmüller, T. L., Barthol, P., et al. 2017, ApJS, 229, 2 [NASA ADS] [CrossRef] [Google Scholar]
 Stein, R. F. 2012, Sol. Phys., 9, 4 [Google Scholar]
 Tagirov, R. V., Shapiro, A. I., & Schmutz, W. 2017, A&A, 603, A27 [NASA ADS] [CrossRef] [EDP Sciences] [Google Scholar]
 Tsuneta, S., Ichimoto, K., Katsukawa, Y., et al. 2008, Sol. Phys., 249, 167 [NASA ADS] [CrossRef] [Google Scholar]
 Werner, K., & Dreizler, S. 1999, J. Comput. Appl. Math., 109, 65 [NASA ADS] [CrossRef] [Google Scholar]
 Yeo, K. L., Shapiro, A. I., Krivova, N. A., & Solanki, S. K. 2016, in Coimbra Solar Physics Meeting: Groundbased Solar Observations in the Space Instrumentation Era, eds. I. Dorotovic, C. E. Fischer, & M. Temmer, 504, 273 [NASA ADS] [Google Scholar]
All Figures
Fig. 1.
Opacity variation within 10 Å (panel a) in addition to sorted opacity and the corresponding mean values over individual subbins (blue and orange lines in panel b, respectively). 

In the text 
Fig. 2.
Ratio of spectra calculated using mean opacity to detailed spectra. Bin size of 10 Å (orange) and bin size of 100 Å (blue). 

In the text 
Fig. 3.
Ratio of ODF based spectra to the detailed one for different uniform subbin sizes, as given by the legend in the plot. The black curve is calculated with continuum opacity only. It is plotted on an inverted scale to enable a better comparison. Bin size is 10 Å. Convolved with a Gaussian, σ = 30 Å. 

In the text 
Fig. 4.
Ratio of ODFbased spectra using nonuniform bins to the detailed one. Legend shows subbin widths in parts of the bin size for each colored curve. The averaged value of opacity in the subbins increases from left to right. The black curve is calculated with continuum opacity only, inverted to allow for a better comparison. Bin size is 10 Å. Convolved with a Gaussian, σ = 30 Å. 

In the text 
Fig. 5.
Ratio of ODF based spectra to the detailed one. The colored curves are for uniform subbins (see legend for the description), while the black curve shows the result of using just four nonuniform subbins. Bin size is 10 Å. Convolved with a Gaussian, σ = 30 Å. 

In the text 
Fig. 6.
Results of the optimal subbin combination search with four subbins. Top panel: optimal configuration of four 10 Å bins as a function of wavelength for the FALC atmosphere model. The colorcoding shows how subbins are distributed relative to the bin length (see text for details). Middle panel: ratio of ODF to detailed spectra using the best combination of subbins for each bin from the upper panel (blue). For comparison we also show accuracy using Kurucz subbins (orange). Bottom panel: ratio of ODF to detailed spectra using the best subbins for each bin from the upper panel applied to the FALP atmosphere model (blue) and using Kurucz subbins on the FALP atmosphere model (orange). The values of the ratio in the middle and bottom panels greater than one were mirrored over the abscissa y = 1. 

In the text 
Fig. 7.
Results of the optimal subbin combination search with ten subbins. Top panel: best subbin distribution for each bin as a function of wavelength for the FALC atmosphere model. For the description of colors confer Fig. 6. Bottom panel: ratio of ODF to detailed spectra showing the single unique subbin combination with the lowest cumulative least squares error in all bins (blue), using Kurucz subbins (orange). The curve showing best subbins for each bin from the upper panel has such a low error that it is indistinguishable from the yaxis. 

In the text 
Fig. 8.
Ratio of ODF to detailed spectra with different bin sizes, as listed in the legend, using Kurucz subbins. All lines smoothed using a Gaussian. 

In the text 
Fig. 9.
Illustration of the wavelength transformation according to Eq. (3). Upper panel: schematic representation of flux dependence on wavelengths. Middle panel: exemplary stepwise transmission curve. Lower panel: resulting detailed flux on a transformed wavelength grid. Colors indicate to which of the three values of the transmission curve the fluxes are associated to. 

In the text 
Fig. 10.
Normalized flux in Strömgren b filter. Spectra synthesized using the full linelist (blue, plotted with decreased line width) and continuum only (orange). 

In the text 
Fig. 11.
Performance of the ODF procedure for the Strömgren b filter. Each column represents one subbin distribution. The colors correspond to the left yaxis. For the description of colors confer to Fig. 6. The distributions are sorted in a descending order according to the accuracy of the Strömgren b filter, shown by the black line and associated with the right yaxis. 

In the text 
Current usage metrics show cumulative count of Article Views (fulltext article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 4896 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.