Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
78 views

The Advection-Diffusion equation!: ∂u ∂t + u ∂u ∂x + v ∂u ∂y = − 1 ρ ∂P ∂x + µ ρ ∂ ∂x + ∂ ∂y ⎛ ⎝ ⎜ ⎞ ⎠ ⎟

The document discusses computational fluid dynamics (CFD) and the numerical solution of the advection-diffusion equation. It contains the following key points: 1) The Navier-Stokes equations that describe fluid flow contain parabolic, hyperbolic, and elliptic parts that have different characteristic behaviors and require different solution techniques. 2) The advection-diffusion equation models processes with both advection and diffusion. It is used to numerically solve transport problems in CFD. 3) Common numerical methods for solving the advection-diffusion equation include forward-time centered-space (FTCS), upwind differencing, Lax-Wendroff, and Crank-N

Uploaded by

Ernesto Lima
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

The Advection-Diffusion equation!: ∂u ∂t + u ∂u ∂x + v ∂u ∂y = − 1 ρ ∂P ∂x + µ ρ ∂ ∂x + ∂ ∂y ⎛ ⎝ ⎜ ⎞ ⎠ ⎟

The document discusses computational fluid dynamics (CFD) and the numerical solution of the advection-diffusion equation. It contains the following key points: 1) The Navier-Stokes equations that describe fluid flow contain parabolic, hyperbolic, and elliptic parts that have different characteristic behaviors and require different solution techniques. 2) The advection-diffusion equation models processes with both advection and diffusion. It is used to numerically solve transport problems in CFD. 3) Common numerical methods for solving the advection-diffusion equation include forward-time centered-space (FTCS), upwind differencing, Lax-Wendroff, and Crank-N

Uploaded by

Ernesto Lima
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Computational Fluid Dynamics

Computational Fluid Dynamics



http://www.nd.edu/~gtryggva/CFD-Course/! Summary!
Navier-Stokes equations!
Parabolic part!

The Advection-Diffusion ∂u ∂u ∂u
+ u +v =−
1 ∂P µ ⎛⎜ ∂ 2 u ∂ 2 u ⎟⎞
+ +
∂t ∂x ∂y ρ ∂x ρ ⎝ ∂x 2 ∂y 2 ⎠
equation!
Hyperbolic part!
The Navier-Stokes equations contain three equation types
that have their own characteristic behavior!

∂u ∂v
+ =0 Depending on the governing parameters, one behavior can
∂x ∂y be dominant!

Grétar Tryggvason ! The different equation types require different solution


Elliptic equation! techniques!
Spring 2013!
For inviscid compressible flows, only the hyperbolic part
survives!

Computational Fluid Dynamics


Computational Fluid Dynamics

1D Advection/diffusion equation! ∂f ∂f ∂2 f
∂f ∂f ∂2 f +U = D 2
+U = D 2 ∂t ∂x ∂x
∂t ∂x ∂x
Forward in time/centered in space (FTCS)! FTCS! O(Δt,h 2 ) UΔt
≤1 &
DΔt 1

f jn +1 − f jn f n − f j−1
n
f n − 2 f jn + f j−1
n 2D h2 2
+ U j +1 = D j +1
Δt 2h h 2
O(Δt,h ) UΔt DΔt
Upwind! + 2 2 ≤1
Stability limits! UL h h
UΔt DΔt 1 R=
≤1 & ≤
O(Δt 2 ,h 2 ) ⎛ UΔt ⎞ 2 ⎛ DΔt ⎞
2D h2 2 D
L-W! ⎜ ⎟ ≤ 2⎜ 2 ⎟ ≤ 1
2D h2 ⎝ h ⎠ ⎝ h ⎠
Δt = & Δt =
U 2D
C-N! O(Δt 2 ,h 2 ) Unconditionally stable!
Δt → 0 For high and low D!

Computational Fluid Dynamics


Computational Fluid Dynamics

Steady state solution to the advection/diffusion equation!


1

