为了实时模拟真实的大规模流体场景,提出一种基于平滑粒子流体力学(SPH)进行流体场景模拟的算法.首先提出了新的精细程度函数作为非均匀采样的依据,以减少实际模拟时所需的粒子数,提高模拟的速度;然后引入一种三维空间网格划分算法和改进的并行基数排序算法,以加快模拟过程中对邻域粒子和边界的查找及其相互作用的计算;最后使用最新的NVIDIA CUDA架构,将SPH的全部模拟计算分配到GPU流处理器中,充分利用GPU的高并行性和可编程性,使得对SPH方法的流体计算和模拟达到实时.实验结果表明,采用文中算法能对流体场景的计算模拟达到实时,并实现比较真实的模拟效果.与已有的SPH流体CPU模拟方法相比,其加速比达到2个数量级以上,同时相比已有GPUSPH方法,能模拟出更为丰富的细节效果.
Simulating large-scale fluid scenes in real-time is of great value in both research and application. To achieve this goal, we present an integrated algorithm for fluid scene simulation. A new function of fineness is proposed to make decision in our non-uniform particle re-sampling process to both reduce the number of particles in need of simulation and enhance simulation speed. We also propose a novel 3D spatial grid partition algorithm and parallel radix sort algorithm to increase speed for searching neighboring particles and interacting with boundaries; We use the new NVIDIA Compute Unified Device Architecture (CUDA) to compute SPH entirely on GPU, which makes full use of the high parallelism and programmability of GPU to simulate fluid in real-time using SPH method. Experiments show that the method proposed can be used to simulate fluid scene in real-time with satisfactory effect, and the computation speed increases up to more than two orders of magnitude in comparison with the existing CPU SPH methods. More detail effects than other GPU SPH methods can be generated.