diffhydro: Inverse Multiphysics Modeling and Embedded Machine Learning in Astrophysical Flows
Benjamin Horowitz, Zarija Lukić, Kentaro Nagamine, Yuri Oku
TL;DR
diffhydro extends differentiable hydrodynamics to include radiative heating/cooling, OU-driven turbulence, and self-gravity via a multigrid Poisson solver, enabling end-to-end gradient-based inference and solver-in-the-loop learning on large-scale astrophysical flows. Built in JAX with accelerator-native execution, it provides a modular finite-volume solver with custom adjoints, supports multi-device scaling, and validates against Athena++ across standard tests while performing gradient-based reconstructions of complex initial conditions. The work demonstrates practical PDE-constrained optimization and differentiable ML augmentation within a rigorous astrophysical context, including solver-in-the-loop neural correctors and high-resolution simulations up to $1024^3$ cells. These capabilities offer a pathway to data-driven, physically constrained inference and model calibration directly inside the forward model, with potential to connect simulations to multi-wavelength observations and statistical cosmology through differentiable pipelines.
Abstract
We present the extension of the differentiable hydrodynamics code, diffhydro, enabling scalable PDE-constrained inference and integrated hybrid physics-ML models for a wide range of astrophysical applications. New physics additions include radiative heating/cooling, OU-driven turbulence, and self-gravity via multigrid Poisson. We demonstrate good agreement with the Athena++ code on standard validation tests such as Sedov-Taylor, Kelvin-Helmholtz, and driven/decaying turbulence. We further introduce a solver-in-the-loop neural corrector that reduces coarse-grid errors during time integration while preserving stability. The addition of custom adjoints facilitates efficient end-to-end gradients and multi-device scaling. We present simulations up to 1024^3 elements, run on distributed GPU systems, and we show gradient-based reconstructions of complex initial conditions in turbulent, self-gravitating, radiatively cooling flows. The code is written in JAX, and the solver's modular finite-volume components are compiled by XLA into fused accelerator kernels, delivering high-throughput forward runs and tractable differentiation through long integrations.
