Skip to content

Commit

Permalink
deploy: 5ef48ee
Browse files Browse the repository at this point in the history
  • Loading branch information
tardis-bot committed Aug 9, 2023
1 parent c1f6818 commit c0c2275
Show file tree
Hide file tree
Showing 71 changed files with 7,933 additions and 0 deletions.
4 changes: 4 additions & 0 deletions branch/gpu/broadening/calc_doppler_width/add-cuda/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 5dd383197697f71a82e091378474d94a
tags: 645f666f9bcd5a90fca523b33c5a78b7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bibliography
============

The following are references used for the development of STARDIS.

.. bibliography::
:all:
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Contributing
============

Generating Conda Lockfiles
--------------------------

In the interest of reproducibility, STARDIS uses `conda-lock <https://conda.github.io/conda-lock/>`__ files to keep the virtual environment consistent across similar machines and installations. High level specifications of the environments are given in ``stardis_env3.yml`` and ``stardis_env3_cuda.yml``, and then ``conda-lock`` is used to create the corresponding lockfile. The steps are as follow.

.. note::
These steps are only tested using `miniconda <https://docs.conda.io/en/latest/miniconda.html>`__.

.. note::
Both sets of steps below assume that all commands are being run from your local STARDIS git repository, which can be obtained using the developer installation instructions.

Without CUDA Support
^^^^^^^^^^^^^^^^^^^^

#. Activate the Conda virtual environment:

.. code-block:: bash
$ conda activate stardis
#. `Create a lockfile <https://conda.github.io/conda-lock/cli/gen/#conda-lock-lock>`__ using conda-lock's `unified lockfile format <https://conda.github.io/conda-lock/output/#unified-lockfile>`__:

.. code-block:: bash
$ conda-lock -f stardis_env3.yml --conda $(which conda) --strip-auth
#. `Render <https://conda.github.io/conda-lock/cli/gen/#conda-lock-render>`__ platform-specific lockfiles:

.. code-block:: bash
$ conda-lock render conda-lock.yml
With CUDA Support
^^^^^^^^^^^^^^^^^^^^

#. Activate the Conda virtual environment:

.. code-block:: bash
$ conda activate stardis-cuda
#. `Create a lockfile <https://conda.github.io/conda-lock/cli/gen/#conda-lock-lock>`__ using conda-lock's `unified lockfile format <https://conda.github.io/conda-lock/output/#unified-lockfile>`__:

.. code-block:: bash
$ conda-lock -f stardis_env3_cuda.yml --conda $(which conda) --strip-auth --lockfile conda-lock-cuda.yml
#. `Render <https://conda.github.io/conda-lock/cli/gen/#conda-lock-render>`__ platform-specific lockfiles:

.. code-block:: bash
$ conda-lock render --filename-template conda-{platform}-cuda.lock conda-lock-cuda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
stardis Documentation
-----------------------

This is the documentation for stardis.

.. toctree::
:maxdepth: 2
:caption: Contents:

Quickstart <quickstart/quickstart>
Downloading and Installation <installation>
Physics of STARDIS <physics/physics_of_stardis>
Running the Code <running_the_code>
Contributing <contributing>
Bibliography <bibliography>

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
..
This file was converted from MarkDown using pandoc 2.19.2, Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13, citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1, Scripting engine: Lua 5.4
The command was `$ pandoc -t rst installation.md -o installation.rst`__
Downloading and Installation
============================

Setting Up the Environment
--------------------------

.. note::
* STARDIS is only supported on macOS and GNU/Linux. Windows users can run STARDIS on a virtual machine.

* STARDIS packages and dependencies are distributed only through the `conda <https://docs.conda.io/en/latest/>`__ package management system, therefore installation requires a conda distribution to be installed on your system. STARDIS uses `Miniconda <https://conda.io/projects/conda/en/latest/user-guide/install/index.html>`__ or `Mamba <https://mamba.readthedocs.io/en/latest/installation.html>`__ by default. Other distributions are untested.

