Sunteți pe pagina 1din 21

1

Realistic Animation of Fluids


Nick Foster and Dimitris Metaxas

Presented by Alex Liberman


CS 667
April 19, 2005
2

Previous Work

● Used non physics-based methods (mostly in 2D)

●Hard to simulate effects that rely on physical


phenomena and volume; rotational and pressure-
based effects

● Hard to make fluid interact with dynamic objects and


to simulate the buoyancy force on such objects

CS 667 Quintessential Player


3

Inspiration from CFD

●Computational Fluid Dynamics has been used in


engineering problems since the mid '60s

● Very detailed fluid models exist

● Unfortunately most methods are needlessly-complex


(for graphics) and scale poorly

● End-user must know what he/she is doing (more than


the average animator is interested in)

CS 667
4

Main contributions from this paper

● Simulation – Solving the Navier-Stokes equations

●Boundary Conditions – Initializing fluid


boundaries and setting up global behavior

● Surface Tracking – Tracking the evolution of the


fluid surface for rendering

CS 667
5

Simulation: Navier-Stokes (N-S)

●N-S are a set of equations that describe the


behavior of various fluids (including gases)

●For graphics the “incompressible Navier-Stokes


equations” are sufficient

Next Level Inc. http://flatrock.org.nz/topics/environment/ass


ets/nuclear_bomb_test.jpg

CS 667
6

Simulation: Equations

Foster & Metaxas formulation:

Foster & Metaxas '96

A vector-based formulation:

www.cc.gatech.edu/~carlson/papers/carlson-thesis.pdf

u – fluid velocity (vector field) (u, v, w)


ut – fluid acceleration (vector field) (∂u/∂t, ∂v/∂t, ∂w/∂t)
p – fluid pressure (scalar field)
ρ – fluid density (~1.0 for water – assumed in F&M)
ν – viscosity or “fluid thickness” (assumed constant)
CS 667
7

Simulation: More N-S detail


www.cc.gatech.edu/~carlson/papers/carlson-thesis.pdf

Mass Conservation:
F net net fluid flow is 0
a=
m

Advection: Describes in what direction a “neighboring” region of


u⋅∇ u water pushes water at u

2 Momentum Diffusion: Describes how quickly variations in velocity


v ∇ u are damped-out; depends on fluid viscosity

1
 ∇ p Pressure Gradient: Describes in which direction fluid at u is
ρ pushed to reach a lower pressure area

CS 667
8

Simulation: Discretization

Foster & Metaxas '00


Foster & Metaxas '96

CS 667
9

Simulation: Velocity field update

Foster & Metaxas '96

CFL Condition:
traverse at most
one cell in a single
time-step
Intimidating, but really means...

CS 667
10

Simulation: Velocity field update (ctd)

Foster & Metaxas '96

CFL Condition:
traverse at most
one cell in a single
time-step
Intimidating, but really means...

ut1=ut hut t 

u =u⋯ ●Is an Euler step that uses a finite-difference


approximation of ut(t)

● Maximum value of h is dictated by the CFL

CS 667
11

Simulation: Finite differences

www.cc.gatech.edu/~carlson/papers/carlson-thesis.pdf
Foster & Metaxas '96

CS 667
12

Simulation: Problem

Foster & Metaxas '96

CS 667
13

Simulation: Problem – compressible fluids?

Foster & Metaxas '96

However: ∇⋅u≠0

CS 667
14

Simulation: Enforcing incompressibility


● Compute divergence

D=∇⋅ui , j , k
● Computer pressure correction

 pi , j , k = D i , j , k
● Update cell-face velocities

ui1/ 2, j , k =ui1/ 2, j , k  t / x pi , j , k


Foster & Metaxas '96 ui−1/ 2, j , k =ui−1/ 2, j , k − t / x pi , j , k
...
● Iterate the above steps until D≈0
● Update pressure field: p i , j , k = pi , j , k  pi , j , k

CS 667
15

Boundary Conditions
free-slip boundary

● Fluid is free to move parallel to


the boundary

Foster & Metaxas '96

non-slip boundary

● Fluid is fixed to boundary

CS 667
16

Inflow/Outflow conditions (sources and sinks)


inflow condition

uc

●Set a constant fluid velocity uc


on the face of a source cell

Foster & Metaxas '96

outflow condition

●Set sink cell's face velocity to


adjacent fluid cell's velocity, and
uf allow it to “relax”

CS 667
17

Boundary condition for free surface cells

●Surface cell's interface's


velocity = sum of the remaining
velocities

● This maintains the condition

∇⋅u≈0

CS 667
18

Surface Tracking: Marker Particles

● Generate marker particles at


sources (and render them only
in cells which contain fluid)

● Use weighted (bilinear)


interpolation to compute a
http://developer.intel.com/technology/itj/q21
999/images/art5fig7.gif marker's velocity from four
nearest cell velocities

●Propagate particles using


standard integration techniques

● Easy to simulate violent effects


like splashing and overturning

McFluid
CS 667
19

Surface Tracking: Free Surface Particles

●Start at known “Full” or


“Empty” regions and grow
particles via 4-connected search

●Insert particles when too


sparse, remove when too dense

●Problematic: how to efficiently


detect sparse/dense areas?

Foster & Metaxas '96

CS 667
20

Surface Tracking: Height Field

http://www.sdsc.edu/GatherScatter/gsjan94/Images/GS.CFD
1.gif

For smooth fluids (ocean, lake, puddles) w/o splashes

H t1=H t  t w t t  H⋅unt1 


unt+1 – velocity field values of neighbor cells

CS 667
21

Miscellaneous & Questions?

●Better Explanation and Implementation Guide –


Available as part of Mark Carlson's PhD thesis:
www.cc.gatech.edu/~carlson/papers/carlson-thesis.pdf

●Other Simulation Techniques – SPH; simulate


motion of marker particles directly

● CFD Math & Derivations – Pain available at:


www.math.colostate.edu/~pauld/M646.html

CS 667

S-ar putea să vă placă și