Intro to Computational Fluid DynamicsOverviewFoundationsTransport TheoremConservation of MassConservation of MomentumSlide 7Navier-Stokes EquationsSolving the equationsTentative Velocity FieldSlide 11Tentative Velocity FieldSlide 13Slide 14Satisfying the Continuity Eq.Explicitly Enforcing u=0Solving for pressureSlide 18Projection MethodSlide 20The Bottom LineBoundary ConditionsStaggered GridTracking the Free SurfaceMACSlide 26Front TrackingSlide 28Slide 29Particle Level Set MethodSlide 31ReferencesThe UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Intro to Computational Fluid DynamicsBrandon LloydCOMP 259April 16, 2003Image courtesy of Prof. A. Davidhazy at RIT. Used without permission. 2The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Overview•Understanding the Navier-Stokes equations Derivation (following [Griebel 1998]) Intuition•Solving the Navier-Stokes equations Basic approaches Boundary conditions•Tracking the free surface3The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Operators - gradient div - divergence2- Laplacian… - Hand waving / Lengthy math compressionFoundationsyuxuuudiv22222yuxuuyuxuu∂∂,∂∂4The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Transport Theoremxdtxufftxdtxfdtdt t),()div(),( ),(),( tcttxu),( tcxc0),( tct5The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Conservation of Massdensity is ; ),()0,(mass0txdtxxdx0),()div(),( xdtxutxdtxdtdt t0)div( utTransport theorem0div uIntegrand vanishes is constantfor incompressiblefluidsContinuity equation6The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Conservation of Momentumtxdtxutx),(),(momentum forces actingmomentumin changetxdtxftx),(),( :forcesbody tdsntx),( :forces surface σtttdsntxxdtxftxxdtxutxdtd),(),(),(),(),( σnormal : tensor stress : nσ7The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Conservation of Momentum0divdiv)())(()( σguuuuudtdTransport theorem Divergencetheoremfupuud tud2 1)(Momentum equation…tttdsntxxdtxftxxdtxutxdtd),(),(),(),(),( σ8The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Navier-Stokes Equationsfupuudtudu2 1)(0convection viscosityexternalforcespressure9The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Solving the equationsBasic Approach1. Create a tentative velocity field.a. Finite differencesb. Semi-Lagrangian method (Stable Fluids [Stam 1999])2. Ensure that the velocity field is divergence free:a. Adjust pressure and update velocitiesb. Projection method10The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Tentative Velocity Field Finite differences – mechanical translation of equations.n11The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Tentative Velocity Field Limits on time step•CFL conditions – don’t move more than a single cell in one time step•Diffusion termytvxtu maxmax ,122112yxt12The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Tentative Velocity FieldStable Fluids Method1. Add forces: 2. Advection3. Diffusion)()()(~01xftxuxu13The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Tentative Velocity FieldAdvectionFinite differences is unstable for large Δt.Solution: trace velocities back in time. Guarantees that the velocities will never blow up.)),((~)(~12txpuxu 14The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Tentative Velocity FieldDiffusionDiscretizing the viscosity term spreads velocity among immediate neighbors. Unstable when time step too small, grid spacing too large, or viscosity is high.Solution: Instead of using an explicit time step use an implicit one.This leads to a large but sparse linear system.)(~)(~)(232xuxutI15The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Satisfying the Continuity Eq.The tentative velocity field is not necessarily divergence free and thus does not satisfy the continuity equation. Three methods for satisfying the continuity equation:1. Explicitly satisfy the continuity equation by iteratively adjusting the pressures and velocities in each cell.2. Find a pressure correction term that will make the velocity field divergence free.3. Project the velocities onto their divergence free part.16The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Explicitly Enforcing u=0Since we have not yet added the pressure term, we can use pressure to ensure that the velocities are divergence free.u>0 increased pressure and subsequent outfluxu<0 decreased pressure and subsequent influxRelaxation algorithm1. Correct the pressure in a cell2. Update velocities 3. Repeat for all cells until each has u<ε17The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Solving for pressureAnother approach involves solving for a pressure correction term over the whole field such that the velocities will be divergence free and then update the velocities at the end.)1()()1(1~nnnptuudtud)1()()1(~nnnptuu0~)1(2)()1( nnnptuuDiscretize in timeRearrange termsSatisfy continuity eq.18The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Solving for pressureWe end up with the Poisson equation for pressure. This is another sparse linear system. These types of equations can be solved using iterative methods. Use pressures to update final velocities.)()1(2~nnutp )1()()1(~nnnptuu19The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Projection MethodThe Helmholtz-Hodge Decomposition Theorem states that any vector field can be decomposed as:where u is divergence free and q is a scalar field defined implicitly as:We can define an operator P that projects a vector field onto its divergence free part: quw 2qw qwwu 20The
View Full Document