STARDIS uses exclusively the packages in the TARDIS enviroment, as well
as using the TARDIS code itself. However, since STARDIS can be sensitive
to changes in TARDIS, we strongly suggest that users create a separate
environment for STARDIS that pins the TARDIS version. To do this, run
the following in the terminal (replacing ``{platform}`` with
``linux-64``, ``linux-64-cuda``, or ``osx-64`` as applicable).

.. code-block:: bash
$ cd <path-to-stardis-directory>
$ conda create --name stardis --file conda-{platform}.lock
$ conda activate stardis
$ pip install git+https://github.com/tardis-sn/[email protected]
The third command (``conda activate stardis``) activates the
environment, which is necessary to correctly install STARDIS using the directions below.

If you are using Mamba, the steps are similar:

.. code-block:: bash
$ cd <path-to-stardis-directory>
$ mamba create --name stardis --file conda-{platform}.lock
$ mamba activate stardis
$ pip install git+https://github.com/tardis-sn/[email protected]
Downloading and Installing STARDIS
----------------------------------

For Non-Developers
^^^^^^^^^^^^^^^^^^

STARDIS can be downloaded by **non-developers** by running

::
$ pip install git+https://github.com/tardis-sn/stardis.git@main

in the terminal with your STARDIS environment activated.

For Developers
^^^^^^^^^^^^^^

Developers should fork and clone the STARDIS repository.
First, `fork the
repository <https://github.com/tardis-sn/stardis/fork>`__ and `configure
GitHub to work with SSH
keys <https://docs.github.com/en/authentication/connecting-to-github-with-ssh>`__,
and then run the following in the terminal:

::

$ git clone [email protected]:<username>/stardis.git
$ cd stardis
$ git remote add upstream [email protected]:tardis-sn/stardis.git
$ git fetch upstream
$ git checkout upstream/main
$ pip install -e .[test,docs]
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
******************
Physics of STARDIS
******************

================
Model and Plasma
================

STARDIS breaks down the stellar atmosphere into spherical shells as shown below and approximates that the plasma state is uniform throughout each shell. We rely on the MARCS code, a code that generates models of stellar atmospheres, to determine the temperatures, elemental abundances, and densities in each shell. The existing TARDIS plasma infrastructure determines the rest of the plasma state, namely the excitation and ionization properties and transition rates.

.. image:: media/model_and_plasma-1.png
:width: 500 px
:alt: Diagram showing inner and outer boundaries of the stellar atmosphere

=========
Opacities
=========

To determine an output spectrum, we need to understand how photons of light move through the atmosphere and what interactions they experience. Opacity is a measure of how likely it is that light will be scattered or absorbed by some material, like the stellar plasma, per unit distance it travels. This is contributed to by several mechanisms, which are described :ref:`below<Opacity Sources>`.

---------------
Opacity Sources
---------------

The first four of these interactions are called continuum interactions, as they affect light at a large range of frequencies. Line interactions, on the other hand, only occur with light around specific frequencies, corresponding to the electron’s jump in energy. These are called *resonant frequencies*.

^^^^^^^^^^^^^^^^^^^^^
Bound-Free Absorbtion
^^^^^^^^^^^^^^^^^^^^^

.. math::
\alpha = \frac{64 \pi^4 e^{10} m_e Z^4}{3 \sqrt 3 h^6 c n_{\text{eff}}^5} n
.. image:: media/bound_free_absorbtion-1.png
:width: 500 px
:alt: Diagram of bound-free absorbtion


^^^^^^^^^^^^^^^^^^^^
Free-Free Absorbtion
^^^^^^^^^^^^^^^^^^^^

.. math::
\alpha = \frac{4 e^6 Z^2 n}{3 h c v^3} \sqrt{\frac{2 \pi}{3 m_e^3 k_B T}}
.. image:: media/free_free_absorbtion-1.png
:width: 500 px
:alt: Diagram of free-free absorbtion


^^^^^^^^^^^^^^^^^^^
Rayleigh Scattering
^^^^^^^^^^^^^^^^^^^