∂f ∂2f
=D 2
0.9
U
∂x ∂x 0.8

RL=1! 0.7

U RL=5!
f =0 f =1
0.6

RL=10! 0.5

RL=20! 0.4
L
0.3

0.2
Exact solution!
0.1

exp( RL x / L) − 1 UL
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
f = RL =
exp( RL ) − 1 D
Computational Fluid Dynamics
Computational Fluid Dynamics

Numerical solution of:!

∂f ∂2 f
U =D 2
∂x ∂x
The Cell Reynolds Centered difference approximation!

number! f j +1 − f j−1 f − 2 f j + f j−1


U = D j +1
2h h2
Upwind!
f j − f j−1 f j +1 − 2 f j + f j−1
U =D
h h2

Computational Fluid Dynamics


Computational Fluid Dynamics

Centered difference approximation!


fj +1 − f j −1 f j +1 − 2 f j + f j −1
( R − 2) f j +1 + 4 f j − ( R + 2) f j −1 = 0
U =D
2h h2
Solution!
Rearrange:! fj = q j
2
Uh
( f − f j −1 ) = f j +1 − 2 f j + f j −1
2hD j +1 Substitute:!

Rearrange:!
( R − 2)q j +1 + 4q j − ( R + 2)q j −1 = 0
( R − 2) f j +1 + 4 f j − ( R + 2) f j −1 = 0 Divide by !q
j −1

Where:! R =
Uh ( R − 2)q2 + 4q1 − ( R + 2 ) = 0
D

Computational Fluid Dynamics


Computational Fluid Dynamics

( R − 2)q2 + 4q1 − ( R + 2 ) = 0 Apply the boundary conditions!

⎛ 2 + R⎞
0
Solving for q gives two solutions:! f 0 = C1 + C2 = C1 + C2 = 0
⎝ 2 − R⎠
2+R
q1 = 1 and! q2 = ⎛ 2 + R⎞
N
2− R f N = C1 + C2 =1
⎝ 2 − R⎠
The general solution is:!
The final solution is:!
f j = C1 q1 + C2 q2
j j
⎛ 2 + R⎞
j

−1
⎝ ⎠
f j = 2 − R N +1
or!
⎛ 2 + R⎞
j

f j = C1 + C2 ⎛ 2 + R⎞
⎝ 2 − R⎠ −1
⎝ 2 − R⎠
Computational Fluid Dynamics
Computational Fluid Dynamics

Upwind! Exact solution!


f j − f j−1 f − 2 f j + f j−1
U = D j +1 exp( RL x / L) − 1 UL
f = RL =
h h2 exp( RL ) − 1 D
or!
(R + 2) f j − (R + 1) f j−1 − f j +1 = 0 Uh Centered differences!
R=
Try solutions! fj =qj D ⎛ 2 + R⎞
j

⎝ ⎠ −1
f j = 2 − R N +1
⎛ 2 + R⎞
giving! −1
⎝ 2 − R⎠
q 2 − ( R + 2)q1 + ( R + 1) = 0 R=
Uh
Upwind! D
Solution! 1− (1+ R)
j

1− (1+ R)
j
fj =
fj = 1− (1+ R)
N

1− (1+ R)
N

Computational Fluid Dynamics


Computational Fluid Dynamics

Upwind! Upwind!
Exact! Exact!
Centered! Centered!

Computational Fluid Dynamics


Computational Fluid Dynamics

Upwind!
When centered differencing is used for the
Exact! advection/diffusion equation, oscillations may
Centered! appear when the Cell Reynolds number is
higher than 2. For upwinding, no oscillations
appear. In most cases the oscillations are
small and the cell Reynolds number is
frequently allowed to be higher than 2 with
relatively minor effects on the result.!

Uh
R= <2
D
Computational Fluid Dynamics
Computational Fluid Dynamics

2D example! Recell=3.2258!

