NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Neural SPH: Improved Neural Modeling of Lagrangian Fluid Dynamics

Artur Toshev, Jonas A. Erbesdobler, Nikolaus A. Adams, Johannes Brandstetter

TL;DR

Neural SPH improves the stability and physical accuracy of Graph Neural Network (GNN) fluid simulators by integrating classical Smoothed Particle Hydrodynamics (SPH) principles. By explicitly handling external forces and introducing an inference-time particle relaxation step, the authors achieve rollout accuracies that are often orders of magnitude better than baseline neural models.

What Problem Does This Paper Address?

Simulating fluids using Lagrangian (particle-based) methods is essential for engineering, but classical solvers are computationally expensive. While GNNs have emerged as fast "surrogates" for these solvers, they struggle with long-term stability.

A primary culprit is particle clustering. In classical SPH, this is known as "tensile instability"—a numerical artifact where particles clump together or leave unnatural voids. GNNs, when trained on coarse-grained data, often "forget" the underlying physics that prevents this clumping. Furthermore, GNNs often struggle to disentangle internal fluid dynamics from external forces like gravity or wall interactions, leading to "virtual wall" artifacts where the fluid behaves as if it hit an invisible barrier.

Methods

The authors propose Neural SPH, which enhances standard GNN architectures (like GNS or SEGNN) with two main components:

  1. External Force Correction & Smoothing: Instead of forcing the GNN to learn gravity implicitly, the authors subtract the effective external force from the training target. For complex, discontinuous forces (like those in shearing flows), they apply a Gaussian convolution to "smooth" the force, accounting for how a particle moves through different force regions during a single discrete time step.
  2. SPH Relaxation Routine: This is a post-processing step applied during inference. After the GNN predicts the next state, the system runs 1–5 steps of a classical SPH update (using pressure and/or viscosity terms). This acts as a "physical refiner," nudging particles into a more regular, physically plausible distribution without requiring the GNN to be retrained.
Comparison of different models on a 2D dam break. The baseline GNS (top) shows significant unphysical density fluctuations and artifacts, while the Neural SPH versions closely match the SPH ground truth.

Datasets

The study utilizes the LagrangeBench suite, a comprehensive benchmark for Lagrangian fluid dynamics. The models were evaluated on seven diverse 2D and 3D datasets:

  • Taylor-Green Vortex (TGV): Decaying flow used to test basic fluid structures.
  • Reverse Poiseuille Flow (RPF): A shearing flow with discontinuous external forces.
  • Lid-Driven Cavity (LDC): Fluid in a box moved by a sliding lid, testing wall boundary interactions.
  • Dam Break (DAM): A classic free-surface problem where a column of water collapses under gravity.

Key Insights and Ideas

  • The "Aha" Moment on Clustering: The authors quantified clustering by looking at the "number of neighbors" histogram. Baseline GNNs significantly deviate from the expected physical distribution, confirming that clustering is a major failure mode.
Histogram showing the mismatch in the number of neighbors due to particle clustering in GNS compared to SPH.
  • Disentanglement is Key: By explicitly removing external forces from the GNN's learning objective, the model can focus entirely on the complex internal interactions of the fluid.
  • Multiscale Stabilization: The SPH relaxation routine effectively uses a larger interaction radius than the GNN. This allows the "classical" part of the solver to stabilize long-range density distributions while the "neural" part handles the short-range dynamics.
  • Inference-Only Correction: One of the most practical insights is that the relaxation routine works best when applied only during inference. Attempting to include it during training ("negative relaxation") actually degraded performance.

Key Results

The improvements are dramatic across all metrics, including position Mean Squared Error (MSE), Sinkhorn divergence (a measure of distribution conservation), and kinetic energy error.

  • Accuracy: In the 2D Lid-Driven Cavity task, Neural SPH improved the Sinkhorn divergence from $3.1 \times 10^{-4}$ to $2.8 \times 10^{-7}$—a thousand-fold improvement in maintaining a physical particle distribution.
  • Stability: The relaxation routine prevents the unphysical "clumping" seen in the baseline GNS, maintaining a smooth density field and significantly lowering Sinkhorn divergence over long rollouts.
  • Generalization: The techniques proved effective for both non-equivariant (GNS) and equivariant (SEGNN) architectures, suggesting these physics-priors are broadly applicable.

Limitations and Future Work

  • Hyperparameter Sensitivity: The relaxation routine introduces new hyperparameters (like the number of steps and the pressure coefficient $\alpha$) that currently require manual tuning for each dataset.
  • Computational Overhead: Adding relaxation steps increases inference time by roughly 5% to 15% per step. While the authors suggest this can be optimized with C++ implementations, it remains a trade-off between speed and stability.
  • Defining "Good Enough": The authors note that for some very high-performing baselines (like 3D RPF), the improvements were marginal, suggesting there is a threshold of model quality beyond which simple relaxation adds little value. Future work could involve automating the "trigger" for when relaxation is needed.

Summary updated

BibTeX
@inproceedings{toshev2024neural,
  author = {Artur Toshev and Jonas A. Erbesdobler and Nikolaus A. Adams and Johannes Brandstetter},
  title = {{Neural SPH: Improved Neural Modeling of Lagrangian Fluid Dynamics}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=Pbey7LqBRl},
}
Figure