Shaderous: A Browser-based Hydrodynamics Code for Physics Research and Teaching
Abstract
Shaderous is a three-dimensional code for compressible gas dynamics and magnetohydrodynamics that runs in WebGPU compute shaders in a web browser on any vendor's GPU. It combines an unsplit MUSCL-Hancock scheme and HLLC fluxes with a multigrid Poisson solver, block-structured adaptive mesh refinement with per-block timesteps, constrained transport with HLLD fluxes, point masses with sinks, gray radiation transport with the M1 closure, implicit pressure for low Mach numbers, tabulated equations of state from degenerate electrons to rock and iron, cooling, viscosity, conduction, resistivity, mixtures of gases, and nuclear burning by a neural network trained on a 13-isotope reaction network. A setup is shared as a link and runs on a student's own laptop or phone, so the code suits teaching at every level. A run is limited to one GPU: the largest adaptive mesh so far held about 175 million cells on an NVIDIA H200. It therefore suits parameter studies, run as sweeps from the command line, rather than the largest single simulations. Three aspects of the design are, as far as we can find, new. First, the hydrodynamic solver stores no face flux. The two cells that share a face compute bit-identical fluxes, so cells at boundaries between levels and between timesteps recompute their neighbors' fluxes instead of keeping a flux register. Mass, momentum and energy are conserved to round-off on the adaptive mesh, and compensated sums keep the divergence of the magnetic field at round-off. Second, the whole step runs on the GPU: the timestep and the assignment of blocks to time bins are reduced there, and ghost cells are computed as they are loaded rather than exchanged. Third, the code computes in single precision yet reproduces a range of astrophysical systems accurately, from stars and atmospheres in hydrostatic balance to shocks, gravitational collapse and magnetized flows, in 206 validation tests.
Create a lesson
Metadata
- Categories
- astro-ph.IM, physics.ed-ph
- Comments
- 54 pages, 13 figures, 12 tables. No journal submission plans at this time
Related papers
RIFT for the O4 era: operating points, calibration marginalization, and cross-code validation
Shared title terminologyastro-ph.IMR. O'Shaughnessy, A. Jan, J. Lange et al.
Computing the Wave: Bridging Gravitational Wave and High-Energy-Physics software (with modular ROOT extensions)
Shared title terminologyastro-ph.IMMarco Meyer-Conde, Hirotaka Takahashi, Nobuyuki Kanda et al.
PLATON 7: An ultra-fast exoplanet atmospheric retrieval code
Shared title terminologyastro-ph.IMMichael Zhang, Tyler Fairnington, Yayaati Chachan et al.
Model-Based Low-Order Wavefront Sensing and Control with a Fully Physical Digital Twin on MagAO-X
Shared title terminologyastro-ph.IMM. Mars, S. Y. Haffert, J. R. Males et al.
bihalofit-JAX: A Differentiable Code for the Nonlinear Matter Bispectrum and its Projected Statistics
Shared title terminologyastro-ph.IMAlexander Roskill, Matteo Zennaro
A parametrized simulation code to simulate the response of ground detector arrays to Extensive Air Showers above 100 TeV
Shared title terminologyastro-ph.IMAndrea Chiavassa, Andrea Negro