2017 , Vol. 19 >Issue 2: 161 - 166

• 李婷 , 1 ,
• 季民 , 1*, * ,
• 靳奉祥 2 ,
• 张静 1 ,
• 孙勇 1

• 1. 山东科技大学测绘科学与工程学院,青岛 266590
• 2. 山东建筑大学,济南 250101
*通讯作者：季民（1970-）,男,山东齐河人,博士,教授,主要从事地理信息系统设计与开发。E-mail:

要求修回日期: 2016-08-09

网络出版日期: 2017-02-17

Research on Ocean Wave Simulation Based on the Method of Combining Smoothed Particle Hydrodynamics with Marching Cubes Algorithm

• LI Ting , 1 ,
• JI Min , 1, * ,
• JIN Fengxiang 2 ,
• ZHANG Jing 1 ,
• SUN Yong 1
Expand
• 1. Geomatics College, Shandong University of Science and Technology, Qingdao 266590, China
• 2. Shandong Jianzhu University, Jinan 250101, China
*Corresponding author: JI Min, E-mail:

Request revised date: 2016-08-09

Online published: 2017-02-17

《地球信息科学学报》编辑部 所有

### Abstract

Traditional algorithms for modeling sea waves have some problems such as poor ocean surface realistic simulation and complicated calculation procedures. In order to solve these problems, this study presented a new sea wave simulation method which combines the Smoothed Particle Hydrodynamics (SPH) algorithm with the Marching Cubes (MC) algorithm. Based on space lattices, particles were allotted into different cubes and we established one way list structure for particle swarms storing and realized fast searching for particles within the smooth core radius in the calculation procedures of wave particle physics such as velocity, accelerator, position and so on. The force of the wave particle is generally composed of three parts: gravity, pressure gradient force and viscous force. Pressure gradient force is generated by the pressure difference between the fluid. Viscous force is caused by the velocity difference between the particles. According to this analysis of particle force, this study gave the Lagrange fluid control equation used for the accelerator calculation of ocean particles. In order to simulate the collision between particles and coastal barriers, we modeled the barrier surface as TIN (Triangular Irregular Network) and simplified the collision detection as whether the particle path passed through the triangle interface within a certain time. Assuming the particle as ideal rigid body, this study introduced an acceleration variation coefficient to calculate the particle's velocity after bouncing and improved the Euler equation by using the average velocity to calculate the particle's new position. In order to enhance the realistic simulation of the ocean wave fluid at the particle allotting time in the machine cube, this study calculated the density for each cube node dynamically. Through setting the threshold of sea surface density, we also extracted the wave surface dynamically by using linear interpolation method to generate triangular irregular network and realized the ocean waves 3D surface modeling and dynamic simulation. Through simulating, it verified the effectiveness and feasibility of this algorithm and could provide certain reference for ocean environmental modeling and virtual visualization.

### 2 SPH及MC算法原理

#### 2.1 SPH算法原理

SPH方法的基本原理是将连续的流体散化为相互作用的粒子质点[14],各个粒子质点上承载质量、速度、密度等物理量,通过求解质点组的动力学方程和跟踪每个粒子的运动轨迹,求得整个系统的力学行为。该方法是一种基于物理的拉格朗日算法,通过一系列粒子质点的“核函数估值”将流体力学基本方程组转换成数值计算用的公式[15-18]。其核心是插值,通过对研究粒子一定的光滑长度范围内其他临近粒子质点连续物理量影响程度的权函数插值得到。如图1所示,所有的粒子都使用统一的光滑核半径,而且都具有质量、密度、速度、加速度、位置等属性,这些物理量的计算如式（1）所示。
$A s ( r → ) = ∑ A j m j p j W ( r → - r j → , h )$ （1）

#### 2.2 MC算法原理

MC算法最早由W.E Lorenson等提出,其本质是将三维数据场中具有某阈值的物质提取出来,然后以某种拓扑形式连接成多边形,属于体素单元内抽取等值面的技术之一[19-20]。其基本原理是将整个三维数据空间进行网格化,形成独立的三维立方体单元,每个体元的8个顶点均具有对应的属性值,根据选定的等值面属性阈值,分别插值计算体元12条边界与等值面的交点,按照指定的规则连接相应的交点构建体元内部的多变形面片,从而实现体元的分隔,将所有体元分隔的多边形面片连接在一起,即可实现等值面的抽取。

### 3 基于SPH与MC耦合算法的海浪场建模

SPH算法通过求解流体动力学方程,在微观尺度下,用一组粒子代替流体来模拟海浪运动,为了同时满足海浪表面的平滑建模,结合改进的MC算法,以水面密度值为阈值进行海浪表面提取与渲染,具体算法过程包括：海浪粒子初始化、粒子受力分析、粒子碰撞检测、水密度等值面提取、海浪表面渲染等。

