1 / 42

Fluid Simulation

Fluid Simulation. Contents. Introduction Diffusion Semi-Lagrangian advection Poisson Equation Implementation. Motivation. Fedkiw et al. 2001. Fluids in Computer Graphics. Fast Looks good Easy to code. Fluid Mechanics. Natural framework for fluid modeling

maya-dillon
Download Presentation

Fluid Simulation

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

  2. Contents • Introduction • Diffusion • Semi-Lagrangian advection • Poisson Equation • Implementation

  3. Motivation Fedkiw et al. 2001

  4. Fluids in Computer Graphics • Fast • Looks good • Easy to code

  5. Fluid Mechanics • Natural framework for fluid modeling • Full Navier-Stokes Equations • Has a long history • Reuse code/algorithms • Equations are hard to solve • Non-linear

  6. Application • Use velocity to move densities

  7. Equations • Density field • Velocity field

  8. Finite Difference Scheme

  9. Equations • Evolution of density (assume velocity known) Over a time step...

  10. Equations • Evolution of density (assume velocity known) Density changes in the direction of the flow

  11. Equations • Evolution of density (assume velocity known) Density diffuses over time

  12. Equations • Evolution of density (assume velocity known) Increases due to sources from the UI

  13. Algorithm Subdivide space into voxels Velocity + density defined in the center of each voxel

  14. Algorithm add source diffuse move

  15. Diffusing Densities dt Dn Dn+1

  16. Diffusing Densities Exchange of density between neighbors

  17. Diffusing Densities Exchange of density between neighbors

  18. Diffusing Densities i,j+1 i-1,j i,j i+1,j i,j-1 Dn+1i,j = Dn i,j + k dt (Dn i-1,j + Dn i+1,j + Dn i,j-1 + Dn i,j+1 - 4Dn i,j)/h2

  19. Algorithm add source diffuse move

  20. Moving Densities dt Velocity known

  21. Moving Densities • Finite differences • Transfer only between neighbors • Unstable with large time steps

  22. Semi-Lagrangian Advection

  23. Semi-Lagrangian Advection

  24. Semi-Lagrangian Advection

  25. Semi-Lagrangian Advection Interpolate the density at new location

  26. Semi-Lagrangian Advection Set interpolated density at grid location Requires two grids

  27. Computing Velocities Use same algorithms as for density Velocity is moved by itself

  28. Moving Velocity Trace particle backwards in time

  29. Moving Velocity Interpolate the velocity at new location

  30. Moving Velocity Set interpolated velocity at grid location Requires two grids

  31. Conservation of Mass Inflow = Outflow Ui+1,j - Ui-1,j + Vi,j+1 - Vi,j-1 = 0

  32. Poisson Equation • Poisson Equation • Step 1 • Step 2

  33. /* Running */ while(simulating) { velocityfield.advect(dt); velocityfield += gravityfield*(densityfield*(dt*10.0f)); fvelocityfield = velocityfield; fvelocityfield.removeDivergence(); velocityfield = fvelocityfield; densityfield.advect(velocityfield, dt); } Implementation

  34. Implicit Diffusion

  35. Implicit Diffusion • Explicit diffusion • Dn+1i,j = Dn i,j + k dt (Dn i-1,j + Dn i+1,j + Dn i,j-1 + Dn i,j+1 - 4Dn i,j)/h2 • Implicit diffusion • Dn+1i,j – k dt (Dn+1i-1,j+Dn+1i+1,j+Dn+1i,j-1+Dn+1 i,j+1-4Dn+1 i,j)/h2 = Dni,j A x = b

  36. Diffusing Densities Linear solvers: Name Cost Comments Gaussian elimination N3 Use only for very small N (test code) Jacobi/SOR relaxation N2 Easy to code but slow FFT/cyclical reduction N logN Use when no internal boundaries Conjugate gradient N1.5 Use when internal boundaries Multi-grid N Slower than FFT in practice. Hard to code when internal boundaries present

  37. Mass Conservation- Numerical Example-

  38. Given Velocity Field 10.0f

  39. Poisson Equation

  40. Solution

  41. Superposition + 10.0f 5.83

  42. Divergence-Free Velocity Field

More Related