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

Abstract

Smoothed particle hydrodynamics (SPH) is omnipresent in modern engineering and scientific disciplines. SPH is a class of Lagrangian schemes that discretize fluid dynamics via finite material points that are tracked through the evolving velocity field. Due to the particle-like nature of the simulation, graph neural networks (GNNs) have emerged as appealing and successful surrogates. However, the practical utility of such GNN-based simulators relies on their ability to faithfully model physics, providing accurate and stable predictions over long time horizons - which is a notoriously hard problem. In this work, we identify particle clustering originating from tensile instabilities as one of the primary pitfalls. Based on these insights, we enhance both training and rollout inference of state-of-the-art GNN-based simulators with varying components from standard SPH solvers, including pressure, viscous, and external force components. All Neural SPH-enhanced simulators achieve better performance than the baseline GNNs, often by orders of magnitude in terms of rollout error, allowing for significantly longer rollouts and significantly better physics modeling.

Introduction

Simulating fluids using a Lagrangian (particle-based) approach is a cornerstone of modern engineering, yet it remains computationally intensive. Graph Neural Networks (GNNs) have recently gained traction as efficient surrogates for these simulations. However, GNN-based simulators often suffer from long-term instability, most notably particle clustering. This phenomenon, akin to tensile instability in classical SPH, causes particles to clump together or form unphysical voids, leading to simulation collapse over extended rollouts. Furthermore, GNNs frequently struggle to implicitly learn constant external forces like gravity, particularly when trained on temporally coarsened data.

Methods: Integrating Physics into GNNs

Neural SPH addresses these challenges by augmenting standard GNN architectures (such as GNS) with two physics-inspired components:

  1. External Force Correction: Instead of requiring the GNN to learn external forces (e.g., gravity) from data, these forces are handled analytically. During training, the known external force is subtracted from the target acceleration, allowing the network to focus on learning complex internal interactions like pressure and viscosity. The force is then added back during inference.
  2. SPH Relaxation: To counteract particle clustering during rollout, the authors introduce a lightweight SPH-based relaxation step. After the GNN predicts new particle positions, a classical SPH routine applies a small corrective "nudge" based on pressure and viscosity gradients. This ensures the particle distribution remains physically plausible without needing to retrain the underlying GNN.
Visual comparison of particle distributions in a Dam Break scenario. The baseline GNS shows significant clumping (red areas), while the addition of gravity correction ($GNS_g$) and SPH relaxation ($GNS_{g,p}$) progressively aligns the distribution with the SPH ground truth.

Key Results and Discussion

The proposed enhancements were evaluated using the LagrangeBench framework across several 2D and 3D datasets, including the Taylor-Green Vortex, Lid-Driven Cavity, and Dam Break scenarios.

Rollout Accuracy and Stability

Neural SPH-enhanced models demonstrated superior performance across all metrics. In the 2D Dam Break test, the position error (MSE) was reduced by more than 50% compared to the baseline GNS. More importantly, the models remained stable for the entire 400-step rollout, whereas baseline GNNs often became chaotic or "blew up" much earlier.

Physical Validity

A critical finding was the elimination of "virtual wall" artifacts. Standard GNNs often learn to stop fluid motion prematurely in gravity-driven scenarios; explicit gravity handling resolved this. Additionally, the SPH relaxation step significantly improved boundary adherence, preventing particles from "leaking" through walls in the Lid-Driven Cavity test.

Quantitative comparison of rollout metrics over 400 steps. Neural SPH variants (colored lines) maintain significantly lower kinetic energy error ($MSE_{Ekin}$) and better density distributions (lower Sinkhorn divergence) compared to the baseline GNS (black line).

Conclusion

Neural SPH demonstrates that integrating classical physics principles—specifically external force handling and SPH-based relaxation—can dramatically improve the stability and accuracy of GNN-based fluid simulators. While the relaxation step introduces a minor inference overhead (approx. 5-40%), the resulting gains in physical fidelity and long-term stability are substantial. Future work will focus on automating hyperparameter tuning for the relaxation steps and extending these hybrid methodologies to broader classes of physical systems.

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