MOTION CONTROL FOR FLUID ANIMATION: FLOW ALONG A CONTROL PATH

Similar documents
Realtime Water Simulation on GPU. Nuttapong Chentanez NVIDIA Research

2.7 Cloth Animation. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter 2 123

Animation of Fluids. Animating Fluid is Hard

Realistic Animation of Fluids

Adarsh Krishnamurthy (cs184-bb) Bela Stepanova (cs184-bs)

CGT 581 G Fluids. Overview. Some terms. Some terms

Realistic Animation of Fluids

Mass-Spring Systems. Last Time?

Navier-Stokes & Flow Simulation

Smoke Simulation using Smoothed Particle Hydrodynamics (SPH) Shruti Jain MSc Computer Animation and Visual Eects Bournemouth University

Navier-Stokes & Flow Simulation

Navier-Stokes & Flow Simulation

CS 231. Fluid simulation

Isogeometric Analysis of Fluid-Structure Interaction

Water. Notes. Free surface. Boundary conditions. This week: extend our 3D flow solver to full 3D water We need to add two things:

Hardware Accelerated Real-Time Fluid Surface Simulation

CHAPTER 1. Introduction

CHAPTER 3. Elementary Fluid Dynamics

Mid-Year Report. Discontinuous Galerkin Euler Equation Solver. Friday, December 14, Andrey Andreyev. Advisor: Dr.

Fluid Simulation. [Thürey 10] [Pfaff 10] [Chentanez 11]

A Framework for Real-Time Animation of Liquid-Rigid Body Interaction

Physically Based Simulation and Animation of Gaseous Phenomena in a Periodic Domain

More Animation Techniques

3D Simulation of Dam-break effect on a Solid Wall using Smoothed Particle Hydrodynamic

Continued Investigation of Small-Scale Air-Sea Coupled Dynamics Using CBLAST Data

Lagrangian and Eulerian Representations of Fluid Flow: Kinematics and the Equations of Motion

CS205b/CME306. Lecture 9

Fluid Simulation. Dhruv Kore, Giancarlo Gonzalez, and Jenny Sum CS 488: Introduction to Computer Graphics Professor Angus Forbes

Physics Tutorial 2: Numerical Integration Methods

Cloth Simulation. Tanja Munz. Master of Science Computer Animation and Visual Effects. CGI Techniques Report

Table of contents for: Waves and Mean Flows by Oliver Bühler Cambridge University Press 2009 Monographs on Mechanics. Contents.

Coupling of STAR-CCM+ to Other Theoretical or Numerical Solutions. Milovan Perić

Interaction of Fluid Simulation Based on PhysX Physics Engine. Huibai Wang, Jianfei Wan, Fengquan Zhang

Technical Report TR

Three Dimensional Numerical Simulation of Turbulent Flow Over Spillways

Level set methods Formulation of Interface Propagation Boundary Value PDE Initial Value PDE Motion in an externally generated velocity field

Fluids in Games. Jim Van Verth Insomniac Games

CS-184: Computer Graphics Lecture #21: Fluid Simulation II

Using a Single Rotating Reference Frame

Overview of Traditional Surface Tracking Methods

A Novel Approach to High Speed Collision

Driven Cavity Example

1.2 Numerical Solutions of Flow Problems

MESHLESS SOLUTION OF INCOMPRESSIBLE FLOW OVER BACKWARD-FACING STEP

Divergence-Free Smoothed Particle Hydrodynamics

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation

IMPROVED WALL BOUNDARY CONDITIONS WITH IMPLICITLY DEFINED WALLS FOR PARTICLE BASED FLUID SIMULATION

Computer Animation. Algorithms and Techniques. z< MORGAN KAUFMANN PUBLISHERS. Rick Parent Ohio State University AN IMPRINT OF ELSEVIER SCIENCE

A Direct Simulation-Based Study of Radiance in a Dynamic Ocean

CFD MODELING FOR PNEUMATIC CONVEYING

Characteristic Aspects of SPH Solutions

Non-Newtonian Transitional Flow in an Eccentric Annulus

Computer Project 3. AA Computational Fluid Dyanmics University of Washington. Mishaal Aleem March 17, 2015

Introduction to C omputational F luid Dynamics. D. Murrin

The 3D DSC in Fluid Simulation

INTERACTION BETWEEN TURBULENT DYNAMICAL PROCESSES AND STATISTICS IN DEFORMED AIR-LIQUID INTERFACES, VIA DNS

ALE Seamless Immersed Boundary Method with Overset Grid System for Multiple Moving Objects

Numerical Analysis of Shock Tube Problem by using TVD and ACM Schemes

Cloth Simulation. COMP 768 Presentation Zhen Wei

Essay 1: Dimensional Analysis of Models and Data Sets: Similarity Solutions

