JAX-SPH: A Differentiable Smoothed Particle Hydrodynamics Framework (2403.04750v2)
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.
- TensorFlow, Large-scale machine learning on heterogeneous systems, November 2015.
- A generalized wall boundary condition for smoothed particle hydrodynamics. Journal of Computational Physics, 231(21):7057–7075, 2012.
- A transport-velocity formulation for smoothed particle hydrodynamics. Journal of Computational Physics, 241:292–307, 2013.
- Universal physics transformers, 2024.
- Inverse design for fluid-structure interactions using graph network simulators, 2022.
- Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
- Jax-fluids: A fully-differentiable high-order computational fluid dynamics solver for compressible two-phase flows. Computer Physics Communications, pp. 108527, 2022. ISSN 0010-4655. doi: https://doi.org/10.1016/j.cpc.2022.108527.
- Small-scale structure of the taylor–green vortex. Journal of Fluid Mechanics, 130:411–452, 1983.
- The taylor-green vortex and fully developed turbulence. Journal of Statistical Physics, 34(5-6):1049–1063, 1984.
- JAX: composable transformations of Python+NumPy programs, 2018.
- Machine Learning for Partial Differential Equations. arXiv preprint arXiv:2303.17078, March 2023.
- Paul W Cleary. Modelling confined multi-material heat and mass flows using sph. Applied Mathematical Modelling, 22(12):981–993, 1998.
- Numerical simulation of interfacial flows by smoothed particle hydrodynamics. Journal of computational physics, 191(2):448–475, 2003.
- Dualsphysics: Open-source parallel cfd solver based on smoothed particle hydrodynamics (sph). Computer Physics Communications, 187:204–216, 2015.
- Reverse poiseuille flow: the numerical viscometer. In Aip conference proceedings, volume 1027, pp. 1432–1434. American Institute of Physics, 2008.
- High-re solutions for incompressible flow using the navier-stokes equations and a multigrid method. Journal of computational physics, 48(3):387–411, 1982.
- Evaluating derivatives: principles and techniques of algorithmic differentiation. SIAM, 2008.
- Learning to control pdes with differentiable physics. In International Conference on Learning Representations, 2020.
- Physics-informed neural networks for inverse problems in supersonic flows. Journal of Computational Physics, 466:111402, 2022.
- Composing partial differential equations with physics-aware neural networks. In International Conference on Machine Learning, pp. 10773–10801. PMLR, 2022.
- Patrick Kidger. On neural differential equations, 2022.
- Machine learning–accelerated computational fluid dynamics. Proceedings of the National Academy of Sciences, 118(21):e2101784118, 2021.
- Smoothed Particle Hydrodynamics Techniques for the Physics Based Simulation of Fluids and Solids. In Wenzel Jakob and Enrico Puppo (eds.), Eurographics 2019 - Tutorials. The Eurographics Association, 2019. doi: 10.2312/egt.20191035.
- Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. doi: 10.1109/5.726791.
- Graph neural network-accelerated lagrangian fluid simulation. Computers & Graphics, 103:201–211, 2022.
- Learning the dynamics of physical systems from sparse observations with finite element networks. In International Conference on Learning Representations (ICLR), 2022.
- jusph: A julia-based open-source package of parallel smoothed particle hydrodynamics (sph) for dam break problems. SoftwareX, 19:101151, 2022.
- A comparison of automatic differentiation and continuous sensitivity analysis for derivatives of differential equation solutions. In 2021 IEEE High Performance Extreme Computing Conference (HPEC), pp. 1–9. IEEE, 2021.
- Joe J Monaghan. Simulating free surface flows with sph. Journal of computational physics, 110(2):399–406, 1994.
- Joe J Monaghan. Smoothed particle hydrodynamics. Reports on progress in physics, 68(8):1703, 2005.
- Modeling low reynolds number incompressible flows using sph. Journal of computational physics, 136(1):214–226, 1997.
- A comparison of the continuous and discrete adjoint approach to automatic aerodynamic optimization. In 38th Aerospace sciences meeting and exhibit, pp. 667, 2000.
- PyTorch: An Imperative Style, High-Performance Deep Learning Library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’Alché Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019.
- Daniel J Price. Smoothed particle hydrodynamics and magnetohydrodynamics. Journal of Computational Physics, 231(3):759–794, 2012.
- Pysph: A python-based framework for smoothed particle hydrodynamics. ACM Trans. Math. Softw., 47(4), sep 2021. ISSN 0098-3500. doi: 10.1145/3460773.
- Learning to simulate complex physics with graph networks. In International Conference on Machine Learning, 2020.
- The graph neural network model. IEEE transactions on neural networks, 20(1):61–80, 2008.
- Spnets: Differentiable fluid dynamics for deep neural networks, 2018.
- Jax m.d. a framework for differentiable physics. In Advances in Neural Information Processing Systems, volume 33. Curran Associates, Inc., 2020.
- Physics-based Deep Learning. arXiv preprint arXiv:2109.05237, 2021.
- Learning lagrangian fluid mechanics with E(3)𝐸3\text{$E$}(3)italic_E ( 3 )-equivariant graph neural networks. In Frank Nielsen and Frédéric Barbaresco (eds.), Geometric Science of Information, pp. 332–341, Cham, 2023a. Springer Nature Switzerland. ISBN 978-3-031-38299-4.
- Lagrangebench: A lagrangian fluid mechanics benchmarking suite, 2023b.
- On the relationships between graph neural networks for the simulation of physical systems and classical numerical methods, 2023c.
- Neural sph: Improved neural modeling of lagrangian fluid dynamics, 2024.
- Solver-in-the-Loop: Learning from Differentiable Physics to Interact with Iterative PDE-Solvers. Advances in Neural Information Processing Systems, 2020.
- Holger Wendland. Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree. Advances in computational Mathematics, 4:389–396, 1995.
- A generalized transport-velocity formulation for smoothed particle hydrodynamics. Journal of Computational Physics, 337:216–232, 2017a.
- A weakly compressible sph method based on a low-dissipation riemann solver. Journal of Computational Physics, 335:605–620, 2017b.
- Sphinxsys: An open-source multi-physics and multi-resolution library based on smoothed particle hydrodynamics. Computer Physics Communications, 267:108066, 2021.