∂f ∂f ∂f ⎛∂ 2 f ∂ 2 f ⎞
+U + V = D⎜ 2 + 2 ⎟ D=0.02!
∂t ∂x ∂y ⎝ ∂x ∂y ⎠ t=1.5088!

f =0

Flow! Computations
f =1 using centered
differences on a
32 by 32 grid!
f =0

Computational Fluid Dynamics


Computational Fluid Dynamics

Recell=6.4516! Recell=12.9032!
D=0.005!
D=0.01! t=1.5088!
t=1.5088!

Computational Fluid Dynamics


Computational Fluid Dynamics

D=0.02!
t=1.50!

Fine grid! Coarser grid!

1.5
Recell=3.2258!
1.5
Recell=6.6716! Stability in !
1
1
terms of Fluxes!
0.5
0.5

0
0
30
25 15
30
20 25 15
15 20 10
10 15 10
5 10 5
5 5
0 0
0 0
Computational Fluid Dynamics
Computational Fluid Dynamics

Stability in terms of fluxes! Stability in terms of fluxes!

Consider the following initial conditions:! U =1 Consider the following initial conditions:!
f j −1 f j f j +1
Δt Fj −1 / 2 = Uf jn−1 = U
1 = 1.5⋅ U = 1.5
h Fj +1 / 2 = Uf jn = 0
1
f j −1 fi fi+1
Fj +1 / 2 = Uf jn = 0
Fj −1 / 2 = Uf jn−1 = 1
Δt n
f jn+1 = fjn − (F − Fjn−1 / 2 ) = 0 − 1.5(0 −1) = 1.5
During one time step, U∆t of f flows into cell j, h j +1 / 2
increasing the average value of f by U∆t/h.!

Computational Fluid Dynamics


Computational Fluid Dynamics

Stability in terms of fluxes! Stability in terms of fluxes!

Fj +1 / 2 = Uf jn = 0.75U
Fj −1 / 2 = Uf jn−1 = U Fj +1 / 2 = Uf jn = 1.5U Fj +1 / 2 = Uf jn = 2.25U
Fj −1 / 2 = Uf jn−1 = U

1 1
f j −1 f j f j +1 f j −1 f j f j +1

Δt n
f jn+1 = fjn − (F − Fjn−1 / 2 ) = 0 − 1.5(1.5 − 1) = 0.75
h j +1 / 2
Δt n Taking a third step will result in an even larger positive value,
f jn+1
+1 = fjn+1 − (F − Fjn+1/ 2 ) = 0 −1.5(0 −1.5) = 2.25
h j + 3/ 2 and so on until the compute encounters a NaN (Not a Number).!

Computational Fluid Dynamics


Computational Fluid Dynamics

Stability in terms of fluxes! Stability in terms of fluxes!

MOVIE FROM MATLAB!


If U∆t/h > 1, the average value of f in cell j will be % one-dimensional advection by first order upwind.!
larger than in cell j-1. In the next step, f will flow out n=80; nstep=100; dt=0.0125; length=2.0;!
of cell j in both directions, creating a larger negative h=length/(n-1);y=zeros(n,1);f=zeros(n,1);f(1)=1.0;!
value of f. Taking a third step will result in an even for m=1:nstep,m!
larger positive value, and so on until the compute hold off, plot(f); axis([1, n, -0.5, 1.5]);!
encounters a NaN (Not a Number).! pause(0.01);!
y=f;!
for i=2:n-1,!
f(i)=y(i)-(dt/h)*(y(i)-y(i-1)); %upwind!
end;!
end;!
Computational Fluid Dynamics
Computational Fluid Dynamics

Stability in terms of fluxes!

By considering the fluxes, it is easy to see why the


centered difference approximation is always unstable.!

Consider the following initial conditions:!


U U
Advection by
Fj −1/ 2 = ( f jn−1 + f jn ) = 1.0 Fj +1/ 2 = ( f jn + f jn+1) = 0.5
2 2 Higher Order
1
f j −1 f j f j +1 Methods!
Δt n
f jn+1 = f jn − (F − Fjn−1/ 2 ) = 1.0 − 0.5(0.5 − 1) = 1.25
h j +1/ 2
So cell j will overflow immediately!!