(LSS Erlangen, Simon Bogner, Ulrich Rüde, Thomas Pohl, Nils Thürey in collaboration with many more

PHYSICALLY BASED ANIMATION

SPH: Towards the simulation of wave-body interactions in extreme seas

Acknowledgements. Prof. Dan Negrut Prof. Darryl Thelen Prof. Michael Zinn. SBEL Colleagues: Hammad Mazar, Toby Heyn, Manoj Kumar

Volcanic Smoke Animation using CML

Computer animation for fluid simulation of a high viscous fluid melting

Introduction to Computational Fluid Dynamics Mech 122 D. Fabris, K. Lynch, D. Rich

Partial Differential Equations

Debojyoti Ghosh. Adviser: Dr. James Baeder Alfred Gessow Rotorcraft Center Department of Aerospace Engineering

Lagrangian methods and Smoothed Particle Hydrodynamics (SPH) Computation in Astrophysics Seminar (Spring 2006) L. J. Dursi

Support for Multi physics in Chrono

Announcements. Ray tracer is due in five days you should have started by now or you re going to have a bad week. Missing file posted on the web page

NUMERICAL VISCOSITY. Convergent Science White Paper. COPYRIGHT 2017 CONVERGENT SCIENCE. All rights reserved.

Particle-Based Fluid Simulation. CSE169: Computer Animation Steve Rotenberg UCSD, Spring 2016

Real-time Breaking Waves for Shallow Water Simulations

Coastal impact of a tsunami Review of numerical models

Simulation in Computer Graphics. Particles. Matthias Teschner. Computer Science Department University of Freiburg

SPC 307 Aerodynamics. Lecture 1. February 10, 2018

Inviscid Flows. Introduction. T. J. Craft George Begg Building, C41. The Euler Equations. 3rd Year Fluid Mechanics

Lesson 1: Introduction to Pro/MECHANICA Motion

A High Quality, Eulerian 3D Fluid Solver in C++ A Senior Project. presented to. the Faculty of the Computer Science Department of

Strömningslära Fluid Dynamics. Computer laboratories using COMSOL v4.4

Fluent User Services Center

The Simulation of Liquids

Simulation in Computer Graphics. Deformable Objects. Matthias Teschner. Computer Science Department University of Freiburg

Transfer and pouring processes of casting by smoothed particle. hydrodynamic method

Solving Partial Differential Equations on Overlapping Grids

An added mass partitioned algorithm for rigid bodies and incompressible flows

6 Fluid. Chapter 6. Fluids. Department of Computer Science and Engineering 6-1

Development of an Integrated Computational Simulation Method for Fluid Driven Structure Movement and Acoustics

Modeling and simulation the incompressible flow through pipelines 3D solution for the Navier-Stokes equations

Anatomy of a Physics Engine. Erwin Coumans

Possibility of Implicit LES for Two-Dimensional Incompressible Lid-Driven Cavity Flow Based on COMSOL Multiphysics

Chapter 5: Introduction to Differential Analysis of Fluid Motion

Tutorial: Modeling Liquid Reactions in CIJR Using the Eulerian PDF transport (DQMOM-IEM) Model

FAST ALGORITHMS FOR CALCULATIONS OF VISCOUS INCOMPRESSIBLE FLOWS USING THE ARTIFICIAL COMPRESSIBILITY METHOD

Structure and Synthesis of Robot Motion

Multi-Domain Pattern. I. Problem. II. Driving Forces. III. Solution

Particle-based Fluid Simulation

computational Fluid Dynamics - Prof. V. Esfahanian

Transcription:

MOTION CONTROL FOR FLUID ANIMATION: FLOW ALONG A CONTROL PATH A Thesis Presented in Partial Fulfillment of the Requirements for Graduation with Distinction in the College of Engineering of The Ohio State University By Patrick Coleman ***** The Ohio State University 2002 Examination Committee: Dr. Richard E. Parent, Advisor Dr. Raghu Machiraju Approved by Adviser Department of Computer and Information Science

Copyright by Patrick Coleman 2002 ii

ABSTRACT The modeling of natural phenomena is among the most challenging problems in computer animation. The difficulty arises from the complexity of the models used to describe the motion of these phenomena. Realistic modeling of fluid motion is difficult because of the variety of detail that must be considered to create a convincing animation. Various models of fluid motion have been presented over the years, and great strides have been made in the development of realistic simulation and rendering techniques. Relatively little attention has been paid to the control of fluid flow, however. There is no easy way to incorporate control into existing simulation techniques with accuracy, as these techniques are not amenable to control. Most existing techniques also require some intuitive knowledge on the part of the animator to produce desired motion with efficiency. This is not desirable, since it can not only require a steeper learning curve, but also increase production time to achieve acceptable results. A control tool for fluid animation has been developed that allows the user to define a path along which motion is desired. The tool includes various methods to manipulate the simulation; this allows the user to choose among different levels of control. Furthermore, the tool abstracts the techniques used to influence motion in order to avoid requiring an understanding of the motion model for effective use. iii

Dedicated to my father, the late Jim Coleman, for all the honest advice. iv

ACKNOWLEDGMENTS Completion of this thesis, and the research that came along before it, would have never happened if not for the advice, help, suggestions, and random comments of many people. Special thanks to Rick Parent and Raghu Machiraju for advising me. They not only helped me find a topic of interest and a direction to head off in, but also provided valuable information along the way. And motivation through the courses I ve taken with them. to Yootai Kim for providing code for reference. To Diane for reviewing a draft of this thesis. To the CIS students who have long provided plenty of random and occasionally valuable conversation In no particular order: Jared, Jon, Diane, Travis, Shane, Jim, Craig, Blair, Andy, Scott, Miriam, and whoever else I m forgetting. And to Nikki for getting me interested in this stuff. for the support of undergraduate research through Europa. Thanks to Bruce, Tim, Paolo, & Wayne. Partial support from Europa was provided by the National Science Foundation under an REU supplement to grant CCR-0081596. Also thanks to the CIS department for support through departmental scholarships. Finally thanks to the ever-eccentric S.B. for all the truly useless comments. v

VITA March 12, 1980 Born Middleburg Heights, Ohio 1998..Diploma, North Olmsted High School, North Olmsted, Ohio FIELDS OF STUDY Major Field: Computer Science and Engineering vi

TABLE OF CONTENTS Abstract...iii Dedication...iv Acknowledgements..v Vita..vi Table of Contents...vii List of Figures..x Chapters: 1. Introduction..1 1.1 Motivation 1 1.2 The Problem of Controlled Fluid Motion 2 1.2.1 Simulation 2 1.2.2 Control.3 1.3 A Path Defining Fluid Controller 4 1.4 Overview of this Thesis...5 2. Background..6 2.1 Modeling Wave Motion...6 2.2 Two-Dimensional Approximations.8 vii

2.3 Three-Dimensional Solutions....10 2.4 Adding Control..14 2.5 Summary 14 3. Methods of Fluid Dynamics...16 3.1 Basic Properties of Fluids..16 3.2 Frames of Reference..17 3.3 Development of the NS Equations.18 3.3.1 Conservation of Momentum..18 3.3.2 Conservation of Mass 19 3.4 Special Cases: Common Fluids Used in Practice..19 4. The Path Defining Control Tool 21 4.1 Effective Fluid Control..21 4.2 The Path Defining Control Interface..22 4.3 Application of Specified Motion...24 4.3.1 Recasting a Path as a Control Field...25 4.3.2 Mechanisms for Simulation Manipulation.27 4.4 Moving Paths.....29 4.4.1 Correspondence Among Discrete Paths 29 4.4.2 Application of a Moving Path...30 4.5 Performance...31 4.6 Summary....31 5. Implementation and Results...33 5.1 Implementation..33 viii

5.1.1 Fluid Simulation 34 5.1.2 Motion Visualization.34 5.1.3 Control Application...35 5.2 Results 35 6. Conclusions and Future Work...38 Bibliography..40 ix

LIST OF FIGURES Figure Page 4.1 Interface of a flow control path..23 4.2 Magnitude falloff for various attenuation values...23 4.3 Spatial discretization of a fluid environment.25 4.4 Influence field resulting from a control curve 26 4.5 An influence field for a piecewise linear approximation of a curve..26 4.6 The tradeoff between control and realism..29 4.7 Creation of an intermediate curve for interpolation...30 4.8 Full algorithm for applying an arbitrary number of static and dynamic controls...32 5.1 Examples of influence fields..36 5.2 The application of the influence fields in Figure 5.1 with different motion constraints..36 x

CHAPTER 1 INTRODUCTION Water is everywhere in our world; we use it for recreation and as a design tool, and it can be regarded as a subject of beauty. Because of this omnipresence, engineers and artists have long studied its appearance and motion. In recent years, the field of computer animation has adopted very believable simulations of fluid motion to facilitate the creation of a wide variety of complex effects. Advances in computer graphics, animation, and numerical modeling have led to the development of realistic models for motion and rendering. Creation of desired fluid motion remains a difficult task. Existing techniques can be difficult to work with, and resulting motion can be unpredictable. Ideally, an animator should set up a fluid environment with motion constraints, and the animation system should be able to create a believable simulation that satisfies these constraints. 1.1 Motivation The motion of fluids is incredibly complex. It depends on both the interactions between the fluid and the environment and among the fluid particles. Fluid motion resembles that of a continuum on a larger scale. The dynamics of splashing, breaking 1

waves, and other interesting fluid phenomena require that a general fluid animation system to include a complex motion model. A great deal of study has been expended on not only general fluid solvers, but also systems that support particular effects[9][17][19]. Incorporating control into these systems is a challenging task. Any direct simulation must be manipulated as it advances to behave as desired. Such manipulations cause the system to deviate from physically correct behavior. To incorporate effective control into direct simulation, mechanisms can be developed that allow the user to control the degree of influence. This freedom allows the animator to choose an appropriate balance between realism and control. The interface of such a tool should be simple and intuitive, to reduce production time. 1.2 The Problem of Controlled Fluid Motion The creation of a system that models the motion of fluids with believable control is a challenging task. An ideal system would incorporate all specified motion into the simulation while maintaining physical integrity. Development of such a system requires the solution of two problems. A model of believable motion that generates believable results in a short amount of time must be created, and a method for applying motion constraints to the physical simulation of the model must be developed. 1.2.1 Simulation Fluid simulation systems for animation require far less realism than those developed for engineering study. Engineers are interested in producing accurate data that represents the motion of a real fluid. Animators, on the other hand, are only concerned with the creation of perceptually believable motion. Researchers in the field of 2

computational fluid dynamics have created near realistic but computationally intensive simulation techniques. These simulations are often run on rather expensive supercomputers to produce realistic, detailed data. Animators require a simulation system that will run at interactive rates on a smaller-scale system. It is in their artistic nature to continually tweak motion in an animation. Animation systems for fluids have made a great deal of progress in the last two decades. For many years, computational resources were the primary constraining factor in terms of what degree of realism could be achieved. Hardware advances and new simulation techniques have facilitated the creation of three-dimensional fluid simulation systems for animation. Methods for producing very realistic animations have been developed, but many details still need to be addressed. These include realistic turbulence models and techniques to handle small-scale details of splashing. 1.2.2 Control Control tools for animators should be intuitive and easy to use. Animators should also be able effectively control motion to create a believable animation. Any motion can be key-framed, but this method can be time consuming to work with, especially when applied to natural phenomena. Applying forces to rigid objects to effect motion is straightforward and predictable. This technique does not adapt well to continuous bodies such as fluids, since the necessary force functions can be rather complex. Abstract tools can to be designed to manipulate fluid flow without requiring user interaction with the underlying simulation. Furthermore, these tools can abstract not only the control mechanism, but also the geometric model of the fluid. 3

In addition to providing an effective interface, animation tools should interact with the simulation to produce visually believable results. Ideally, the resulting motion would adhere to the motion model with accuracy. Accomplishing this accuracy in fluid simulation requires knowledge of initial conditions that would produce the desired motion. Determining these conditions requires an inverse solution process that is beyond the scope of this thesis. Instead, a more tangible and simpler technique is presented to enforce various degrees of control. It does not guarantee any physical correctness, but allows the animator to manipulate the level of control as necessary to produce visually believable motion. 1.3 A Path Defining Fluid Controller This thesis presents a particular fluid control tool that of a constrained motion path. The tool will allow the user to specify a curve through a fluid environment. This curve conceptually defines a channel of current. A number of characteristics of the fluid flow can be manipulated. The magnitude can be specified, and the effect of control within the region of influence can be manipulated. The control curve can also be animated to create moving currents. Beneath the interface, the curve tool manipulates a vector field. This field is applied to the simulation process to directly manipulate fluid flow. Different interpretations of this vector field lead to different techniques of manipulation. Each manipulation technique results in a different level of control. A tradeoff exists between the level of control enforced and the accuracy of the motion produced. It is the overall premise of this thesis that fluid flow for animation can be directly controlled, but an 4

animator should have the ability to choose an effective balance between control and realism. 1.4 Overview of this Thesis Chapter 2 presents previous work in fluid animation, including the development of modern three-dimensional simulation techniques. A discussion of known control mechanisms is also presented. A review of the physics behind the motion models in animation is presented in Chapter 3. Chapter 4 describes the control of fluid simulation, and an appropriate implementation is described in Chapter 5. Finally, in Chapter 6, a summary and conclusions are presented, along with a discussion of future research directions. 5

CHAPTER 2 BACKGROUND The simulation of fluids for computer animation has come a long way since the early 1980s when physical models of motion were first adapted. Early animations of fluid utilized rendering techniques such as bump mapping and height field displacement. These techniques were applied to a static surface. Early physical models simulated the motion of ocean waves [9][14][19]. More realistic two-dimensional physical descriptions of fluid motion were later used. This motion was applied to height field approximations of a fluid volume [3][12][17]. Since the mid-1990s, a number of closely related threedimensional simulation methods have been presented. These all adapt techniques from the Computational Fluid Dynamics (CFD) literature [4][7][8][21]. These models can simulate arbitrary fluid motion in either two or three dimensions. Little work has focused on the control of fluid motion [6][11], and an effective method for applying physically correct control to fluid animation has yet to be developed. 2.1 Modeling Wave Motion Early models of fluid motion for computer animation model the motion of ocean waves. These techniques model wave motion as a linear combination of sinusoidal 6

functions. They also make the assumption that fluid has no mass transport and only local displacement will occur. Max presents a basic model for ocean waves that applies well to a relatively calm region with no nearby boundaries [14]. Equation 2.1 gives the height function for any point on the surface. n z( x, y, t) = a cos( l x + m y ω t) (2.1) j= 1 j j j j The vector ( l, m ) is the direction of a waveform, ω is the frequency, and a j is the amplitude. The height is calculated using a linear first approximation of the above function. The resulting height field is a linear combination of waveform approximations. Peachy uses a more complex model that takes the steepening and breaking of waves as they approach shore into account [19]. The surface is again modeled as a height field. It is expressed as the composition of two functions, as described in Equation 2.2. n z( x, y, t) = a w ( θ ( x, y, t)) (2.2) j= 1 j j j The amplitude of a waveform is given by a j, and θ j defines the phase of the waveform. θ j varies over space and time as a function of the water depth and wavelength. The shape of a waveform is governed by w. This is a sinusoid in the general case. Waves j created with this model display the characteristic of refraction they slow down as they approach shore. This avoids any waves passing perpendicular to shore. Depth is also used to linearly blend the sinusoidal waveform function with a quadratic function (Equation 2.3). This increases wave steepness near shore. 7

w j 2 = 8 u 0.5 1 (2.3) The parameter u is the normalized distance between crests. Breaking waves are simulated by the emission of particles from the crest of a wave whenever the slope exceeds a threshold value. Fournier and Reeves use parametric equations to represent the water surface. This allows for limited three-dimensional effects [9]. Water motion is modeled by individual particles moving in elliptical paths that vary with depth. Effects such as breaking waves and refraction and handled by manipulation of the phase to include the cumulative effects of the bottom over which a wave passes. The phase also includes a parameter to create overturning wave profiles. The resulting motion model is given by Equations 2.4 and 2.5. x = x0 + r cos( α ) sx sin( φ) + sin( α) sy cos( φ) (2.4) y = y0 + r cos( α) sy cos( φ) + sin( α ) sx sin( φ) (2.5) The quantity φ is a time and depth dependent phase function, and α, s x, and s y are constants used to manipulate waveforms. 2.2 Two-Dimensional Approximations A desire to animate general fluid motion led to the development of physically based motion models. These two dimensional models all incorporate a height field to represent the fluid surface. However, a height field does not lend itself to overturning or pouring fluids. 8

Kass and Miller present a physically based method to simulate fluid flow over existing terrain [12]. The model handles effects caused by wave reflection, mass transport, and boundary conditions. They use a simplified version of the shallow water equations, given by Equations 2.6 and 2.7. 2 2 h h = gd 2 2 t x (2.6) 2 2 h h = gd 2 2 t y (2.7) The height of the water column is given by h, g is the constant of gravitation, and d is the water depth. The system is solved using a first-order implicit solution to a finite difference approximation. To utilize this technique, the fluid is represented as a grid of columns. The horizontal velocity is recorded for each column, and the height and depth are recorded for each intersection. Vertical velocity is assumed to be zero, although the height field is updated to conserve volume. Numerical instability can arise with this method if time steps are not sufficiently small. Chen and Lobo present a technique based on the Navier-Stokes equations in two dimensions [3]. Two restricting assumptions are made: the fluid has no depth, and the internal pressure of the liquid drives the height field. Reactions to moving objects in the fluid are also taken into account. O'Brien and Hodgins present an extension to Kass and Miller's technique to add interaction with objects and allow for splashing upon impact [17]. Fluid is again represented as a discrete grid of fluid columns. Velocity is defined within virtual pipes that exist between all pairs of adjacent and diagonal columns. These velocity values are 9

scalar, as the direction can be determined from the pipe s spatial orientation. These values are updated by considering the forces resulting from the pressure exerted by the two connected columns. The resulting change in flow between columns at ( i, j ) and ( k, l ) is driven by Equation 2.8. Q ta[ ρ g h + Eij Ekl ] = + Q (2.8) 2ρl t+ t t ij kl ij kl The value of h is the difference in height between the two columns, and E and ij E kl are the external pressures exerted on each. The cross-sectional area of the pipe is given by A, and l is its length. Volume conservation and response to external pressure are used to update the height field. This results in a less physically correct model, but it produces believable motion. 2.3 Three Dimensional Solutions Full three-dimensional solutions to the Navier-Stokes (NS) equations for fluid flow were adapted in the mid-1990s. Available computing power made it feasible to utilize computational fluid dynamics (CFD) methods of simulation in an animation environment. The CFD approach approximates a fluid environment into a volumetric grid, with fluid properties recorded for each voxel. As applied to animation, solution of the NS equations is accomplished by taking discrete time steps to update fluid properties at all locations. NS-based simulations create believable results for a large class of problems, as they naturally handle much of the complicated motion that arises in fluids. Foster and Metaxas presented the first NS-based fluid animation system [8]. The system handles the motion of incompressible liquids, maintains the liquid surface, and 10

handles interaction with the external environment. The environment containing the fluid is converted to a voxel representation for simulation purposes, and interacting objects are also incorporated as voxelized approximations. Simulation is based on the NS equations for conservation of momentum and mass. These equations will be presented in Chapter 3. For each simulation step, the following actions are taken: Determine current cell contents. Enforce boundary conditions. Compute new fluid velocity. Force fluid to conserve mass and update the pressure field. Update the surface location. The first two steps are rather straightforward, and the last is dependent on the surface representation, which can be a set of tracking particles, a parametric surface, or a height field. The velocity is updated by a finite difference approximation for conservation of momentum. This requires a rather small time step to maintain stability. Conservation of mass is accomplished through a relaxation scheme. This involves in iterative process of reducing velocity components of each cell until the divergence is close to zero. Overall, the algorithm in easy to write, but is not useful for interactive systems, due to the small time step required for stability. Stam later presented a numerically stable method for simulation of incompressible fluids. This stability is accomplished by using a semi-lagrangian method to update the velocity field [21]. The method as presented handles the simplified case of an 11

environment entirely filled with fluid to avoid tracking a surface. However, it can be easily modified to make use of many existing techniques that do so. Each time step involves the following: Add effects of forces to the velocity field. Advect the velocity field. Diffuse the velocity field. Force the fluid to conserve mass. The first step is straightforward, and the advection step involves a first-order integration scheme to trace a virtual particle back in time to determine its velocity. Diffusion takes the effects of viscosity into account, and it is accomplished through the solution of Equation 2.9, where I is the identity operator. 2 ( I - t ) ν u = u (2.9) 1 0 Divergent flow is calculated by solution of the following equation: 2 q = u (2.10) The gradient of q is subtracted from the velocity field. Solution of Equations 2.9 and 2.10 is accomplished with a sparse linear solver. This method remains stable for relatively large time steps, but dampening small-scale rotational effects and a dissipation of mass can occur. Fedkiw, et. al. present a refinement of this technique to reduce rotational dampening with vorticity confinement [4]. The approach is applied to inviscid fluids only, which removes the diffusion step from Stam's method [21]. It can, however, be 12

used for viscous fluids. Effects of density and temperature are modeled by the advection of scalar fields, as the technique is applied to smoke simulation. Vorticity confinement involves an automatic reintroduction of rotational forces that dampen out. A confinement force is added to the system during the force application step (Equation 2.11). f = εh( N ) (2.11) conf The constant ε is used to control the expression of the confinement force, h is the value of the spatial discretization, N is the normalized vorticity location vector, and is local vorticity. These are related by Equations 2.12-2.14. = u (2.12) = u (2.13) N = (2.14) Foster and Fedkiw present another method for liquid [7], incorporating part of Stam's semi-lagrangian solution [21]. This model reduces mass dissipation by using an implicit surface known as a level set to model the liquid surface. A set of inertialess particles is also added to incorporate splashing effects. The diffusion step is solved with a finite difference approximation. An adaptive step size is incorporated to automatically correct for high velocity regions. Diffusion is solved using a finite difference approximation, as had previously been used by Foster and Metaxas [8]. Conservation of mass is expressed to take pressure variation into account: ρ u 2 p = t (2.15) 13

This equation is solved using another finite approximation based on a technique known as the Preconditioned Conjugate Gradient Method. 2.4 Adding Control The creation of accurate models for control has yet to be solved. Direct manipulation of the force field is often suggested [7][8][21]. This technique produces unpredictable results, and can be difficult to work with. Foster and Fedkiw also suggest direct manipulation of the velocity field at virtual boundaries [7]. Foster and Metaxas present a set of tool to control motion by manipulating velocity, force, pressure, and surface tension[6]. However, the more general tools require a mathematical specification of a field, which can be difficult to create for most arbitrary motion. None of these techniques suggest a simple approach for creating fields to manipulate simulation. Gates presents a more intuitive control tool, that of a streamline curve. This is used to create an exact flow field in a region surrounding the curve [11]. The controlled flow field can then be linearly combined with an existing dynamic flow field. This method abstracts the control technique, and works when assuming a linear motion model. However, the full NS equations are nonlinear, and the interaction between controlled and dynamic flow within the full NS model is not handled. 2.5 Summary Fluid simulation for animation has come a long way toward creating believable motion. A number of problems have been solved for simulating a wide variety of fluids encountered in nature, and at interactive rates. Creating desired motion for computer animation is still a challenging problem, as a physically correct solution has yet to be 14

developed. Existing control mechanisms also have complex interfaces that are difficult for a conventional animator to use. 15

CHAPTER 3 METHODS OF FLUID DYNAMICS This chapter introduces basic fluid properties and presents the full Navier-Stokes (NS) equations of fluid motion. This is meant only to provide enough background to understand the techniques used in this thesis; a wide variety of texts are available for further information. Aris provides a detailed discussion of fluid mechanics [1], and introductory texts provide a good overview of fluid properties. Cengel and Turner has been referenced for this discussion [2]. 3.1 Basic Properties of Fluids Any substance in the liquid or gas phase can be classified as a fluid. The primary characteristics of a fluid are its lack of a definite shape, its ability to flow, and its tendency to react to very slight changes in pressure. Fluids may be classified in many ways. A common primary classification is by resistance to flow. Inviscid fluids have no internal resistance to flow, as inter-molecular forces are trivial relative to molecular inertia. Viscous fluids do resist flow, and can be further classified as Newtonian or non- Newtonian. Newtonian fluids obey a linear relationship between the shear stress, s, u applied by friction and the resulting velocity gradient,. The vector u denotes velocity. t 16

Most commonly encountered fluids are Newtonian. Examples of non-newtonian fluids are blood, egg whites, and plastics. Viscosity may be expressed by the coefficient of dynamic viscosity, µ, which is the constant of proportionality in the Newtonian relationship (Equation 3.1). u s = µ t (3.1) Viscosity, as it is commonly used, is coupled with density, ρ. This defines the coefficient of kinematic viscosity (Equation 3.2). µ ν = (3.2) ρ All fluids are compressible to some degree. Compressible fluids have a nontrivial degree of density variation when undergoing flow, and incompressible fluids have negligible density variation. All liquids and gases moving much slower than the speed of sound can be treated as incompressible. Fluid flows can also be classified as either turbulent and laminar (non turbulent). Turbulence is a qualitative measure of the degree of chaotic motion in fluid flow. Most fluids, especially highly viscous fluids, undergo laminar flow. Air and water at high velocities undergo highly turbulent flow. 3.2 Frames of Reference All fluids are physically made up of a large system of particles. The motion of fluids is dependent on the interaction among these particles and with the external environment. Fluid motion as presented from the particle perspective is known is the Lagrangian description. A large body of fluid may be approximated as a continuum, 17

where most of the molecular interactions cancel out. This perspective is known as Euclidean. From a Euclidean perspective, the properties of the fluid are considered at a spatial point. Lagrangian simulations of fluid flow are very complex, as they involve interactions among a large number of particles. They do not adapt well to computational systems, unless the fluid particles are sparse enough to render their interaction nearly insignificant. Euclidean simulations are much better suited to computation. The continuum can be approximated as a grid of discrete cells, with the properties of the fluid defined in each cell. 3.3 Development of the NS Equations The Navier-Stokes equations of fluid motion are based on two fundamental principles: conservation of momentum and conservation of mass. Conservation of momentum can be expressed with Newton's second law, f = ma. Conservation of mass as applied to fluids states that any closed volume has no mass dissipation. It is from these basic concepts that the NS equations are derived. The equations will be developed with the assumption of three dimensions, although they can describe the motion of a fluid of arbitrary dimension. 3.3.1 Conservation of Momentum When applying Newton's second law to fluid motion, the acceleration of a fluid at a given point and all forces present must be considered. Fluid acceleration at a spatial point is given by the material derivative (Equation 3.3). This takes into account the change of motion in each direction as well as over time. D u = u + u u x + u u y + u u z Dt t x y z (3.3) 18

This is more concisely expressed by Equation 3.4. Du u = + ( u ) u (3.4) Dt t The simplest force affecting fluid motion is the body force, f b. A body force is any force that is constant through the fluid volume, such as the local effect of gravity. The pressure gradient exerts a force against its direction equal to p, and viscosity ρ exerts an opposing force equal to ν ( u ). Casting these forces and the material derivative (Equation 3.4) into Newton's second law results in the flowing equation: D u 1 = f b p + ν ( u ) (3.5) Dt ρ 3.3.2 Conservation of Mass For mass to be conserved within a fluid, the change of mass due to density variation must equal the change in mass due to fluid motion. The change in density at a given point is its material derivative, and Equation 3.6 equates density variation and mass movement. Dρ = ( ρu ) (3.6) Dt 3.4 Special Cases: Common Fluids Used in Practice The NS equations describe the motion of fluids encountered in practice, as most common fluids are Newtonian. Making certain assumptions when possible simplifies the equations; this in turn simplifies motion simulation. Most gases are approximately inviscid, and removing the viscosity term from Equation 3.5 results in the 19

following relation for conservation of momentum: D u 1 = f b p (3.7) Dt ρ Most liquids and low-velocity gases can be assumed to be incompressible; therefore their density is approximately constant. The density variation term drops out from Equation 3.6, and the following equation represents conservation of mass: u = 0 (3.8) Finally, low velocity gases can be assumed as both incompressible and inviscid. Equation 3.7 gives conservation of momentum and conservation of mass is given by Equation 3.8. These equations are also known as the Euler equations. 20

CHAPTER 4 THE PATH DEFINING CONTROL TOOL Computer animators require effective motion control mechanisms to express ideas with ease. Such control mechanisms may or may not be based on physical models; it can be desirable to impart nonrealistic motion on an object to meet demands of a particular scene. Physically based animation techniques have been developed to automate complex natural motion such as fluid flow, fire, and explosion. These models are necessary for believable incorporation of these phenomena into an animation, as directly describing their motion would be prohibitive in terms of development time. The complexity of many of these physical models makes it difficult to incorporate accurate methods of control, as direct manipulation often produces motion that is not physically correct. To approach this problem, a method for specifying control for fluid motion is discussed, and its application to a particular control tool is presented. 4.1 Effective Fluid Control To effectively express ideas of motion in natural systems, animators require tools which incorporate user-supplied motion constraints into the physical motion model. These tools should also provide an intuitive interface that abstracts the details of the 21

motion model. This interface should not only hide the details of how motion is created, but also provide an abstract set of motion parameters which can be manipulated. Adherence to these criteria will help ensure a tool is easy to use while also allowing for the effective expression of ideas. Animated natural phenomena should also adhere to physical laws of motion to an extent that is believable. Unfortunately, it is very difficult to determine physically correct behavior of many natural phenomena with motion constraints. Within the domain of fluid simulation, it requires a temporally inverse solution of the system to determine a set of initial conditions that naturally produce desired motion. Rather than attempting to approach the problem from the inverse perspective, a method of control that manipulates the simulation as it progresses is presented. This method allows a degree of freedom in terms of control enforcement. More exact control comes at the cost of adherence to the simulation model, but this freedom allows animators to choose between control and realism. 4.2 The Path Defining Control Interface One desirable fluid motion effect is a current that can be manipulated. A motion control tool for this effect should present an interface that allows an animator to describe a wide variety of currents (Figure 4.1). A path is used to define the location of current flow. A wide variety of curve modeling techniques are available to suit this need. Mortenson [15] provides a good introduction to potential models, and Gallier [10] provides a more rigorous treatment. Both open and closed paths are supported, as circular motion often arises in fluids. The magnitude and direction of desired flow are also specified. 22

Figure 4.1: Interface of a flow control path Figure 4.2: Magnitude falloff for various attenuation values 23

The interface also includes a threshold value to limit the affected region and a value to control how the magnitude of motion falls off with distance. An attenuation function is adapted from Parent [18]: s( r) = r width r width k + 1 1 ( ) ; k 0 1 k (1 ) ; k < 0 (4.1) This function is restrictive in the variety of cross-sectional currents that can be specified. However, it presents a simple interface and can describe many believable currents. Negative values of k will cause the current magnitude to fall off more rapidly at a greater distance from the curve, and positive values will it to fall off more quickly at a closer distance. Figure 4.2 demonstrates how magnitude falls off for different values of k. 4.3 Application of Specified Motion State-of-the-art fluid animation systems are based on the full simulation approach originally adapted for animation by Foster and Metaxas [8]. This approach requires a spatial discretization of the environment into a regular grid of voxels, with fluid properties defined for each voxel (Figure 4.3). To facilitate this geometric model, the effect of the control path is determined for each voxel within the threshold region. Modern simulation techniques for computer animation incorporate the stable velocity advection of Stam s solution. This allows time steps to be of arbitrary size without danger of numerical instability [21]. Control can be applied in the simulation process using different manipulation techniques. Each manipulation technique controls motion to a different extent. 24

Figure 4.3: Spatial discretization of a fluid environment 4.3.1 Recasting a Path as a Control Field Application of an arbitrary path to the voxelized environment is achieved by creating a field that describes the effect of control for each voxel. To simplify the discussion, a nonmoving path is assumed. Extension to moving curves is straightforward, as the control field can be computed for each time step. To facilitate multiple interpretations of the control field in the simulation process, it is described in abstraction as an influence field. Possible interpretations and corresponding incorporation into the simulation process are described below. To create this field of influence, a vector can be determined for each voxel in the environment (see Figure 4.4). The value of the influence vector at an arbitrary point is given by the combined influence of all points along the curve within the threshold distance (Equation 4.2). 1 inf = m ( u) s( r( u)) du (4.2) cell 0 25

Figure 4.4: Influence field resulting from a control curve Figure 4.5: An influence field for a piecewise linear approximation of a curve 26

The quantity u is the normalized distance along the curve, and m ( u) is the tangent vector at u, scaled to the specified magnitude of flow. The distance to the point of the curve at u is represented by r( u ), and s is the attenuation function described above. The attenuation function is modified to produce zero influence outside the threshold distance. For a discrete approximation to the curve (Figure 4.5), the influence vector of each cell is the linear combination of influence due to each segment: n inf = m s( r ) (4.3) cell i= 1 i i The vector m i is parallel to the i th segment and equal in magnitude to the average flow magnitude along the segment. The distance from the point to the segment is given by r i. Care must be taken to avoid too fine of a curve approximation, relative to the grid resolution. 4.3.2 Mechanisms for Simulation Manipulation The control tool has been applied to the stable fluids system presented by Stam [21]. This is a simple system whose model has been adapted for recent work in more accurate animation [4] [7]. The simulation consists of four steps: Apply forces to the velocity field. Advect the velocity field. Diffuse the field to take viscosity into account. Enforce conservation of mass. The first two steps directly modify the velocity field, and either can be exploited to manipulate motion. To interpret the influence field as a force function, it is incorporated 27

as a component of the force. This approach is straightforward; it involves addition of the influence field to any existing force field. The influence field can also be interpreted as a velocity constraint. One method considers the influence field as a minimum velocity constraint. In this case, the advected velocity field is modified to enforce the constraint. Motion in surrounding fluid regions still exerts influence on the controlled region. If natural motion is beyond the magnitude of the minimum constraint, the effect of control will not be apparent. Another interpretation of the influence field is as a direct constraint of velocity. In this case, the advected velocity field is modified to equal the influence field within the affected region. Both velocity constraints are enforced before diffusion and conservation of mass. This maintains viscous effects and avoids mass dissipation. Constraints could potentially be imposed after each step for even greater control, but with less realism. The three interpretations of the influence field result in different levels of control (Figure 4.6). In practice, the force field interpretation produces the most believable results, but with the least degree of control. The low level of control is due to the accumulation of force effects. This results in increasingly unpredictable behavior over time. The minimum velocity constraint exerts more control, as velocity is directly modified. Nearby regions of unconstrained fluid still influence the flow. The hard velocity constraint does not allow controlled flow to be modified by nearby unconstrained flow, except in regard to diffusion and mass conservation. As a result, this method exerts the strongest degree of influence, but with the least adherence to the motion model. Within the interface, these three interpretations are described as motion driving constraints, soft motion value constraints, and hard motion value constraints. 28

Figure 4.6: The tradeoff between control and realism 4.4 Moving Paths The creation of moving currents is facilitated by allowing the user to specify keyframed curves. Arbitrary discretization of key-framed curves is desirable, as they may not require the same resolution. Taking advantage of this can reduce computational expense, which can be especially valuable for high-resolution fluid environments. The method used to incorporate arbitrary resolution key-framed curves is described below. In practice, the resolution can be dynamically adjusted based on curvature or manually set by the user. 4.4.1 Correspondence Among Discrete Paths To determine the field at an arbitrary moment in time, at least the two temporally surrounding key-framed curves need to be considered for interpolation. For higher-order interpolation, additional curves need to be considered. Before interpolation can be performed, a correspondence needs to be created among the sampled curves. An intermediate interpolation curve is constructed. The sequence of points for this intermediate curve corresponds to the union of the points in each sampled curve. The 29

points are added such that the normalized distance along the new curve equals that in the original curve (Figure 4.7). For interpolation, each point includes a sample of the other key-framed curves at the same normalized distance. Figure 4.7: Creation of an intermediate curve for interpolation 4.4.2 Application of a Moving Path Application of a dynamic path is straightforward. For each temporal region between two keyed-framed moments in time, a single interpolated curve needs to be constructed (as in Figure 4.7). The location of the points on this curve is interpolated for each time step within that temporal region. This interpolated location of the intermediate curve is used to create the influence field for each time step. All interpolating curves are precomputed, and only one is necessary for each time sequence between two key-frames. 30

4.5 Performance results in Simulation of the fluid environment is linear in the number of cells [21]. This 2 O( n ) running time for two-dimensional fluids and 3 O( n ) running time for three-dimensional fluids. Application of a discrete control path is linear in the number of segments ( m ) and the number of cells. This is done once for static paths, resulting in an initial computational overhead of either 2 O( n m ) for two-dimensional fluids or 3 O( n m ) for three-dimensional fluids. Asymptotic performance of fluid simulation is not changed. The running time does increase when moving paths are defined, however. The influence field must be calculated for each time step, and the simulation performance increases to 2 O( n m ) for two-dimensional fluids and 3 O( n m ) for three-dimensional fluids. Utilizing minimum-resolution key-frame curves can minimize this computational expense. 4.6 Summary Multiple constraints can be applied to a simulation environment. Constraints that enforce greater levels of control are given precedence over those enforcing less control. Within each class of control, more recently defined paths are given precedence. For force constraints alone, this is not the case. Each force constraint has an additive effect to the force field, and this resulting field is used for flow manipulation. The resulting algorithm is listed in Figure 4.8. 31

initialize fluid simulator calculate all interpolating curves calculate all static influence fields for each time step add forces add forces due to static force constraints for each dynamic force constraint select appropriate interpolating curve calculate influence field add forces due to this influence field advance velocity enforce static minimum velocity constraints for each dynamic minimum velocity constraint select appropriate interpolating curve calculate influence field enforce minimum velocity due to this influence field enforce static exact velocity constraints for each dynamic exact velocity constraint select appropriate interpolating curve calculate influence field enforce exact velocity due to this influence field diffuse fluid enforce conservation of mass Figure 4.8: Full algorithm for applying an arbitrary number of static and dynamic controls 32

CHAPTER 5 IMPLEMENTATION AND RESULTS To investigate the actual effects of the path-defining fluid motion control tool, a basic but easily extensible fluid simulation system has been developed. The control tool has been incorporated into the simulation system, and a simple interface has been created to interact with it. Animations have been created to demonstrate the motion produced by applying the control tool in different configurations. 5.1 Implementation The fluid simulation system is based on the stable fluids system presented by Stam [21]. The system includes all the functionality of his, including application to both two- or three-dimensional fluids, and either periodic or closed fluid boundaries. The control system is also adaptable to both two- and three-dimensional environments. The system has been developed in Java and C, and makes use of FORTRAN library code for numerical solution, as discussed below. The resulting timings resulted from running the system on a PC with a 550 MHz Pentium III processor and 320 MB of RAM. 33

5.1.1 Fluid Simulation The fluid simulator is closely related to Stam's model, as it is straightforward to implement and provides stable results. The only notable difference is in the choice of library code used to solve the sparse linear systems. The POIS3D routine is used to solve the three-dimensional systems, while the GENBUN routine is used for the twodimensional case, as suggested by Kim [13]. These routines solve systems of separable elliptic differential equations in three and two dimensions, respectively, and are part of the FISHPACK library [16]. For a 20 x 20 grid, the simulation runs at approximately seven frames/second, and for a 50 x 50 grid, it runs at approximately two frames/second. 5.1.2 Motion Visualization To visualize two-dimensional motion, three techniques have been incorporated into the system. One technique tracks a number of particles through the fluid; these are updated for each time step using a first-order Runge-Kutta integration of the velocity field. Press, et. al. [20] discuss higher-order interpolation schemes that could be used, but the first order technique matches the accuracy of the fluid simulator. The second visualization technique tracks streamlines through the fluid. A regular grid of particle sources is placed in the fluid region, and these sources release virtual particles at a regular rate. Each sequence of particles is used to create a curve along the streamline moving away from the source. These virtual particles have no effect on the fluid motion, and only serve as a visualization aid. The third technique uses a grid of lines aligned to the velocity vectors of the fluid. These lines are updated for each time step to align to the velocity field, and they are scaled to avoid any overlap. 34

5.1.3 Control Application The control tool has been implemented using a discrete series of points for the curve. Cubic B-spline subdivision can optionally be applied to the point sequence to smooth its resolution. In either case, the resulting segments are used as the discretization for creation of the influence field. 5.2 Results A variety of two-dimensional animations has been created to demonstrate how the control tool affects the motion of the fluid. The animations demonstrate motion under various levels of control. Each level of control has been applied to a number of configurations, including simple arrangements and more complex arrangements. Use of the force-application control produces close-to-desired motion for a short amount of time. However, cumulative effects of force on the fluid velocity result in rather quick deviation from specified motion. This is especially evident with more complicated paths, and is noticeable in Figure 5.2d. Use of the soft velocity constraint avoids this quick dissipation, but the dynamic motion can be greater than the threshold. This would render the effects of control unnoticeable (Figure 5.2e). The hard velocity constraint produces exactly the specified motion, but the border of the influenced region has less believable motion in more complicated configurations (Figures 5.2c, 5.2f). Figure 5.1 shows the influence fields generated from a circular curve and an oscillating curve. Frames from resulting flows are included in Figure 5.2. 35

Figure 5.1b Figure 5.1a Figure 5.1: Examples of influence fields 5.2a. Effect of force constraint with circular field in Figure 5.1a. 5.2b. Effect of minimum velocity constraint with circular field in Figure 5.1a. 5.2c. Effect of exact velocity constraint with circular field in Figure 5.1a. 5.2d. Effect of force constraint with field in Figure 5.1b. 36

5.2e. Effect of minimum velocity constraint with field in Figure 5.1b. 5.2e. Effect of exact velocity constraint from field in Figure 5.1b. Figure 5.2: The application of the influence fields in Figure 5.1 with different motion constraints 37

CHAPTER 6 CONCLUSIONS AND FUTURE WORK The methods used to animate many natural phenomena are based on complex physical models. These models simplify a great deal of the animation process, and they release the animator from having to specify extremely detailed motion that arises in natural systems. A tradeoff exists, however, as applying control to these complex models such as those used for animating fluids does not maintain physical correctness. Most existing control techniques for fluid animation are unpredictable and difficult to work with. They also require a deeper understanding of the system for effective use. Knowledge beyond what would be expected of a typical animator is often necessary. A particular control tool for fluid animation along a path has been presented. This tool provides an intuitive interface and allows the animator to select from various degrees of control. These levels of control give the animator the freedom to adjust the motion constraint to achieve a believable level of physical correctness. To more effectively demonstrate the use of this tool, it could be incorporated into a larger fluid animation system. Desirable features such as object interaction and surface constraints should be included, and more detailed features of fluid motion could be taken into account. 38