0% found this document useful (0 votes)
46 views

Intro To Computational Fluid Dynamics: Brandon Lloyd COMP 259 April 16, 2003

This document provides an overview of computational fluid dynamics (CFD) and the Navier-Stokes equations. It discusses key concepts like the continuity equation, conservation of mass and momentum, and operators used in CFD. It also summarizes approaches for solving the Navier-Stokes equations numerically, including creating a tentative velocity field using finite differences or semi-Lagrangian methods, and enforcing divergence-free conditions through pressure adjustment or projection methods. The document derives the Navier-Stokes equations from physical principles of fluid flow and conservation laws.

Uploaded by

Lloyd Mathias
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Intro To Computational Fluid Dynamics: Brandon Lloyd COMP 259 April 16, 2003

This document provides an overview of computational fluid dynamics (CFD) and the Navier-Stokes equations. It discusses key concepts like the continuity equation, conservation of mass and momentum, and operators used in CFD. It also summarizes approaches for solving the Navier-Stokes equations numerically, including creating a tentative velocity field using finite differences or semi-Lagrangian methods, and enforcing divergence-free conditions through pressure adjustment or projection methods. The document derives the Navier-Stokes equations from physical principles of fluid flow and conservation laws.

Uploaded by

Lloyd Mathias
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 32

Intro to Computational

Fluid Dynamics
Brandon Lloyd
COMP 259
April 16, 2003

Image courtesy of Prof. A. Davidhazy at RIT. Used without permission. 

The 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 surface

2
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Foundations
Operators
 - gradient u   ∂u , ∂u 
 ∂x ∂y 
div - divergence div u    u  u x  u y
 u
 - Laplacian  u
2 2
2 u 2
x y
2 2

… - Hand waving / Lengthy math


compression

3
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Transport Theorem

 (c , t )


c
t
0

d      

dt t

f ( x , t )dx    f  div( fu )( x , t )dx
 t t
 
       
x   (c , t ) u ( x , t )   (c , t )
t
4
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conservation of Mass
   
mass    ( x ,0)dx    ( x , t )dx ;  is density
0 t

Transport theorem
d      

dt t
 ( x , t ) dx   
 t t

  div( u ) 

( x , t ) dx 0

  Integrand vanishes
  div( u )  0
t
 is constant 
for incompressible
fluids
div u  0
Continuity equation
5
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conservation of Momentum
  
momentum    ( x , t )u ( x , t )dx
t

change in momentum   acting forces


   
body forces :   ( x , t ) f ( x , t )dx
t
 
surface forces :  σ ( x , t )n ds
 t

σ : stress tensor n : normal

d         

dt t
 ( x , t )u ( x , t ) dx  t
 ( x , t ) f ( x , t ) dx   t
σ ( x , t )nds

6
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Conservation of Momentum
d         

dt t

 ( x , t )u ( x , t )dx    ( x , t ) f ( x , t )dx   σ( x , t )n ds
t  t

Transport theorem Divergence


theorem
d      
( u )  (u  )( u )  ( u ) div u  g  div σ  0
dt

 
du   1 2
 (u  )u  p   u  f
dt 
Momentum equation
7
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Navier-Stokes Equations


 u  0
 
du   1 2
 (u  )u  p   u  f
dt 

external
convection pressure viscosity
forces

8
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Solving the equations
Basic Approach
1. Create a tentative velocity field.
a. Finite differences
b. Semi-Lagrangian method (Stable Fluids
[Stam 1999])
2. Ensure that the velocity field is
divergence free:
a. Adjust pressure and update velocities
b. Projection method

9
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Tentative Velocity Field
Finite differences – mechanical
translation of equations.

n

10
The 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

umax t  x, vmax t  y

• Diffusion term
1
 1 1 
2t   2  2 
 x y 
11
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Tentative Velocity Field
Stable Fluids Method  
  
1. Add forces: u~1 ( x )  u0 ( x )  t  f ( x )
2. Advection
3. Diffusion

12
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Tentative Velocity Field
Advection
Finite differences is unstable for large Δt.
Solution: trace velocities back in time. Guarantees that
the velocities will never blow up.

~  ~  
u2 ( x )  u1 ( p ( x , t ))

13
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Tentative Velocity Field
Diffusion
Discretizing 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.

~  ~ 
(I  t )u3 ( x )  u 2 ( x )
2

This leads to a large but sparse linear system.

14
The 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.

15
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Explicitly Enforcing u=0
Since 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 outflux
u<0 decreased pressure and subsequent influx

Relaxation algorithm
1. Correct the pressure in a cell
2. Update velocities
3. Repeat for all cells until each has u<ε

16
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Solving for pressure
Another 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.
 ( n 1) ~ ( n )
du u u 1
   p ( n 1) Discretize in time
dt t 
( n 1) ~ ( n ) t Rearrange terms
u  u  p ( n 1)

( n 1) ~ t 2 ( n 1)
 u   u   p
(n)
0 Satisfy continuity eq.

17
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Solving for pressure
We end up with the Poisson equation for pressure.


 p
2 ( n 1)
   u~ ( n )
t
This is another sparse linear system. These types of
equations can be solved using iterative methods.
Use pressures to update final velocities.

