About

Quokka is a high-resolution shock capturing AMR radiation hydrodynamics code using the AMReX library (Zhang et al., 2019)1 to provide patch-based adaptive mesh functionality. We take advantage of the C++ loop abstractions in AMReX in order to run with high performance on either CPUs, NVIDIA GPUs, or AMD GPUs.

Development methodology

The code is written in modern C++17, using MPI for distributed-memory parallelism, with the AMReX GPU abstraction compiling as either native CUDA code or native HIP code when GPU support is enabled.

We use a modern C++ development methodology, using CMake, CTest, and Doxygen. We use clang-format for automated code formatting, and clang-tidy and SonarCloud for static analysis, in order to audit code adherence to the ISO C++ Core Guidelines and the MISRA C/C++ guidelines. We additionally ensure the code is free of memory corruption bugs using Clang's AddressSanitizer.

There is an automated suite of test problems that can be run using CTest. Each test problem has a validated solution against which it is compared (usually in L1 norm) in order to pass.

Code development is managed using pull requests (PRs) on GitHub. In an effort to ensure long-term code maintainability, all code must be written in C++17 following the Coding Guidelines, it must compile using Clang without warnings, all tests must pass, and the static analyzers must show zero new bugs before a pull request is merged with the main branch.

User assistance and bug reports are managed via Discussions and Issues in the GitHub repository.

Numerical methods

Hydrodynamics

The hydrodynamics solver is an unsplit method, using the piecewise parabolic method (Colella & Woodward, 1984)2 for reconstruction in the primitive variables, the HLLC Riemann solver (Toro, 2013)3 for flux computations, and a method-of-lines formulation for the time integration.

We use the method of (Miller & Colella, 2002)4 to reduce the order of reconstruction in zones where shocks are detected in order to suppress spurious oscillations in strong shocks.

Radiation

The radiation hydrodynamics formulation is based on the mixed-frame moment equations (e.g., (Mihalas & Mihalas, 1984)5). The radiation subsystem is coupled to the hydrodynamic subsystem via operator splitting, with the hydrodynamic update computed first, followed by the radiation update, with the latter update including the source terms corresponding to the radiation four-force applied to both the radiation and hydrodynamic variables. A method-of-lines formulation is also used for the time integration, with the time integration done by the same integrator chosen for the hydrodynamic subsystem.

The hyperbolic radiation subsystem is solved using an unsplit method, using PPM for reconstruction of the moment variables, with fluxes computed via the HLL Riemann solver, with the wavespeeds computed using the 'frozen Eddington factor' approximation (Balsara, 1999)6, which is more robust than using the eigenvalues of the M1 system (Skinner & Ostriker, 2013)7 itself.

We reconstruct the energy density and the reduced flux \(f = F/cE\), in order to maintain the flux-limiting condition \(F \le cE\) in discontinuous and near-discontinuous radiation flows.

To ensure the correct behavior of the advection terms in the asymptotic diffusion limit (Lowrie & Morel, 2001)8, we modify the Riemann solver according to (Skinner, Dolence, Burrows, Radice, & Vartanyan, 2019)9. We use the Lorentz-factor local closure of (Levermore, 1984)10 to compute the variable Eddington tensor.

The source terms corresponding to matter-radiation energy exchange are solved implicitly with the method of (Howell & Greenough, 2003)11 following the hyperbolic subsystem update. The matter-radiation momentum update is likewise computed implicitly in order to maintain the correct behavior in the asymptotic diffusion limit (Skinner, Dolence, Burrows, Radice, & Vartanyan, 2019)9.


  1. Zhang, W., Almgren, A., Beckner, V., Bell, J., Blaschke, J., Chan, C., … Zingale, M. (2019). AMReX: A framework for block-structured adaptive mesh refinement. Journal of Open Source Software, 4(37), 1370. https://doi.org/10.21105/joss.01370 

  2. Colella, P., & Woodward, P. R. (1984). The Piecewise Parabolic Method (PPM) for Gas-Dynamical Simulations. Journal of Computational Physics, 54, 174–201. https://doi.org/10.1016/0021-9991(84)90143-8 

  3. Toro, E. F. (2013). Riemann solvers and numerical methods for fluid dynamics: A practical introduction. Springer Berlin Heidelberg. Retrieved from https://books.google.com.au/books?id=zkLtCAAAQBAJ 

  4. Miller, G. H., & Colella, P. (2002). A Conservative Three-Dimensional Eulerian Method for Coupled Solid-Fluid Shock Capturing. 183(1), 26–82. https://doi.org/10.1006/jcph.2002.7158 

  5. Mihalas, D., & Mihalas, B. W. (1984). Foundations of radiation hydrodynamics. Oxford University Press. 

  6. Balsara, D. S. (1999). An analysis of the hyperbolic nature of the equations of radiation hydrodynamics. 61(5), 617–627. https://doi.org/10.1016/S0022-4073(98)00049-1 

  7. Skinner, M. A., & Ostriker, E. C. (2013). A Two-moment Radiation Hydrodynamics Module in Athena Using a Time-explicit Godunov Method. 206(2), 21. https://doi.org/10.1088/0067-0049/206/2/21 

  8. Lowrie, R. B., & Morel, J. E. (2001). Issues with high-resolution Godunov methods for radiation hydrodynamics. 69, 475–489. https://doi.org/10.1016/S0022-4073(00)00097-2 

  9. Skinner, M. A., Dolence, J. C., Burrows, A., Radice, D., & Vartanyan, D. (2019). FORNAX: A Flexible Code for Multiphysics Astrophysical Simulations. 241(1), 7. https://doi.org/10.3847/1538-4365/ab007f 

  10. Levermore, C. D. (1984). Relating Eddington factors to flux limiters. 31(2), 149–160. https://doi.org/10.1016/0022-4073(84)90112-2 

  11. Howell, L. H., & Greenough, J. A. (2003). Radiation diffusion for multi-fluid Eulerian hydrodynamics with adaptive mesh refinement. Journal of Computational Physics, 184(1), 53–78. https://doi.org/10.1016/S0021-9991(02)00015-3