基于CUDA技术的流体模拟方法的研究
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
随着虚拟现实、电子游戏等图形学相关产业的迅猛发展,流体模拟已经成为图形学领域中研究的一个热点问题。近年来,基于物理方法的流体模拟技术取得了很大的进展,并且得到了广泛应用。但是,由于该种方法的计算过程相对比较复杂,所以模拟出的流体现象实时性较差。为了提高流体的模拟速度,本文主要在下述几个方面做了较深入的研究:
     1.采用CUDA技术对流体现象进行加速模拟。该方法首先将纳维-斯托克斯流体运动方程中具有并行特性的部分(比如对流项、外力项、扩散项等)分离出来,然后把它们分别映射成CUDA编程模型中的设备端内核函数,最后将这些内核函数放到GPU上并行执行;而方程中那些逻辑性强的部分则在CPU上执行。这种CPU+GPU协同模拟流体的方法不但充分的发挥了GPU的并行处理能力,而且简化了传统的GPU流体模拟方法。通过烟雾现象的模拟对该方法进行验证。实验结果表明:采用该方法进行流体模拟的速度比采用一般CPU方式的快了几十到上百倍。比如流体规模为3500*3500时,两者的加速比达到128.57。
     2.采用多GPU方式对流体现象进行加速模拟。该方法首先将流体域空间划分成若干个子区域,然后将这些子区域分别交由不同的GPU来协同模拟。在模拟的过程中各个GPU通过对应的主机端线程进行彼此的数据通信,以及彼此与渲染部分的同步过程。这种CPU+多GPU协同模拟流体的方法不但提高了单个GPU的执行效率,而且为今后的超大规模流体模拟集群系统的设计提供了铺垫。通过烟雾现象的模拟对该方法进行了检验。实验结果表明,采用多GPU方式的流体模拟速度相比单GPU方式的又有了进一步的提高。比如流体规模为3500*3500时,三GPU与单GPU的加速比达到2.16。
With the rapid development of virtual reality, computer games and other graphics related industries, the fluid simulation already became a hot research direction in the graphics area. In recent years, the physically-based fluid simulation has made very great progress. It has been widly used in many area. However, as the computational process of this method is relatively quite complex, the fluid phenomenon simulated real-time poor. To improve the speed of the fluid simulation, this paper has done in-depth study of the following aspects:
     1. Based on CUDA technical fluid simulation acceleration method. Firstly, it separate these parallel parts(advect item, external force item, diffusion item) from the Navier-Stokes equations of fluid motion. Then they are mapped into the CUDA programming model of the device-side kernel functions. Finally, these core functions are parallel executed on the GPU, while the equation parts which has strong logic are ran in the CPU. this method not only plays a full GPU's parallel processing capabilities, and it also simplifies the traditional GPU fluid simulation. The results show that the speed of Based on CUDA technical fluid simulation has been further improved comparing to the speed of using a CPU. Such as the fluid scale is 3500 * 3500, the ratio of three-GPU and single GPU acceleration is 128.57.
     2. Acceleration simulation of fluid phenomena adopting way of multi-GPU. In this method, the fluid domain space is divided into several sub-regions, then these sub-regions are referred to different GPUs to be simulated cooperately. In the course of simulation, every GPU corresponding to the host thread communicates with each other, and synchronizes with rendering part of the process. This method of co-simulation not only improves the efficiency of the implementation of a single GPU, but also provides a cushion for designing a large scale fluid simulation clusting system in the future. The results show that the speed of multi-GPU has been further improved comparing to the speed of using a single GPU. Such as the fluid scale is3500*3500, the ratio of three-GPU and single GPU acceleration is 2.16.
