Astrophysics Simulation Codes

  • a representative image of a Castro simulation

    Castro: compressible hydrodynamics

    Castro is our fully compressible hydrodynamics code built on the adaptive mesh refinement library AMReX. It supports self-gravity, diffusion, general equations of state, nuclear reactions, and more.
  • a representative image of a MAESTROeX simulation

    MAESTROeX: low Mach number stratified flows

    MAESTROeX is a low Mach number hydrodynamics code built on the AMReX library. It supports a general equation of state and is designed for problems involving stellar convection.
  • AMReX-Astro Microphysics

    AMReX-Astro Microphysics is a collection of reaction networks, EOSes, and other physics modules for use in our AMReX-Astrophysics suite of hydrodynamics codes.
  • a representative image of a pyro simulation

    pyro: a python hydro code

    pyro is a tutorial code designed to introduce new students into computational hydrodynamics. The python code implements 2-d solvers for linear advection, compressible hydrodynamics, multigrid, implicit diffusion, and incompressible hydrodynamics.
  • pynucastro logo

    pynucastro: python for nuclear astrophysics

    pynucastro interfaces to nuclear reaction rate databases and allows for the exploration of reaction networks and the output of network ODE righthand sides for integrating in a stellar physics code.
  • PPMpy: python piecewise parabolic method

    ppmpy is a simple 1-d compressible hydrodynamics code that implements the piecewise parabolic method. It is written in python and has many methods to visualize the steps that PPM is taking in the reconstruction of the data.

Astronomy / Numerical Methods Education Codes

  • Computational Astro Jupyter Book

    An interactive introduction to the core numerical methods used in astrophysics, including those for astrophysical simulations, written as a collection of Jupyter notebooks that can run in the cloud.

Simple Numerical PDE Examples

  • Godunov methods for linear advection

    A simple 1-d second-order accurate finite-volume method for the linear advection equation. A choice of reconstruction is provided: Godunov (piecewise constant), piecewise linear, and piecewise parabolic (PPM). The code is structured to with the subroutines you would find in a typical hydrodynamics code.

    Fortran version:
    advect.f90

    python version (no ppm):
    advection.py

  • Multigrid examples

    A simple python class for solving 1-d Poisson and constant-coefficient Helmholtz equations on a finite-volume grid. The driver program (mg_test.py) solves uxx = sin(x), u(0)=0, u(1)=0. The discretization is second order (mg-converge.png).

    multigrid solver github page

    Also see pyro for a 2-d solver.

  • Diffusion

    Simple 1-d second-order explicit and implicit diffusion codes. The implicit code uses a Crank-Nicolson time discretization and the banded matrix solver from SciPy.

    diffusion_explicit.py
    diffusion_implicit.py

    Also see pyro for a 2-d solver.

  • 2nd order finite volume method for Burgers' equation

    A simple second-order accurate finite-volume method for the 1-d Inviscid Burgers' Equation:
    ut + [1/2 u2]x = 0
    A choice of limiters is provided, and periodic BCs are implemented. The code is structured to with the subroutines you would find in a typical hydrodynamics code.

    Fortran version:
    burger.f90

    python version:
    burgers.py

  • Viscous Burgers' equation solver

    Solve:
    ut + [ 1/2 u2 ]x = ε uxx
    using a second-order Godunov method for advection and Crank-Nicolson implicit diffusion for the viscous term. The two processes are coupled together.

    burgervisc.py

  • Diffusion-reaction equation

    Solve:
    φt = κ φxx + (1/τ) R(φ)
    using Crank-Nicolson diffusion and Strang-split reactions. This setup gives rises to a spreading burning front.

    diffreact.py

Parallel Programming

  • OpenMP Relaxation Solver of Poisson's Equation

    Solve the 2-d Poisson equation with pure relaxation (we do a fixed number of iterations). This is parallelized with OpenMP.

    relax-omp.f90

  • MPI Relaxation Solver of Poisson's Equation

    Solve the 2-d Poisson equation with pure relaxation (we do a fixed number of iterations). This is parallelized with MPI, doing a one-dimensional domain decomposition in the x direction.

    relax-mpi.f90

  • Parallel I/O Tutorial

    A simple parallel I/O tutorial showing various ways to output data from a parallel hydrodynamics code into a single HDF5 file.

Utilities / Other Examples

  • Simple Backup Script

    A simple script for automatically backing up several directories in your home directory to another disk mounted on your local system. To have this run automatically, set it up as a cron job.

    backup-machine.py

  • Research Journal

    A python script to manage a research journal / logbook in restructured text / Sphinx. It is distributed (uses git under the hood), so you can use it on all of the machines you work on and keep things in sync, and it is commandline driven, so the barrier to entry to make a journal entry is very low. It supports images in an entry, editing previous entries, and has simple sub-commands to build and display your web-based journal.

    pyjournal2