Visual Simulation of Smoke
Total Page:16
File Type:pdf, Size:1020Kb
Visual Simulation of Smoke Ý Þ Ronald Fedkiw £ Jos Stam Henrik Wann Jensen Stanford University Aliaswavefront Stanford University Abstract the animation of gases such as smoke. We propose a model which is stable, rapid and doesn’t suffer from excessive numerical dis- In this paper, we propose a new approach to numerical smoke sipation. This allows us to produce animations of complex rolling simulation for computer graphics applications. The method pro- smoke even on relatively coarse grids (as compared to the ones used posed here exploits physics unique to smoke in order to design a in CFD). numerical method that is both fast and efficient on the relatively coarse grids traditionally used in computer graphics applications (as compared to the much finer grids used in the computational 1.1 Previous Work fluid dynamics literature). We use the inviscid Euler equations in The modeling of smoke and other gaseous phenomena has received our model, since they are usually more appropriate for gas mod- a lot of attention from the computer graphics community over the eling and less computationally intensive than the viscous Navier- last two decades. Early models focused on a particular phenomenon Stokes equations used by others. In addition, we introduce a physi- and animated the smoke’s density directly without modeling its ve- cally consistent vorticity confinement term to model the small scale locity [10, 15, 5, 16]. Additional detail was added using solid tex- rolling features characteristic of smoke that are absent on most tures whose parameters were animated over time. Subsequently, coarse grid simulations. Our model also correctly handles the inter- random velocity fields based on a Kolmogoroff spectrum were used action of smoke with moving objects. to model the complex motion characteristic of smoke [18]. A com- Keywords: Smoke, computational fluid dynamics, Navier-Stokes equations, Euler mon trait shared by all of these early models is that they lack any equations, Semi-Lagrangian methods, stable fluids, vorticity confinement, participat- dynamical feedback. Creating a convincing dynamic smoke simu- ing media lation is a time consuming task if left to the animator. A more natural way to model the motion of smoke is to simulate the equations of fluid dynamics directly. Kajiya and Von Herzen 1 Introduction were the first in CG to do this [13]. Unfortunately, the computer power available at the time (1984) only allowed them to produce results on very coarse grids. Except for some models specific to The modeling of natural phenomena such as smoke remains a chal- two-dimensions [21, 9], no progress was made in this direction un- lenging problem in computer graphics (CG). This is not surprising til the work of Foster and Metaxas [7, 6]. Their simulations used since the motion of gases such as smoke is highly complex and relatively coarse grids but produced nice swirling smoke motions in turbulent. Visual smoke models have many obvious applications in three-dimensions. Because their model uses an explicit integration the industry including special effects and interactive games. Ideally, scheme, their simulations are only stable if the time step is chosen a good CG smoke model should both be easy to use and produce small enough. This makes their simulations relatively slow, espe- highly realistic results. cially when the fluid velocity is large anywhere in the domain of in- Obviously the modeling of smoke and gases is of importance terest. To alleviate this problem Stam introduced a model which is to other engineering fields as well. More generally, the field of unconditionally stable and consequently could be run at any speed computational fluid dynamics (CFD) is devoted to the simulation of [17]. This was achieved using a combination of a semi-Lagrangian gases and other fluids such as water. Only recently have researchers advection schemes and implicit solvers. Because a first order inte- in computer graphics started to excavate the abundant CFD litera- gration scheme was used, the simulations suffered from too much ture for algorithms that can be adopted and modified for computer numerical dissipation. Although the overall motion looks fluid-like, graphics applications. Unfortunately, current CG smoke models are small scale vortices typical of smoke vanish too rapidly. either too slow or suffer from too much numerical dissipation. In Recently, Yngve et al. proposed solving the compressible ver- this paper we adapt techniques from the CFD literature specific to sion of the equations of fluid flow to model explosions [22]. While £ Stanford University, Gates Computer Science Bldg., Stanford, CA the compressible equations are useful for modeling shock waves 94305-9020, [email protected] and other compressible phenomena, they introduce a very strict Ý Alias wavefront, 1218 Third Ave, 8th Floor, Seattle, WA 98101, U.S.A. time step restriction associated with the acoustic waves. Most CFD [email protected] practitioners avoid this strict condition by using the incompressible Þ Stanford University, Gates Computer Science Bldg., Stanford, CA equations whenever possible. For that reason, we do not consider 94305-9020, [email protected] the compressible flow equations. Another interesting alternative which we do not pursue in this paper is the use of lattice gas solvers based on cellular automata [4]. 1.2 Our Model Our model was designed specifically to simulate gases such as smoke. We model the smoke’s velocity with the incompressible Eu- ler equations. These equations are solved using a semi-Lagrangian integration scheme followed by a pressure-Poisson equation as in [17]. This guarantees that our model is stable for any choice of the time step. However, one of our main contributions is a method to reduce the numerical dissipation inherent in semi-Lagrangian from the following Poisson equation schemes. We achieve this by using a technique from the CFD lit- ½ £ erature known as ”vorticity confinement” [20]. The basic idea is ¾ Ô = Ö¡ Ù Ö (4) Ø to inject the energy lost due to numerical dissipation back into the ¡ fluid using a forcing term. This force is designed specifically to in- @Ô with pure Neumann boundary condition, i.e., =¼at a bound- Ò crease the vorticity of the flow. Visually this keeps the smoke alive @ ary point with normal Ò. (Note that it is also straightforward to im- over time. This forcing term is completely consistent with the Eu- pose Dirichlet boundary conditions where the pressure is specified ler equations in the sense that it disappears as the number of grid directly as opposed to specifying its normal derivative.) The inter- cells is increased. In CFD this technique was applied to the numeri- mediate velocity field is then made incompressible by subtracting cal computation of complex turbulent flow fields around helicopters the gradient of the pressure from it where it is not possible to add enough grid points to accurately re- solve the flow field. The computation of the force only adds a small £ = Ù ¡ØÖÔ: Ù (5) computational overhead. Consequently our simulations are almost as fast as the one’s obtained from the basic Stable Fluids algorithm We also need equations for the evolution of both the tempera- [17]. Our model remains stable as long as the magnitude of the ture Ì and the smoke’s density . We assume that these two scalar forcing term is kept below a certain threshold. Within this range, quantities are simply moved (advected) along the smoke’s velocity our time steps are still orders of magnitude higher than the ones used in explicit schemes. @Ì ´Ù ¡ÖµÌ; = (6) Semi-Lagrangian schemes are very popular in the atmospheric @Ø sciences community for modeling large scale flows dominated by @ ´Ù ¡Öµ: = (7) constant advection where large time steps are desired, see e.g. [19] @Ø for a review. We borrow from this literature a higher order inter- polation technique that further increases the quality of the flows. Both the density and the temperature affect the fluid’s velocity. This technique is especially effective when moving densities and Heavy smoke tends to fall downwards due to gravity while hot gases temperatures through the velocity field. tend to rise due to buoyancy. We use a simple model to account for Finally, our model, like Foster and Metaxas’ [6], is able to han- these effects by defining external forces that are directly propor- dle boundaries inside the computational domain. Therefore, we are tional to the density and the temperature able to simulate smoke swirling around objects such as a virtual f = «Þ · ¬ ´Ì Ì µÞ; Ý aÑb bÙÓ (8) actor. =´¼; ¼; ½µ Ì The rest of the paper is organized as follows. In the next section Þ b where points in the upward vertical direction, aÑ ¬ we derive our model from the equations of fluid flow, and in section is the ambient temperature of the air and « and are two positive 3 we discuss vorticity confinement. In section 4, we outline our constants with appropriate units such that Equation 8 is physically =¼ Ì = Ì implementation. In section 5, we present both an interactive and a b meaningful. Note that when and aÑ , this force is high quality photon map based renderer to depict our smoke simu- zero. ´Ù ¡Öµ lations. Subsequently, in section 6, we present some results, while Equations 2, 6 and 7 all contain the advection operator . section 7 concludes and discusses future work. As in [17], we solve this term using a semi-Lagrangian method [19]. We solve the Poisson equation (Equation 4) for the pressure using an iterative solver. We show in Section 4 how these solvers can also 2 The Equations of Fluid Flow handle bodies immersed in the fluid. At the outset, we assume that our gases can be modeled as inviscid, incompressible, constant density fluids. The effects of viscosity 3 Vorticity Confinement are negligible in gases especially on coarse grids where numerical dissipation dominates physical viscosity and molecular diffusion.