1 / 47

Modeling, Simulating and Rendering Fluids

Modeling, Simulating and Rendering Fluids. Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan. Applications. Mostly Hollywood Shrek Antz Terminator 3 Many others… Games Engineering. Animating Fluids is Hard…. Too complex to animate by hand Surface is changing very quickly

riva
Download Presentation

Modeling, Simulating and Rendering Fluids

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. Modeling, Simulating and Rendering Fluids Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan

  2. Applications • Mostly Hollywood • Shrek • Antz • Terminator 3 • Many others… • Games • Engineering

  3. Animating Fluids is Hard… • Too complex to animate by hand • Surface is changing very quickly • Lots of small details • Need automatic simulations

  4. Ad-Hoc Methods • Some simple algorithmsexist for special cases • Mostly waves • What about water glass? • Too much work to comeup with empirical algorithmsfor each case

  5. Physically-Based Approach • Borrow techniques from Fluid Dynamics • Long history. Goes back to Newton… • Equations that describe fluid motion • Use numerical methods to approximate fluid equations, simulating fluid motion • Like mass-spring systems

  6. What do we mean by ‘Fluid’? • liquids or gases • Mathematically: • A vector field u (represents the fluid velocity) • A scalar field p (represents the fluid pressure) • fluid density (d) and fluid viscosity (v)

  7. Vector Fields • 2D Scalar function: • f(x,y) = z • z is a scalar value • 2D Vector function: • u(x,y) = v • v is a vector value • v = (x’, y’) • The set of valuesu(x,y) = v is called avector field

  8. Fluid Velocity == Vector Field • Can model a fluid as a vector field u(x,y) • u is the velocity of the fluid at (x,y) • Velocity is different at each point in fluid! • Need to compute change in vector field

  9. Particles carry Velocities • Particle Simulation: • Track particle positionsx = (x,y) • Numerically Integrate: change in position • Fluid Simulation : • Track fluid velocitiesu = (u,v) atall pointsx in some fluid volume D • Numerically Integrate: change in velocity

  10. Some Math • Del Operator: • Laplacian Operator: • Gradient:

  11. More Math • Vector Gradient: • Divergence: • Directional Derivative:

  12. Navier-Stokes Fluid Dynamics • Velocity field u, Pressure field p • Viscosity v, density d (constants) • External force f • Navier-Stokes Equation: • Mass Conservation Condition:

  13. Navier-Stokes Equation • Derived from momentum conservation condition • 4 Components: • Advection/Convection • Diffusion (damping) • Pressure • External force (gravity, etc)

  14. Mass Conservation Condition • Velocity field u has zero divergence • Net mass change of any sub-region is 0 • Flow in == flow out • Incompressible fluid • Comes from continuum assumption

  15. Change in Velocity • Derivative of velocity with respect to time • Change in velocity, or acceleration • So this equation models acceleration of fluids

  16. Change inVelocity Advection Term • Advection term • Force exerted on a particleof fluid by the other particlesof fluid surrounding it • How the fluid “pushes itself around”

  17. Change inVelocity Advection Diffusion Term • Viscosity constant controls velocity diffusion • Essentially, this term describes how fluid motion is damped • Highly viscous fluids stick together • Like maple syrup • Low-viscosity fluids flow freely • Gases have low viscosity

  18. Weather: Advection & Diffusion • “Jet-Stream”

  19. Change inVelocity Advection Diffusion p = 0 p = 1 p = 0.5 Pressure Term • Pressure follows a diffusion process • Fluid moves from high-pressureareas to low-pressure areas • Moving == velocity • So fluid moves in direction oflargest change in pressure • This direction is the gradient Time…

  20. Weather: Pressure • “Fronts” are the boundaries between regions of air with different pressure… • “High Pressure Zones” will diffuse into “Low Pressure Zones”

  21. Change inVelocity Advection Diffusion Pressure Body Force • Body force term represents external forces that act on the fluid • Gravity • Wind • Etc…

  22. Change inVelocity Advection Diffusion Pressure Summary • Add mass conservation (1 liter in == 1 liter out) constraint: • Need to simulate these equations…

  23. Incompressible Euler Equations forces self-advection incompressible (Navier-Stokes without viscosity)

  24. Additional Equations smoke’s density temperature

  25. Discretization v u

  26. Algorithm add forces self-advect project t = 0 t = t + dt

  27. Step 1 – Add Force • Assume change in force is small during timestep • Just do a basic forward-Euler step • Note: f is actually an acceleration?

  28. Step 2 - Advection

  29. Method of Characteristics • p is called the characteristic • Partial streamline of velocity field u • Can show u does not vary along streamline • Determine p by tracing backwards • Unconditionally stable • Maximum value of w2 is never greater than maximum value of w1

  30. Self-Advection t t+dt Semi-Lagrangian solver (Courant, Issacson & Rees 1952)

  31. Self-Advection For each u-component…

  32. Self-Advection Trace backward through the field

  33. Self-Advection Interpolate from neighbors

  34. Self-Advection Set interpolated value in new grid

  35. Self-Advection Repeat for all u-nodes

  36. Self-Advection Similar for v-nodes

  37. Self-Advection Vmax > Vmax Advected velocity field

  38. Enforcing Zero Divergence • Pressure and Velocity fields related • Say we have velocity field w with non-zero divergence • Can decompose into • Helmholtz-Hodge Decomposition • u has zero divergence • Define operator P that takes w to u: • Apply P to Navier-Stokes Equation: • (Used facts that and )

  39. Operator P • Need to find • Implicit definition: • Poisson equation for scalar field p • Neumann boundary condition • Sparse linear system when discretized

  40. Adding Viscosity – Diffusion • Standard diffusion equation • Use implicit method: • Sparse linear system

  41. Step 4 - Projection • Enforces mass-conservation condition • Poisson Problem: • Discretize q using central differences • Sparse linear system • Maybe banded diagonal… • Relaxation methods too inaccurate • Method of characteristics more precise for divergence-free field

  42. Solving the System • Need to calculate: • Start with initial state • Calculate new velocity fields • New state:

  43. Vorticity Confinement Basic idea: Add energy lost as an external force. Avoid very quick dissipation. “Vorticity Confinement” force preserves swirling nature of fluids.

  44. Vorticity Confinement

  45. Vorticity Confinement

  46. Vorticity Confinement

  47. Videos

More Related