1 / 62

Fluid Simulation for Computer Animation

Fluid Simulation for Computer Animation. Greg Turk College of Computing and GVU Center Georgia Institute of Technology. Why Simulate Fluids?. Feature film special effects Computer games Medicine (e.g. blood flow in heart) Because it’s fun. Fluid Simulation.

salma
Télécharger la présentation

Fluid Simulation for Computer Animation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fluid Simulation forComputer 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. Diffusion Pressure Advection Body Forces Change in Velocity Navier-Stokes Equations u=0 ut= k2u –(u)u – p + f Incompressibility

  5. Navier-Stokes Equations u=0 ut= k2u–(u)u – p + f Incompressibility Diffusion Pressure Advection Body Forces Change in Velocity

  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) … 5.1 1.2 3.7 cij

  8. Diffusion cij

  9. 1 1 -4 1 1 change in value value relative to neighbors Diffusion ct = k2c cijnew = cij + k Dt (ci-1j + ci+1j + cij-1 + cij+1 - 4cij)

  10. More Diffusion Some Diffusion Original Diffusion = Blurring

  11. Vector Fields (Fluid Velocity) uij = (ux,uy)

  12. viscosity Two separate diffusions: uxt= k2ux uyt= k2uy Vector Field Diffusion ut= k2u … blur the x-velocity and the y-velocity

  13. Effect of Viscosity Low Medium High Very High • Each one is ten times higher viscosity than the last “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

  18. Navier-Stokes Equations u=0 ut= k2u –(u)u – p + f Incompressibility Diffusion Pressure Advection Body Forces Change in Velocity

  19. Advection = Pushing Stuff

  20. Advection

  21. Advection 0.3 2.7 0.3

  22. change in value advection current values Scalar Field Advection ct=–(u)c

  23. Two separate advections: uxt=–(u)ux uyt=–(u)uy Vector Field Advection ut=–(u)u … push around x-velocity and y-velocity

  24. Advection • Easy to code • Method stable even at large time steps • Problem: numerical inaccuracy diffuses flow

  25. Diffusion/dissipation in first order advection After 360 degree rotation using first order advection Original Image

  26. 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

  27. Forward Compensate Forward Backward error Intuition to BFECC

  28. Navier-Stokes Equations u=0 ut= k2u –(u)u– p + f Incompressibility Diffusion Pressure Advection Body Forces Change in Velocity

  29. Low divergence Zero divergence Divergence High divergence

  30. 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

  31. uyij+1 ? -uxi-1j uxi+1j -uyij-1 Measuring Divergence u=? uij=(uxi+1j - uxi-1j) + (uyij+1-uyij-1)

  32. zero Pressure Term unew= u – p Take divergence of both sides…  unew=  u – p  u = 2p

  33. 1 known unknown 1 1 -4 1 Pressure Term  u = 2p pnew = p + e( u - 2p) Let dij =  uij pnewij = pij + e(dij - (pi-1j + pi+1j + pij-1 + pij+1 - 4pij))

  34. Pressure Term unew= u – p …and velocity is now divergence-free Found “nearest” divergence-free vector field to original.

  35. Fluid Simulator Diffuse velocity Advect velocity Add body forces (e.g. gravity) Pressure projection Diffuse dye/smoke Advect dye/smoke

  36. “Real-Time Fluid Dynamics for Games” Jos Stam, March 2003 (CDROM link is to source code) www.dgp.toronto.edu/people/stam/reality/Research/pubs.html

  37. 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

  38. 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

  39. Small-scale liquid-solid Interactions 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/m2 at 20º C) Lake ( >1 meter) Water drops (millimeters)

  40. Surface Tension Normal (always pointing outward) Surface Tension Force

  41. Water/Surface Contact hydrophillic hydrophobic

  42. Contact Front

  43. Virtual Liquid Virtual Surface Virtual Surface Method Air Liquid Solid

  44. Air Liquid Virtual Liquid Solid Virtual Surface Advancing to right:qc>qs 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

  45. Air Virtual Liquid Solid Virtual Surface Receding to left:qc<qs 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

More Related