An Overview of Fluid Animation. Christopher Batty March 11, 2014

Similar documents
Fluid Animation. Christopher Batty November 17, 2011

Math background. Physics. Simulation. Related phenomena. Frontiers in graphics. Rigid fluids

PDE Solvers for Fluid Flow

Modeling, Simulating and Rendering Fluids. Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan

Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

Soft Bodies. Good approximation for hard ones. approximation breaks when objects break, or deform. Generalization: soft (deformable) bodies

Physics-Based Animation

( ) Notes. Fluid mechanics. Inviscid Euler model. Lagrangian viewpoint. " = " x,t,#, #

Dan s Morris s Notes on Stable Fluids (Jos Stam, SIGGRAPH 1999)

7 The Navier-Stokes Equations

Notes. Multi-Dimensional Plasticity. Yielding. Multi-Dimensional Yield criteria. (so rest state includes plastic strain): #=#(!

2. FLUID-FLOW EQUATIONS SPRING 2019

Pressure corrected SPH for fluid animation

Numerical methods for the Navier- Stokes equations

Conservation of Mass. Computational Fluid Dynamics. The Equations Governing Fluid Motion

Chapter 5. The Differential Forms of the Fundamental Laws

2 Equations of Motion

CHAPTER 7 SEVERAL FORMS OF THE EQUATIONS OF MOTION

fluid mechanics as a prominent discipline of application for numerical

Lecture 1: Introduction to Linear and Non-Linear Waves

Computational Astrophysics

Chapter 9: Differential Analysis

V (r,t) = i ˆ u( x, y,z,t) + ˆ j v( x, y,z,t) + k ˆ w( x, y, z,t)

Chapter 9: Differential Analysis of Fluid Flow

Entropy generation and transport

150A Review Session 2/13/2014 Fluid Statics. Pressure acts in all directions, normal to the surrounding surfaces

Chapter 4: Fluid Kinematics

Particle Systems. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2017

Getting started: CFD notation

EULERIAN DERIVATIONS OF NON-INERTIAL NAVIER-STOKES EQUATIONS

A Study on Numerical Solution to the Incompressible Navier-Stokes Equation

Homework 4 in 5C1212; Part A: Incompressible Navier- Stokes, Finite Volume Methods

5.1 Fluid momentum equation Hydrostatics Archimedes theorem The vorticity equation... 42

Diffusion / Parabolic Equations. PHY 688: Numerical Methods for (Astro)Physics

CSCI1950V Project 4 : Smoothed Particle Hydrodynamics

Introduction to Fluid Dynamics

Review of fluid dynamics

CHAPTER 8 ENTROPY GENERATION AND TRANSPORT

SW103: Lecture 2. Magnetohydrodynamics and MHD models

Particle-based Fluids

Fluid Mechanics Prof. T.I. Eldho Department of Civil Engineering Indian Institute of Technology, Bombay. Lecture - 17 Laminar and Turbulent flows

Simulation in Computer Graphics Elastic Solids. Matthias Teschner

MAE 3130: Fluid Mechanics Lecture 7: Differential Analysis/Part 1 Spring Dr. Jason Roney Mechanical and Aerospace Engineering

Math (P)Review Part II:

Computer Fluid Dynamics E181107

Simulation of Particulate Solids Processing Using Discrete Element Method Oleh Baran

ESCI 485 Air/Sea Interaction Lesson 1 Stresses and Fluxes Dr. DeCaria

Conservation of mass. Continuum Mechanics. Conservation of Momentum. Cauchy s Fundamental Postulate. # f body

CHAPTER 4. Basics of Fluid Dynamics

AMME2261: Fluid Mechanics 1 Course Notes

A unifying model for fluid flow and elastic solid deformation: a novel approach for fluid-structure interaction and wave propagation

Introduction to Marine Hydrodynamics

ESS314. Basics of Geophysical Fluid Dynamics by John Booker and Gerard Roe. Conservation Laws

Large Steps in Cloth Simulation. Safeer C Sushil Kumar Meena Guide: Prof. Parag Chaudhuri

Continuum Mechanics Lecture 5 Ideal fluids

Navier-Stokes Equation: Principle of Conservation of Momentum

Differential relations for fluid flow

1. Introduction, fluid properties (1.1, 2.8, 4.1, and handouts)

The Shallow Water Equations

(Refer Slide Time: 2:14)

Vortex stretching in incompressible and compressible fluids

Macroscopic plasma description

Shell Balances in Fluid Mechanics

Several forms of the equations of motion

Burgers equation - a first look at fluid mechanics and non-linear partial differential equations

Discrete Projection Methods for Incompressible Fluid Flow Problems and Application to a Fluid-Structure Interaction

