820 likes | 830 Views
Learn about the distinguishing characteristics of fluids, the difference between Eulerian and Lagrangian methods, the concept of advection, the forces acting on fluids, and the role of pressure and viscosity. This comprehensive guide explores the fundamentals of fluid dynamics and provides simulations to enhance your understanding.
E N D
Fluid Animation Christopher Batty November 17, 2011
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
Eulerian vs. Lagrangian Lagrangian: 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. Lagrangian Consider an evolving temperature field. • Lagrangian: Set of movingparticles, each with a temperature value.
Eulerian vs. Lagrangian Consider an evolving temperature field. • Eulerian: A fixed grid of temperature values, that temperature flows through.
Relating Eulerian and Lagrangian Consider the temperature at a point following a given path, . Two ways temperature changes: • Heating/cooling occurs at the current point. • Following the path, the point moves to a cooler/warmer location.
Time derivatives Mathematically: Chain rule! Definition of Choose
Material Derivative This is called the material derivative, and denoted. Change at a point moving with the velocity field. Change due to movement. Change at the current (fixed) point.
Advection To 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 equivalently Watch dye in fluid clip
Equations of Motion • For general materials, we have Newton’s second law: F = ma. • Specialized for fluids: “Navier-Stokes Equations”
Navier-Stokes Density Acceleration = Sum of Forces Expanding the material derivative…
What are the forces on a fluid? Primarily for now: • Pressure • Viscosity • Simple “external” forces • (e.g. gravity, buoyancy, user forces) Also: • Surface tension • Coriolis • Possibilities for more exotic fluid types: • Elasticity (e.g. silly putty) • Shear thickening / thinning (e.g. “oobleck”, ketchup) • Electromagnetic forces • Sky’s the limit... Watch oobleck clip
In full… Change in velocity at a fixed point Advection Forces (pressure, viscosity gravity,…)
Operator splitting Break the equation into steps: • Advection: • Pressure: • Viscosity: • External:
Advection Previously, we considered advection of a passive scalar quantity, , by velocity . In Navier-Stokes we saw: Velocity is advectedby itself!
Advection i.e., The scalar components of the vector are each advected in the same way. We can reuse the same numerical method.
Pressure What does pressure do? • Enforces incompressibility. Typical fluids (mostly) do not compress. • Exceptions: high velocity, high pressure, …
Incompressibility Compressible velocity field Incompressible velocity field
Incompressibility Intuitively, net flow into/out of a given region is zero (no sinks/sources). Integrate the flow across the boundary of a closed region:
Incompressibility By divergence theorem: But this is true for any region, so everywhere.
Pressure How does pressure enter in? • Pressure is the force required to ensure that . • Pressure force has the following form:
Helmholtz-Hodge Decomposition Input Velocity field Curl-Free (irrotational) Divergence-Free (incompressible) + =
Aside: Pressure as Lagrange Multiplier Interpret as an optimization: Find the closest to where A Lagrange multiplier to enforce the constraint is exactly pressure.
3. Viscosity [Carlson et al. 2003]
Viscosity What characterizes a viscous liquid? • “Thick”, damped behaviour • Higher resistance to flow Watch viscous honey clip
Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules in different layers causes shear stressthat… • acts to oppose relative motion. • causes an exchange of momentum
Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules in different layers causes shear stressthat… • acts to oppose relative motion. • causes an exchange of momentum
Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules in different layers causes shear stressthat… • acts to oppose relative motion. • causes an exchange of momentum
Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules in different layers causes shear stressthat… • acts to oppose relative motion. • causes an exchange of momentum
Viscosity Imagine fluid particles with general velocities. Each particle interacts with nearby neighbours, exchanging momentum.
Viscosity Amount of momentum exchanged is proportional to: • Velocity gradient, • Viscosity coefficient, For any closed region, net in/out flow of momentum: So the viscosity force is:
Viscosity The end result is a smoothing of the velocity. This is exactly the action of the Laplacian operator, . For scalar quantities, the same operator is used to model diffusion.
External Forces Any other forces you may want. • Simplest is gravity: • for • Buoyancy models are similar, • e.g.,
Advection of a Scalar • First, we’ll consider advecting a scalar quantity, . • temperature, color, smoke density, … • The grid stores and .
Eulerian Approximate derivatives with finite differences. FTCS = Forward Time, Centered Space: Unconditionally Unstable! Lax: Conditionally Stable! Many possible methods, stability can be a challenge.
Lagrangian • Advect data forward from grid points by integrating position according to grid velocity. • Problem: New data position doesn’t necessarily land on a grid point. ?
Semi-Lagrangian • Look backwards in time from grid points, to see where data is coming from. • Interpolate data at previous time.
Semi-Lagrangian - Details • Determine velocity at grid point,. • Integrate position for a timestepof • e.g. • Interpolate at , call it . • Assign for the next time. Unconditionally stable!
Advection of Velocity • This is great for scalars. What about velocity advection? • Same method: • Trace back with current velocity • Interpolate velocity (component) at that point • Assign it to the grid point at the new time. • Caution: Do not overwrite the velocity field you’re using to trace back!
Recall… Helmholtz-Hodge Decomposition Input Velocity field Curl-Free (irrotational) Divergence-Free (incompressible) + =
Pressure Projection - Derivation (1) and (2) Discretize (1) in time… Then plug into (2)…
Pressure Projection Implementation: 1) Solve a linear system for p: 2) Update grid velocity with: