Download presentation
Presentation is loading. Please wait.
Published bySharyl Grant Modified over 9 years ago
1
Fluid Simulation for Computer Animation Greg Turk College of Computing and GVU Center Georgia Institute of Technology
2
Why Simulate Fluids? Feature film special effects Computer games Medicine (e.g. blood flow in heart) Because it’s fun
3
Fluid Simulation Called Computational Fluid Dynamics (CFD) Many approaches from math and engineering Graphics favors finite differences Jos Stam introduced fast and stable methods to graphics [Stam 1999]
4
Navier-Stokes Equations u=0 u t = k 2 u –(u )u – p + f Incompressibility Change in Velocity Advection Diffusion Body Forces Pressure
5
Navier-Stokes Equations u=0 u t = k 2 u –(u )u – p + f Incompressibility Change in Velocity Advection DiffusionPressure Body Forces
6
Finite Differences Grids All values live on regular grids Need scalar and vector fields Scalar fields: amount of smoke or dye Vector fields: fluid velocity Subtract adjacent quantities to approximate derivatives
7
Scalar Field (Smoke, Dye) c ij 1.23.7 5.1 …
8
Diffusion c ij
9
Diffusion 1 1 1 1 -4 c ij new = c ij + k t (c i-1j + c i+1j + c ij-1 + c ij+1 - 4c ij ) c t = k 2 c change in value value relative to neighbors
10
Diffusion = Blurring Original Some Diffusion More Diffusion
11
Vector Fields (Fluid Velocity) u ij = (u x,u y )
12
Vector Field Diffusion u t = k 2 u … blur the x-velocity and the y-velocity u x t = k 2 u x u y t = k 2 u y Two separate diffusions: viscosity
13
Effect of Viscosity Each one is ten times higher viscosity than the last Low Medium High Very High “Melting and Flowing” Mark Carlson, Peter J. Mucha, Greg Turk Symposium on Computer Animation 2002
14
Low Viscosity
15
High Viscosity
16
Variable Viscosity Viscosity can vary based on position Viscosity field k can change with temperature Need implicit solver for high viscosity
17
Wax
20
Navier-Stokes Equations u=0 u t = k 2 u –(u )u – p + f Incompressibility Change in Velocity Advection DiffusionPressure Body Forces
21
Advection = Pushing Stuff
22
Advection
23
0.32.70.3
24
Scalar Field Advection c t = –(u )c change in value advection current values
25
Vector Field Advection u t = –(u )u u x t = –(u )u x u y t = –(u )u y Two separate advections: … push around x-velocity and y-velocity
26
Advection Easy to code Method stable even at large time steps Problem: numerical inaccuracy diffuses flow
27
Diffusion/dissipation in first order advection Original Image After 360 degree rotation using first order advection
28
Solution: BFECC 1) Perform forward advection 2) Do backward advection from new position 3) Compute error and take correction step 4) Do forward advection from corrected position “Flowfixer: Using BFECC for Fluid Simulation” ByungMoon Kim, Yingjie Liu, Ignacio Llamas, Jarek Rossignac Eurographics Workshop on Natural Phenomena 2005
29
Intuition to BFECC error Compensate Forward Backward Forward
31
Navier-Stokes Equations u=0 u t = k 2 u –(u )u – p + f Incompressibility Change in Velocity Advection DiffusionPressure Body Forces
32
Divergence High divergence Low divergence Zero divergence
33
Enforcing Incompressibility First do velocity diffusion and advection Find “closest” vector field that is divergence-free Need to calculate divergence Need to find and use pressure
34
Measuring Divergence u=? u ij =(u x i+1j - u x i-1j ) + (u y ij+1 -u y ij-1 ) ? -u y ij-1 u y ij+1 -u x i-1j u x i+1j
35
Pressure Term u new = u – p Take divergence of both sides… u new = u – p u = 2 p zero
36
Pressure Term u = 2 p p new ij = p ij + (d ij - (p i-1j + p i+1j + p ij-1 + p ij+1 - 4p ij )) p new = p + ( u - 2 p) Let d ij = u ij knownunknown 1 1 1 1 -4
37
Pressure Term u new = u – p …and velocity is now divergence-free Found “nearest” divergence-free vector field to original.
38
Fluid Simulator 1)Diffuse velocity 2)Advect velocity 3)Add body forces (e.g. gravity) 4)Pressure projection 5)Diffuse dye/smoke 6)Advect dye/smoke
39
www.dgp.toronto.edu/people/stam/reality/Research/pubs.html “Real-Time Fluid Dynamics for Games” Jos Stam, March 2003 (CDROM link is to source code)
40
Rigid Objects Want rigid objects in fluid Use approach similar to pressure projection “Rigid Fluid: Animating the Interplay Between Rigid Bodies and Fluid” Mark Carlson, Peter J. Mucha and Greg Turk Siggraph 2004
41
Rigid Fluid Method 1) Solve Navier-Stokes on entire grid, treating solids exactly as if they were fluid 2) Calculate forces from collisions and relative density 3) Enforce rigid motion for cells inside rigid bodies
43
Small-scale liquid-solid Interactions Lake ( >1 meter)Water drops (millimeters) What makes large water and small water behave differently? Surface Tension (water: 72 dynes/cm at 25º C) Viscosity (water: 1.002 x 10 -3 N·s/m 2 at 20º C)
44
Surface Tension Normal (always pointing outward) Surface Tension Force
45
Water/Surface Contact hydrophillichydrophobic
46
Contact Front
47
Virtual Surface Method Solid Virtual Surface Virtual Liquid Liquid Air
48
Virtual Surface Method 1) Creating a virtual surface 2) Estimate curvature from new fluid surface 3) Kink will “push” the fluid towards stable contact angle Solid Liquid Air Advancing to right: c > s Virtual Liquid Virtual Surface
49
Virtual Surface Method 1) Creating a virtual surface 2) Estimate curvature from new fluid surface 3) Kink will “push” the fluid towards stable contact angle Solid Air Receding to left: c < s Virtual Liquid Virtual Surface
51
Swimming Creatures Create assemblies of rigid objects (figures with joints) Use Rigid Fluid method Work in progress (Nipun Kwatra, Chris Wojtan, Peter J. Mucha, Irfan Essa, Greg Turk)
55
Erosion and Corrosion Fluids modify rigid objects Erosion: fluid sweeps away particles Corrosion: fluid eats away objects Work in progress (Chris Wojtan, Peter J. Mucha, Mark Carlson, Greg Turk)
60
Fluid Researchers at Georgia Tech Mark Carlson Peter J. Mucha Huamin Wang ByungMoon Kim Yingjie Liu Ignacio Llamas Jarek Rossignac Chris Wojtan Nipun Kwatra Irfan Essa Greg Turk
61
Questions?
62
Implementation of BFECC A : Advection step u : velocity field h = A(g, u) r = A(h,-u) s = g + (g-r)/2 g’ = A(s,u)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.