Probability density function (PDF) methods 1,2 belong to the broader family of statistical approaches

OCR Physics Specification A - H156/H556

Chapter 1 Fluid Characteristics

From the last time, we ended with an expression for the energy equation. u = ρg u + (τ u) q (9.1)

Advection / Hyperbolic PDEs. PHY 604: Computational Methods in Physics and Astrophysics II

7 EQUATIONS OF MOTION FOR AN INVISCID FLUID

Fluid equations, magnetohydrodynamics

Fluid Dynamics. Part 2. Massimo Ricotti. University of Maryland. Fluid Dynamics p.1/17

1 Introduction to Governing Equations 2 1a Methodology... 2

Physics 9 Wednesday, March 2, 2016

Partial Differential Equations II

1. Introduction, tensors, kinematics

Thursday Simulation & Unity

Fundamentals of Fluid Dynamics: Elementary Viscous Flow

Chapter 1. Introduction

1. The Properties of Fluids

Fluid Mechanics 3502 Day 1, Spring 2018

Control Volume. Dynamics and Kinematics. Basic Conservation Laws. Lecture 1: Introduction and Review 1/24/2017

Lecture 1: Introduction and Review

Time scales. Notes. Mixed Implicit/Explicit. Newmark Methods [ ] [ ] "!t = O 1 %

d v 2 v = d v d t i n where "in" and "rot" denote the inertial (absolute) and rotating frames. Equation of motion F =

Open boundary conditions in numerical simulations of unsteady incompressible flow

ME 144: Heat Transfer Introduction to Convection. J. M. Meyers

Fluid Dynamics Exercises and questions for the course

meters, we can re-arrange this expression to give

Advection, Conservation, Conserved Physical Quantities, Wave Equations

X i t react. ~min i max i. R ij smallest. X j. Physical processes by characteristic timescale. largest. t diff ~ L2 D. t sound. ~ L a. t flow.

MOMENTUM PRINCIPLE. Review: Last time, we derived the Reynolds Transport Theorem: Chapter 6. where B is any extensive property (proportional to mass),

Lecture 3: 1. Lecture 3.

Introduction to Heat and Mass Transfer. Week 9

Application of Chimera Grids in Rotational Flow

1/18/2011. Conservation of Momentum Conservation of Mass Conservation of Energy Scaling Analysis ESS227 Prof. Jin-Yi Yu

Lecture 7: Rheology and milli microfluidic

Peristaltic Pump. Introduction. Model Definition

Transcription:

An Overview of Fluid Animation Christopher Batty March 11, 2014

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 (compare v.s., elastic objects)

Examples For further detail on today s material, see Robert Bridson s online fluid notes. http://www.cs.ubc.ca/~rbridson/fluidsimulation/ (There s also a book.)

Basic Theory

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 scalar field (e.g., temperature). Lagrangian view: Set of moving particles, each with a temperature value.

Eulerian vs. Lagrangian Consider an evolving scalar field (e.g., temperature). Eulerian view: A fixed grid of temperature values, that temperature flows through.

Relating Eulerian and Lagrangian Consider the temperature T(x, t) at a point following a given path, x(t). x(t 0 ) x(t 1 ) x(t now ) How can temperature measured at x(t) change? 1. There is a hot/cold source at the current point. 2. Following the path, the point moves to a cooler/warmer location.

Mathematically: Time derivatives D Dt T T x t, t = t + T x x t Chain rule! = T t = T t + T x t + u T Definition of Choose x t = u

Material Derivative This is called the material derivative, and denoted D Dt. (AKA total derivative.) Change at a point moving along the given path, x(t). Change due to movement of the point. DT Dt = T t + u T Change at the current (fixed) point.

Advection To track a quantity T moving (passively) through a velocity field: DT Dt = 0 or equivalently T t + u T = 0 This is the advection equation. Think of colored dye or massless particles drifting around in fluid.

Advection

Equations of Motion For general materials, we have Newton s second law: F = ma. The Navier-Stokes equations are essentially the same equation, specialized to fluids.

Navier-Stokes Density Acceleration = Sum of Forces ρ Du Dt = i F i Expanding the material derivative ρ u t = ρ u u + i F i

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, paints) Electromagnetic forces: magnetohydrodynamics, ferrofluids, etc. Sky s the limit...

Exotic Fluids - Oobleck

Exotic Fluids - Ferrofluid

In full ρ u t = ρ u u + i F i Change in velocity at a fixed point Advection (of velocity) Forces (pressure, viscosity gravity, )

