• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学

• 高性能计算 • 上一篇    下一篇

基于CUDA的弱可压SPH流体建模与仿真

段兴锋1,2,任鸿翔1,神和龙1   

  1. (1.大连海事大学航海动态仿真和控制交通行业重点实验室,辽宁 大连 116026;
    2.集美大学航海学院,福建 厦门 361021)
  • 收稿日期:2017-04-11 修回日期:2017-05-26 出版日期:2018-08-25 发布日期:2018-08-25
  • 基金资助:

    国家863计划(2015AA010504);交通运输部应用基础研究项目(2015329225240);福建省教育厅科技项目(JA15269)

Fluid modeling and simulation using
CUDA-based weakly compressible SPH

DUAN Xingfeng1,2,REN Hongxiang1,SHEN Helong1   

  1. (1.Key Laboratory of Marine Dynamic Simulation & Control for Ministry of Communications,
    Dalian Maritime University,Dalian 116026;
    2.College of Navigation,Jimei University,Xiamen 361021,China)
  • Received:2017-04-11 Revised:2017-05-26 Online:2018-08-25 Published:2018-08-25

摘要:

为了实现小尺度范围流体场景的实时、真实感模拟,采用弱可压SPH方法对水体进行建模,提出了流体计算的CPUGPU混合架构计算方法。针对邻域粒子查找算法影响流体计算效率的问题,采用三维空间网格对整个模拟区域进行均匀网格划分,利用并行前缀求和和并行计数排序实现邻域粒子的查找。最后,采用基于CUDA并行加速的Marching Cubes算法实现流体表面提取,利用环境贴图表现流体的反射和折射效果,实现流体表面着色。实验结果表明,所提出的流体建模和模拟算法能实现小尺度范围流体的实时计算和渲染,绘制出水的波动、翻卷和木块在水中晃动的动态效果,当粒子数达到1 048 576个时,GPU并行计算方法相较CPU方法的加速比为60.7。
 

 

 

关键词: 光滑流体粒子动力学, 边界处理, 邻域搜索, Marching Cubes, CUDA

Abstract:

In order to realize the realtime and realistic simulation of smallscale fluid scenes, the Weakly Compressible SPH (WCSPH) method is used to model fluids and a hybrid CPUGPU framework is proposed for fluid calculation. Aiming at the problem that the neighbor particle search algorithm affects the computational efficiency of the fluid, we propose a 3D spatial grid partition algorithm and parallel counting sort algorithm to increase speed for searching neighbour particles. Lastly, we propose a parallel Marching Cubes algorithm based on CUDA to triangulate the isosurface of fluids, and use cube map technology to represent the effect of reflection and refraction, thus achieving fluid surface shading. The experiments show that the proposed fluid modeling and simulation method can realize the realtime calculation and rendering of smallscale fluid scenes and draw the dynamic effects of water flow, overturning and the wood swaying in the water. When the number of particles reaches 1 048 576, the parallel method based on GPU achieves the speedup of 60.7 in comparison to the sequential method based on CPU.
 

Key words: smoothed particle hydrodynamics(SPH), Boundary handling, neighbour search, marching cubes, CUDA