Gaseous Phenomena © Copyright 2003-15, Howard J. Hamilton, University of Regina Main Reference for this page: Computer Animation: Algorithms and Techniques by Rick Parent (Section 8.2 in the second edition, Section 5.3 in the first edition) Gaseous Phenomena - difficult to model since gas has no fixed geometry - usually treated as compressible as opposed to liquids which are not - a steady state flow indicates constant velocity and acceleration through space - vortices are circular swirls like a tornado 1. General Approaches to Modeling Gas - there are three main approaches used to model gas A. grid-based methods (Eulerian formulations) B. particle-based methods (Lagrangian formulations) C. hybrid methods A. Grid-Based Method o break space into equal-sized cells and then calculate the flow of gas among the individual cells o mass in each cell is therefore updated at each time interval o since all cells have equal size, density is directly proportional to mass o we can use the density to determine visibility and illumination during rendering o gas attributes (i.e., velocity, mass, etc) can be used to control movement from cell to cell Flow out: based on cell size and the mass and velocity of the gas in the cell Flow in: based on the movements of gas from the surrounding cells o changes in a cell can occur when external forces (i.e., wind, object movement, etc) go through a cell o the animator must either define the cells before rendering (fixed number throughout but low overhead) or allocate and deallocate cells throughout the procedure (flexible number but high overhead) Example: o We can simulate gases moving through 2D space by updating the position of each cell-sized mass of gas independently at each time step. o The update is done by determining a new position based on the old position plus the velocity. o Suppose that the new position is represented by a shape of the same size as the original cell. o Since this may overlap several cells, we determine which cells, and then distributed the mass from the original cell to these cells in proportion to the extent the shape overlaps the cells. o Recall that we assume that all cells have the same size. o If two or more bodies of gas flow into the same cell, then their masses are added and a new velocity is computed based on the mass-weighted average of the inflowing gases (we compute a weighted average to conserve momentum). o Two tendencies: o Since we combine inflowing gases whenever they are in the same cell, the gas may become more concentrated with time; o Since we divide outflowing gas whenever they straddle cell boundaries, the gas may be more dispersed with time. o Over time, in the example program, the latter tendency always wins. o For notes on how to program a gas simulation: see http://www.cs.uregina.ca/~anima/Notes/Gas/GasSimulationProgram.htm o For some classroom examples: see o http://www.cs.uregina.ca/~anima/Notes/Gas/GasExample1.txt output for first class example o http://www.cs.uregina.ca/~anima/Notes/Gas/GasExample2.txt output for second class example o http://www.cs.uregina.ca/~anima/Notes/Gas/GasExample3.txt output for third class example o picture of real gases in space: http://apod.nasa.gov/apod/ap080217.html B. Particle-Based Method o break the gas into particles or “globs” which flow through the space (think particle systems) o particles are given masses and external forces can act upon them o this method is similar to rigid body dynamics so the concepts and equations are familiar o unfortunately, the number of particles needed to generate a realistic animation is quite large o so fewer, larger particles are used and they are typically visualized as fuzzy images that combine well. C. Hybrid Method o break the space into cells and track the movement of particles through those cells 2. Computational Fluid Dynamics (CFD) - Physics-based methods of animating gas flow use computational fluid dynamics (CFD) - CFD is based on the Navier-Stokes (NS) equations, which are differential equations that describe fluid flow. Gas flow can be modeled using the Navier-Stokes equations in a grid-based format This approach uses the principles of conservation of momentum, mass, energy The approach also takes into account the flow in and out of cells - Vortex-based methods (utilizing particle methods) can also be used.