.. math::
\alpha = \sigma_T n \left ( c_4 \left ( \frac{v}{2 v_H} \right )^4 + c_6 \left ( \frac{v}{2 v_H} \right )^6 + c_8 \left ( \frac{v}{2 v_H} \right )^8 \right )
.. image:: media/rayleigh_scattering-1.png
:width: 500 px
:alt: Diagram of Rayleigh scattering


^^^^^^^^^^^^^^^^^^^
Electron Scattering
^^^^^^^^^^^^^^^^^^^

.. math::
\alpha = \sigma_T n_E
.. image:: media/electron_scattering-1.png
:width: 500 px
:alt: Diagram of electron scattering


^^^^^^^^^^^^^^^^
Line Interaction
^^^^^^^^^^^^^^^^

.. math::
\alpha = \frac{\pi e^2}{m_e c} n_l f_{lu} \left (1 - \frac{g_l n_u}{g_u n_l} \right ) \phi(v)
.. image:: media/line_interaction-1.png
:width: 500 px
:alt: Diagram of line interaction

----------
Broadening
----------

Line interaction opacity does not occur only at the exact resonant frequencies; lines are broadened to reach other nearby frequencies. Thus, the line interaction opacity is the total line opacity

.. math::
\alpha_{lu} = \frac{\pi e^2}{m_e c} n_l f_{lu} \left ( 1 - \frac{g_l n_u}{g_u n_l} \right )
times the *line profile* :math:`\phi(v)` which describes the broadening.

..
The below was taken from https://stackoverflow.com/a/42522042
|wide_line_profile| vs. |narrow_line_profile|

.. |wide_line_profile| image:: media/wide_line_profile.png
:width: 45 %
:alt: Broad line profile

.. |narrow_line_profile| image:: media/narrow_line_profile.png
:width: 45 %
:alt: Less broad line profile

Above are examples of line profiles, the left being very broadened and the right being less broadened.

The line profile uses the following parameters for determining how much the line is broadened:

- The Einstein coefficient :math:`A_{ul}`, describing the line’s natural acceptance of non-resonant frequencies.
- The doppler width :math:`\Delta v_D`, the range of frequencies that are doppler shifted to be the resonant frequency due to the movement of ions in the plasma.
- The collisional broadening parameter :math:`\gamma_{\text{col}}`, describing the effects of forces between ions or ions and electrons which shift the resonant frequency.

The line profile centered at the resonant frequency :math:`v_{lu}` is then:

.. math::
\phi(v) = \frac{\gamma_{\text{col}}}{4 \pi^{\frac{5}{2}} \Delta v_D} \int_{-\infty}^{\infty} \frac{\exp \left ( -\frac{y^2}{\Delta v_D^2} \right )}{\left (v - v_{lu} - y \right )^2 + \left ( \frac{\gamma_{\text{col}} + A_{ul}}{4 \pi} \right )^2} \, d y
=========
Transport
=========

Finally, we use the opacity information to trace beams of light coming from the photosphere at different angles and frequencies to find the final intensity. We use the equation

.. math::
I_{N + 1}(v, \theta) = I_N(v, \theta) e^{-\tau} + (1 - e^{- \tau}) B_{N + 1} (v) + (1 - e^{-\tau} - \tau e^{-\tau}) \frac{\Delta B_{N + 1}(v)}{\tau}
where :math:`\tau = \frac{\alpha l}{\cos \theta}` is the *optical depth*, :math:`l` is the depth of each shell, and :math:`B(v)` is the blackbody distribution.

.. image:: media/transport.png
:width: 500 px
:alt: A diagram of how the opacity is a function of the angle and frequency of a location in the photosphere


The flux density (the desired spectrum) is then:

.. math::
F(v) = 2 \pi \int_0^{\frac{\pi}{2}} I(v, \theta) \sin \theta \cos \theta \, d \theta.
Loading

0 comments on commit c0c2275

Please sign in to comment.