Table of Contents
Fetching ...

JAX-SPH: A Differentiable Smoothed Particle Hydrodynamics Framework

Artur P. Toshev, Harish Ramachandran, Jonas A. Erbesdobler, Gianluca Galletti, Johannes Brandstetter, Nikolaus A. Adams

TL;DR

The paper addresses the lack of ML-ready, differentiable Lagrangian SPH solvers by building JAX-SPH in the JAX framework. It integrates Transport Velocity SPH, Riemann SPH, and thermal diffusion, and validates the differentiable gradients against finite differences over multiple solver steps. The authors demonstrate inverse-design and Solver-in-the-Loop applications, and provide an open-source Python package to enable easy adoption. This work paves the way for hybrid Lagrangian solvers and motivates development of foundation models for PDEs that can operate on both Eulerian and Lagrangian data.

Abstract

Particle-based fluid simulations have emerged as a powerful tool for solving the Navier-Stokes equations, especially in cases that include intricate physics and free surfaces. The recent addition of machine learning methods to the toolbox for solving such problems is pushing the boundary of the quality vs. speed tradeoff of such numerical simulations. In this work, we lead the way to Lagrangian fluid simulators compatible with deep learning frameworks, and propose JAX-SPH - a Smoothed Particle Hydrodynamics (SPH) framework implemented in JAX. JAX-SPH builds on the code for dataset generation from the LagrangeBench project (Toshev et al., 2023) and extends this code in multiple ways: (a) integration of further key SPH algorithms, (b) restructuring the code toward a Python package, (c) verification of the gradients through the solver, and (d) demonstration of the utility of the gradients for solving inverse problems as well as a Solver-in-the-Loop application. Our code is available at https://github.com/tumaer/jax-sph.

JAX-SPH: A Differentiable Smoothed Particle Hydrodynamics Framework

TL;DR

The paper addresses the lack of ML-ready, differentiable Lagrangian SPH solvers by building JAX-SPH in the JAX framework. It integrates Transport Velocity SPH, Riemann SPH, and thermal diffusion, and validates the differentiable gradients against finite differences over multiple solver steps. The authors demonstrate inverse-design and Solver-in-the-Loop applications, and provide an open-source Python package to enable easy adoption. This work paves the way for hybrid Lagrangian solvers and motivates development of foundation models for PDEs that can operate on both Eulerian and Lagrangian data.

Abstract

Particle-based fluid simulations have emerged as a powerful tool for solving the Navier-Stokes equations, especially in cases that include intricate physics and free surfaces. The recent addition of machine learning methods to the toolbox for solving such problems is pushing the boundary of the quality vs. speed tradeoff of such numerical simulations. In this work, we lead the way to Lagrangian fluid simulators compatible with deep learning frameworks, and propose JAX-SPH - a Smoothed Particle Hydrodynamics (SPH) framework implemented in JAX. JAX-SPH builds on the code for dataset generation from the LagrangeBench project (Toshev et al., 2023) and extends this code in multiple ways: (a) integration of further key SPH algorithms, (b) restructuring the code toward a Python package, (c) verification of the gradients through the solver, and (d) demonstration of the utility of the gradients for solving inverse problems as well as a Solver-in-the-Loop application. Our code is available at https://github.com/tumaer/jax-sph.
Paper Structure (13 sections, 2 equations, 10 figures, 1 table)

This paper contains 13 sections, 2 equations, 10 figures, 1 table.

Figures (10)

  • Figure 1: Gradient magnitudes with JAX Autograd and with finite differences on Taylor-Green vortex (left) and lid-driven cavity (right).
  • Figure 2: Inverse problems of finding the initial coordinates (light blue) given the final coordinates (blue) of a falling water cube simulation spanning 100 SPH steps. The optimization spans 15 gradient descent steps from orange to red. Free fall case (left) and wall-interactions (right).
  • Figure 3: Evolution of the velocity magnitude in reverse Poiseuille flow. The stamps in each image refer to the respective step of the original SPH simulation, i.e., 500 means 10 000 SPH steps.
  • Figure 4: 2D Taylor Green vortex velocity magnitudes at the start of the simulation (left) and at $t=5$ (right), calculated using transport velocity formulation SPH.
  • Figure 5: 2D Taylor Green vortex SPH method comparison for $u_{max}$ (left) and $E_{kin}$ (right) between standard SPH, transport velocity formulation SPH, and Riemann SPH at $dx=0.02$ and $dx=0.01$.
  • ...and 5 more figures