โ† All projects
Simulation

Stellar Fusion and Stratification

Modelling nuclear fusion, structure, and convective energy transport in a solar-like star

Python ยท Stellar Astrophysics

GitHub repository

I developped this simulation as part of the undergraduate course Astrophysical Plasma and Stellar Interiors (AST3310) at UiO. The project simulates a solar-like star in three connected parts. The first models the nuclear reaction rates and energy production in the core, tracking the PP chains and CNO cycle as functions of temperature and density to obtain the core's energy generation rate.

The second part solves the stellar structure equations governing hydrostatic equilibrium, mass conservation, and energy transport,

\begin{align*} \frac{\text{d}P}{\text{d}m} &= -\frac{Gm}{4\pi r^4}, \\ \frac{\text{d}r}{\text{d}m} &= \frac{1}{4\pi r^2 \rho}, \end{align*}

to determine where energy transport is radiative and where the temperature gradient becomes steep enough for the star to stratify into a convective envelope.

The third part resolves the convective motion in that outer envelope directly, solving the hydrodynamic equations on a 2D grid to model rising and sinking plumes of gas transporting energy outward beneath the stellar surface. It does this by solving the hydrodynamic equations

\begin{align*} \frac{\partial\rho}{\partial t} + \nabla\cdot(\rho\mathbf{u})&=0,\\ \frac{\partial\rho\mathbf{u}}{\partial t} + \nabla\cdot(\rho\mathbf{u}\otimes \mathbf{u}) &= -\nabla P + \rho\mathbf{g},\\ \frac{\partial e}{\partial t} + \nabla\cdot (e\mathbf{u}) &= -P\nabla\cdot \mathbf{u}. \end{align*}

The code also produces pretty animations :)

Simulated convective motion