引文
[1]訾玲玲,周永霞,訾贵昌.基于物理模型的烟雾动画模拟[J].计算机与数字工程2007,35(7):65-67
    [2]湛永松,石民勇,费广正.基于物理模型的实时卡通烟雾模拟算法[J].中国图象图形学报,2007,12(2):262-265
    [3]湛永松,石民勇,费广正.基于流体力学方程的二维烟雾模拟[J].中国传媒大学学报,2007,14(1):602-611
    [4]Peachey R.Modeling waves and surf[C]. Proceedings ofSIGGRAPH86,1986,20(4): 65-74
    [5]Jerry Tessendorf. Simulating Ocean Waves[R]. SIGGRAPH'99 Course Notes &SIGGRAPH'2000:3.1-3.18
    [6]柳有权.基于物理的计算机动画及其加速技术的研究[D].北京:中国科学院研究生院,2005
    [7]柳有权,刘学慧,吴恩华.基于GPU带有复杂边界的三维实时流体模拟[J]. Journal of Software,2006,17(3):569-576
    [8]Nick Foster, Dimitri Metaxas. Realistic Animation of Liquids[J]. Graphical Models and Image Processing,1996,58(5):471-483
    [9]Jos Stam. Stable Fluids[C]. Proceedings of SIGGRAPH 1999,1999,121-128
    [10]Ronald Fedkiw, Jos Stam, Henrik Wann Jensen. Visual Simulation of Smoke[C] Proceedings of SIGGRAPH 2001,2011,15-22
    [11]Duc Quang Nguyen, Ronald Fedkiw, Henrik Wann Jensen. Physically Based Modeling and Animation of Fire[J]. ACM Transactions on Graphics,2002,21(3):721-728
    [12]Bryan E. Feldman, James F. O'Brien, Okan Arikan. Animating Suspended Particle Explosions[J]. ACM Transactions on Graphics,2003,22(3):708-715
    [13]Jos Stam, Eugene Fiume. Depicting fire and other gaseous phenomena using diffusionprocesses[C]. Proceedings of SIGGRAPH 1995,1995,129-136
    [14]胡甫强,毕学工.基于Smoothed ParticleHydrodynam ics方法的实时流体模拟[J].计算机应用,2009,3:29-34
    [15]Mathieu Desbrun, Marie-Paule Gascuel. Smoothed particles:A new approach for animating highly deformable bodies[C]. Proceedings of the 7th Eurographics Workshop on Animationand Simulation,1996,61-76
    [16]鲍凯,吴恩华,武小龙等.可互溶液体的真实感模拟[J].计算机辅助设计与图形学学报,2010,22(10):1721-1727
    [17]GPU.[EB/OL],http://baike.baidu.com/view/1196.htm,2010-4-3
    [18]nVidia website.[EB/OL],http://developer.nvidia.com/,2009-9-11
    [19]徐新海,林宇斐,易伟.CPU-GPGPU异构体系结构相关技术综述[J].计算机工程与科学,2009,31(A1):24-27
    [20]GPGPU website. [EB/OL],http://www.gpgpu.org.2010-7-15
    [21]刘伟峰,王智广.细粒度并行计算编程模型研究[J].微电子学与计算机,2008,25(10):104-106
    [22]CUDA走向GPGPU新时代[EB/OL],http://www.cnki.com.cn/Articl.html,2010-3
    [23]刘勇. 使用GPU加速通用科学计算-CUDA技术解析[J].计算机与数字工程,2008,24:394-395
    [24]CUDA软硬件环境简介.[EB/OL],http://www.cnki.com.cn/Article/CJFDTotal-ITSJ200 803020.htm,2008-4-15
    [25]吴恩华,柳有权.基于图形处理器(GPU)的通用计算[J].计算机辅助设计与图形学学报,2004,16(5):602-611
    [26]吴恩华. 图形处理器用于通用计算的技术、现状及其挑战[J].软件学报,2004,15(10):1494-1504
    [27]张舒,褚艳利.GPU高性能运算之CUDA[M].北京:中国水利水电出版社,2009:8-130
    [28]CUDA Programming Model Overview[EB/OL],http://www.sdsc.edu/us/training/cuda.pdf 2009-7-15
    [29]钱悦.图形处理器CUDA编程模型的应用研究[J].计算机与数字工程,2008,36(12):178-180
    [30]邓培智.CUDA编程模型.[EB/OL],http://www.cnki.com.cn/Article/CJFDTo tal-ITSJ200805051.htm,2008-05-05
    [31]NVIDIA_CUDA_ProgrammingGuide_3.0[EB/OL],http://developer.download.nvidia.com /compute/cuda/3_0/toolkit/docs/NVIDIA_CUDA_ProgrammingGuide_3.0.pdf,2010-02-20
    [32]Jos Stam. Real-Time Fluid Dynamics for Games[EB/OL], http://www.dgp.toronto.edu/ people/sta m/reality/index.html,2003-09-24
    [33]Enhua Wu, Youquan Liu, Xuehui Liu. An Improved Study of Real-Time Fluid Simulation on GPU(J), Journal of Computer Animation and Virtual World,2003,15(3-4): 139-146
    [34]武斌博,张田文.基于N-S方程的真实感流体仿真[J].微计算机信息,2009,25(10):212-214
    [35]胡香,张威巍,周玉柱等.利用GPU实现基于物理模型的流体运动仿真[J].测绘科学技术学报,2009,26(3):188-194
    [36]Stam J. Simulation and control of physical phenomena in computer graphics[C] Proceedings of Pacific Graphics, Seoul, Korea,2004:171-173
    [37]陈曦,王章野,何戬等.GPU中的流体场景实时模拟算法[J].计算机辅助设计与图形学学报,2010,22(3):397-405
    [38]湛永松,杨明浩,石民勇等.基于可编程图形处理器的实时烟雾控制模拟[J].工程图学学报,2008,29(4):61-64
    [39]杨志凌,董兴辉.基于二维流体场的烟雾模拟算法[J].工程图学学报,2005,26(5):70-73
    [40]王栋栋,庄雷.CPU与GPU并行计算的火焰模拟[J].计算机应用,2009,26(6):1703-1706
    [41]Matt Pharr,Randima GPU Gems2:Programming Techniques for High-Performance Graphics and General-Purpose Computation[M]. New Jersy:Addison-Wesley,2005:637-665

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700