Liquid Simulation With Mesh-Based Surface Tracking Overview of Traditional Surface Tracking Methods Matthias Müller
Introduction Research lead of NVIDIA PhysX team PhysX GPU acc. Game physics engine www.nvidia.com\physx www.matthiasmueller.info [Fast and Robust Tracking of Fluid Surfaces, SCA 09]
The Problem initial surface deformation field deformed surface
Applications Shape deformation Displacement field Liquid surface tracking Fluid velocity field
Applications [Sumner et al., Embedded Deformation for Shape Manipulation, SIGGRAPH 2007] [Thürey et al., A Multiscale Approach to Meshbased Surface Tension Flows, SIGGRAPH 2010]
Solver Tracker Interaction Solver Update velocity field getvelat(pos) Tracker Update surface Solve Navier Stokes Eqs. inside liquid isliquid(pos) Solve advection eqn. on liquid surface
Eulerian vs. Lagrangian Solver Eulerian: solve Navier Stokes Eqns. on grid Lagrangian: particle based, e.g. SPH Tracker Eulerian: solve advection eqn. φ = u φ t Lagrangian: move particles using dx = u(x) dt
getvelat(pos) Eulerian simulation: tri-linear interpolation Lagrangian simulation: spherical basis functions
Handling Topological Changes Eulerian Lagrangian iso surface of advected scalar field iso surface of scalar field induced by particles
Combinations Eulerian Lagrangian This course Solver Tracker
Eulerian Tracking Methods Level Set Method (LSM) Volume Of Fluid method (VOF) Density based
Scalar Field LSM: Signed distance VOF: Volume fraction Pseudo density
Level Set Method [Osher and Fedkiw, The Level Set Method and Dynamic Implicit Surfaces, 2003] Initialize: construct signed distance field φ Advect using fluid velocity: φ t = u φ Advection destroys distance field property φ = 1 Periodically re-initialize φ
Fast Marching 2D upwind discretization of φ = 1 max φ i,j φ i 1,j, φ i,j φ i+1,j, 0 2 + max φ i,j φ i,j 1, φ i,j φ i,j+1, 0 2 = 1 (1) Explicitly φ values near the surface, others are Compute adjacent φ i,j by solving (1) and push on heap Pop smallest φ i,j from heap, mark as fixed Compute all adjacent values of φ i,j by solving (1) and push on heap
Advection Solve φ t = u φ with finite differences Semi-Lagrangian advection (uncond. stable) [Jos Stam, Stable fuids, SIGGRAPH 99] t n+1 t n
Semi Lagrangian Advection Update φ x, t n+1 = φ x tu(x, t n+1, t n ) Euler backtrace tri-linear interpolation Simple version: feature and volume loss!
Accuracy Improvements Back-tracing Runge Kutta 2 scheme: use midway velocity MacCormack: backward + forward error estimation Interpolation Cubic Interpolation Propagation (CIP) also advects spatial derivatives of φ [Selle et al., J.Sci.Comp. 2008] [Kim et al., Eurographics 2008]
Back Tracing Methods Correct vs. Euler Runge Kutta 2 MacCormack
Particle Level Set Method [Enright et al., SIGGRAPH 2002] Add passively advected signed particles + + - - + - + + + - + - + - + + Sign inversion indicates error Periodical particle re-seeding
Other Correction Methods Semi-Lagrangian Contouring [Bargteil et al., SIGGRAPH 2006] Explicit mesh, recreated at each time step Volume controller [Kim et al., SIGGRAPH 2007] Global volume pressure correction Octree for feature preservation Feature thickening [Losasso et al., SIGGRAPH 2004] [Chentanez et al., SCA 2007]
Semi-Lagrangian Contouring [Bargteil et al., SIGGRAPH 2006]
Octree for feature preservation [Losasso et al., SIGGRAPH 2004]
Feature thickening [Chentanez et al., SCA 2007]
Volume Of Fluid [Puckett et al., A high-order projection method for tracking fluid interfaces in variable density incompressible flows, J. Comp. Phys. 1997]
Basic Idea Signed distance field does not contain global volume information Store fluid volume contained in each cell Keep sum constant using conserving exchange operations
Surface Reconstruction Fluid volume fraction per cell: 0 f i,j 1 Assume planar in cell, not unique: Unique with specified normal Least squares VOF Interface Reconstruction Algorithm (LVIRA) Optimize to cut adjacent cells according to their f i±1,j±1
Advection For each face: subtract from upwind cell, add to downwind cell u u t VOF difficulty: Definition of smooth normal and curvature Straight forward in LSM: n= φ, κ = n
CLSVOF [Sussman et al., A coupled level set and volume-of-fluid method for computing 3d and axisymmetric incompressible two-phase flows. J. Comp. Phys. 2000] Coupling Level Sets and an Volume Of Fluid Volume conservation and smooth interface VOF interface used to re-distance φ Curvature computed from φ
VOF Demo More popular in computational sciences than in graphics: Software FLUENT 12.1 CPU: 19 hours [Mario Saavedra]
CLSVOF Demo [Kang et al., Computer Graphics forum 2010]
Density Based Approach [Mullen et al., A variational approach to eulerian geometry processing. SIGGRAPH 2007]
Pseudo Density Each cell stores density ρ i,j Surface defined as an iso-surface Pseudo density fluid density ρ i,j > 0 liquid in cell
Advection Mass conserving advection equation ρ t = ρu = u ρ - ρ( u) ρ i,j t h u i+ 1 2,j Subtract from upwind cell, ρ i,j ρ i+1,j add to downwind cell u 1 i+ 2,j h
Remarks Finite difference advection: CFL condition must hold Due to numerical errors ρ i,j > 1: add divergence to the fluid simulation Blurred density profile at liquid surface: apply sharpening flow.
Density Based Approach [Mullen et al., A variational approach to eulerian geometry processing. SIGGRAPH 2007]
Lagrangian Tracking Methods
Tracking Particles Particle based simulation Tracking particles = simulation particles Eulerian simulation Marker particles (MAC) [Harlow and Welch, Phys. Fluids 1965] [Foster and Metaxas, GMIP 1996] Mesh vertices (this course)
Marker Particles Large number render particles directly (many in 3D!) Liquid Houdini Ink Simulation
Implicit Surface Two steps Derive scalar field from particles Extract iso-surface (Marching Cubes) Advantage Topological changes handled automatically Global volume conserved
Blobby [Blinn, ACM Trans. Graph. 1982] Popular kernel: 1 w i x = 1 h 2 h2 x x i 2 3 if x x i h 0 -h 0 h Scalar field: ρ x = w i (x) i Surface: S = x: ρ x = 0.5
Blobby Example Image courtesy of Jihun Yu
Averaged Centers [Zhu and Bridson, ACM Trans. Graph. 2005] Compute averaged center i a x = x iw i x i w i x Evaluate kernel at this center ρ x = 1 h 2 h2 x a(x) 2 3
Averaged Centers Example Blobby Averaged centers
Anisotropic Kernels [Yu and Turk, SCA 2010] Multiply distance by matrix G i R 3 3 w i x = 1 h 2 h2 G i (x x i ) 2 3 Yields anisotropic kernels G i from PCA of neighboring particle positions
Anisotropic Kernels Example Blobby Averaged centers Anisotropic kernels
Comparison [Yu and Turk. Reconstructing surfaces of particle-based fluids using anisotropic kernels. SCA 2010]
Explicit Surface Tracking Skip scalar field generation Simply advect vertices of a triangle mesh Use triangles as surface
Naïve Mesh Tracking Implicit Explicit Videos by Nuttapong Chentanez
My Mesh-Based Tracking? Previous Eulerian and Lagrangian tracking methods are implicit Topological changes handled automatically Detail limited by grid resolution Mesh-based tracking Detail perfectly preserved! Explicit handling of topological changes and mesh quality