You are on page 1of 15

Acknowledgement

This slide set is based on:


Computational Fluid Dynamics
An Introduction n John D. Anderson, Jr., “Computational Fluid Dynamics –
The Basics with Applications,” McGraw-Hill, Inc.,
New York, ISBN 0-07-001685-2
Simulation in Computer Graphics
University of Freiburg

WS 04/05

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Motivation Outline

n introduction
n pre-requisites
n governing equations
n continuity equation
n momentum equation
n summary
n solution techniques
D. Enright, S. Marschner, R. Fedkiw, n Lax-Wendroff
“Animation and Rendering of
n MacCormack
Complex Water Surfaces,”
Siggraph 2002, ACM TOG, n numerical aspects
vol. 21, pp. 736-744, 2002. n recent research in graphics

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•1
Introduction Numerical Solution - Overview

n physical aspects of fluid flow are governed by


three principles
n mass is conserved System of
Governing Equation Approx.
n force = mass × acceleration (Newton’s second law) Discretization Algebraic
Equations Solver Solution
n energy is conserved (not considered in this lecture) Equations
n principles can be described with integral equations or
partial differential equations
Navier-Stokes Finite Discrete Lax-Wendroff
n in CFD, these governing equations are replaced by
Euler Difference Nodal MacCormack
discretized algebraic forms Values
n algebraic forms provide quantities at discrete points
in time and space, no closed-form analytical solution

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Continuous Quantities Problem

n x, y, z – 3D coordinate system
n t – time

n ρ ( x,y,z,t ) – density
n v ( x,y,z,t ) – velocity

n v ( x,y,z,t ) = (u ( x,y,z,t ), v ( x,y,z,t ), w ( x,y,z,t ) )T

v (x,y,z,t ) v (x,y,z,t+∆t )
ρ (x,y,z,t ) ρ (x,y,z,t+∆t )
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•2
Outline Substantial Derivative of ρ

n introduction n infinitesimally small fluid element moving with the flow


n pre-requisites
n governing equations n ( x1,y1,z1 ) – position at time t1
n continuity equation n ( x2,y2,z2 ) – position at time t2
n momentum equation
n summary
n v1(x1,y1,z1,t1) = (u (x1,y1,z1,t1 ),v (x1,y1,z1,t1 ),w (x1,y1,z1,t1 ))T
n solution techniques
n v2(x2,y2,z2,t2) = (u (x2,y2,z2,t2 ),v (x2,y2,z2,t2 ),w (x2,y2,z2,t2 ))T
n Lax-Wendroff
n MacCormack
n numerical aspects n ρ1 ( x1,y1,z1,t1 )
n recent research in graphics n ρ2 ( x2,y2,z2,t2 )

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Substantial Derivative of ρ Substantial Derivative

n Taylor series at point 1 n substantial derivative of ρ


 ∂ρ   ∂ρ   ∂ρ   ∂ρ  Dρ ∂ρ ∂ρ ∂ρ ∂ρ
ρ2 = ρ1 +   ( x 2 − x1 ) +   ( y 2 − y 1 ) +   (z 2 − z 1 ) +   (t2 − t1 ) ≡u +v +w +
 ∂x  1  ∂y 1  ∂ z 1  ∂ t 1 Dt ∂x ∂y ∂z ∂t

n substantial derivative = local derivative + convective derivative
ρ 2 − ρ 1  ∂ ρ  x 2 − x1  ∂ ρ  y 2 − y1  ∂ ρ  z 2 − z 1  ∂ ρ 
=  +   +  +  T
t2 − t1  ∂ x  1 t 2 − t1  ∂ y 1 t 2 − t1  ∂ z  1 t 2 − t1  ∂ t  1 D ∂  ∂ ∂ ∂ 
≡ + (v ⋅∇) ∇ =  , , 
t2 → t1 Dt ∂t  ∂x ∂y ∂z 
ρ 2 − ρ 1  ∂ρ   ∂ρ   ∂ρ   ∂ρ  local derivative – time rate of change at a fixed location
=  u +   v +   w +  n
t2 − t1  ∂ x 1  ∂y 1  ∂z  1  ∂t  1
n convective derivative – time rate of change due to fluid flow
n subst. derivative = total derivative with respect to time
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•3
Divergence of v Outline