( n 1) ~ ( n ) t
u  u  p ( n 1)

18
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Projection Method
The Helmholtz-Hodge Decomposition Theorem states
that any vector field can be decomposed as:
 
w  u  q
where u is divergence free and q is a scalar field
defined implicitly as:

  w  2q
We can define an operator P that projects a vector field
onto its divergence free part:
  
u  w  w   q

19
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Projection Method
Applying P to both sides of the momentum equation
yields a single equation only in terms of u:
 
du   2
 P( (u  )u   u  f )
dt
Thus for the last step :
 ~
  u~   2 q u  u  q
Look familiar? The scalar field q is actually related to
pressure!
 ( n 1) ~ ( n ) t
 p
2 ( n 1)
   u~ ( n ) u  u  p ( n 1)
t 
20
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
The Bottom Line

All three methods are equivalent!

21
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Boundary Conditions
• No slip: Set velocity to 0 on the boundary.
Good for obstacles.
• Free slip: Set only the velocity in the direction
normal to the boundary to zero. Good for
setting up a plane of symmetry.
• Inflow: Specified positive normal velocity.
Good for sources.
• Outflow: Specified negative normal velocity.
Good for sinks.
• Periodic: Copy the last row and column of cells
to first row and column. Good for simulating
an infinite domain.

22
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Staggered Grid
The staggered grid provides velocities
immediately at cell boundaries, is
pi , j 1
convenient for finite differences,
and avoids oscillations.
vi , j  1 Consider problem of a 2D fluid at rest
2

with no external forces. The


ui  1 , j ui  1 , j
2 2 continuous solution is:
pi 1, j pi , j pi 1, j
u0 v0 p  constant
vi , j  1 On a discretized non-staggered grid
2

you can have:


pi , j 1 ui , j  0 vi , j  0
pi , j  P1 for i  j even, P2 for i  j odd

23
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Tracking the Free Surface
The movement of the free surface is not
explicit in the Navier-Stokes
equations.

Three methods for tracking the free


surface:
1. Marker and cell (MAC) method
2. Front tracking
3. Particle level set method

24
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
MAC
Due to [Harlow and Welch 1965].
Track massless marker particles to determine
where the free surface is located.
Markers are transported according to the
velocity field.
Cells with markers are fluid cells. Fluid cells
bordering empty cells are surface cells.
There are boundary conditions that must be
satisfied at the surface.
Extended by [Chen et al. 1997] to track
particles only near the surface.

25
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
MAC

Image from [Griebel 1998].

Problems:
• Can lead to mass dissipation, especially with stable
fluid style advection.
• No straight forward way to extract a smooth surface.

26
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Front Tracking
Proposed by [Foster and Fedkiw 2001]
Front tracking uses a combination of a level set and
particles to track the surface.
The particles are used to define an implicit function. An
isocontour of this function represents the liquid surface.

The isocontour yields a smoother surface than particles


alone.

27
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Front Tracking
Using the level set method, the isocontour can
be evolved directly over time by using the
fluid velocities.

Particles and level set evolution have


complementary strengths and weaknesses
­ Level set evolution suffers volume loss
­ Particles can cause visual artifacts
­ Level sets are always smooth.
­ Particles retain details.

28
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Front Tracking
Combine the two techniques by giving particles more
weight in areas of high curvature. Particles escaping
the level set are rendered directly as splashing
droplets.

29
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Particle Level Set Method
Presented by [Enright et al
2002].
Implicit surface loses detail
on coarse grids.
Particles keep the surface
from crossing them but
can’t keep it from drifting
away.
Add particles to both side of
the implicit surface.
Escaped particles indicate
the location of errors in
the implicit surface so it
can be rebuilt.

30
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Particle Level Set Method
Extrapolated velocities at the surface give
more realistic motion.

31
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
References
CHEN, J., AND LOBO, N. 1994. Toward interactive-rate simulation of fluids with moving
obstacles using the navier-stokes equations. Computer Graphics and Image
Processing, 107–116.
CHEN, S., JOHNSON, D., RAAD, P. AND FADDA, D. 1997. The surface marker and
micro cell method. International Journal of Numerical Methods in Fluids, 25, 749-778.
FOSTER, N., AND METAXAS, D. 1996. Realistic animation of liquids. Graphical Models
and Image Processing, 471–483.
FOSTER, N., AND FEDKIW, R. 2001. Practical animation of liquids. In Proceedings of
SIGGRAPH 2001, 23–30.
GRIEBEL, M., DORNSEIFER, T., AND NEUNHOEFFER, T. 1998. Numerical Simulation
in Fluid Dynamics: A Practical Introduction . SIAM Monographs on Mathematical
Modeling and Computation. SIAM
KASS, M., AND MILLER, G. 1990. Rapid, stable fluid dynamics for computer graphics.
In Computer Graphics (Proceedings of SIGGRAPH 90) , vol. 24, 49–57.
O’BRIEN, J., AND HODGINS, J. 1995. Dynamic simulation of splashing fluids. In
Proceedings of Computer Animation 95, 198–205.
STAM, J. 1999. Stable fluids. In Proceedings of SIGGRAPH 99, 121-128.

32
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

You might also like