My first project this week was to get correct data from an HLLD solver. After extracting the HLLD solver from Athena last week I ran some shock tubes using Athena++, plotted the results to find the locations of the waves, then extractracted the states on each side of each wave. After that I plugged those states into the HLLD solver to get known correct fluxes. In addition to the cross-wave states I only created some tests with special cases, negative density, all zeros, degenerate state, etc.

Writing dozens of tests for the HLLD solver would have required duplicating a ton of code. To deal with this I wrote a test fixture that handles most of the actual running and testing so that the user just has to provide the states, adiabatic index, etc. I tested it by implementing it the HLLC solver and made a PR with the new changes. While working on this I also implemented a processor agnostic function for computing the MHD energy in a cell so I’ll need to write some tests for that too. I found that Athena does something so that their adiabatic index variable, Gamma, appears to actually be \( \gamma - 1 \) but I haven’t verified that. I will look into that more next week and get it ironed out; I’ll probably have to rerun the flux calculations to get new fiducial fluxes.

Brio & Wu Brio & Wu run by Athena++. Fields with constant values not shown

Dai & Woodward Dai & Woodward shock tube run by Athena++. Fields with constant values not shown

Ryu & Jones Ryu & Jones shock tube 4d run by Athena++. Fields with constant values not shown

EFR Einfeldt Strong Rarefaction run by Athena++. Fields with constant values not shown


  • Figured out how to use VS Code for Jupyter Notebooks
  • Ryu & Jones 19951 has a ton of great MHD shock tubes that would make fantastic system tests once MHD is done.

Original HLLD paper: Miyoshi & Kusano 2005

Blog post on the HLLD Algorithm: HLLD Algorithm


  1. Ryu, D., Jones, T. W., & Frank, A. (1995). Numerical Magnetohydrodynamics in Astrophysics: Algorithm and Tests for Multi-Dimensional Flow 1. The Astrophysical Journal.…452..785R ↩︎

This post is licensed under CC BY 4.0 by the author.