n divergence of velocity v = time rate of change of the n introduction


volume δV of a moving fluid element per unit volume n pre-requisites
∂u ∂v ∂w 1 D (δ V ) n governing equations
∇⋅v = + + = continuity equation
∂x ∂y ∂z δV Dt n

n momentum equation
n summary
n solution techniques
n Lax-Wendroff
n MacCormack
n numerical aspects
n recent research in graphics

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Continuity Equation Continuity Equation

n mass is conserved
n infinitesimally small fluid element moving with the flow

n fixed mass δm, variable volume δV, variable density ρ + ρ∇ ⋅ v = 0
δm = ρ ⋅ δV Dt
n time rate of change of the mass of the moving fluid substantial derivative – divergence of velocity -
element is zero time rate of change of time rate of change of volume
D δm D (ρ ⋅ δ V ) Dρ D δV density of a moving of a moving fluid element per
= = δV +ρ =0 fluid element volume
Dt Dt Dt Dt
Dρ 1 D δV Dρ
+ρ =0 → + ρ∇ ⋅ v = 0
Dt δ V Dt Dt

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•4
Continuity Equation Continuity Equation

n non-conservation form (considers moving element) n motivation for conservation form


Dρ n infinitesimally small element at a fixed location
+ ρ∇ ⋅ v = 0 n mass flux through element
Dt
n difference of mass inflow and outflow = net mass flow
n manipulation n net mass flow = time rate of mass increase
Dρ ∂ρ ∂ρ
+ ρ∇ ⋅ v = + v ⋅ ∇ ρ + ρ∇ ⋅ v = + ∇ ⋅ (ρ v )
Dt ∂t ∂t
∂ρ
n conservation form (considers element at fixed location) + ∇ ⋅ (ρ v ) = 0
∂t
∂ρ
+ ∇ ⋅ (ρ v ) = 0
∂t time rate of mass net mass flow
increase per volume per volume

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Outline Momentum Equation

n introduction n consider a moving fluid element


n pre-requisites n physical principle: F = m⋅a (Newton’s second law)
n governing equations n two sources of forces
n continuity equation n body forces
n momentum equation n gravity

n summary n surface forces


n solution techniques n based on pressure distribution on the surface

n based on shear and normal stress distribution on the surface


n Lax-Wendroff
due to deformation of the fluid element friction
n MacCormack
n numerical aspects fluid pressure normal shear velocity
n recent research in graphics element stress stress
gravity velocity

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•5
Body Force Pressure Force

n f = body force per unit mass n consider the x component


n gravity: f = δm⋅g / δm = g n pressure force dz
→ body force on fluid element acts orthogonal
p dy dz ( p + ∂p/ ∂x dx ) dy dz
to surface into
ρ f (dx dy dz )
the fluid element dx
dy

dy
fluid
element n net pressure force in x direction
  ∂p  ∂p
dz  p −  p + ∂ dx   dy dz = − dx dy dz
  x  ∂x
dx

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Stress Stress

n normal stress – related to the time rate of change of volume n normal stress is related to pressure orthogonal to surface
n shear stress – related to the time rate of change n shear stress is related to friction parallel to surface
of the shearing deformation n friction and pressure are related to the velocity gradient
n τjk – stress in k direction applied to a surface perpendicular n friction (shear stress) models viscosity (viscous flow)
to the j axis n in contrast to inviscid flow, where friction is not considered
n τxx – normal stress in x direction
friction
n τzx , τyx – shear stresses in x directions
pressure normal shear velocity
τyx
stress stress
y
velocity
τxx

x
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•6
Surface Forces in x Momentum Equation in x
(τyx + ∂ τyx / ∂y dy) dx dz

dz
m a x = Fx
p dy dz ( p + ∂p/ ∂x dx ) dy dz
Du  ∂p ∂τ xx ∂τ yx ∂τ zx 
τxx dy dz (τxx + ∂ τxx / ∂x dx) dy dz ρ dx dy dz = − + + +  dx dy dz + ρ f x dx dy dz
dx Dt  ∂x ∂x ∂y ∂z 
dy
τyx dx dz τzx not illustrated mass acceleration surface force body force
  ∂p   ∂τ   time rate of change pressure gravity
