Skip to content
Modelling the Inner Workings of a Star - Repository for projects in the course AST3310 at UiO
TeX C++ Python CMake Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status Coverage Status

AST3310 projects

This repository contains work related to projects in the course AST3310 at UiO. The course is organized in projects, but these are sequential and therefore presented as one repository. To see the state of the code as of completion of separate projects, tags exists for the relevant commits.


The final goal (now completed) is the have a working numerical model of a star, able to produce any relevant quantity as a function of its radius, given a set of initial conditions. Project 1 sets up the framework for computing the energy production at any point in the star, given a density, temperature and mass fractions for all the different types of particles present. In project 2, a model of the inner radiative core of a star is developed, and project 3 expands the model to include the outer convection zone.

Cross section plot of simulated star


The report folder contains PDF's with reports describing the projects in more detail. If you wish, you can generate the PDF's from source by using the supplied Makefile:

$ cd report && make

Code structure

The main body of the code base is written in C++, with plotting and other data processing done in Python. All of the latter is placed in the python/ folder.

As for the main C++ code, it is organized with all header files in include/, all sources in src/, and all tests in tests/.

The program itself is built around the main integrator method that solves the governing equations of a star. In order to do this, there are functions and data structures for computing densities, pressures, energy production etc. The latter is the most complex function, making use of several tabulated functions, reaction energies and particle types. The best way to get an overview of the code quickly, would be to sift through the include/ folder.


If you prefer, a HTML-version of the code documentation can be generated:

$ make doc

Then just open the file build/html/index.html in a browser.


To build the sources you can use the supplied CMakeLists.txt file.

$ mkdir build && cd build
$ cmake [-Ddebug=ON/OFF -Dcoverage=ON/OFF] .. # ".." is path to CMakeLists.txt
$ make

The options to cmake are optional, and defaults to using debugging (compiles with -g). This will produce executables for every file in app/, as well as a test executable unit_tests.x from tests/main.cpp.

Note that the project uses Armadillo as a strict dependency, so this will need to be installed prior to building. The following (taken from .travis.yml) is tested to work on Ubuntu 12:

$ sudo apt-get install liblapack-dev libblas-dev libboost-dev
$ # use apt-get (version might not be recent enough)
$ sudo apt-get install libarmadillo-dev
$ # or, if apt-get version is not recent enough
$ wget
$ tar xf armadillo-6.600.4.tar.gz
$ cd armadillo-6.600.4 && cmake . && make && sudo make install && cd -
You can’t perform that action at this time.