Wednesday 7 June 2023

Opacity for realistic 3D MHD simulations of cool stellar atmospheres

The first paper of Andrea Perdomo Garcia is just submitted for publication in Astronomy & Astrophysics, and out on The paper is all about computing the opacities for realistic modelling of cool stellar atmospheres. It is divided in three unities. First (Section 3) it describes the computation of detailed monochromatic opacity including millions of atomic and molecular spectral lines and millions of wavelength points. For this the code SYNSPEC (Hubeny and Lanz, 2011, 2017a, b) is used. Then (Section 4) the monochromatic opacities are used to construct opacity distribution function which reduces the number of wavelength points from millions to thousands. The results are compared in detail with ones produced by Kurucz. Some striking similarities and some warning differences are found. Finally (Section 5), the opacity distribution function to construct opacity bins. This method, originally proposed by Nordlund (1982) is the key ingredient for realistically simulating stellar atmospheres in 3D as it reduced the problem further, from thousands of wavelength points to only a few. However, the method depends on a choice of some free parameters. In our paper the possible choices are carefully analyzed and some interesting conclusions are offered. 

In Sect.3 there are two figures (Figs.2 and 3) that I find very useful and illustrative. The monochromatic opacity (Fig.2) and the radiative heating rate (Fig.3) are shown as 2D functions of wavelength (X-axis) and height in the atmosphere (Y-axis) for four different cool stars (all with solar metalicity). Optical depths in the continuum and continuum+lines are overplotted.

(Andrea is the final year PhD student at Instituto de Astrofisica de Canarias and Univeridad de La Laguna, supervised by Manolo Collados Vera and myself. Stay tuned, more cool stuff is coming out from her research this year.)

Saturday 25 March 2023

Charles Hermite (1822 - 1901)

Sunday morning in Paris was opportunity to walk to the Montparnasse cemetery and pay respect to some of my personal heroes buried there. While the graves of Beckett, Cortázar and Poincaré attract quite many attention and visitors, it is less known that the great French mathematician Charles Hermite is buried there as well. Not only that he was a mentor to Henri Poincaré, Henri Padé, Thomas Stieltjes and Mihajlo Petrovic Alas, but his work on interpolation and function approximation is at the very core of the modern numerical methods used in computational fluid dynamics and radiative transfer (even when this is not so obvious or properly acknowledged). His work from 1878 ("Sur la formule d'interpolation de Lagrange") should be read by anyone interested in function approximation. The name on his grave stone are barely readable nowadays.

Monday 3 October 2022

Wednesday 7 September 2022

1D Solar Atmosphere Models in IDL: Standard Solar Model (from "The Sun", by Stix)

Stix, in his book ("The Sun: An Introduction", Springer, 2002) in Sect.2.4 introduces a standard solar model from the core to the surface defined as $\tau = 2/3$. His Table 2.4 (on p.56) lists the values of various quantities of this model versus the column mass or the height. Check the book for the details of the model. The table in ascii format is here: stix_tab.2.4.txt The columns are: $m/m_\odot$, $r/r_\odot$, $p \mathrm[Pa]$, $T \mathrm[K]$, $\rho \mathrm[kg/m^3]$, $L/L_\odot$, $X$, $\mu$, $\Gamma_1$.

Wednesday 13 July 2022

NGC 7319: GTC vs JWST