Fx =  p −  p + dx  dy dz + τ xx + xx dx  − τ xx  dy dz
  ∂ x   ∂x   of velocity of a normal stress
 ∂τ    ∂τ  moving fluid element shear stress

+ τ yx + yx dy  − τ yx  dx dz + τ zx + zx dz  − τ zx  dy dz
 ∂y    ∂z  
Du ∂p ∂τ ∂τ yx ∂τ zx
ρ = − + xx + + + ρ fx
 ∂p ∂τ xx ∂τ yx ∂τ zx  Dt ∂x ∂x ∂y ∂z
Fx =  − + + +  dx dy dz
 ∂x ∂x ∂y ∂z 

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Momentum Equation Momentum Equation in x

n viscous flow, non-conversation form n obtaining the conservation form of Navier-Stokes


n Navier-Stokes equations Du ∂u
ρ =ρ + ρ v ⋅ ∇u
∂τ yx ∂τ zx ∂t
Du ∂p ∂τ Dt
ρ = − + xx + + + ρ fx
Dt ∂x ∂x ∂y ∂z ∂( ρu) ∂u ∂ρ ∂u ∂ρ ∂(ρ u)
=ρ +u ρ =u −
∂t ∂t ∂t ∂t ∂t ∂t
Dv ∂p ∂τ xy ∂τ yy ∂τ zy ∇ ⋅ (ρ u v ) = u ∇ ⋅ ( ρ v) + ( ρ v )∇ u (ρ v ) ∇u = ∇ ⋅ ( ρ u v) − u ∇ ⋅ ( ρ v)
ρ =− + + + + ρ fy
Dt ∂y ∂x ∂y ∂z
Du ∂( ρu)  ∂ρ  Du ∂ ( ρu )
ρ = − u  + ∇ ⋅ (ρ v) + ∇ ⋅ (ρ u v ) ρ = + ∇ ⋅ (ρ u v )
Dw ∂p ∂τ ∂τ yz ∂τ zz Dt ∂t  ∂t  Dt ∂t
ρ = − + xz + + + ρ fz continuity equation
Dt ∂z ∂x ∂y ∂z

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•7
Momentum Equation Newtonian Fluids

n Navier-Stokes equations in conservation form n Newton: shear stress in a fluid is proportional


to velocity gradients
∂(ρ u ) ∂p ∂τ ∂τ yx ∂τ zx most fluids can be assumed to be newtonian,
+ ∇ ⋅ ( ρ u v ) = − + xx +
n
+ + ρ fx
∂t ∂x ∂x ∂y ∂z but blood is a popular non-newtonian fluid
n Stokes:
∂(ρ v ) ∂p ∂τ xy ∂τ yy ∂τ zy
+ ∇ ⋅ (ρ v v) = − + + + + ρ fy τ xx = λ (∇ ⋅ v ) + 2 µ
∂u
τ yy = λ (∇ ⋅ v ) + 2 µ
∂v
τ zz = λ (∇ ⋅ v ) + 2µ
∂w
∂t ∂y ∂x ∂y ∂z ∂x ∂y ∂z

∂(ρ w ) ∂p ∂τ ∂τ yz ∂τ zz  ∂v ∂u   ∂u ∂w   ∂w ∂v 
τ xy = τ yx = µ  +  τ xz = τ zx = µ  + τ yz = τ zy = µ  + 
+ ∇ ⋅ (ρ w v ) = − + xz + + + ρ fz  ∂x ∂y 

 ∂z ∂x   ∂y ∂z 
∂t ∂z ∂x ∂y ∂z
n µ is the molecular viscosity coefficient
n λ is the second viscosity coefficient with λ = -2/3 ⋅ µ
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Perfect Gas Momentum Equation in x

intermolecular forces are negligible


∂(ρ u ) ∂τ yx ∂τ zx
n
∂p ∂τ
R – specific gas constant + ∇ ⋅ (ρ u v ) = − + xx + + + ρ fx
∂t ∂x ∂x ∂y ∂z
n

n T – temperature
n termal equation of state p = ρ R T n now,
p can be expressed using density and
τ can be expressed using velocity gradients,
fx is user-defined (e. g. gravity)

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•8
Governing Equations –
Outline
Viscous Compressible Flow
n introduction n thus, four equations and four unknowns ρ, u, v, w
pre-requisites ∂ρ
+ ∇ ⋅ (ρ v ) = 0
n
continuity equation
n governing equations ∂t
n continuity equation
∂(ρ u ) ∂p ∂τ ∂τ yx ∂τ zx
n momentum equation
+ ∇ ⋅ ( ρ u v ) = − + xx + + + ρ fx
∂t ∂x ∂x ∂y ∂z

momentum equation
n summary
n solution techniques
∂ (ρ v ) ∂p ∂τ xy ∂τ yy ∂τ zy
n Lax-Wendroff + ∇ ⋅ (ρ v v) = − + + + + ρ fy
n MacCormack ∂t ∂y ∂x ∂y ∂z
n numerical aspects
∂(ρ w ) ∂p ∂τ ∂τ yz ∂τ zz
n recent research in graphics + ∇ ⋅ (ρ w v ) = − + xz + + + ρ fz
∂t ∂z ∂x ∂y ∂z
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Governing Equations – Comments


Inviscid Compressible Flow on the Governing Equations
n Euler equations n coupled system of nonlinear partial differential equations
∂ρ normal and shear stress terms are functions of the
+ ∇ ⋅ (ρ v ) = 0
n
continuity equation
∂t velocity gradients
n pressure is a function of the density
∂(ρ u ) ∂p
+ ∇ ⋅ (ρ u v ) = − + ρ f x n only momentum equations are Navier-Stokes equations,
∂t ∂x however the name is commonly used for the full set
momentum equation

of governing equations (plus energy equation)


∂(ρ v ) ∂p
+ ∇ ⋅ (ρ v v ) = − + ρ f y
∂t ∂y

∂(ρ w ) ∂p
+ ∇ ⋅ (ρ w v ) = − + ρ f z
∂t ∂z
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•9
Governing Equations in
Generic Form
Conservation Form
n can be obtained directly from a control volume fixed in n viscous flow
space  ρ   ρu   ?v   ?w   0 
         
n consider flux of mass, momentum (and energy) into and ρu
U= 
F=
ρ u u + p − τ xx   ? u v − t yx 
G =

H =
? u w − t zx 
J =
 ? fx 
   ? v w + p − t zy  ? f 
out of the volume 
ρv
 
ρ v u − τ xy
 
? v v + p − t yy
    y
 ρ w  ρ w u −τ   ? wv − t   ? ww + p − t  ? f 
n have a divergence term which involves the flux of    xz   yz   zz   z
mass (ρv), momentum in x, y, z (ρu v, ρv v, ρw v)
n inviscid flow
n can be expressed in a generic form
 ρ   ρu   ?v   ?w   0 
         
ρu  ρ uu + p  ?u v   ?u w   ? fx 
∂U ∂F ∂G ∂H U= F = = H = J =
+ + + =J ρv  ρ vu  ?v w + p 
G  ?v v + p ? f 
         y
∂t ∂x ∂y ∂z  ρ w  ρ wu   ?w w + p ? f 
     ?w v     z

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Motivation for Different Forms


Generic Form
of the Governing Equations
n U – solution vector (to be solved for) n in many real-world problems, discontinuous changes in
n F, G, H – flux vectors the flow-field variables ρ, v occur (shocks, shock waves)
n J – source vector (external forces, energy changes) n problem: differential form of the governing equations
∂U ∂F ∂G ∂H
assumes differentiable (continuous) flow properties
=J− + + simple 1-D shock wave: ρ1 u1 = ρ2 u2
∂t ∂x ∂y ∂z n

n dependent flow field variables can be solved progressively ρ u ρu


in steps of time (time-marching )
n spatial derivatives are know from previous time steps
x x x
n numbers can be obtained for density ρ and flux variables
ρu, ρv, ρw n conservation form solves for ρu, sees no discontinuity
n positive effect on numerical accuracy and stability
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•10
Outline Lax-Wendroff Technique

n introduction n flow-field variables ρ, u, v, w are known at each discrete


n pre-requisites spatial position ( x, y, z ) at time t
n governing equations n Lax-Wendroff computes all information at time t +∆t
n continuity equation n second-order accuracy in space and time
n momentum equation
n summary n explicit, finite-difference method
n solution techniques
n particularly suited to marching solutions
n Lax-Wendroff
n marching suited to hyperbolic, parabolic PDEs
n MacCormack
n numerical aspects n unsteady (time-dependent), compressible flow
n recent research in graphics is governed by hyperbolic PDEs

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Lax-Wendroff
Taylor Series Expansions
Example
n 2D, inviscid flow, no body force, in non-conservation form n ρti,j – density at position (i, j ) and time t
n ρti,j , u ti,j , v ti,j are known

 (∆ t )2
t
 ∂ρ   ∂2ρ
t
∂ρ  ∂u ∂ρ ∂v ∂ρ 
= −  ρ +u +ρ +v  ρ it,+j ∆ t = ρ it, j +   ∆ t +   + ...
∂t ∂ ∂ ∂ ∂ y   ∂t i , j  ∂t
2
 x x y  i, j 2
∂u  ∂u ∂u R T ∂ρ 
 (∆ t )
t
 ∂u   ∂ 2u
t 2
= −  u +v + 
∂t  ∂x ∂y ρ ∂x 
u it ,+j ∆ t = u it, j +   ∆ t +  2  + ...
 ∂t i , j  ∂t i , j 2
∂v  ∂v ∂v R T ∂ρ 
= −  u +v +   ∂ 2 v  (∆ t )2
t
ρ ∂ y   ∂v 
t
∂t  ∂ x ∂y v it,+j ∆ t = v it, j +   ∆ t +  2  + ...
 ∂ t i , j  ∂t  i, j 2
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•11
Taylor Expansion - Density Taylor Expansion - Density
 (∆ t )
t
 ∂ρ   ∂ 2ρ
t 2

ρ it,+j ∆ t = ρ it, j +   ∆ t +  2  + ... n ∂2ρ/∂t 2 can be obtained by differentiating the governing


 ∂ t  i, j  ∂t  i, j 2 equation with respect to time
n ∂ρ/∂t can be replaced by spatial derivatives  ∂ 2u
∂2ρ ∂u ∂ ρ ∂ 2 ρ ∂ ρ ∂u ∂2v ∂v ∂ρ ∂ 2 ρ ∂ρ ∂v 
given in the governing equations = −  ρ + +u + +ρ + +v + 
∂t 2  ∂x ∂t ∂x ∂t ∂x ∂ t ∂x ∂t ∂y ∂t ∂y ∂t ∂ y ∂ t ∂ y ∂ t 

∂ρ  ∂u ∂ρ ∂v ∂ρ 
= −  ρ +u +ρ +v  n mixed second derivatives can be obtained by differentiating
∂t  ∂x ∂x ∂y ∂y  the governing equations with respect to a spatial variable,
using second-order central differences e. g.
n 2
∂ u 2
 ∂ u  ∂u 
2 2
∂ u
2
∂ u ∂v R T  ∂ ρ 
2
R T ∂ ρ 
= −u + +v + − 2   +
∂ x ∂t  ∂ x 2  ∂ x  ∂ x ∂ y ∂ y ∂ x ρ  ∂ x  ρ ∂ x 2 
 t u it+ 1, j − u it −1, j ρt − ρ it− 1, j − vit −1, j ρt − ρ it− 1, j  
 ∂ρ 
t
vt
  = −  ρ i , j + u it, j i + 1, j + ρ it, j i + 1, j + v it, j i + 1, j 

 ∂t  i , j  2 ∆x 2∆ x 2 ∆y 2∆ y  n brackets missing on pp. 219, 220 in Anderson’s book!

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Taylor Expansion - Density Outline

n → ∂2ρ/∂t 2 can be computed using central differences for n introduction


spatial derivatives n pre-requisites
n higher-order terms are required, e. g. n governing equations
t continuity equation
∂ u − 2u + u
t t t n
2
u i +1, j i −1, j
 2  = i, j
momentum equation
(∆x )
n

 ∂ x  i, j
2
n summary

t
n solution techniques
 ∂ 2u  ut + ut − ut − ut Lax-Wendroff
  = i+1, j +1 i −1, j−1 i −1, j +1 i +1, j −1 n

 ∂x∂y i, j 4∆x∆y n MacCormack


n numerical aspects
n ... u, v are computed in the same way n recent research in graphics

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•12
MacCormack Technique MacCormack Technique

n same characteristics like Lax-Wendroff n predictor step for density


n second-order accuracy in space and time  ∂ρ 
t
 t u it +1 , j − u it−1 , j ρt − ρ it−1, j vt − v it− 1, j ρt − ρ it− 1, j 
  = −  ρ i , j + u it, j i + 1, j + ρ it, j i + 1, j + v it, j i + 1, j 

n requires only first time derivative  ∂ t i, j  2 ∆ x 2 ∆ x 2 ∆ y 2 ∆y 
n predictor – corrector  ∂ρ 
t

ρ it,+j ∆ t = ρ it, j +   ∆t
n illustrated for density  ∂ t i , j

av
 ∂ρ 
ρ it,+j ∆ t = ρ it, j +   ∆t n u, v are predicted the same way
 ∂t  i, j
 ∂u   ∂v 
t t

u it, +j ∆ t = u ti , j +   ∆t v it,+j ∆ t = vit, j +   ∆t


 ∂t  i , j  ∂ t i, j

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

MacCormack Technique Comments

n corrector step for density n Lax-Wendroff and MacCormack can be used for
 ∂ρ 
t + ∆t
 u t + ∆t
−u t + ∆t
ρ t + ∆t
−ρ t+∆ t
v t+∆ t
−v t + ∆t
ρ t + ∆t
−ρ t + ∆t
 unsteady flow
  = −  ρ it,+j ∆ t
i +1 , j i −1 , j
+ u it,+j ∆ t
i +1 , j i −1 , j
+ ρ it,+j ∆ t
i +1 , j i −1 , j
+ v it,+j ∆ t
i +1 , j i − 1, j

 ∂t 
 i , j 2∆ x 2∆x 2∆ y 2∆ y  n non-conservation form
 
n conservation form
1  ∂ ρ  
t + ∆t
 ∂ρ   ∂ρ 
av t

ρ it,+j ∆ t = ρ it, j +   ∆ t = ρ i, j + 
t
 +   ∆t n viscous flow
 ∂  i, j   ∂  i , j  ∂t 
t 2 t  i , j  n inviscid flow
n higher-order accuracy required to avoid numerical
n corresponds to Heun scheme for ODEs dissipation, artificial viscosity, numerical dispersion
n other higher-order schemes, e. g. Runge-Kutta 2 or 4, n note, that viscosity is represented by second partial
could be used as well derivatives in the governing equations

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•13
Outline Numerical Effects

n introduction n truncation error causes dissipation and dispersion


n pre-requisites n numerical dissipation is caused by even-order terms
n governing equations of the truncation error
n continuity equation n numerical dispersion is caused by odd-order terms
n momentum equation n leading term in the truncation error dominates the
n summary behavior
n solution techniques
u u u
n Lax-Wendroff
n MacCormack
n numerical aspects x x x
n recent research in graphics original function dissipation dispersion

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

Numerical Effects Summary

n artificial viscosity compromises the accuracy, but n governing equations for compressible flow
improves the stability of the solution n continuity equation, momentum equation
n adding artificial viscosity increases the probability of n Navier-Stokes (viscous flow) and Euler (inviscid flow)
making the solution less accurate, but improves n discussion of conservation and non-conservation form
the stability n explicit time-marching techniques
n similar to iterative solution schemes for implicit integration n Lax-Wendroff
schemes, where a smaller number of iterations introduces n MacCormack
“artificial viscosity”, but improves the stability n numerical aspects
n recent research in graphics

University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•14
Recent Research Recent Research

M. Carlson, P. J. Mucha, G. Turk, “Rigid Fluid: Animating the T. G. Goktekin, A. W. Bargteil, J. F. O’Brien,
Interplay Between Rigid Bodies and Fluid,” Siggraph 2004. “A Method for Animating Viscoelastic Fluids,” Siggraph 2004.
University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory University of Freiburg - Institute of Computer Science - Computer Graphics Laboratory

•15

You might also like