Real-time fluid simulation with adaptive SPH - · PDF fileREAL-TIME FLUID SIMULATION In the...

download Real-time fluid simulation with adaptive SPH - · PDF fileREAL-TIME FLUID SIMULATION In the state Equation (3), ρ 0 denotes the static density, κ denotesthepressureconstantwhichcontrolstherelative

If you can't read please download the document

Transcript of Real-time fluid simulation with adaptive SPH - · PDF fileREAL-TIME FLUID SIMULATION In the...

  • COMPUTER ANIMATION AND VIRTUAL WORLDSComp. Anim. Virtual Worlds (2009)Published online in Wiley InterScience(www.interscience.wiley.com) DOI: 10.1002/cav.300...........................................................................................Real-time fluid simulation with adaptiveSPH

    By He Yan, Zhangye Wang*, Jian He, Xi Chen, Changbo Wang andQunsheng Peng..........................................................................

    We present a new adaptive model for real-time fluid simulation based on Smoothed ParticleHydrodynamics (SPH) framework. Unlike traditional time-consuming SPH methods, ourmodel can simulate fluid at a considerably faster speed without losing realism. In ourmodel, we first introduce the non-uniform particle system and propose a generalizeddistance field function which considers not only geometrical complexity but also physicalcomplexity of fluid body. And the new sampling rules for splitting and merging of particlesare also presented. This can greatly reduce the computation time of the dynamic fluidsimulation. Then, a new pressure state equation and an adaptive surface tension model areproposed to enhance the stability of the system and to make the free surface more realistic.To further accelerate the computation, a special fluid solver is designed and implementedusing GPU. Various fluid phenomena like breaking wave and flood are simulated atreal-time. Experiments demonstrate that our new adaptive model can greatly enhance thecomputation efficiency of fluid simulation compared with previous adaptive methods.Copyright 2009 John Wiley & Sons, Ltd.

    Received: 25 March 2009; Accepted: 25 March 2009

    KEY WORDS: physically based fluid simulation; adaptive SPH; adaptive surface tension model;GPU

    Introduction

    The modeling and rendering of natural scenes are stillchallenging tasks in computer graphics. Among them thefluid simulation plays an important roles in many areassuch as navigation simulation, PC game, special effectsin movies and TV, disaster rescue, etc. In the early years,procedural surface generation1 was often used to simu-late ocean and water waves. Besides, there are also manyworks like References2,3 which simplified the 3D fluidsimulation to 2D height field. These work may animatelarge scale ocean waves in real-time. However, since theyare not based on physical model, it is hard to simulatemore detailed and complicated realistic scene withthe phenomena such as breaking wave. Consequently,more and more researchers have turned their attentionto the physically based approaches for fluid simulation.

    *Correspondence to: Z. Wang, State Key Laboratory ofCAD&CG, Zhejiang University, P.R. China.E-mail: [email protected]

    Generally, there are two physically based ways forfluid simulation: one is grid-based method which isalso called Eulerian method. Another is particle-basedmethod known as Lagrangian method. The latter isgaining popularity for creating animations of physicalphenomena such as breaking waves and splashes. Inrecent years, it has achieved significant progress in thearea of fluid simulation based on Smoothed ParticleHydrodynamics (SPH) and other Lagrangian meth-ods, both in visual accuracy and rendering efficiency.However, little attention had been paid to physicallybased simulation of complex fluid scenes in real-time.Actually, most of previous work require substantialoffline computation, while attaining high realism withdetails of free surface in real-time still remains an openquestion.

    In this paper, we propose a new model to simulate fluidin real-time based on adaptive SPH framework. The maincontributions of this paper can be described as follows: A new distance field function is proposed which con-

    sider not only geometrical but also physical complex-ity of fluid body, thus reducing the number of particles

    ............................................................................................Copyright 2009 John Wiley & Sons, Ltd.

  • H. YAN ET AL............................................................................................

    actually needed and making the real-time fluid simu-lation possible.

    An adaptive surface tension model and a modifiedpressure state equation are presented, and make thesimulation of dynamic fluid more realistic and stable.

    We have designed and implemented a special fluidsolver in GPU which greatly accelerates the simu-lation procedure. The simulation speed is at leasttwo orders of magnitude faster than previous SPHmethods without GPU.

    Related Work

    Due to the flexibility for time-varying simulation ofdifferent scales and the ability to simulate the realisticeffect of breaking waves, the particle-based Lagrangianmethods play an more and more important role in recentresearches on fluid simulation. Among them, the SPHmethod is one of the most promising approaches.

    The SPH method was originally developed to modelcosmological fluids4,5 and was first introduced tocomputer graphics by Reeves.6 Stam et al.7 simulatedgas and fire using the similar framework. After that,the SPH method has quickly become a popular toolin fluid simulation. Takeshita et al.8 applied an similarapproach to explosive flames. Muller et al.9 introducedSPH method to simulation of water for the first time.Their work has been extended later to simulate theinteraction of fluids with deformable meshes by addingboundary particles to the surface of the mesh.10 Otherwork includes the simulation of melting and freezing,11

    solid fluid coupling,12 and multi-phase flows.13

    However, all the above work do not consider thatthe computation efficiency can be enhanced greatlyjust by constructing the particle system adaptively.Fewer particles will be sufficient in areas where thelocal pressure is almost constant, and that are far deepin the fluid body, while more will be needed in areasthat are more physically or visually important. Desbrunet al.14 first introduce adaptive frameworks in spaceand time to simulate highly deformable substances.In their method, only physical sampling conditionsare considered hence the results are not so convincing.Adams et al.15 improved this method by introducingthe extended local feature size as sampling conditions.The improved model, however, needs to approximatethe medial axis of fluid body. As their algorithm is notsuitable for parallel computation, it cannot be efficientlyimplemented on GPU. Hence the inherent limitationof this method results in much more offline computa-

    tion and the efficiency of the whole algorithm is notso high.

    Some researches attempt to combine the strengthsof two different methods. Thurey et al.16 proposed anovel model to simulate breaking waves in real-time bycombining the height field method and SPH method.However, obvious uncontinuity between the free surfaceand splashes can be observed in their simulation results.Losasso et al.17 proposed a new method which combinedthe mesh-based Particle Level Set method (PLS) and theparticle-based SPH method. But this method costs quitecomplicated calculation and therefore, the efficiency ofthe algorithm is still rather low.

    Although many work have been done about fluid sim-ulation based on SPH as discussed above, they cannotsimulate the complex fluid scenes (e.g., dynamic waterscene) in real-time. Other methods combing differenttechniques fail to maintain the visual continuity or thestability of dynamic fluid. In this paper, we presenta new adaptive method to realize the real-time fluidsimulation based on SPH framework while keeping thevisual continuity and system stability of the fluid. Belowwe will discuss our new model in detail.

    The New SPH BasedAdaptive Method

    In this section, we first briefly describe the basic SPHframework, then we introduce the non-uniform particlesystem and the generalized distance field function, at lastwe define the rules of splitting and merging.

    Basic SPH Framework

    Generally the governing equations of Lagrangianmethod are given as

    dvdt

    = 1

    P + g + II (1)

    ddt

    = v (2)

    P = ((

    0

    ) 1

    )(3)

    which are composed of three equations, i.e., momentumequation, continuity equation, and the equation of pres-sure state, respectively. The value v denotes the velocityfield of the fluid, denotes the density, P the pressure, gthe external forces and II denotes the artificial viscosity.

    ............................................................................................Copyright 2009 John Wiley & Sons, Ltd. Comp. Anim. Virtual Worlds (2009)

    DOI: 10.1002/cav

  • REAL-TIME FLUID SIMULATION...........................................................................................

    In the state Equation (3), 0 denotes the static density, denotes the pressure constant which controls the relativedensity fluctuation, and is the exponential constant.

    SPH is one of most efficient model of Lagrangianmethods, which is an interpolation approach for particlesystems. With SPH, field quantities can be calculatedeverywhere which are only defined at discrete particlepositions in space. The interpolation is given as

    A(x) =

    D

    A(x)W(x x, h)dx (4)

    which can be discretized as

    A(x) =

    j

    mjAj

    jW(x xj, h) (5)

    with A(x) denoting the field quantities such as velocity,pressure etc., mj the mass of the particle, j the densityat the particle location. The function W(x, h) is called thesmoothing kernel with h as the support radius, which is ascaling factor that controls the smoothness or roughnessof the kernel. Here we use different kernel functions forevaluating different field quantities,9 in order to enhancethe precision and the robustness of our algorithm.

    Particularly, for the pressure force acting on pi, Equa-tion (5) can be written as