470 likes | 571 Views
Efficient Simulation of Large Bodies of Water by Coupling Two and Three Dimensional Techniques. Frank Losasso Ron Fedkiw Stanford University Industrial Light + Magic. Geoffrey Irving Stanford University Pixar Animation Studios. Eran Guendelman Stanford University. Motivation.
E N D
Efficient Simulation of Large Bodies of Water by Coupling Two and Three Dimensional Techniques Frank Losasso Ron Fedkiw Stanford University Industrial Light + Magic Geoffrey Irving Stanford University Pixar Animation Studios Eran Guendelman Stanford University
Motivation • Large scale water phenomena important • Rivers, lakes, oceans, floods • Fast option: height field methods • Nice wave propagation • Can’t handle overturning • Accurate option: 3D Navier Stokes • Captures three dimensional behavior • Slow at high resolutions: O(N4)
Solution: use both • Uniform 3D Navier-Stokes near interface • Coarsen elsewhere using tall cells
Related work: 2D • Deep water • Fournier and Reeves 1986, Peachy 1986 • Recent: Thon et al. 2000, Hinsinger 2002 • Shallow Water • Kass and Miller 1990, O’Brien and Hodgins 1995 • Rivers and streams • Chen and Lobo 1994, Thon and Ghazanfarpour 2001
Related work: 3D • Uniform Navier-Stokes water • Foster and Metaxas 1997, Foster and Fedkiw 2001 • Enright et. al 2002: Particle level set method • Large bodies of water • Takahashi et al. 2003: spray and foam • Mihalef et al. 2004: breaking waves • Adaptive simulation • Losasso et al. 2004: Octree grids • Houston et al. 2006: Run-Length Encoded (RLE) grids
Outline • Grid structure • Uniform solver • Advection on tall cells • Pressure solver on tall cells • Parallel implementation • Discussion and Results
Outline • Grid structure • Uniform solver • Advection on tall cells • Pressure solver on tall cells • Parallel implementation • Discussion and Results
Why height fields work • Water likes to stay flat • Only water-air interface is visible • Vertical structure simpler than horizontal
Mixing height fields and 3D • Specify “optical depth” where we expect turbulent motion • Use uniform 3D cells within optical depth • Use height field model elsewhere optical depth
Grid structure • Start with uniform MAC grid • Keep cells within optical depth of the interface • Outside optical depth, merge vertical sequences of cells into single tall cells
Grid structure: storing values • Start with MAC grid storage • Level set values in cell centers near interface • Pressure values in cell centers • Velocity components on corresponding faces
Grid structure: pressure • Two pressure samples per tall cell • Linear interpolation between • Allows
Grid structure: velocity • Velocity corresponds to pressure gradients
Refinement and coarsening • Grid is rebuilt whenever fluid moves based on current level set • Linear time (Houston et al. 2006) • Velocity must be transferred to new grid • optionally transfer pressure as initial guess
Transferring velocity Interpolate Least squares
Transferring velocity (cont) • Interpolate: • Least squares:
Outline • Grid structure • Uniform solver • Advection on tall cells • Pressure solver on tall cells • Parallel implementation • Discussion and Results
Uniform solver • Navier-Stokes equations plus level set • Level set exists only in uniform cells • Velocity updated using projection method
Uniform solver (cont) • Advect velocity and add gravity • use semi-Lagrangian for uniform cells • Solve Laplace equation for pressure • Apply pressure correction to velocity
Outline • Grid structure • Uniform solver • Advection on tall cells • Pressure solver on tall cells • Parallel implementation • Discussion and Results
Tall cell advection • Can’t use semi-Lagrangian for • Use conservative method for plausible motion • Simplest option: first order upwinding
First order upwinding • Conservation form of advection equation • Compute flux on each control volume face • Add fluxes to current velocity
First order upwinding (tall cells) • Pretend to do the following • Refine to uniform grid • Advect • Coarsen back to original grid • Simulate this by applying least squares directly to uniform discretization • Same answer but faster
First order upwinding (tall cells) u along u u along v v along u v along v
Advection issues • Occasional instabilities near steep terrain • fix by clamping to affine combination • Lots of numerical dissipation • good enough for bulk motion • Future work: generalize higher order schemes used in shallow water
Outline • Grid structure • Uniform solver • Advection on tall cells • Pressure solver on tall cells • Parallel implementation • Discussion and Results
Pressure solve on tall cells • Pressure projection is • Need gradient and divergence operators
Pressure solve: gradient • Gradient is easy
Pressure solve: divergence • Two divergence samples per cell • Interpolate velocity to uniform face • Divide flux between samples with same weights used for interpolation
Pressure solve: Laplacian • Compose divergence and gradient to get linear system • Symmetric and positive definite since we used the same weights in both • Solve using preconditioned conjugate gradients
Outline • Grid structure • Uniform solver • Advection on tall cells • Pressure solver on tall cells • Parallel implementation • Discussion and Results
Parallel implementation • Parallelize only along horizontal dimensions • No harder than parallelizing a uniform code • Vertical dimension already cheap • Exchange data with neighbors every step
Parallel implementation • Pressure solved globally on all processor together • Block diagonal preconditioner built out of incomplete Choleski on each processor A B C D
Results: splash (300 x 200) Optical depth equal to water depth
Results: splash (300 x 200) Optical depth 1/4th water depth
Results: splash (300 x 200) Optical depth 1/16th water depth
Results: deep splash Water depth doubled
Matching bottom topography • Tall cells match ground for free • Octrees would require extra refinement • Less important for deep problems
Comparison with octrees • Advantages over octrees: • Easy to parallelize • Reduces to MAC discretization with refinement • Matches bottom topography for free • Main disadvantage: relies on vertical simplicity for efficiency • Not applicable for all flows • rising bubbles, colliding droplets, etc.
Conclusion • Want high resolution near interface • Uniform resolution at interface sufficient • Plausible bulk motion enough elsewhere • Many flows have simple vertical structure • Use this to create hybrid 2D/3D method
Future work • Improved advection scheme • Match ENO/WENO schemes for shallow water • Better parallelism • Remove global linear system solve • Find optimal adaptive structure • Hybrid RLE / octree grid?
The End Questions?