# CraftSPH: A composable framework for differentiable smoothed particle hydrodynamics implemented in PyTorch

DevFeed: [CraftSPH: A composable framework for differentiable smoothed particle hydrodynamics implemented in PyTorch](<https://devfeed.tech/articles/craftsph-a-composable-framework-for-differentiable-smoothed-particle-hydrodynamics-implemented-in-pytorch-103827.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2609.38208>)

Author: Gen Matono, Shujiro Fujioka, Mayuko Nishio

Published: 2026-10-28T04:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Computational Fluid Dynamics (CFD)](<https://devfeed.tech/topics/cfd.md>), [PyTorch](<https://devfeed.tech/topics/pytorch.md>)

Tags: [automatic](<https://devfeed.tech/tags/automatic.md>), [coupling](<https://devfeed.tech/tags/coupling.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-na](<https://devfeed.tech/tags/cs-na.md>), [deep-learning](<https://devfeed.tech/tags/deep-learning.md>), [flow](<https://devfeed.tech/tags/flow.md>), [fluid](<https://devfeed.tech/tags/fluid.md>), [fluid-dynamics](<https://devfeed.tech/tags/fluid-dynamics.md>), [framework](<https://devfeed.tech/tags/framework.md>), [math-na](<https://devfeed.tech/tags/math-na.md>), [physics-flu-dyn](<https://devfeed.tech/tags/physics-flu-dyn.md>), [pytorch](<https://devfeed.tech/tags/pytorch.md>)

## AI overview

CraftSPH is a modular, differentiable smoothed particle hydrodynamics framework implemented in PyTorch. Users combine independent computational modules to build problem-specific solvers, with high-accuracy discretization and both explicit and implicit schemes available in a common framework. Selected operations support automatic differentiation for parameter estimation and possible coupling with deep learning models. Forward tests using an implicit scheme agreed well with analytical or reference solutions for Poiseuille flow and a rising bubble, and captured key experimental trends in 2D and 3D dam-break problems. In inverse tests, explicit and implicit schemes estimated kinematic viscosity for Taylor-Green vortex flow and Reynolds number for lid-driven cavity flow. The authors also found that which operations are included in the computational graph affects the resulting gradients.

## Source excerpt

arXiv:2609.38208v2 Announce Type: replace-cross Abstract: Smoothed particle hydrodynamics (SPH) is well suited to large-deformation fluid problems, and the growing use of automatic differentiation in engineering applications has motivated interest in differentiable SPH solvers. In this study, a composable differentiable SPH framework, CraftSPH, has been developed. In CraftSPH, major computational operations are implemented as independent modules that users can combine to construct solvers for different purposes. This design supports high-accuracy discretization and both explicit and implicit computation within a common framework, while allowing individual components to be maintained and extended. Selected numerical operations also support automatic differentiation (AD) for physical-parameter estimation and potential coupling with deep learning models. These capabilities were demonstrated through forward and inverse analyses. Forward analyses using an implicit SPH scheme with high-accuracy discretization showed good agreement with analytical and reference solutions for Poiseuille flow and a rising bubble, while capturing the key experimental trends in two- and three-dimensional dam-break problems. In inverse analyses, explicit and implicit SPH schemes were used to estimate kinematic viscosity in Taylor-Green vortex flow and Reynolds number in lid-driven cavity flow. The results also showed that the choice of operations included in the computational graph affects the computed gradients. Together, these findings demonstrate that CraftSPH enables users to assemble problem-specific solvers for forward and inverse analyses within a common framework.