1cs533d-term1-2005 Notes  Smoke: Fedkiw, Stam, Jensen, SIGGRAPH’01  Water: Foster, Fedkiw, SIGGRAPH’01 Enright, Fedkiw, Marschner, SIGGRAPH’02  Fire:

Slides:



Advertisements
Similar presentations
Stable Fluids A paper by Jos Stam.
Advertisements

My First Fluid Project Ryan Schmidt. Outline MAC Method How far did I get? What went wrong? Future Work.
Realistic Simulation and Rendering of Smoke CSE Class Project Presentation Oleksiy Busaryev TexPoint fonts used in EMF. Read the TexPoint manual.
Christopher Batty and Robert Bridson University of British Columbia
Level set based Image Segmentation Hang Xiao Jan12, 2013.
Lecture 15: Capillary motion
Least squares CS1114
1cs533d-winter-2005 Notes  Assignment 1 is not out yet :-)  courses/533d-winter-2005.
Depicting Fire and Other Gaseous Phenomena Using Diffusion Processes Jos Stam and Eugene Fiume Dept. of CS, University of Toronto Presentation ©2001 Brenden.
1cs533d-term Notes. 2 Fire  [Nguyen, Fedkiw, Jensen ‘02]  Gaseous fuel/air mix (from a burner, or a hot piece of wood, or …) heats up  When it.
Course 14 Fluid Simulation Monday, Half Day, 8:30 am - 12:15 pm.
Solving Linear Equations
MATH 685/ CSI 700/ OR 682 Lecture Notes
1cs533d-winter-2005 Notes  How are projects going?
Notes Assignment questions… cs533d-winter-2005.
1cs533d-term Notes  Assignment 2 is up. 2cs533d-term Modern FEM  Galerkin framework (the most common)  Find vector space of functions that.
1cs533d-term Notes. 2 Shallow water equations  To recap, using eta for depth=h+H:  We’re currently working on the advection (material derivative)
1cs533d-winter-2005 Shallow water equations  From last time, using eta for depth=h+H:  We’ll discretize this using “splitting” Handle the material derivative.
1Notes. 2 Building implicit surfaces  Simplest examples: a plane, a sphere  Can do unions and intersections with min and max  This works great for.
Combating Dissipation. Numerical Dissipation  There are several sources of numerical dissipation in these simulation methods  Error in advection step.
More Accurate Pressure Solves. Solid Boundaries  Voxelized version works great if solids aligned with grid  If not: though the error in geometry is.
1Notes. 2 Triangle intersection  Many, many ways to do this  Most robust (and one of the fastest) is to do it based on determinants  For vectors a,b,c.
1Notes  Textbook: matchmove 6.7.2, B.9. 2 Match Move  For combining CG effects with real footage, need to match synthetic camera to real camera: “matchmove”
1cs533d-winter-2005 Notes  Please read Fedkiw, Stam, Jensen, “Visual simulation of smoke”, SIGGRAPH ‘01.
Chapter 8 Coordinate Systems.
University of North Carolina - Chapel Hill Fluid & Rigid Body Interaction Comp Physical Modeling Craig Bennetts April 25, 2006 Comp Physical.
1cs533d-winter-2005 Notes  Please read Enright et al., “Animation and rendering of complex water surfaces”, SIGGRAPH’02.
1cs533d-winter-2005 Notes  I’m now in X663 Well, sort of…  Questions about assignment 3?
1cs426-winter-2008 Notes  Course project: Will be due at the end of the term You can do it in pairs Create an animation that combines an algorithm for.
Modeling Fluid Phenomena -Vinay Bondhugula (25 th & 27 th April 2006)
1cs533d-term Notes. 2 Poisson Ratio  Real materials are essentially incompressible (for large deformation - neglecting foams and other weird composites…)
1cs533d-term Notes  Typo in test.rib --- fixed on the web now (PointsPolygon --> PointsPolygons)
Visual Simulation of Smoke SIGGRAPH’01 Ronald Fedkiw, Jos Stam and Henrik Wann Jensen Stanford University & Alias|wavefront.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Modelling Realistic Water & Fire Sérgio Leal Socrates/Erasmus student at: AK Computer Graphics Institute for Computer Graphics and Vision Technical University.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Intro to Computational Fluid Dynamics Brandon Lloyd COMP 259 April 16, 2003 Image courtesy of Prof. A.
1cs426-winter-2008 Notes  Assignment 1 is out, due immediately after reading week (Feb 25)  Please read: William T. Reeves, "Particle systems: a technique.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Introduction to Modeling Fluid Dynamics 1.
Modeling, Simulating and Rendering Fluids Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan.
Fluid Simulation for Computer Animation Greg Turk College of Computing and GVU Center Georgia Institute of Technology.
Monte Carlo Methods in Partial Differential Equations.
Gravity and Orbits The gravitational force between two objects:
Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly.
Systems of Linear Equations Iterative Methods
CEE 262A H YDRODYNAMICS Lecture 5 Conservation Laws Part I 1.
A Hybrid Particle-Mesh Method for Viscous, Incompressible, Multiphase Flows Jie LIU, Seiichi KOSHIZUKA Yoshiaki OKA The University of Tokyo,
Results from kinetic theory, 1 1. Pressure is associated with collisions of gas particles with the walls. Dividing the total average force from all the.
Animation of Fluids.
Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an.
Scientific Computing Partial Differential Equations Poisson Equation.
Finite Element Method.
1 Discretization of Fluid Models (Navier Stokes) Dr. Farzad Ismail School of Aerospace and Mechanical Engineering Universiti Sains Malaysia Nibong Tebal.
A particle-gridless hybrid methods for incompressible flows
Mathematical Equations of CFD
Solving Linear Equations To Solve an Equation means... To isolate the variable having a coefficient of 1 on one side of the equation. Examples x = 5.
How far away something is gets complicated at high z How far it is now? How far it was then? How far light travelled? How distant it looks? Let’s call.
CEE 262A H YDRODYNAMICS Lecture 15 Unsteady solutions to the Navier-Stokes equation.
Stable, Circulation- Preserving, Simplicial Fluids Sharif Elcott, Yiying Tong, Eva Kanso, Peter Schröder, and Mathieu Desbrun.
Example How far from the earth's surface must an astronaut in space be if she is to feel a gravitational acceleration that is half what she would feel.
Overview of Propagating Interfaces Donald Tanguay October 30, 2002.
Parallel Solution of the Poisson Problem Using MPI
Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory # Discretization Methods Topics Equations and The Goal Brief overview.
November 2005 Center for Computational Visualization Institute of Computational and Engineering Sciences Department of Computer Sciences University of.
ASCI/Alliances Center for Astrophysical Thermonuclear Flashes An Interface Propagation Model for Reaction-Diffusion Advection Adam Oberman An Interface.
Efficient Simulation of Large Bodies of Water by Coupling Two and Three Dimensional Techniques Geoffrey Irving Stanford University Pixar Animation Studios.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Water Computational Fluid Dynamics Volumes Lagrangian vs. Eulerian modelling Navier-Stokes equations.
Animating smoke with dynamic balance Jin-Kyung Hong Chang-Hun Kim 발표 윤종철.
Conjugate gradient iteration One matrix-vector multiplication per iteration Two vector dot products per iteration Four n-vectors of working storage x 0.
Introduction to Fluid Dynamics & Applications
Particle-in-Cell Methods
Presentation transcript:

1cs533d-term Notes  Smoke: Fedkiw, Stam, Jensen, SIGGRAPH’01  Water: Foster, Fedkiw, SIGGRAPH’01 Enright, Fedkiw, Marschner, SIGGRAPH’02  Fire: Nguyen, Fedkiw, Jensen, SIGGRAPH’02

2cs533d-term Recall: plain CG  CG is guaranteed to converge faster than steepest descent Global optimality property  But… convergence is determined by distribution of eigenvalues Widely spread out eigenvalues means sloooow solution  How can we make it efficient?

3cs533d-term Speeding it up  CG generally takes as many iterations as your grid is large E.g. if 30x70x40 expect to take 70 iterations (or proportional to it) Though a good initial guess may reduce that a lot  Basic issue: pressure is globally coupled - information needs to travel from one end of the grid to the other Each step of CG can only go one grid point: matrix-vector multiply is core of CG  Idea of a “preconditioner”: if we can get a routine which approximately computes A -1, call it M, then solve MAx=Mb If M has global coupling, can get information around faster Alternatively, improve search direction by multiplying by M to point it closer to negative error Alternatively, cluster eigenvalues

4cs533d-term Preconditioners  Lots and lots of work on how to pick an M  Examples: FFT, SSOR, ADI, multigrid, sparse approximate inverses  We’ll take a look at Incomplete Cholesky factorization  But first, how do we change CG to take account of M? M has to be SPD, but MA might not be…

5cs533d-term PCG  r=b-Ap, z=Mr, s=z   =z T r, check if already solved  Loop: t=As  =  /(s T t) x+=  s, r-=  t, check for convergence z=Mr  new =z T r  =  new /  s=z+  s  =  new