Computational Fluid Dynamics


Computational Fluid Dynamics

s=5/2! Use to solve:!


For the advection terms, the methods s=1! s=2! s=3! s=4! ∂f 1 ∂f 2 ∂2 f
+ =D 2
described for hyperbolic equations, including f1! f2! f3! f4! ∂t 2 ∂x ∂x
ENO, can all be applied, yielding stable and
robust methods that can be “forgiving” for At s = 5/2!
low resolution. ! f 5 / 2 = (1/8)[ 3 f 3 + 6 f 2 − f1]

QUICK, where a third order upstream


∂f 2 ⎞ 1 2
differencing is used is also popular.! ⎟ ≈ { f i+1/ 2 − f i−1/ 2 }
2

∂x ⎠ i h

=
1
64h
{
[3 f i+1 + 6 f i − f i−1 ] − [3 f i + 6 f i−1 − f i− 2 ]
2 2
}

Computational Fluid Dynamics


Computational Fluid Dynamics

∂f 1 ∂f 2 ∂2 f
+ =D 2
∂t 2 ∂x ∂x
∂f 1 ∂f 2 ∂2 f
+ =D 2
∂t 2 ∂x ∂x 10 10

9
Centered!
9

8 8

7 QUICK! 7

6
Upwind! 6

5 5

4 4
Centered! 3 3

QUICK! 2 2

Upwind! 1 1

0 0
0 5 10 15 20 25 30 35 40 0 5 10 15 20 25 30 35 40

Re_cell=10! Re_cell=20!
Computational Fluid Dynamics
Computational Fluid Dynamics

Second order ENO scheme for the linear advection equation! Second order ENO!
∂f ∂f ⎧ a, ∂f 1 ∂f 2 ∂2 f
+u =0 ⎪ a < b + =D 2
∂t ∂x amin ( a,b ) = ⎨ ∂t 2 ∂x ∂x
Δt ⎪⎩ b, b ≤ a
h
(
f j* = f jn − u nj f jn+1/2 − f jn−1/2 ) 10
Re_cell=20!

f jn +1 = f jn −
Δt 1 n n
h 2
( ( ) (
u j f j +1/2 − f jn−1/2 + u *j f j*+1/2 − f j*−1/2 )) 9

8
Centered!
7 QUICK! ENO!
Upwind!
( ) (u + u ) > 0
6

⎧ f + 1 amin Δf + , Δf − , if 1 Upwind!
⎪ j 2
5
j j 2 j j +1
f j +1/2 =⎨ 4


(
+ −
⎪ f j − 2 amin Δf j +1 , Δf j +1 , if
1
) 1
2(u + u ) < 0
j j +1
3

1
+ −
Δf = f j +1 − f j
j Δf = f j − f j −1
j
0
0 5 10 15 20 25 30 35 40

Computational Fluid Dynamics


Computational Fluid Dynamics

Second order ENO scheme for the linear advection equation!

∂f ∂f
+u =0
∂t ∂x
ENO!
Upwind!
Higher order!
in space!

Computational Fluid Dynamics


Computational Fluid Dynamics

Centered

Higher order finite difference approximations!
∂f ⎞ f j−2 − 8 f j−1 + 8 f j +1 − f j +2
⎟ = + O(h 4 )
The simplest approach is to use more points:! ∂x ⎠ j 12h
∂ 2 f ⎞ − f j−2 + 16 f j−1 − 30 f j + 16 f j +1 − f j +2
f(x-2h) f(x-h) f(x) f(x+h) f(x+2h) ! ⎟ = + O(h 4 )
∂x 2 ⎠ j 12h 2
h
h

Skewed

∂f ⎞ f j−2 − 6 f j−1 + 3 f j + 2 f j +1
⎟ = + O(h 3 )
∂x ⎠ j 6h
Computational Fluid Dynamics
Computational Fluid Dynamics