Operator splitting Break the full, nonlinear equation into substeps: 1. Advection: ρ u t = ρ u u 2. Pressure: ρ u t = F pressure 3. Viscosity: ρ u t = F viscosity 4. External: ρ u t = F other

1. Advection

Advection Earlier, we considered advection of a passive scalar quantity, T, by velocity u. T t = u T In Navier-Stokes we saw: u t = u u Velocity u is advected by itself!

Advection That is, u, v, w components of velocity u are advected as separate scalars. May be able to reuse the same numerical method.

2. Pressure

Pressure What does pressure do? Enforces incompressibility (fights compression). 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: u n = 0 Ω n

Incompressibility u n = 0 Ω By divergence theorem: u = 0 But this is true for any region, so u = 0 everywhere. Incompressibility implies u is divergence-free.

Pressure Where does pressure come in? Pressure is the force needed to enforce the constraint u = 0. Pressure force has the following form: F p = p

Helmholtz Decomposition Input (Arbitrary) Velocity Field Curl-Free (Irrotational) Divergence-Free (Incompressible) = + u = p + φ u old = F pressure + u new

Aside: Pressure as Lagrange Multiplier Interpret as an optimization: Find the closest u new to u old where u new = 0 ρ argmin u new 2 u new u old subject to u new = 0 The Lagrange multiplier that enforces the constraint is the pressure. e.g., recall the fast projection paper, Goldenthal et al. 2007. 2

3. Viscosity

High Speed Honey

Viscosity What characterizes a viscous liquid? Thick, damped behaviour. Strong resistance to flow.

Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules causes shear stress that opposes relative motion. causes an exchange of momentum.

Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules causes shear stress that opposes relative motion. causes an exchange of momentum.

Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules causes shear stress that opposes relative motion. causes an exchange of momentum.

Viscosity Loss of energy due to internal friction between molecules moving at different velocities. Interactions between molecules causes shear stress that opposes relative motion. causes an exchange of momentum.

Viscosity Imagine fluid particles with general velocities. Each particle interacts with nearby neighbours, exchanging momentum.

Diffusion The momentum exchange is related to: Velocity gradient, u, in a region. Viscosity coefficient, μ. Net effect is a smoothing or diffusion of the velocity over time.

Viscosity Diffusion is typically modeled using the heat equation: dt dt = α T

Viscosity Diffusion applied to velocity gives our viscous force: F viscosity = ρ u t = μ u Usually, diffuse each component of u =(u, v, w) separately.

4. External Forces

External Forces Any other forces you may want. Simplest is gravity: F g = ρg for g = (0, 9.81, 0) Buoyancy models are similar, e.g., F b = β(t current T ref )g

Numerical Methods for Fluid Animation

1. Advection

Advection of a Scalar Consider advecting a quantity, φ temperature, color, smoke density, according to a velocity field u. Allocate a grid (2D array) that stores scalar φ and velocity u.

Eulerian Approximate derivatives with finite differences. φ + u φ = 0 t FTCS = Forward Time, Centered Space: φ n+1 n i φ i + u φ i+1 n n φ i 1 = 0 t 2 x Unconditionally Unstable! Lax: φ i n+1 (φ i+1 n + φ i 1 n )/2 t + u φ i+1 n φ i 1 n 2 x = 0 Conditionally Stable! Many possible methods, stability can be a challenge.

Lagrangian Advect data forward from grid points by integrating position according to grid velocity (e.g. forward Euler).? Problem: New data position doesn t necessarily land on a grid point.

Semi-Lagrangian Look backwards in time from a grid point, to see where its new data is coming from. Interpolate data at previous time.

Semi-Lagrangian - Details 1. Determine velocity u i,j at grid point. 2. Integrate position for a timestep of t. e.g. x back = x i,j tu i,j 3. Interpolate φ at x back, call it φ back. 4. Assign φ i,j = φ back for the new time. Unconditionally stable! (Though dissipative drains energy over time.)

Advection of Velocity This handles scalars. What about advecting velocity? u t = u u Same method: Trace back with current velocity Interpolate velocity 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! (Make a copy.)

2. Pressure

Recall Helmholtz Decomposition Input Velocity field Curl-Free (irrotational) Divergence-Free (incompressible) = + u = p + φ u old = F pressure + u new

Pressure Projection - Derivation (1) ρ u = p and (2) u = 0 t Discretize (1) in time u new = u old t ρ p Then plug into (2) u old t ρ p = 0

Pressure Projection Implementation: 1) Solve a linear system of equations for p: t ρ p = u old 2) Given p, plug back in to update velocity: u new = u old t ρ p

Implementation t ρ p = u old Discretize with finite differences: u i+1 u i p i+1 p i p i 1 e.g., in 1D: t ρ p i+1 p i x p i p i 1 x x = u old old i+1 ui x