6cs533d-term Cholesky  True Gaussian elimination, which is called Cholesky factorization in the SPD case, gives A=LL T  L is a lower triangular matrix  Then solving Ap=b can be done by Lx=p, L T p=x Each solve is easy to do - triangular  But can’t do that here since L has many more nonzeros than A -- EXPENSIVE!

7cs533d-term Incomplete Cholesky  We only need approximate result for preconditioner  So do Cholesky factorization, but throw away new nonzeros (set them to zero)  Result is not exact, but pretty good Instead of O(n) iterations (for an n 3 grid) we get O(n 1/2 ) iterations  Can actually do better: Modified Incomplete Cholesky Same algorithm, only when we throw away nonzeros, we add them to the diagonal - better behaviour with low frequency components of pressure Gets us down to O(n 1/4 ) iterations

8cs533d-term IC(0)  Incomplete Cholesky level 0: IC(0) is where we make sure L=0 wherever A=0  For this A (7-point Laplacian) with the regular grid ordering, things are nice  Write A=F+D+F T where F is strictly lower triangular and D is diagonal  Then IC(0) ends up being of the form L=(FE -1 +E) where E is diagonal We only need to compute and store E!

9cs533d-term Computing IC(0)  Need to find diagonal E so that (LL T ) ij =A ij wherever A ij ≠0  Expand out: LL T =F+F T +E 2 +FE -2 F T  Again, for this special case, can show that last term only contributes to diagonal and elements where A ij =0  So we get the off-diagonal correct for free  Let’s take a look at diagonal entry for grid point ijk

10cs533d-term Diagonal Entry  Assume we order increasing in i, j, k  Note F=A for lower diagonal elements  Want this to match A’s diagonal Then solving for next E ijk in terms of previously determined ones:

11cs533d-term Practicalities  Actually only want to store inverse of E  Note that for values of A or E off the grid, substitute zero in formula In particular, can start at E 000,000 =√A 000,000  Modified Incomplete Cholesky looks very similar, except instead of matching diagonal entries, we match row sums  Can squeeze out a little more performance with the “Eisenstat trick”

12cs533d-term Viscosity  The viscosity update (if we really need it - highly viscous fluids) is just Backwards Euler:  Boils down to almost the same linear system to solve! Or rather, 3 similar linear systems to solve - one for each component of velocity (NOTE: solve separately, not together!) Again use PCG with Incomplete Cholesky

13cs533d-term Staggered grid advection  Problem: velocity on a staggered grid, don’t have components where we need it for semi-Lagrangian steps  Simple answer Average velocities to get flow field where you need it, e.g. u ijk =0.5(u i+1/2 jk + u i-1/2 jk ) So advect each component of velocity around in averaged velocity field  Even cheaper Advect averaged velocity field around (with any other quantity you care about) --- reuse interpolation coefficients! But - all that averaging smears u out… more numerical viscosity! [worse for small ∆t]

14cs533d-term Vorticity confinement  The interpolation errors behave like viscosity, the averaging from the staggered grid behaves like viscosity… Net effect is that interesting flow structures (vortices) get smeared out  Idea of vorticity confinement - add a fake force that spins vortices faster Compute vorticity of flow, add force in direction of flow around each vortex Try to cancel off some of the numerical viscosity in a stable way

15cs533d-term Smoke  Smoke is a bit more than just a velocity field  Need temperature (hot air rises) and smoke density (smoke eventually falls)  Real physics - density depends on temperature, temperature depends on viscosity and thermal conduction, … We’ll ignore most of that: small scale effects Boussinesq approximation: ignore density variation except in gravity term, ignore energy transfer except thermal conduction We might go a step further and ignore thermal conduction - insignificant vs. numerical dissipation - but we’re also ignoring sub-grid turbulence which is really how most of the temperature gets diffused

16cs533d-term Smoke concentration  There’s more than just air temperature to consider too  Smoke weighs more than air - so need to track smoke concentration Also could be used for rendering (though tracing particles can give better results) Point is: physics depends on smoke concentration, not just appearance  We again ignore effect of this in all terms except gravity force

17cs533d-term Buoyancy  For smoke, where there is no interface, we can add  gy to pressure (and just solve for the difference) thus cancelling out g term in equation  All that’s left is buoyancy -- variation in vertical force due to density variation  Density varies because of temperature change and because of smoke concentration  Assume linear relationship (small variations) T=0 is ambient temperature; ,  depend on g etc.