Compact Schemes!

The standard way to obtain higher order


approximations to derivatives is to include more
points. This can lead to very wide stencils and near
Compact schemes! boundaries this requires a large number of “ghost”
points outside the boundary. This can be overcome by
“compact” schemes, where we derive expressions
relating the derivatives at neighboring points to each
other and the function values.!

Computational Fluid Dynamics


Computational Fluid Dynamics

Compact Schemes! Compact Schemes!

By a Taylor series expansion the following forth order relations By a Taylor series expansion the following forth order relations
between the values of f and the derivatives of f can be derived! between the values of f and the derivatives of f can be derived!
∂ fi ∂ 2 fi Δx 2 ∂ f i
3
Δx 3 ∂ f i Δx 4
4
∂ fi ∂ 2 fi Δx 2 ∂ f i
3
Δx 3 ∂ f i Δx 4
4

f i+1 = f i + Δx + + 3 + + O(Δx 5 ) (1)! f i+1 = f i + Δx + + 3 + + O(Δx 5 ) (1)!


∂x ∂ x2 2 ∂x 6 ∂ x 4 24 ∂x ∂ x2 2 ∂x 6 ∂ x 4 24
∂ fi ∂ 2 fi Δx 2 ∂ f i
3
Δx ∂ f i Δx
3 4 4
∂ fi ∂ 2 fi Δx 2 ∂ f i
3
Δx ∂ f i Δx
3 4 4
f i−1 = f i − Δx + − 3 + + O(Δx 5 ) f i−1 = f i − Δx + − 3 + + O(Δx 5 )
∂x ∂ x2 2 ∂x 6 ∂ x 4 24 (2)! ∂x ∂ x2 2 ∂x 6 ∂ x 4 24 (2)!
Adding! Adding and taking the first derivative:!
Δx4 4
Δx
f i+1 + f i−1 = 2 f i + f i′′Δx 2 + f i iv + O(Δx 6 ) ′ + f i−1
f i+1 ′ = 2 f i′+ f i′′′Δx 2 + f i iv + O(Δx 6 )
12 12
Taking the second derivative:! (3)! Subtracting 2 from 1! (3)!
Δx 4 Δx 3
′′ + f i−1
f i+1 ′′ = 2 f i′′+ f i iv Δx 2 + f i vi + O(Δx 6 ) f i+1 − f i−1 = 2 f i′Δx + f i′′′ + O(Δx 5 )
12 (4)! 3 (4)!
Eliminating the fourth derivative! Eliminating the third derivative!
′′ + 10 f i′′+ f i−1
f i+1 ′′ =
12
(
f − 2 f i + f i−1 + O Δx 4
Δx 2 i+1
) ( ) ′ + 4 f i′+ f i−1
f i+1 ′ =
3
(
f − f i−1 + O Δx 4
Δx i+1
) ( )

Computational Fluid Dynamics


Computational Fluid Dynamics

Compact Schemes!

To solve the nonlinear advection-diffusion equation!


∂f i ∂f ∂2 f
= − f i i + D 2i
∂t ∂x ∂x
A large number of advanced numerical
we first solve find the first and second derivatives using the
methods have been developed for
expressions derived above:!
hyperbolic, parabolic and elliptic
∂f i+1 ∂f ∂f
∂x
+ 4 i + i−1 =
∂x ∂x
3
(
f − f i−1 + O Δx 4
Δx i+1
) ( ) equations. These methods can be applied
directly to the Navier-Stokes equations,
∂ f i+1
2
∂ fi
2
∂ f i−1
2 although the structure of the equations
∂x 2
+ 10
∂x 2
+
∂x 2
=
12
( )
f − 2 f i + f i−1 + O Δx 4
Δx 2 i+1
( ) generally requires us to pay close
attention in which order the solution
And use the values to compute the RHS. The time integration is proceeds.!
then done using a high order time integration method.!

You might also like