GASPHiA: A GPU-Accelerated Smoothed Particle Hydrodynamics (SPH) Code
GASPHiA is a high-performance, three-dimensional SPH (Smoothed Particle Hydrodynamics) code developed by Keqi Ye as part of his doctoral research at the School of Aeronautics and Astronautics, Sun Yat-sen University. The code is designed for simulating complex hydrodynamical problems, particularly those involving material strength, damage, and gravitational interactions.
Features
High-Performance & Scalable
- Fully parallelized with CUDA: Leverages the massive computational power of modern NVIDIA GPUs.
- Barnes-Hut tree algorithm [1-4]: Accelerates both neighbor search (
O(N log N)) and self-gravity force calculations, enabling efficient simulation of large particle systems.
Configurable & Flexible
- Switchable Precision: Easily toggle between single-precision (
float) and double-precision (double) calculations. Maximize performance on consumer-grade GPUs (float) or ensure high accuracy for scientific applications (double). - Multi-Dimensional: Natively supports both 2D and 3D simulation domains.
Advanced Physics Modeling
- Gravity Models: Choose between uniform external gravity field and/or N-body self-gravity for astrophysical scenarios.
- Strength & Yield Models: A suite of sophisticated constitutive models to define the elastic limit and subsequent plastic flow of solids, including:
- Von Mises: A classic pressure-independent yield criterion, serving as a fundamental model for plastic flow.
- Lundborg: A pressure-dependent model with strength saturation for brittle materials. This implementation is based on the formulation originally proposed by Lundborg (1968) [6] and later adopted by Collins et al. (2004) [7] and Jutzi (2015) [8].
- Damage & Fracture Model: An optional damage model, based on the concepts proposed by Melosh et al. (1992) [9], simulates material weakening and failure under tensile stress. This is crucial for modeling fracture and fragmentation, following the SPH approaches pioneered by Benz & Asphaug (1995) [5] and Collins et al. (2004) [7].
- Porosity Model: An optional p-α porosity model to simulate the crushing of porous geological materials like pumice or regolith, following the classic framework developed by Jutzi et al. (2008) [10].
Numerical Methods
- Time Integration: Currently implemented as predictor-corrector integration with adaptive Bogacki–Shampine RK23 [11].
User-Friendly Workflow
- INI Configuration: Simulation parameters are controlled via readable INI files, parsed by the lightweight
inihlibrary. - Standardized Output: Results are written in the widely adopted HDF5 format, with accompanying XDMF files generated for direct visualization in scientific software like ParaView and VisIt.
Code Access and Usage Policy
GASPHiA source code is available to academic researchers and collaborators upon request, for non-commercial, educational, and research purposes only.
To request access to the source code, please send an email to:
- Keqi Ye (Author):
yekq6@mail2.sysu.edu.cn|plloningye@gmail.com - Prof. Xiaodong Liu (Supervisor, School of Aeronautics and Astronautics):
liuxd36@mail.sysu.edu.cn
In your request, please briefly introduce yourself, your institution, and your intended research application for the code.
All usage of this code must adhere to the terms specified in the copyright notice at the beginning of each source file. Any form of redistribution, modification for commercial purposes, or use without prior written permission from the authors is strictly prohibited.
Acknowledgements
I would like to express my sincere gratitude to my supervisor, Prof. Xiaodong Liu, for his support and guidance throughout my doctoral studies.
The development of GASPHiA has also benefited from the open-source community. Special thanks are extended to the authors of the following projects, whose work provided crucial insights and architectural inspiration:
This project utilizes the following third-party libraries:
- HDF5: For high-performance data storage (The HDF Group)
- inih: For parsing INI configuration files (Ben Hoyt)
References
[1] Schäfer, C., Riecker, S., Maindl, T. I., Schaal, K., & Speith, R. (2016). A smooth particle hydrodynamics code to model collisions between solid, self-gravitating objects. Astronomy & Astrophysics, 590, A19.
[2] Barnes, J., & Hut, P. (1986). A hierarchical O(N log N) force-calculation algorithm. Nature, 324(6096), 446–449.
[3] Nyland, L., Harris, M., & Prins, J. (2007). Fast n-body simulation with CUDA. GPU Gems, 3, 62-66.
[4] Burtscher, M., & Pingali, K. (2011). An efficient CUDA implementation of the tree-based barnes hut n-body algorithm. In GPU Computing Gems Emerald Edition (pp. 75-92). Morgan Kaufmann.
[5] Benz, W., & Asphaug, E. (1995). Simulations of brittle solids using smooth particle hydrodynamics. Computer Physics Communications, 87(1-2), 253–265.
[6] Lundborg, N. (1968). Strength of rock-like materials. International Journal of Rock Mechanics and Mining Sciences & Geomechanics Abstracts, 5(5), 427-454.
[7] Collins, G. S., Melosh, H. J., & Ivanov, B. A. (2004). Modeling damage and deformation in impact simulations. Meteoritics & Planetary Science, 39(2), 217-231.
[8] Jutzi, M. (2015). SPH calculations of asteroid disruptions: The role of pressure dependent failure models. Icarus, 250, 356-362.
[9] Melosh, H. J., Ryan, E. V., & Asphaug, E. (1992). Dynamic fragmentation in impacts: Hydrocode simulation of laboratory impacts. Journal of Geophysical Research: Planets, 97(E9), 14735-14759.
[10] Jutzi, M., Benz, W., & Michel, P. (2008). Numerical simulations of impacts involving porous bodies: I. Implementing sub-resolution porosity in a 3D SPH hydrocode. Icarus, 198(1), 242-255.
[11] Bogacki, P., & Shampine, L. F. (1989). A 3(2) pair of Runge-Kutta formulas. Applied Mathematics Letters, 2(4), 321-325.
Copyright
Copyright (c) 2025 Keqi Ye. All Rights Reserved.