Plasma
This module calculates the ionization balance and level populations in the BasePlasma, give a abundance fraction, temperature
and density. After calculating the state of the plasma, these classes are able to calculate \(\tau_\textrm{sobolev}\)
for the supernova radiative transfer. The simplest BasePlasma (BasePlasma) only calculates the atom number densities, but serves
as a base for all BasePlasma classes. The next more complex class is LTEPlasma which will calculate the aforementioned quantities in
Local Thermal Equilibrium conditions (LTE). The NebularPlasma-class inherits from LTEPlasma and uses a more complex
description of the BasePlasma (for details see nebular_plasma).
Note
In this documentation we use the indices \(i, j, k\) to mean atomic number, ion number and level number respectively.
All plasma calculations follow the same basic procedure in calculating the plasma state.
This is always accomplished with the function update_radiationfield. This block diagram shows the basic procedure
Base Plasma
BasePlasma serves as the base class for all plasmas and can just calculate the atom number densities for a given input of
abundance fraction.
\[N_{atom} = \rho_\textrm{total} \times \textrm{Abundance fraction} / m_\textrm{atom}\]
In the next step the line and level tables are purged of entries that are not represented in the
abundance fractions are saved in BasePlasma.levels and BasePlasma.lines. Finally, the function BasePlasma.update_t_rad is called
at the end of initialization to update the plasma conditions to a new \(T_\textrm{radiation field}\) (with the give t_rad).
This function is the same in the other plasma classes and does the main part of the calculation. In the case of BasePlasma this is only
setting BasePlasma.beta_rad to \(\frac{1}{k_\textrm{B}T_\textrm{rad}}\).
Here’s an example how to instantiate a simple base plasma:
>>> from tardis import atomic, plasma
>>> atom_data = atomic.AtomData.from_hdf5()
>>> my_plasma = plasma.BasePlasma({'Fe':0.5, 'Ni':0.5}, 10000, 1e-13, atom_data)
>>> print my_plasma.abundances
atomic_number abundance_fraction number_density
------------- ------------------ --------------
28 0.5 513016973.936
26 0.5 539183641.472
Sobolev optical depth
This function calculates the Sobolev optical depth \(\tau_\textrm{Sobolev}\)
\[C_\textrm{Sobolev} = \frac{\pi e^2}{m_e c}\]\[\tau_\textrm{Sobolev} = C_\textrm{Sobolev}\, \lambda\, f_{\textrm{lower}\rightarrow\textrm{upper}}\,
t_\textrm{explosion}\, N_\textrm{lower}
(1 - \frac{g_\textrm{lower}}{g_\textrm{upper}}\frac{N_\textrm{upper}}{N_\textrm{lower}})\]
Macro Atom
The macro atom is described in detail in [1]. The basic principal is that when an energy packet
is absorbed that the macro atom is on a certain level. Three probabilities govern the next step the Pup,
Pdown and Pdown emission being the probability for going to a higher level, a lower level and a lower
level and emitting a photon while doing this respectively (see Figure 1 in [1] ).
The macro atom is the most complex idea to implement as a data structure. The setup is done in ~tardisatomic, but
we will nonetheless discuss it here (as ~tardisatomic is even less documented than this one).
For each level we look at the line list to see what transitions (upwards or downwards are possible). We create a two arrays,
the first is a long one-dimensional array containing the probabilities. Each level contains a set of probabilities, The first
part of each set contains the upwards probabilities (internal upward), the second part the downwards probabilities
(internal downward), and the last part is the downward and emission probability.
each set is stacked after the other one to make one long one dimensional ~numpy.ndarray.
The second array is for book-keeping it has exactly the length as levels (with an example for the Si II level 15):
Level ID |
Probability index |
Nup |
Ndown |
Ntotal |
14001015 |
??? |
17 |
5 |
17 + 5*2 = 27 |
We now will calculate the transition probabilites, using the radiative rates in Equation 20, 21, and 22
in [1]. Then we calculate the downward emission probability from Equation 5, the downward and
upward internal transition probabilities in [2].
\[\begin{split}p_\textrm{emission down}&= {\cal R}_{\textrm{i}\rightarrow\textrm{lower}}\,(\epsilon_\textrm{upper} - \epsilon_\textrm{lower}) / {\cal D}_{i}\\
p_\textrm{internal down}&= {\cal R}_{\textrm{i}\rightarrow\textrm{lower}}\,\epsilon_\textrm{lower}/{\cal D}_{i}\\,
p_\textrm{internal up}&={\cal R}_{\textrm{i}\rightarrow\textrm{upper}}\,\epsilon_{i}/{\cal D}_{i}\\,\end{split}\]
- where \(i\) is the current level, \(\epsilon\) is the energy of the level, and \({\cal R}\) is the radiative
- rates.
We ignore the probability to emit a k-packet as TARDIS only works with photon packets.
Next we calculate the radidative
rates using equation 10 in [2].
\[\begin{split}{\cal R}_{\textrm{upper}\rightarrow\textrm{lower}} &=
A_{\textrm{upper}\rightarrow\textrm{lower}}\beta_\textrm{Sobolev}n_\textrm{upper}\\
{\cal R}_{\textrm{lower}\rightarrow\textrm{upper}} &=
(B_{\textrm{lower}\rightarrow\textrm{upper}}n_\textrm{lower}-
B_{\textrm{upper}\rightarrow\textrm{lower}}n_\textrm{upper})
\beta_\textrm{Sobolev} J_{\nu}^{b}\\,\end{split}\]
with \(\beta_\textrm{Sobolev} = \frac{1}{\tau_\textrm{Sobolev}}(1-e^{-\tau_\textrm{Sobolev}})\) .
using the Einstein coefficients
\[\begin{split}A_{\textrm{upper}\rightarrow\textrm{lower}} &= \frac{8 \nu^2 \pi^2 e^2}{m_e c^3}~
\frac{g_\textrm{lower}}{g_\textrm{upper}}~f_{\textrm{lower}\rightarrow\textrm{upper}}\\
A_{\textrm{upper}\rightarrow\textrm{lower}} &= \underbrace{\frac{4 \pi^2 e^2}{m_e c}}_{C_\textrm{Einstein}}~ \frac{2\nu^2}{c^2}
\frac{g_\textrm{lower}}{g_\textrm{upper}}~f_{\textrm{lower}\rightarrow\textrm{upper}}\\
B_{\textrm{lower}\rightarrow\textrm{upper}} &= \frac{4\pi^2 e^2}{m_e h\nu c}\,f_{\textrm{lower}\rightarrow\textrm{upper}}\\
B_{\textrm{lower}\rightarrow\textrm{upper}} &= \underbrace{\frac{4 \pi^2 e^2}{m_e c}}_{C_\textrm{Einstein}}\frac{1}{h\nu} f_{\textrm{lower}\rightarrow\textrm{upper}}\\\end{split}\]\[\begin{split}B_{\textrm{upper}\rightarrow\textrm{lower}} &= \frac{4\pi^2 e^2}{m_e h\nu c}\,f_{\textrm{lower}\rightarrow\textrm{upper}}\\
B_{\textrm{upper}\rightarrow\textrm{lower}} &= \underbrace{\frac{4 \pi^2 e^2}{m_e c}}_{C_\textrm{Einstein}}\frac{1}{h\nu}\frac{g_\textrm{lower}}{g_\textrm{upper}}f_{\textrm{lower}\rightarrow\textrm{upper}}\\\end{split}\]
we get
\[\begin{split}{\cal R}_{\textrm{upper}\rightarrow\textrm{lower}} &=
C_\textrm{Einstein} \frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{upper}}~f_{\textrm{lower}\rightarrow\textrm{upper}}
\beta_\textrm{Sobolev}n_\textrm{upper}\\\end{split}\]\[\begin{split}{\cal R}_{\textrm{lower}\rightarrow\textrm{upper}} &=
C_\textrm{Einstein}\frac{1}{h\nu} f_{\textrm{lower}\rightarrow\textrm{upper}}
(n_\textrm{lower}-\frac{g_\textrm{lower}}{g_\textrm{upper}}n_\textrm{upper})
\beta_\textrm{Sobolev} J_{\nu}^{b}\\\end{split}\]
This results in the transition probabilities:
\[\begin{split}p_\textrm{emission down}&= C_\textrm{Einstein} \frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{i}}~f_{\textrm{lower}\rightarrow\textrm{i}}
\beta_\textrm{Sobolev}n_\textrm{i}\,(\epsilon_\textrm{i} - \epsilon_\textrm{lower}) / {\cal D}_{i}\\
p_\textrm{internal down}&= C_\textrm{Einstein} \frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{i}}~f_{\textrm{lower}\rightarrow\textrm{i}}
\beta_\textrm{Sobolev}n_\textrm{i}\,\epsilon_\textrm{lower}/{\cal D}_{i}\\
p_\textrm{internal up}&=C_\textrm{Einstein}\frac{1}{h\nu} f_{\textrm{i}\rightarrow\textrm{upper}}
(n_\textrm{i}-\frac{g_\textrm{i}}{g_\textrm{upper}}n_\textrm{upper})
\beta_\textrm{Sobolev} J_{\nu}^{b}\,\epsilon_{i}/{\cal D}_{i}\\,\end{split}\]
- and as we will normalise the transition probabilities numerically later, we can get rid of \(C_\textrm{Einstein}\),
- \(\frac{1}{{\cal D}_i}\) and number densities.
\[\begin{split}p_\textrm{emission down}&= \frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{i}}~f_{\textrm{lower}\rightarrow\textrm{i}}
\beta_\textrm{Sobolev}\,(\epsilon_\textrm{i} - \epsilon_\textrm{lower})\\
p_\textrm{internal down}&= \frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{i}}~f_{\textrm{lower}\rightarrow\textrm{i}}
\beta_\textrm{Sobolev}\,\epsilon_\textrm{lower}\\
p_\textrm{internal up}&=\frac{1}{h\nu} f_{\textrm{i}\rightarrow\textrm{upper}}
\underbrace{(1-\frac{g_\textrm{i}}{g_\textrm{upper}}\frac{n_\textrm{upper}}{n_i})}
_\textrm{stimulated emission}
\beta_\textrm{Sobolev} J_{\nu}^{b}\,\epsilon_{i}\\,\end{split}\]
There are two parts for each of the probabilities, one that is pre-computed by ~tardisatomic and is in the HDF5 File,
and one that is computed during the plasma calculations:
\[\begin{split}p_\textrm{emission down}&= \underbrace{\frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{i}}~f_{\textrm{lower}\rightarrow\textrm{i}}
(\epsilon_\textrm{i} - \epsilon_\textrm{lower})}_\textrm{pre-computed}
\,\beta_\textrm{Sobolev}\\
p_\textrm{internal down} &= \underbrace{\frac{2\nu^2}{c^2} \frac{g_\textrm{lower}}{g_\textrm{i}}~f_{\textrm{lower}\rightarrow\textrm{i}}
\epsilon_\textrm{lower}}_\textrm{pre-computed}\,\beta_\textrm{Sobolev}\\
p_\textrm{internal up} &= \underbrace{\frac{1}{h\nu} f_{\textrm{i}\rightarrow\textrm{upper}}}_\textrm{pre-computed}
\beta_\textrm{Sobolev} J_{\nu}^{b}\,
(1-\frac{g_\textrm{i}}{g_\textrm{upper}}\frac{n_\textrm{upper}}{n_i})
\,\epsilon_{i}.\end{split}\]
NLTE treatment
NLTE treatment of lines is available both in ~LTEPlasma and the ~NebularPlasma class. This can be enabled by specifying
which species should be treated as NLTE with a simple list of tuples (e.g. [(20,1)] for Ca II).
First let’s dive into the basics:
There are two rates to consider from a given level.
\[\begin{split}R_{\textrm{upper}\rightarrow\textrm{lower}} &= \underbrace{A_{ul} n_u}_\textrm{spontaneous emission}
+ \underbrace{B_{ul} n_u \bar{J}_\nu}_\textrm{stimulated emission} +
\underbrace{C_{ul} n_u n_e}_\textrm{collisional deexcitation}\\
&= n_u \underbrace{(A_{ul} + B_{ul}\bar{J}_\nu + C_{ul} n_e)}_{r_{ul}} \\\end{split}\]\[\begin{split}R_{\textrm{lower}\rightarrow\textrm{upper}} &= \underbrace{B_{lu} n_l \bar{J}_\nu}_\textrm{stimulated absorption} +
\underbrace{C_{lu}\,n_l\,n_e}_\textrm{collisional excitation}\\
&= n_l \underbrace{(B_{lu}\bar{J}_\nu + C_{ul}n_e)}_{r_{lu}},\end{split}\]
where \(\bar{J}_\nu\) (in LTE this is \(B(\nu, T)\)) denotes the mean intensity at the frequency of the line and
\(n_e\) the number density of electrons.
Next, we calculate the rate of change of a level by adding up all outgoing and all incoming transitions from level \(j\).
\[\frac{dn_j}{dt} = \underbrace{\sum_{i \ne j} R_{ij}}_\textrm{incoming rate} -
\underbrace{\sum_{i \ne j} R_{ji}}_\textrm{outgoing rate}\]
In a statistical equilibrium all incoming rates and outgoing rates add up to 0 (\(\frac{dn_j}{dt}=0\)). We use this to
calculate the level populations using the rate coefficients (\(r_ij, r_ji\)).
\[\begin{split}\left(
\begin{matrix}
-(\cal{R}_{12} + \dots + \cal{R}_{1j}) & \dots & \cal{R}_{j1}\\
\vdots & \ddots & \vdots \\
\cal{R}_{1j} & \dots & - (\cal{R} _{j1} + \dots + \cal{R} _{j, j-1}) \\
\end{matrix}
\right)
%
\left(
\begin{matrix}
n_1\\
\vdots\\
n_j\\
\end{matrix}
\right)
%
=
%
\left(
\begin{matrix}
0\\
0\\
0\\
\end{matrix}
\right)\end{split}\]
with the additional constrained that all the level number populations need to add up to the current ion population $N$ we change this to
\[\begin{split}\left(
\begin{matrix}
1 & 1 & \dots \\
\vdots & \ddots & \vdots \\
\cal{R}_{1j} & \dots & - (\cal{R} _{j1} + \dots + \cal{R} _{j, j-1}) \\
\end{matrix}
\right)
%
\left(
\begin{matrix}
n_1\\
\vdots\\
n_j\\
\end{matrix}
\right)
%
=
%
\left(
\begin{matrix}
N\\
0\\
0\\
\end{matrix}
\right)\end{split}\]
For a three level atom we have:
\[\begin{split}\frac{dn_1}{dt} &= \underbrace{n_2 r_{21} + n_3 r_{31}}_\textrm{incoming rate}
- \underbrace{(n_1 r_{12} + n_1 r_{13})}_\textrm{outgoing rate} = 0\\\end{split}\]\[\begin{split}\frac{dn_2}{dt} &= \underbrace{n_1 r_{12} + n_3 r_{32}}_\textrm{incoming rate}
- \underbrace{(n_2 r_{21} + n_2 r_{23})}_{outgoing rate} = 0\\\end{split}\]\[\begin{split}\frac{dn_3}{dt} &= \underbrace{n_1 r_{13} + n_2 r_{23}}_\textrm{incoming rate}
- \underbrace{(n_3 r_{32} + n_3 r_{31})}_\textrm{outgoing rate} = 0,\end{split}\]
which can be written in matrix from:
\[\begin{split}\left(\begin{matrix}
-(r_{12} + r_{13}) & r_{21} & r_{31}\\
r_{12} & -(r_{21} + r_{23}) & r_{32}\\
r_{13} & r_{23} & -(r_{31} + r_{32}) \\
\end{matrix}\right)
\left(
\begin{matrix}
n_1\\
n_2\\
n_3\\
\end{matrix}
\right)
=
\left(
\begin{matrix}
0\\
0\\
0\\
\end{matrix}
\right)\end{split}\]
To solve for the level populations we need an additional constraint: \(n_1 + n_2 + n_3 = N\). By setting \(N = 1\):
we can get the relative rates:
\[\begin{split}\left(\begin{matrix}
1 & 1 & 1\\
r_{12} & -(r_{21} + r_{23}) & r_{32}\\
r_{13} & r_{23} & -(r_{31} + r_{32}) \\
\end{matrix}\right)
\left(
\begin{matrix}
n_1\\
n_2\\
n_3\\
\end{matrix}
\right)
=
\left(
\begin{matrix}
1\\
0\\
0\\
\end{matrix}
\right)\end{split}\]
Now we go back and look at the rate coefficients used for a level population - as an example \(\frac{dn_2}{dt}\):
\[\begin{split}\frac{dn_2}{dt} &= n_1 r_{12} - n_2 (r_{21} + r_{23}) + n_3 r_{32}\\
&= n_1 B_{12} \bar{J}_{12} + n_1 C_{12} n_e - n_2 A_{21} - n_2 B_{21} \bar{J}_{21} - n_2 C_{21} n_e\\
- n_2 B_{23} \bar{J}_{23} - n_2 C_{23} n_e + n_3 A_{32} + n_3 B_{32} \bar{J}_{32} + n_3 C_{32} n_e,\\
+ n_3 A_{32} + n_3 C_{32} n_e,\end{split}\]
Next we will group the stimulated emission and stimulated absorption terms as we can assume \(\bar{J_{12}} = \bar{J_{21}}\):
\[\begin{split}\frac{dn_2}{dt} &= n_1 (B_{12} \bar{J}_{12} \underbrace{(1 - \frac{n_2}{n_1}\frac{B_{21}}{B_{12}})}_\textrm{stimulated emission term} + C_{12} n_e)
- n_2 (A_{21} + C_{23} n_e + n_2 B_{23} \bar{J}_{23} \underbrace{(1 - \frac{n_3}{n_2}\frac{B_{32}}{B_{23}})}_\textrm{stimulated emission term})
+ n_3 (A_{32} + C_{32} n_e)\end{split}\]