Source code accompanying the course "Methods of Computational Astrophysics" by Oliver Hahn for MSc students in astrophysics and computational science at the University of Vienna. Note that most source code is not provided via github, but only listed in the lecture notes. Provided here are only longer code pieces and is a mixture of python source files and jupyter notebooks. The code has been tested to run with Python 3.10 and may require various packages to be installed. The code is provided as is, without any guarantees. If you find any bugs or have suggestions for improvements, please let me know.
This repo is work in progress and will be regularly updated as the course proceeds over spring 2025
Not all chapters might have long code pieces that are mirrored here. The chapters in the current version of the lecture notes are:
- Chapter 1: HPC, jit compilation and parallelization with numba, mpi4py, GPU programming with JAX and MLX
- Chapter 2: computing derivatives: sympy, finite difference approximations, autodiff
- Chapter 3: the discrete Fourier transform, convolutions, spectral derivatives
- Chapter 4: ordinary differential equations, methods for stiff problems, Hamiltonian systems
- Chapter 5: Monte-Carlo sampling and simulation, stochastic DEs
- Chapter 6: the diffusion/heat equation
- Chapter 7: the Poisson equation and gravity solvers
- Chapter 8: computational fluid dynamics