18cs533d-term Smoke equations  So putting it all together…  We know how to solve the u part, using old values for s and T  Advecting s and T around is simple - just scalar advection  Heat diffusion handled like viscosity

19cs533d-term Notes on discretization  Smoke concentration and temperature may as well live in grid cells same as pressure  But then to add buoyancy force, need to average to get values at staggered positions  Also, to maintain conservation properties, should only advect smoke concentration and temperature (and anything else - velocity) in a divergence-free velocity field If you want to do all the advection together, do it before adding buoyancy force I.e. advect; buoyancy; pressure solve; repeat

20cs533d-term Water

21cs533d-term Water - Free Surface Flow  Chief difference: instead of smoke density and temperature, need to track a free surface  If we know which grid cells are fluid and which aren’t, we can apply p=0 boundary condition at the right grid cell faces First order accurate…  Main problem: tracking the surface effectively

22cs533d-term Interface Velocity  Fluid interface moves with the velocity of the fluid at the interface Technically only need the normal component of that motion…  To help out algorithms, usually want to extrapolate velocity field out beyond free surface

23cs533d-term Marker Particle Issues  From the original MAC paper (Harlow + Welch ‘65)  Start with several particles per grid cell  After every step (updated velocity) move particles in the velocity field dx/dt=u(x) Probably advisable to use at least RK2  At start of next step, identify grid cells containing at least one particle: this is where the fluid is

24cs533d-term Issues  Very simple to implement, fairly robust  Hard to determine a smooth surface for rendering (or surface tension!) Blobbies look bumpy, stair step grid version is worse But with enough post-smoothing, ok for anything other than really smooth flow

25cs533d-term Surface Tracking  Actually build a mesh of the surface  Move it with the velocity field  Rendering is trivial  Surface tension - well studied digital geometry problem  But: fluid flow distorts interface, needs adaptivity  Worse: topological changes need “mesh surgery” Break a droplet off, merge a droplet in… Very challenging in 3D

26cs533d-term Volume of Fluid (VOF)  Work in a purely Eulerian setting - maintain another variable “volume fraction”  Update conservatively (no semi- Lagrangian) so discretely guarantee sum of fractions stays constant (in discretely divergence free velocity field)

27cs533d-term VOF Issues  Difficult to get second order accuracy -- smeared out a discontinuous variable over a few grid cells May need to implement variable density  Volume fraction continues to smear out (numerical diffusion) Need high-resolution conservation law methods Need to resharpen interface periodically  Surface reconstruction not so easy for rendering or surface tension

28cs533d-term Level Set  Maintain signed distance field for fluid-air interface  Gives smooth surface for rendering, curvature estimation for surface tension is trivial  High order notion of where surface is

29cs533d-term Level Set Issues  Numerical smearing even with high- resolution methods Interface smoothes out, small features vanish

30cs533d-term Level Set Distortion  Assuming even no numerical diffusion problems in level set advection (e.g. well- resolved on grid), level sets still have problems  Initially equal to signed distance  After non-rigid motion, stop being signed distance E.g. points near interface will end up deep underwater, and vice versa

31cs533d-term Fixing Distortion  Remember it’s only zero isocontour we care about - free to change values away from interface  Can reinitialize to signed distance (“redistance”) Without moving interface, change values to be the signed distance to the interface  Fast Marching Method  Fast Sweeping Method

32cs533d-term Problems  Reinitialization will unfortunately slightly move the interface (less than a grid cell)  Errors look like, as usual, extra diffusion or smoothing In addition to the errors we’re making in advection…

33cs533d-term Velocity extrapolation  We can exploit level set to extrapolate velocity field outside water Not a big deal for pressure solve - can directly handle extrapolation there But a big deal for advection - with semi-Lagrangian method might be skipping over, say, 5 grid cells So might want velocity 5 grid cells outside of water  Simply take the velocity at an exterior grid point to be interpolated velocity at closest point on interface Alternatively, propagate outward to solve similar to reinitiatalization methods

34cs533d-term Particle-Level Set  Marker particle (MAC) method great for rough surfaces  But if we want surface tension (which is strongest for rough flows!) or smooth water surfaces, we need a better technique  Hybrid method: particle-level set [Fedkiw and Foster], [Enright et al.] Level set gives great smooth surface - excellent for getting mean curvature Particles correct for level set mass (non-)conservation through excessive numerical diffusion

35cs533d-term Level set advancement  Put marker particles with values of  attached in a band near the surface We’re also storing  on the grid, so we don’t need particles deep in the water For better results, also put particles with  >0 (“air” particles) on the other side  After doing a step on the grid and moving , also move particles with (extrapolated) velocity field  Then correct the grid  with the particle   Then adjust the particle  from the grid 