#### 3.2 海浪粒子受力分析及状态计算

$F → = ρ a →$ （2）

$ρ d u → d t → = ρ g → - ∇ p + μ ∇ 2 u →$ （3）

### 5 结论

The authors have declared that no competing interests exist.

### 参考文献

 [1] 李德仁,姚远,邵振峰.海岛礁及周边复杂环境动态三维建模[J].武汉大学学报·信息科学版,2012,37(11):1261-1265.对海岛礁及周边包括海浪、潮汐、潮流、温度等在内的复杂环境要素 及其特点进行了分析。针对海洋复杂要素的特点,提出了适用于海洋高动态的面向可细分对象的时空数据模型,能够有效地对高动态及交互性较强的对象进行建模。 以舟山群岛附近海域为例,对海岛礁及周边复杂环境进行了动态三维建模,并在Geoglobe等平台上进行了验证。实验表明,该模型对海岛礁及周边复杂环境 建模有较好的实用性。 [ Li D R, Yao Y, Shao Z F.Dynamic 3D modeling of island, reef and surrounding complex environment[J]. Geomatics and Information Science of Wuhan University, 2012,37(11):1261-1265. ]
 [2] Gary A M, Peter A W, John F M.Fourier synthesis of ocean scene[J]. IEEE Computer Graphics and Application, 1987,7(3):16-23.Considerable interest in scene synthesis has focused on fractal techniques such as 1/f noise filtering. However, these techniques produce poor synthetic ocean scenes. A superior technique is presented here that used an empirical sea spectrum model to represent a fully developed sea in nautre. A computer program has been written whereby a user supplies a wind velocity, and a two-dimensional Fourier-domain filter is created whose shape is decribed by the modified Pierson-Moskowitz spectrum. A white-noise image can then be filtered and rendered with a ray-tracing algorithm to produce a realistic ocean scene. Wave motion may be invoked by manipulating teh phase of the Fourier-transormed white-noise image. Several phase-manipulating techniques have been implemented.
 [3] 李昭. 虚拟海洋环境时空数据建模与可视化服务研究[D].杭州:浙江大学,2010. [ Li Z.Virtual marine environment spatio-temporal data modeling and service for visualization[D]. Hangzhou: Zhejiang University, 2010. ]
 [4] 黄杰. 海洋环境综合数据时空建模与可视化研究[D].杭州:浙江大学,2008. [ Huang J.Research on modeling and visualization of marine environment spatio-temporal data[D]. Hangzhou: Zhejiang University, 2008. ]
 [5] 丁绍洁. 虚拟海洋环境生成及场景特效研究[D].哈尔滨:哈尔滨工程大学,2008. [ Ding S J.Research on generating technique of virtual ocean environment and special effects[D]. Harbin: Harbin Engineering University, 2008. ]
 [6] 邹建武,祝明波,董巍.海浪建模方法综述[J].舰船电子工程,2010,30(11):10-14.海浪建模作为海浪模拟的重要组成部分,直接影响海浪模拟的逼真度和效率.侧重于虚拟现实和海面回波仿真的角度对海浪建模进行综述.介绍了海浪的形成过程;详细总结了海浪建模的主要方法及其优缺点;并对今后海浪建模技术的研究重点进行了预测. [ Zou J W, Zhu M B, Dong W.An overview of ocean wave modeling[J]. Ship Electronic Engineering, 2010,30(11):10-14. ]
 [7] 李苏军,蒋杰,杨冰,等.基于球面的海浪建模与绘制技术研究[J].中国图象图形学报,2009,14(4):744-752.由于传统的海浪建模与绘制方法多是基于平面进行建模与绘制,较少细致考虑球面曲率对海浪建模和绘制的影响,因此无法在球形表面绘制出海浪在不同条件下形状、色泽等的变化。为了实现无界海洋的虚拟自由漫游,提出了一种考虑球面影响的、任意视点下的海浪建模与绘制方法,其核心是球面海洋模型和屏幕细分的自适应算法,同时基于海洋学知识以及解析几何和数字地球特点,首先解决和消除了模型生成中存在的计算量大和高纬度"压缩现象"等问题,并建立了球面海浪模型;然后,依靠可逐点计算的海浪生成模型,利用屏幕细分自适应算法将计算限制在与视点相关的可视球面海洋区域,并使几何分辨率依视点变化;接着采用"夹球"技术,解决了海面生成中存在的"边缘裂缝"现象;最后,采用GPU技术绘制出不同观察距离和方向下的真实感海浪场景,进而实现了用户在无界海洋上的自由漫游。 [ Li S J, Jiang J, Yang B, et al.Research on sphere based modeling and rendering of ocean waves[J]. Journal of Image and Graphics, 2009,14(4):744-752. ]
 [8] 王相海,李婷婷.基于几何建模的海浪模拟[J].计算机科学,2011,38(10):259-262.提出一种基于几何的快速海浪建模方法，即将人眼对海浪的观察感知结合到对海平面网格的区域剖分中，对人眼不敏感区域进行网格粗剖分，而对人眼敏感区域进行网格细剖分，进一步对不同区域采用不同的数学函数或不同的参数控制来模拟海浪的涌动，同时通过设置相应的随机过程来增加敏感区域海浪的细节运动模拟。所提出的方法具有实现简单、计算消耗小、算法易于实现等优点，可满足游戏、动画等应用场景对海浪背景的实时性要求。仿真试验结果验证了模型的有效性。 [ Wang X H, Li T T.Wave simulation based on geometric modeling[J]. Computer Science, 2011,38(10):259-262. ]
 [9] 李永进,金一丞,任鸿翔,等.基于物理模型的近岸海浪建模与实时绘制[J].中国图象图形学报,2010,15(3):518-523.提出一种可以逼真地模拟大面积近岸海浪的方法。首先利用Boussinesq类方程求得指定 海域一段时间内的海面运动序列；然后通过对此序列进行重建，得到“无限”长的海面运动序列；最后把相应的海面高度场作为顶点纹理进行绘制。在绘制时采用视 点相关的海面网格，达到实时绘制的效果。实验表明，该方法模拟的大面积近岸海浪真实感强，绘制速度快，适合于实时仿真应用。 [ Li Y J, Jin Y C, Ren H X, et al.Based modeling and real-time rendering of near-shore waves[J]. Journal of Image and Graphics Physically, 2010,15(3):518-523. ]
 [10] 皮学贤,杨旭东,李思昆,等.近岸水域的波浪与水面仿真[J].计算机学报,2007,30(2):324-329.近岸水域由于受地形的影响，其波动呈现出与地形等高线垂直的趋势．已有的海面仿真与绘制算法 未能实现近岸水域的逼真模拟．文中通过对方向频率谱模型的分析，提出了波浪方向分布函数的分解模型；在已有的基于多分辨率网格和噪声分形面的海面仿真算法 框架下，实现了深海水域到近岸水域的过渡以及近岸水域的模拟．实验表明，该方法适合大规模自然场景应用中的水域仿真，其绘制效果逼真性好，绘制速度较快 （50FPS以上），能满足交互式应用的需求． [ Pi X X, Yang X D, Li S K, et al.Simulation of wave and water surface near the seashore[J]. Chinese Journal of Computers, 2007,30(2):324-329. ]
 [11] 李苏军,杨冰,吴玲达.基于Gerstner-Rankine模型的真实感海洋场景建模与绘制[J].工程图学学报,2008(2):77-82.通过对国内外典型的海浪建模和 绘制方法的研究,提出一种新的海浪模拟方法。该方法基于Gerstner-Rankine模型,引入概率统计思想,建立包括波浪折射在内的海浪模型,并采 用基于立方体映射的方法实时计算海洋表面纹理,生成了真实感较强的海浪效果,再现了海天一体化场景。实验结果表明能满足数字化海战场环境的逼真性和实时性 需求。 [ Li S J, Yang B, Wu L D.Modeling and rendering of ocean scene based on Gerstner-Rankine model[J]. Journal of Engineering Graphics, 2008,2:77-82. ]
 [12] Foster N, Metaxas D.Modeling water for computer animation[J]. Commun ACM, 2000,43(7):60-67.Abstract The article focuses on cognitive modeling for games and animation The article focuses on modeling water for computer animation. An ongoing goal for computer graphics is to provide tools not only for the artistic rendition of our physical world but for re-creating as much of our world in as realistic a way as possible. The reasons for wanting greater physical realism vary depending on the application. Modeling physics on a computer and visualizing the results using graphics techniques can lead to complex pictures as dazzling as the real-world phenomena they are intended to represent, especially for such fluid effects as the motion of water, fire, and smoke. Mechanical engineers and physicists have been modeling the behavior of liquids on computers for nearly 40 years. A pragmatic approach to the problem of water simulation is described in this article. The system for modeling and animating the interaction between realistic-looking water and a computer graphics environment described in this article, draws on the science of computational fluid dynamics to calculate an approximate velocity field describing the time-varying motion of a volume of water.
 [13] Reeves W T, L Ltd. Particle systems: A technique for modeling a class of fuzzy objects[J]. Computer Graphics, 1983,17(3):359-376.CiteSeerX - Scientific documents that cite the following paper: Particle Systems--A Technique for Modefing a Class of Fuzzy Objects
 [14] 周枭楠,周贵云.基于DEM数据的SPH水体流动模拟[J].地理空间信息,2015,13(2):86-90.对基于DEM数据的SPH水体流动模拟技术进行研究。对整个模拟流程进行重点介绍，并根据DEM数据的特点，对SPH的边界条件处理方法进行修改。最后借助OpenGL的显示能力，在2种不同类型的地形上对水体流动进行实时计算和模拟。实验表明，对边界条件处理方法的修改是合理的，基于DEM数据的SPH水体流动模拟结果令人满意。 [ Zhou X N, Zhou G Y.Simulation of SPH water flow based on DEM data[J]. Geospatial Information, 2015,13(2):86-90. ]
 [15] 张静. 基于粒子系统的海洋要素动态演变仿真研究[D].青岛:山东科技大学,2012. [ Zhang J.Study of the simulation of wave's dynamic evolution based on particle system[D]. Qingdao: Shandong University of Science and Technology, 2012. ]
 [16] 孙晓艳,王军.SPH方法的理论及应用[J].水利水电技术,2007,38(3):44-46.对光滑粒子流体动力学(SPH)的发展背景、理论基础等进行了介 绍,并分析了SPH方法在海冰和河冰模拟、具有自由表面的流动等方面的应用,作为一种无网格的纯Lagrange方法,在和其他方法对比的基础上列举了其 主要优缺点,结合目前国内外研究成果总结了改善缺点的对策. [ Sun X Y, Wang J.Theories and application on smoothed particle hydrodynamics method[J]. Water Resources and Hydropower Engineering, 2007,38(3):44-46. ]
 [17] 严芳. 粒子系统及其SPH方法应用的研究与实现[D].武汉:武汉理工大学,2006. [ Yan F.Research and implementation on particle system and its application[D]. Wuhan: Wuhan University of Technology, 2006. ]
 [18] 谭小辉,万旺根,黄炳,等.基于SPH的三维流体模拟[J].计算机应用与软件,2009,26(12):222-258.流体模拟是计算机图形学和虚拟现实技术的一个研究热点和难点,针 对目前的流体模拟真实感不够强,不能描述流体表面破碎的缺陷,根据流体的物理模型,采用基于光滑粒子动力学(SPH)的方法实现了三维流体的模拟.算法的 核心思想就是将流体视为一系列"粒子"的集合,粒子的物理量及其空间导数是通过搜索光滑半径内与其相互作用的粒子的物理量进行插值得到.此举可以简化拉氏 流体力学偏微分方程组求解过程.与传统的流体模拟方法相比,采用SPH算法所得到的模拟结果不仅可以比较真实地模拟流体流动的效果,而且还能实现流体表面 的剧烈变形,甚至表面破碎(如浪花飞溅效果).试验结果表明采用的算法在流体自由表面描述的逼真度上具有十分明显的优势. [ Tan X H, Wan W G, Huang B, et al.SPH based 3D fluid simulation[J]. Computer Applications and Software, 2009,26(12):222-258. ]
 [19] 陈勇,陈戈,张淑军.近岸海浪实时仿真[J].系统仿真学报,2008,20(3):741-745.自然景物的模拟是计算机图形学的一个热点问题，看上去简单的现实世界实现起来却极其复杂，特别是以海浪为代表的流体视觉仿真。海浪进入近岸区后，会出现变形和折射现象。将海洋学已有的波浪理论和计算方法应用到近岸海浪仿真中，采用椭圆余弦波构造波形，用波向线和波峰线组成的变形网格来解决波浪的折射现象，实现了近岸海浪实时仿真。实践证明该方法可以快速有效地模拟进入浅水区的海浪。 [ Chen Y, Chen G, Zhang S J.Real-time simulation of near-shore waves[J]. Journal of System Simulation, 2008,20(3):741-745. ]
 [20] 曾芬芳,黄建国.虚拟海洋场景中波浪的模拟[J].计算机应用,2001,21(4):33-35.采用水波动力学理论，对随机海洋面在理想情况下的海洋波面以及舰 船在海洋中航行时所产生的浪花进行了分析，并建立了相应模型。根据计算机图形学的相关技术和波谱函数方程，生成了随机的海浪，运用粒子系统技术绘制了舰船 航行中的浪花(艏浪、艉浪等)，为海战场视景图生成创建了一个较为逼真的海洋虚拟场景。 [ Zeng F F, Huang J G.Wave simulation in virtual ocean scene[J]. Computer Applications, 2001,21(4):33-35. ]
Options

/

 〈 〉