Solid Boundary Conditions Free Slip: u new n = 0 u n i.e., Fluid cannot penetrate or flow out of the wall, but may slip along it. 58

Air ( Free surface ) Boundary Conditions Assume air (outside the liquid) is at some constant atmospheric pressure, p = p atm.

Free Surface Boundary Conditions Only the pressure gradient matters, so simplify and assume p = p atm = 0. p=0 p=10 Same (vertical) pressure gradient, p. p=100 p=110 p=20 p=120

3. Viscosity

Viscosity PDE: ρ u t = μ u Again, apply finite differences. Discretized in time: u new = u old + tμ ρ u u old -> explicit u new -> implicit

Viscosity Time Integration Explicit integration: Compute tμ u ρ old from current velocities. Add on to current u. Quite unstable (stability restriction: t O( x 2 )) Implicit integration: u new = u old + tμ ρ u old u new = u old + tμ ρ u new Stable even for high viscosities, large steps. Must solve a system of equations.

Viscosity Implicit Integration Solve for u new : u new tμ ρ u new = u old (Apply separately for each velocity component.) e.g. in 1D: u i+1 u i u i 1 u i tμ ρ u i+1 u i x u i u i 1 x x = u i old

Viscosity - Solid Boundary Conditions No-Slip: u new = 0 65

No-slip Condition

Viscosity - Free Surface Conditions We want to model no momentum exchange with the air. Simplest attempt: u n = 0 Drawback: Breaks rotation! True conditions are more involved: pi + μ u + u T n = 0 (Still ignores surface tension!) See [Batty & Bridson, 2008] for the current standard solution in graphics. (Needed e.g., for honey coiling.)

4. External Forces

Gravity Discretized form is: u new = u old + tg Simply increment the vertical velocities at each step!

Gravity Notice: in a closed fluid-filled container, gravity (alone) won t do anything! Incompressibility cancels it out. (Assuming constant density.) Start After gravity step After pressure step

Simple Buoyancy Track an extra scalar field T, representing local temperature. Apply advection and diffusion to evolve it with the velocity field. Difference between current and reference temperature induces buoyancy.

Simple Buoyancy e.g. u new = u old + tβ T current T ref g β dictates the strength of the buoyancy force. For an enhanced version of this: Visual simulation of smoke, [Stam et al., 2001].

User Forces Add whatever additional forces we want: Wind forces near a mouse click. Paddle forces in Plasma Pong. Plasma Pong

Ordering of Steps Order is important. Why? 1) Incompressibility is not satisfied at intermediate steps. 2) Advecting with a compressive field causes volume/material loss or gain!

Ordering of Steps For example, consider advection in this field:

The Big Picture Velocity Solver Advect Velocities Add Viscosity Add Gravity Project Velocities to be Incompressible

Liquids

Liquids What s missing? We still need a surface representation.

Interaction between Solver and Surface Tracker Velocity Solver Geometric Information Advect Velocities Add Viscosity Surface Tracker Add Gravity Project Velocities to be Incompressible Velocity Information

Solver-to-Surface Tracker Given: current surface geometry, velocity field, and timestep. Compute: new surface geometry by advection. u n T n T n+1

Surface Tracker-to-Solver Given the surface geometry, identify the type of each cell. Solver uses this information for boundary conditions. S A A A S S L L L S S S L L S S S S S S

Surface Tracker Ideally: Efficient Accurate Handles merging/splitting (topology changes) Conserves volume Retains small features Gives a smooth surface for rendering Provides convenient geometric operations (postprocessing?) Easy to implement Very hard (impossible?) to do all of these at once.

Surface Tracking Options 1. Particles 2. Level sets 3. Volume-of-fluid (VOF) 4. Triangle meshes 5. Hybrids (many of these)

Particles [Zhu & Bridson 2005]

Particles Perform passive Lagrangian advection on each particle. For rendering, need to reconstruct a surface.

Level sets [Losasso et al. 2004]

Level sets Each grid point stores signed distance to the surface (inside <= 0, outside > 0). Surface is the interpolated zero isocontour. > 0 <= 0

Densities / Volume of fluid [Mullen et al 2007]

Volume-Of-Fluid Each cell stores fraction f ϵ 0,1 indicating how empty/full it is. Surface is transition region, f 0.5. 1 1 0. 8 0 0 0 1 1 1 0.4 0 0 1 1 1 0.4 0 0 1 1 0.8 0 0 0 1 1 0.5 0 0 0

Meshes [Brochu et al 2010]

Meshes Store a triangle mesh. Advect its vertices, and deal with collisions.