36cs533d-term Level set correction  Look for escaped particles Any particle on the wrong side (sign differs) by more than the particle radius |  |  Rebuild  0 values from escaped particles (taking min/max’s of local spheres)  Merge rebuilt  0 by taking minimum- magnitude values  Reinitialize new grid   Correct again  Adjust particle  values within limits (never flip sign)

37cs533d-term Fire

38cs533d-term Fire  [Nguyen, Fedkiw, Jensen ‘02]  Gaseous fuel/air mix (from a burner, or a hot piece of wood, or …) heats up  When it reaches ignition temperature, starts to burn “blue core” - see the actual flame front due to emission lines of excited hydrocarbons  Gets really hot while burning - glows orange from blackbody radiation of smoke/soot  Cools due to radiation, mixing Left with regular smoke

39cs533d-term Defining the flow  Inside and outside blue core, regular incompressible flow with buoyancy  But an interesting boundary condition at the flame front Gaseous fuel and air chemically reacts to produce a different gas with a different density Mass is conserved, so volume has to change Gas instantly expands at the flame front  And the flame front is moving too At the speed of the flow plus the reaction speed

40cs533d-term Interface speed  Interface = flame front = blue core surface  D=V f -S is the speed of the flame front It moves with the fuel flow, and on top of that, moves according to reaction speed S S is fixed for a given fuel mix  We can track the flame front with a level set   Level set moves by  Here u LS is u f -Sn

41cs533d-term Numerical method  For water we had to work hard to move interface accurately  Here it’s ok just to use semi-Lagrangian method (with reinitialization)  Why? We’re not conserving volume of blue core - if reaction is a little too fast or slow, that’s fine Numerical error looks like mean curvature Real physics actually says reaction speed varies with mean curvature!

42cs533d-term Conservation of mass  Mass per unit area entering flame front is  f (V f - D) where V f =u f n is the normal component of fuel velocity D is the (normal) speed of the interface  Mass per unit area leaving flame front is  h (V h - D) where V h =u h n is the normal component of hot gaseous products velocity  Equating the two gives:

43cs533d-term Velocity jump  Plugging interface speed D into conservation of mass at the flame front gives:

44cs533d-term Ghost velocities  This is a “jump condition”: how the normal component of velocity jumps when you go over the flame interface  This lets us define a “ghost” velocity field that is continuous When we want to get a reasonable value of u h for semi- Lagrangian advection of hot gaseous products on the fuel side of the interface, or vice versa (and also for moving interface) When we compute divergence of velocity field  Simply take the velocity field, add/subtract (  f /  h -1)Sn

45cs533d-term Conservation of momentum  Momentum is also conserved at the interface  Fuel momentum per unit area “entering” the interface is  Hot gaseous product momentum per unit area “leaving” the interface is  Equating the two gives

46cs533d-term Simplifying  Make the equation look nicer by taking conservation of mass: multiplying both sides by -D: and adding to previous slide’s equation:

47cs533d-term Pressure jump  This gives us jump in pressure from one side of the interface to the other  By adding/subtracting the jump, we can get a reasonable continuous extension of pressure from one side to the other For taking the gradient of p to make the flow incompressible after advection  Note when we solve the Poisson equation density is NOT constant, and we have to incorporate jump in p (known) just like we use it in the pressure gradient

48cs533d-term Temperature  We don’t want to get into complex (!) chemistry of combustion  Instead just specify a time curve for the temperature Temperature known at flame front (T ignition ) Temperature of a chunk of hot gaseous product rises at a given rate to T max after it’s created Then cools due to radiation

49cs533d-term Temperature cont’d  For small flames (e.g. candles) can model initial temperature rise by tracking time since reaction: Y t +u  Y=1 and making T a function of Y  For large flames ignore rise, just start flame at T max (since transition region is very thin, close to blue core)  Radiative cooling afterwards:

50cs533d-term Smoke concentration  Can do the same as for temperature: initially make it a function of time Y since reaction (rising from zero) And ignore this regime for large flames  Then just advect without change, like before  Note: both temperature and smoke concentration play back into velocity equation (buoyancy force)

51cs533d-term Note on fuel  We assumed fuel mix is magically being injected into scene Just fine for e.g. gas burners Reasonable for slow-burning stuff (like thick wood)  What about fast-burning material? Can specify another reaction speed S fuel for how fast solid/liquid fuel turned into flammable gas (dependent on temperature) Track level set of solid/liquid fuel just like we did the blue core