Fluid Animation

82
Fluid Animation Christopher Batty November 17, 2011

description

Fluid Animation. Christopher Batty November 17, 2011. What distinguishes fluids?. What distinguishes fluids?. No “preferred” shape Always flows when force is applied Deforms to fit its container Internal forces depend on velocities, not displacements. Watch fluid simulation clips. - PowerPoint PPT Presentation

Transcript of Fluid Animation

Fluid Animation

Fluid AnimationChristopher BattyNovember 17, 2011What distinguishes fluids?

What distinguishes fluids?No preferred shapeAlways flows when force is appliedDeforms to fit its containerInternal forces depend on velocities, not displacementsWatch fluid simulation clipsBasic TheoryEulerian vs. LagrangianLagrangian: Point of reference moves with the material.

Eulerian: Point of reference is stationary.

e.g. Weather balloon (Lagrangian) vs. weather station on the ground (Eulerian)

Eulerian vs. LagrangianConsider an evolving temperature field.

Lagrangian: Set of moving particles, each with a temperature value.

Eulerian vs. LagrangianConsider an evolving temperature field.

Eulerian: A fixed grid of temperature values, that temperature flows through.

Relating Eulerian and LagrangianTime derivativesMathematically:

Chain rule!Material DerivativeChange at the current (fixed) point.Change due to movement.Change at a point moving with the velocity field.AdvectionTo track a quantity T simply moving (passively) through a velocity field:

This is the advection equation.

Think of colored dye or massless particles drifting around in fluid.or equivalentlyWatch dye in fluid clipEquations of MotionFor general materials, we have Newtons second law: F = ma.

Specialized for fluids:Navier-Stokes EquationsNavier-Stokes

What are the forces on a fluid?Primarily for now:PressureViscositySimple external forces (e.g. gravity, buoyancy, user forces)

Also:Surface tensionCoriolisPossibilities for more exotic fluid types:Elasticity (e.g. silly putty)Shear thickening / thinning (e.g. oobleck, ketchup)Electromagnetic forcesSkys the limit...Watch oobleck clipIn fullAdvectionChange in velocity at a fixed pointForces(pressure, viscosity gravity,)Operator splitting1. Advection

AdvectionAdvection2. Pressure

PressureWhat does pressure do?Enforces incompressibility.

Typical fluids (mostly) do not compress.Exceptions: high velocity, high pressure,

Incompressibility

Compressible velocity fieldIncompressible velocity field

IncompressibilityIncompressibilityPressureHelmholtz-Hodge Decomposition

=+Input Velocity fieldCurl-Free (irrotational)Divergence-Free (incompressible)Aside: Pressure as Lagrange Multiplier3. Viscosity

[Carlson et al. 2003]ViscosityWhat characterizes a viscous liquid?Thick, damped behaviourHigher resistance to flow

Watch viscous honey clipViscosityLoss of energy due to internal friction between molecules moving at different velocities.

Interactions between molecules in different layers causes shear stress that acts to oppose relative motion.causes an exchange of momentum

ViscosityLoss of energy due to internal friction between molecules moving at different velocities.

Interactions between molecules in different layers causes shear stress that acts to oppose relative motion.causes an exchange of momentum

ViscosityLoss of energy due to internal friction between molecules moving at different velocities.

Interactions between molecules in different layers causes shear stress that acts to oppose relative motion.causes an exchange of momentum

ViscosityLoss of energy due to internal friction between molecules moving at different velocities.

Interactions between molecules in different layers causes shear stress that acts to oppose relative motion.causes an exchange of momentum

ViscosityImagine fluid particles with general velocities.

Each particle interacts with nearby neighbours, exchanging momentum.ViscosityViscosity4. External Forces

External ForcesNumerical Methods1. Advection

Advection of a ScalarEulerianUnconditionally Unstable!Conditionally Stable!Many possible methods, stability can be a challenge.LagrangianAdvect data forward from grid points by integrating position according to grid velocity.

Problem: New data position doesnt necessarily land on a grid point.?Semi-LagrangianLook backwards in time from grid points, to see where data is coming from.Interpolate data at previous time.

Semi-Lagrangian - DetailsAdvection of VelocityThis is great for scalars. What about velocity advection?

Same method:Trace back with current velocityInterpolate velocity (component) at that pointAssign it to the grid point at the new time.

Caution: Do not overwrite the velocity field youre using to trace back!2. Pressure

Recall Helmholtz-Hodge Decomposition

=+Input Velocity fieldCurl-Free (irrotational)Divergence-Free (incompressible)Pressure Projection - DerivationPressure ProjectionImplementationSolid Boundary Conditions52The interaction with solids is handled through a boundary condition. In this case, we want fluid to be able to flow parallel to walls, but not into or out of them. Ie. U dot N = 0. So now we have two things to do: discretize our PDE, and then discretely incorporate our boundary conditions.52Staggered vs. Non-staggeredTwo choices for grids:Velocity and pressure co-located

Velocity and pressure staggeredWhy prefer staggered?3. Viscosity

[Carlson et al. 2003]ViscosityViscosity Time IntegrationViscosity Implicit IntegrationSolid Boundary Conditions59Watch no-slip clipThe interaction with solids is handled through a boundary condition. In this case, we want fluid to be able to flow parallel to walls, but not into or out of them. Ie. U dot N = 0. So now we have two things to do: discretize our PDE, and then discretely incorporate our boundary conditions.594. External Forces

GravityGravityNote: in a closed fluid-filled container, gravity (alone) wont do anything!Incompressibility cancels it out.(Assuming constant density)StartAfter gravity stepAfter pressure stepSimple Buoyancy

User ForcesAdd whatever additional forces we want, such as:near the mouse when the user clicksPaddle forces in Plasma Pong

Watch clipOrdering of StepsOrder turns out to be important.

Why?Incompressibility is not guaranteed at intermediate stepsAdvecting with a compressible field causes volume/material loss or gain!Ordering of StepsConsider advection in this field:

Best orderingAdvectionViscosityAdd ForcesMake incompressible (Pressure)

Useful ReferencesRobert Bridsons SIGGRAPH 2007 Fluid Course notes: http://www.cs.ubc.ca/~rbridson/fluidsimulation/

Stable Fluids [Stam 1999]

Real-Time Stable Fluid Dynamics for Games [Stam, 2003]

Liquids

LiquidsWhats missing so far?

We need:A surface representationBoundary conditions at the surface

The Big PictureVelocity SolverAdvect VelocitiesAdd ViscosityAdd GravityProject Velocities to be IncompressibleWhat about liquids?Advect VelocitiesAdd ViscosityAdd GravityProject Velocities to be IncompressibleSurface TrackerVelocity SolverSurface TrackerGiven: liquid surface geometry, velocity field, timestepCompute: new surface geometry by advection.

Surface TrackerIdeally:EfficientAccurateHandles merging/splitting (topology changes)Conserves volumeRetains small featuresSmooth surface for renderingProvides convenient geometric operationsEasy to implement

Very hard (impossible?) to do all of these at once.

Surface Tracking OptionsParticlesLevel setsVolume-of-fluid (VOF)Triangle meshesHybrids (many of these)

Particles

[Zhu & Bridson 2005]ParticlesPerform passive Lagrangian advection on each particle.For rendering, need to reconstruct a surface.Level sets

[Losasso et al. 2004]Level setsEach grid point stores signed distance to the surface (inside 0).Surface is interpolated zero isocontour.> 0