The first pictures from James Webb Space Telescope are simply mind blowing! Here is a comparison of NGC 7319 (from Stephan's quintet of galaxies) from Gran Telescopio Canarias (still the largest single aperture optical telescope) and from JWST. One should keep in mind that these are different instruments observing and different wavelengths. The alignment is also not perfect.

Wednesday 1 April 2020

Quadratic splines: Part I

Some basic properties of parabola in the context of the second-order Hermite interpolation equation. 

There is a one-dimensional dataset with $n$ points: $x = (x_0, \dots, x_{n-1})$ and $y = (y_0, \dots, y_{n-1})$, such that $x_{i} > x_{i-1}$ for any $i$. We introduce the following labels: $$h_{i-1} = x_i - x_{i-1}$$ $$\delta_{i-1} = \frac{y_i - y_{i-1}}{x_i - x_{i-1}}$$ $h$ is always positive, while $\delta$ can have any value. On each segment, we approximate the unknown function with a parabola. On the $[i-1, i]$ segment: \begin{equation}f(x) = a_0 + a_1 (x - x_{i-1}) + a_2 (x - x_{i-1})^2\end{equation} The first and the second derivative of the parabola are: \begin{equation}f'(x) = a_1 + 2 a_2 (x - x_{i-1})\end{equation} \begin{equation}f''(x) = 2 a_2 \end{equation} The Hermite interpolation theorem provides us with a tool to determine the $a$ coefficients on the $[i-1, i]$ segment if we know $y_{i-1}$, $y_i$ and one of the first derivative in the end points, either $y'_{i-1}$ or $y'_i$. Let's assume that we know ("know" in the sense "we can compute") $y'_{i-1}$. Then there are three equations that the parabola must obey: \begin{equation}f(x_{i-1}) = y_{i-1} = a_0\end{equation} \begin{equation}f'(x_{i-1}) = y'_{i-1} = a_1\end{equation} \begin{equation}f(x_{i}) = y_i = a_0 + a_1 h_{i-1} + a_2 h_{i-1}^2\end{equation} The solution is then trivial: \begin{equation}a_0 = y_{i-1}\end{equation} \begin{equation}a_1 = y'_{i-1}\end{equation} \begin{equation}a_2 = \frac{y_{i} - y_{i-1} - y'_{i-1} h_{i-1}}{h_{i-1}^2}\end{equation} Once the $a$ coefficients are known, the parabola is fully determined. That also means that the derivative in the point $i$ is fixed: $$f'(x_{i}) = y'_i = a_1 + 2 a_2 (x_i - x_{i-1}) = y'_{i-1} + 2 \frac{y_{i} - y_{i-1} - y'_{i-1} h_{i-1}}{h_{i-1}^2} h_{i-1}$$ $$y'_i = \frac{2(y_{i} - y_{i-1}) - y'_{i-1} h_{i-1}}{h_{i-1}} $$ \begin{equation}y'_i = 2\delta_{i-1} - y'_{i-1}\end{equation} Local extremum

The extremum of this parabola is located at $x_m$: $$f'(x_m) = 0 = a_1 + 2 a_2 (x_m - x_{i-1})$$ \begin{equation}x_m = x_{i-1} - \frac{a_1}{2a_2}\end{equation} Monotonicity

The function $f(x)$ is monotone on the $[i-1, i]$ segment if it does not have an extremum on it, i.e. if $$x_m < x_{i-1}\;\;\;\;\;\;\;\;\;\;\mathrm{or}\;\;\;\;\;\;\;\;\;\; x_m > x_i$$ The first condition readily translates into: $$x_{i-1} - \frac{a_1}{2a_2} < x_{i-1}$$ $$ \frac{a_1}{2a_2} > 0$$ or, when we substitute $a_1$ and $a_2$: $$ \frac{y'_{i-1} h_{i-1}^2}{2(y_{i} - y_{i-1} - y'_{i-1} h_{i-1})} > 0$$ $$ \frac{y'_{i-1} h_{i-1}}{2(\delta_{i-1} - y'_{i-1})} > 0$$ As by definition $h_{i-1} > 0$ $$ \frac{y'_{i-1}}{2(\delta_{i-1} - y'_{i-1})} > 0$$ If $y'_{i-1} > 0$ then $\delta_{i-1} - y'_{i-1} > 0$ and $\delta_{i-1} > y'_{i-1}$. If $y'_{i-1} < 0$, then $\delta_{i-1} < y'_{i-1}$. Therefore, the first condition ($x_m < x_{i-1}$) reduces to: \begin{equation}\boxed{|\delta_{i-1}| > |y'_{i-1}|}\end{equation} The second condition leads to: $$x_{i-1} - \frac{a_1}{2a_2} > x_{i}$$ $$-x_{i} + x_{i-1} - \frac{a_1}{2a_2} > 0$$ $$h_{i-1} + \frac{a_1}{2a_2} < 0$$ $$h_{i-1} + \frac{y'_{i-1} h_{i-1}}{2(\delta_{i-1} - y'_{i-1})} < 0$$ $$\frac{2\delta_{i-1} - y'_{i-1}}{2(\delta_{i-1} - y'_{i-1})} < 0$$ There are two cases. First, if $2\delta_{i-1} - y'_{i-1} > 0$, i.e. $2\delta_{i-1} > y'_{i-1}$. then it must be $\delta_{i-1} - y'_{i-1}< 0$, i.e.$\delta_{i-1} < y'_{i-1}$. Therefore, the first case leads to $2\delta_{i-1} > y'_{i-1} > \delta_{i-1}$. Secondly, if $2\delta_{i-1} - y'_{i-1} < 0$, i.e. $2\delta_{i-1} < y'_{i-1}$, it must be $\delta_{i-1} - y'_{i-1}> 0$, i.e. $\delta_{i-1} > y'_{i-1}$. So the second case leades to $\delta_{i-1} > y'_{i-1}> 2\delta_{i-1}$. The first case is possible only when both $\delta_{i-1}$ and $y'_{i-1}$ are positive and the second case is possible only when both are negative. Therefore, together, the two cases reduce the second condition ($x_m > x_{i}$) to: \begin{equation}\boxed{|2\delta_{i-1}| > |y'_{i-1}| > |\delta_{i-1}|}\end{equation} Together, the two conditions combine into \begin{equation}\boxed{|2\delta_{i-1}| > |y'_{i-1}|}\end{equation} A much faster way to reach the same result is to realize that the the derivatives $y'_{i-1}$ and $y'_{i}$ must be of the same sign if the function is monotone on the $[i-1, i]$ segment, i.e. $$y'_{i-1} \cdot (2\delta_{i-1} - y'_{i-1}) > 0$$ which obviously leads to $|2\delta_{i-1}| > |y'_{i-1}|$.

Therefore, for a Hermite parabola defined by $y_{i-1}$, $y_i$ and $y'_{i-1}$ to be monotone on the interval $(i-1, i)$, the derivative $y'_{i-1}$ must be of the same sign as the linear slope $\delta_{i-1}$ and smaller in magnitude than $2\delta_{i-1}$.


For the function $f$ to be convex on $(i-1, i)$ (if parabola is convex on a segment, it's convex everywhere) the condition is $f''(x) > 0$. In the case of our parabola: $$f''(x) = 2a_2 > 0$$. $$\frac{y_{i} - y_{i-1} - y'_{i-1} h_{i-1}}{h_{i-1}^2} > 0$$ or $$y_{i} - y_{i-1} - y'_{i-1} h_{i-1} > 0$$ \begin{equation}\delta_{i-1} > y'_{i-1}\end{equation} This result is obvious $\delta_{i-1} = y'_{i-1}$ is the straight line going through the end-points of the segment. For the parabola to be concave, it must hold $f''(x) < 0$, i.e. \begin{equation}\delta_{i-1} < y'_{i-1}\end{equation} 


Saturday 7 December 2019

XXXI Canary Islands Winter School: Computational Fluid Dynamics in Astrophysics (Photos)

Two weeks of interesting lectures, intensive hands-on exercises, discussions and meeting new people... A couple of photos by Claudio Dalla Vecchia that perfectly capture the spirit of the school.