Docstoc

Fluid Simulation for Computer Animation.ppt

Document Sample
Fluid Simulation for Computer Animation.ppt Powered By Docstoc
					    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
•   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]
         Navier-Stokes Equations

                       u=0    Incompressibility



      ut = k2u –(u)u – p + f

           Diffusion                Pressure
                        Advection
                                         Body Forces
Change in Velocity
         Navier-Stokes Equations

                       u=0    Incompressibility



      ut = k2u –(u)u – p + f

           Diffusion                Pressure
                        Advection
                                         Body Forces
Change in Velocity
        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
Scalar Field (Smoke, Dye)
  1.2 3.7 5.1 …


      cij
  Diffusion



cij
                       Diffusion

      ct = k2c
                                           1

change in     value relative
                                 1        -4         1
value         to neighbors

                                           1
  cijnew = cij + k Dt (ci-1j + ci+1j + cij-1 + cij+1 - 4cij)
           Diffusion = Blurring




Original        Some Diffusion   More Diffusion
Vector Fields (Fluid Velocity)



                      uij = (ux,uy)
      Vector Field Diffusion
             ut =      k2u

                       viscosity
Two separate diffusions:

            ux           2ux
                  t=   k
            u y          2uy
                  t=   k
… blur the x-velocity and the y-velocity
         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
Low Viscosity




         QuickTime™ an d a
    YUV420 codec decompressor
   are need ed to see this p icture .
High Viscosity




          QuickTime™ an d a
     YUV420 codec decompressor
    are need ed to see this p icture .
            Variable Viscosity
• Viscosity can vary based on position
• Viscosity field k can change with temperature
• Need implicit solver for high viscosity
Wax
      QuickTime™ an d a
 YUV420 codec decompressor
are need ed to see this p icture .
      QuickTime™ an d a
 YUV420 codec decompressor
are need ed to see this p icture .
         Navier-Stokes Equations

                       u=0    Incompressibility



      ut = k2u –(u)u – p + f

           Diffusion                Pressure
                        Advection
                                         Body Forces
Change in Velocity
Advection = Pushing Stuff
Advection
      Advection



0.3      0.3
         2.7
       Scalar Field Advection


             ct = –(u)c

change in value   advection   current values
       Vector Field Advection

           ut = –(u)u
Two separate advections:

          u x
                t=   –(u)u x

          uy
                t=   –(u)u y

 … push around x-velocity and y-velocity
               Advection
• Easy to code
• Method stable even at large time steps
• Problem: numerical inaccuracy diffuses flow
     Diffusion/dissipation
      in first order advection




Original Image    After 360 degree rotation
                  using first order advection
              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
             Intuition to BFECC



               Forward


Compensate

                         Forward   Backward


                 error
      QuickTime™ an d a
         decompressor
are need ed to see this p icture .
         Navier-Stokes Equations

                       u=0    Incompressibility



      ut = k2u –(u)u – p + f

           Diffusion                Pressure
                        Advection
                                         Body Forces
Change in Velocity
             Divergence




High divergence    Low divergence



                    Zero divergence
    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
       Measuring Divergence

u=?             uyij+1


            -uxi-1j ?       uxi+1j

                  -uyij-1

uij=(uxi+1j - uxi-1j) + (uyij+1-uyij-1)
        Pressure Term
     unew =   u – p
Take divergence of both sides…

      unew =    u – p
   zero

     u =    2p
                   Pressure Term
      u =        2p


    known unknown                                  1

 pnew = p + e( u - 2p)                 1      -4       1

 Let dij =  uij                                  1

pnewij = pij + e(dij - (pi-1j + pi+1j + pij-1 + pij+1 - 4pij))
          Pressure Term

         unew =   u – p

 …and velocity is now divergence-free


Found “nearest” divergence-free vector
field to original.
    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
     “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
                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
             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
       QuickTime™ an d a
    DivX 5.0 decompressor
are need ed to see this p icture .
    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)
Surface Tension
  Fsurf   N
     Normal (always pointing outward)
     Surface Tension Force




   0               0
         Water/Surface Contact


 s  60                         s  90    s  120

 hydrophillic
                         s
                                             hydrophobic
  sa  ( la cos  s   ls )  0
       sa ,  la ,  ls


              s

                     s                        s
                          Contact Front


 s  60                             s  120


                       s
  sa  ( la cos  s   ls )  0



              s

                     s                s
Virtual Surface Method


                     Air


Liquid
                        Solid
  Virtual Liquid
                   Virtual
                   Surface
            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


                                                   Air


                  Liquid

                 Virtual Liquid                    Solid

                                         Virtual Surface

                        Advancing to right:c>s
            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




                                                    Air



                  Virtual Liquid                   Solid

                                           Virtual Surface

                          Receding to left:c<s
       QuickTime™ and a
    DivX 5.0 decompressor
are neede d to see this picture.
        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)
      QuickTime™ and a
 MPEG-4 Video decompressor
are neede d to see this picture.
      QuickTime™ and a
   Anima tion d ecompressor
are neede d to see this picture.
      QuickTime™ and a
 MPEG-4 Video decompressor
are neede d to see this picture.
         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)
      QuickTime™ an d a
 MPEG-4 Video decompressor
are need ed to see this p icture .
      QuickTime™ an d a
 MPEG-4 Video decompressor
are need ed to see this p icture .
      QuickTime™ an d a
 MPEG-4 Video decompressor
are need ed to see this p icture .
      QuickTime™ an d a
 MPEG-4 Video decompressor
are need ed to see this p icture .
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
Questions?
   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)

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:20
posted:5/24/2012
language:English
pages:62
zhaonedx zhaonedx http://
About