Search arXiv⌕ Search

arXiv · 2609.38208

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

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.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Gen Matono, Shujiro Fujioka, Mayuko Nishio. 2026-10-27. CraftSPH: A composable framework for differentiable smoothed particle hydrodynamics implemented in PyTorch. https://arxiv.org/abs/2609.38208

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Differential Geometry of Deterministic Stokesian Dynamics

We present a differential geometric framework for the motion of a non-Brownian particle in the presence of fixed obstacles in a quiescent fluid, in the deterministic Stokesian regime. While one may think (owing to the Helmholtz Minimum Dissipation Theorem) that the hydrodynamic resistance tensor could be the natural candidate for a Riemannian metric shaping the particle trajectories, we demonstrate that the trajectories driven by constant external forces are \emph{not} geodesics of this bare resistance metric. Instead, they experience a geometric drift due to the curvature induced by the presence of obstacles. By rigorously incorporating translational-rotational coupling through a modified effective resistance tensor $\tilde{\mathbf{R}} = \mathbf{R}_{\mathbf{FU}} - \mathbf{R}_{\mathbf{Fω}}\mathbf{R}_{\mathbf{Tω}}^{-1}\mathbf{R}_{\mathbf{Fω}}^T$, which accounts for the hidden dissipation savings afforded by particle rotation, we introduce a unified geometric formalism. We prove that the physical particle trajectories are exact geodesics of a conformally scaled metric, $\tilde{g}_{ij} = \mathcal{D}(\mathbf{x})\tilde{R}_{ij}$, where $\mathcal{D}$ is the instantaneous power dissipation. This framework establishes that the affine parameter along the trajectory corresponds strictly to the cumulative energy dissipated. We apply this theory to the scattering of a spherical particle by a fixed spherical obstacle, showing that the exact analytical trajectory derived previously by the author is recovered as a geodesic of the dissipation-scaled manifold.

physics.flu-dyn↗

Submerged Immiscible Oil Jet: Breakup Dynamics and Droplet Size Modelling

Immiscible liquid-liquid jets occur in numerous industrial and environmental settings, including oil spill response and liquid-liquid extraction, yet the coupled evolution of turbulence, interfacial instability, and droplet size distribution across transitional to turbulent regimes remains poorly understood. We present a combined experimental and theoretical investigation of a silicone oil jet injected into refractive-index-matched sugar water, employing simultaneous Particle Image Velocimetry (PIV) and Planar Laser-Induced Fluorescence (PLIF). Beyond the breakup region, mean velocity and Reynolds stress profiles exhibit self-similarity. Proper Orthogonal Decomposition (POD) of the volume fraction reveals a systematic shift in the dominant instability mechanism with increasing Reynolds number: axisymmetric Rayleigh-Plateau modes govern breakup at low Reynolds numbers, sinuous and varicose modes coexist in the transitional regime, and Kelvin-Helmholtz-driven shear-layer breakup dominates at higher Reynolds numbers. Droplet sizes are extracted from PLIF images using a convolutional neural network-based segmentation approach. In the transitional regime, a bimodal droplet size distribution is observed, reflecting the coexistence of shear-induced breakup and Rayleigh-Plateau instability. As the Reynolds number increases and turbulent dissipation intensifies, the distribution evolves toward a single mode with smaller characteristic droplet sizes. To predict the droplet size distribution, existing population balance models are extended to include droplet coalescence. Incorporating coalescence substantially improves agreement with experimental measurements, particularly for larger droplets. These findings demonstrate that turbulent dissipation, interfacial instabilities, and droplet coalescence collectively govern the evolution of droplet size distribution in immiscible liquid-liquid jets.

physics.flu-dyn↗

FAMIR: Future-aligned latent dynamics for complex-flow forecasting

Learned flow surrogates are applied recursively, so errors in phase, amplitude and transport accumulate as each prediction feeds the next. During training, however, the realized next state is known. We propose Future-Aligned Motion Inference for Recursive Physical Forecasting (FAMIR), which uses this realized future to shape the signal that drives the update, not only the predicted state. On the latent grid of a frozen autoencoder, a future-conditioned teacher and a history-only student infer motion tensors that condition one shared residual transition. Posterior--Prior Motion Alignment (PPMA) jointly aligns the teacher (posterior) and student (prior) motions, prediction-fed multistep objectives train the student on its own rollouts, and only the student is deployed. On viscoelastic channel flow, Rayleigh--Bénard convection and planetary shallow-water flow, FAMIR achieves lower complete-prefix normalized root-mean-square error than three direct latent predictors of comparable size and a delay-embedded linear reference at ten steps (1.003\%, 1.055%, 0.620%) and twenty steps (1.661%, 1.683%, 1.036%). Its advantage is largest at the first step in the viscoelastic flow and grows with lead time in the other flows. Over forty-step forecasts, FAMIR keeps fluctuation profiles and probability densities closer to the reference than the direct predictors. Without the teacher, the motion-conditioned student already outperforms the direct predictors; in the shallow-water flow, prediction-fed rollouts are decisive and joint alignment is far more effective than distillation toward a fixed teacher (1.036% against 1.874%). Fixed-state interventions show that the trained update relies on the state-specific motion, and the deployed student matches the one-step accuracy of the future-informed teacher.

physics.flu-dyn↗