Upload
buikien
View
223
Download
1
Embed Size (px)
Citation preview
Computational Fluid Dynamics I
Numerical Methods!for Hyperbolic!Equations—I!
Grétar Tryggvason!Spring 2009!
http://users.wpi.edu/~gretar/me612.html!Computational Fluid Dynamics I
FTCS and upwind! Stability in terms of fluxes!
Generalized upwind!Second order schemes for smooth flow!
Modified Equation!Conservation!
Computational Fluid Dynamics I
�
∂ 2 f∂t 2
− c 2 ∂2 f
∂x 2= 0
�
∂u∂t
− c 2 ∂v∂x
= 0
∂v∂t
− ∂u∂x
= 0
The wave equation:!
Write as:!
In general:!
∂u∂t∂v∂t
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
+a11 a12a21 a22
⎡
⎣⎢⎢
⎤
⎦⎥⎥
∂u∂x∂v∂x
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
= 0
Most of the issues involved can be addressed by examining:!
�
∂f∂t
+U ∂f∂x
= 0
Computational Fluid Dynamics I
FTCS and Upwind!
Computational Fluid Dynamics I
We will start by examining the linear advection equation:!∂f∂t
+ U∂f∂x
= 0
The characteristic for this equation are:!dxdt
=U; dfdt
= 0;
Showing that the initial conditions are simply advected by a constant velocity U!
t
f
f
x
Computational Fluid Dynamics I
A simple forward in time, centered in space discretization yields!
∂f∂t
+ U∂f∂x
= 0
fjn+1 = fj
n −Δt2hU ( fj+1
n − fj−1n )
j-1 j j+1 n
n+1
Computational Fluid Dynamics I
This scheme is O(Δt, h2) accurate, but a stability analysis shows that the error grows as!
ε n+1
ε n= 1− i
UΔt2h
sin kh
Since the amplification factor has the form 1+i() the absolute value of this complex number is always larger than unity and the method is unconditionally unstable for this case.!
iUΔt2h
sinkh
1
ε n+1
ε n
Computational Fluid Dynamics I
A simple forward in time but “upwind” in space discretization yields!
∂f∂t
+ U∂f∂x
= 0
fjn+1 = fj
n −ΔthU ( fj
n − fj−1n )
j-1 j n
n+1 This scheme is O(Δt, h) accurate. !
Another scheme for!
Flow direction!
Computational Fluid Dynamics I
To examine the stability we use the von Neumanʼs method:!
ε jn+1 − ε j
n
Δt+Uh(ε j
n − ε j−1n ) = 0
ε jn = εneikx j
ε n+1 − ε n
Δt+U ε n
h(1− e− ikh) = 0
The evolution of the error is governed by:!
Write the error as:!
�
εn+1
εn=1−UΔt
h(1− e−ikh )
�
G = εn+1
εn=1− λ(1− e−ikh ), λ = UΔt
h
Amplification factor!
�
G =1− λ + λe− ikhOr:!
�
G <1Need to find when!
Computational Fluid Dynamics I
Stable!
Im(G)
1
1
kh
λ 1-λ
G
UΔth
≤ 1
This restriction was first derived by Courant, Fredrik, and Levy in 1932, and is usually called the Courant condition, or the CFL condition. !
�
G =1− λ + λe− ikh, λ = UΔth
Stability condition: λ<1!
Graphically:!
Computational Fluid Dynamics I
�
G =1− λ + λe− ikh =1− λ + λcoskh − iλ sinkh
�
G 2 = 1− λ + λcoskh( )2 + λ2 sin2 kh
= 1− λ( )2 + 2 1− λ( )λcoskh + λ2 cos2 kh + λ2 sin2 kh
= 1− λ( )2 + 2 1− λ( )λcoskh + λ2
=1− 2λ + 2λ2 + 2 1− λ( )λcoskh
�
G 2 =1− 2λ 1− λ( ) if coskh = 0
G 2 =1 if coskh =1
G 2 =1− λ 4 − 3λ( ) if coskh = −1
�
G 2 ≤1 if λ ≤1
Finf the absolute value of the amplification factor!
1!
�
G 2
�
λ1!�
coskh = 0
�
coskh = −1
Computational Fluid Dynamics I
The CFL condition implies that a signal has to travel less than one grid spacing in one time step!
�
UΔt ≤ h
Flow direction!
j-1 j
n
n+1
Allowable characteristics!
Not allowable characteristics!
Computational Fluid Dynamics I
Stability in !terms of Fluxes!
Computational Fluid Dynamics I
f j−1 f j f j+1
Fj−1 / 2 = Ufj−1n = 1
Fj+1 / 2 = Ufjn = 0
Consider the following initial conditions:!
1
During one time step, U∆t of f flows into cell j, increasing the average value of f by U∆t/h.!
U = 1
Δ th
= 1.5 ⋅U = 1.5
Computational Fluid Dynamics I
If U∆t/h > 1, the average value of f in cell j will be larger than in cell j-1. In the next step, f will flow out of cell j in both directions, creating a larger negative value of f. Taking a third step will result in an even larger positive value, and so on until the compute encounters a NaN (Not a Number).!
Computational Fluid Dynamics I
fi+1
Consider the following initial conditions:!
1f j−1 fi
Fj−1 / 2 = Ufj−1n = U
Fj+1 / 2 = Ufjn = 0
f jn+1 = fj
n −Δth(Fj+1 / 2
n − Fj−1 / 2n ) = 0 − 1.5(0 −1) = 1.5
Computational Fluid Dynamics I
f j+11
f j−1 f j
Fj−1 / 2 = Ufj−1n =U Fj+1 / 2 = Ufj
n = 1.5U
f jn+1 = fj
n −Δth(Fj+1 / 2
n − Fj−1 / 2n ) = 0 − 1.5(1.5 − 1) = 0.75
f j+1n+1 = fj+1
n −Δth(Fj+ 3/ 2
n − Fj+1/ 2n ) = 0 −1.5(0 −1.5) = 2.25
Computational Fluid Dynamics I
f j+11
f j−1 f j
Fj−1 / 2 = Ufj−1n =U
Fj+1 / 2 = Ufjn = 0.75U
Taking a third step will result in an even larger positive value, and so on until the compute encounters a NaN (Not a Number).!
Fj+1 / 2 = Ufjn = 2.25U
Computational Fluid Dynamics I
MOVIE FROM MATLAB!% one-dimensional advection by first order upwind.!n=80; nstep=100; dt=0.0125; length=2.0;!h=length/(n-1);y=zeros(n,1);f=zeros(n,1);f(1)=1.0;!
for m=1:nstep,m! hold off, plot(f); axis([1, n, -0.5, 1.5]);! 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 I
fj+1
Consider the following initial conditions:!
1fj−1 fj
Fj−1/ 2 =U2( fj−1
n + fjn ) =1.0 Fj+1/ 2 =
U2( fj
n + f j+1n ) = 0.5
fjn+1 = fj
n −Δth(Fj+1/ 2
n − Fj−1/ 2n ) = 1.0 − 0.5(0.5 −1) =1.25
So cell j will overflow immediately!!
By considering the fluxes, it is easy to see why the centered difference approximation is always unstable.!
Computational Fluid Dynamics I
dt=0.25*h!
20 40 60 80-0.5
0
0.5
1
1.5
Upwind
Although the upwind method is exceptionally robust, its low accuracy in space and time makes it unsuitable for most serious computations !
Computational Fluid Dynamics I
Numerical Methods!for Hyperbolic!Equations—II!
http://users.wpi.edu/~gretar/me612.html!
Grétar Tryggvason!Spring 2009!
Computational Fluid Dynamics I
FTCS and upwind! Stability in terms of fluxes!
Generalized upwind!Second order schemes for smooth flow!
Modified Equation!Conservation!
Computational Fluid Dynamics I
fjn+1 = fj
n −ΔthU ( fj
n − fj−1n )
j-1 j n
n+1
O(Δt, h) accurate. !
For the linear advection equation:!
Flow direction!
UΔth
≤ 1
U h
First Order Schemes!
The Upwind Scheme!
�
∂f∂t
+U ∂f∂x
= 0
Computational Fluid Dynamics I
Finite Volume point of view:!
xj1/2 xj+1/2 !
�
f j−1
�
f j
x!
f
�
f j+1
�
f jn+1 = f j
n − Δth(Fj+1/ 2
n − Fj−1/ 2n ) = f j
n − ΔthU( f j
n − f j−1n )
�
Fj+1/ 2=Uf jn
�
Fj−1/ 2=Uf j−1n
First Order Schemes!Computational Fluid Dynamics I
Generalized Upwind Scheme (for both U > 0 and U < 0 )!
�
f jn+1 = f j
n −UΔth( f j
n − f j−1n ), U > 0
�
f jn+1 = f j
n −UΔth( f j+1
n − f jn ), U < 0
Define:!
�
U + = 12U + U( ), U− = 1
2U − U( )
The two cases can be combined into a single expression:!
�
f jn+1 = f j
n − ΔthU +( f j
n − f j−1n ) +U−( f j+1
n − f jn )[ ]
First Order Schemes!
Or, substituting! −+ UU ,
�
f jn+1 = f j
n −U Δt2h( f j+1
n − f j−1n ) +
U Δt2h
( f j+1n − 2 f j
n + f j−1n )
central difference + numerical viscosity! Dnum =U h2
Computational Fluid Dynamics I
Other First Order Schemes!
Computational Fluid Dynamics I
Implicit (Backward Euler) Method!
- Unconditionally stable!- 1st order in time, 2nd order in space!- Forms a tri-diagonal matrix (Thomas algorithm)!
( ) 02
11
11
1
=−+Δ− +
−++
+nj
nj
nj
nj ff
hU
tff
nj
nj
nj
nj f
tf
hUf
tf
hU
Δ=−
Δ+ +
−++
+
12
12
11
111
jnjj
njj
njj Cfbfdfa =++ +
−++
+11
111
First Order Schemes!
Computational Fluid Dynamics I
Lax-Fredrichs method!
- stable for λ < 1!- 1st order in time, 1nd order in space!- Conditionally consistent!�
f jn+1 − 1
2 f j+1n + f j−1
n( ) f jnΔt
+ U2h
f j+1n − f j−1
n( ) = 0
( ) xxxxx fUhfUh 22
13
12
λλλ
−+⎟⎠⎞⎜
⎝⎛ −
Error term:!
First Order Schemes!
λ =UΔth
hλ=
h2
UΔt
Computational Fluid Dynamics I
Second Order Schemes!
Computational Fluid Dynamics I
)(2
211
tOtff
tf n
jnj Δ+
Δ−
=∂∂ −+
Leap Frog Method!
The simplest stable second-order accurate (in time) method:!
Modified equation!
( )nj
nj
nj
nj ff
htUff 11
11−+
−+ −Δ−=
( ) +−=∂∂+
∂∂
xxxfUh
xfU
tf 1
62
2
λ
- Stable for ! 1<λ- Dispersive (no dissipation) – error will not damp out!- Initial conditions at two time levels !- Oscillatory solution in time (alternating) !
Second Order Schemes!Computational Fluid Dynamics I
+Δ∂∂+Δ
∂∂+Δ
∂∂+=Δ+
62)()(
3
3
32
2
2 ttft
tft
tftfttf
Lax-Wendroffʼs Method (LW-I)!
First expand the solution in time!
Then use the original equation to rewrite the time derivatives!
xfU
tf
∂∂−=
∂∂
2
22
2
2
xfU
tf
xU
xfU
ttf
ttf
∂∂=
∂∂
∂∂−=⎟
⎠⎞⎜
⎝⎛
∂∂
∂∂−=⎟
⎠⎞⎜
⎝⎛∂∂
∂∂=
∂∂
Second Order Schemes!
Computational Fluid Dynamics I
)(2
)()( 32
2
22 tOtxfUt
xfUtfttf Δ+Δ
∂∂+Δ
∂∂−=Δ+
Substituting!
Using central differences for the spatial derivatives!
�
f jn+1 = f j
n −UΔt2h
f j+1n − f j−1
n( ) + U2Δt 2
2h2f j+1n − 2 f j
n + f j−1n( )
2nd order accurate in space and time!
Stable for! 1<ΔhtU
Second Order Schemes!Computational Fluid Dynamics I
Two-Step Lax-Wendroffʼs Method (LW-II)!
LW-I into two steps:!
For the linear equations, LW-II is identical to LW-I!
02/
2/)( 112/12/1 =
−+
Δ+− ++
++
hff
Ut
fff nj
nj
nj
nj
nj
02/12/1
2/12/1
1
=−
+Δ− +
−++
+
hff
Utff n
jnj
nj
nj
Step 1 (Lax)!
Step 2 (Leapfrog)!
- Stable for ! 1/ <Δ htU- Second order accurate in time and space !
Second Order Schemes!
Computational Fluid Dynamics I
MacCormack Method!
Similar to LW-II, without !
( )njnj
nj
tj ff
htUff −Δ−= +1
( )⎥⎦⎤
⎢⎣⎡ −Δ−+= −
+ tj
tj
tj
nj
nj ff
htUfff 1
1
21
Predictor!
Corrector!
- A fractional step method!!- Predictor: forward differencing!!- Corrector: backward differencing!
- For linear problems, accuracy and stability ! properties are identical to LW-I. !
2/1,2/1 −+ jj
Second Order Schemes!Computational Fluid Dynamics I
Second-Order Upwind Method!
Warming and Beam (1975) – Upwind for both steps!
( )nj
nj
nj
tj ff
htUff 1−−Δ−=
�
f jn+1 = 1
2f jn + f j
t −U Δth
f jt − f j−1
t( ) −U Δth
f jn − 2 f j−1
n + f j−2n( )⎡
⎣ ⎢ ⎤ ⎦ ⎥
Predictor! Corrector!
Combining the two:!
( ) ( )nj
nj
nj
nj
nj
nj
nj fffffff 2111 2)1(
21
−−−+ +−−+−−= λλλ
- Stable if!- Second-order accurate in time and space !
20 ≤≤ λ
Second Order Schemes!
Computational Fluid Dynamics I
QUICK!s=1!f1!
s=2!f2!
s=3!f3!
s=4!f4!
s=5/2!
�
1− 2 : (2 − s) f1 + (s−1) f22 − 3 : (3− s) f2 + (s− 2) f3
�
1− 3 : 12(3− s) (2 − s) f1 + (s−1) f2[ ] + 1
2(s−1) (3− s) f2 + (s− 2) f3[ ]
�
s = 5 /2 : f5 / 2 = 18(3 f3 + 6 f2 − f1)
Interpolate linearly between 1-2 and 2-3!
Then quadratically between 1-2!
The function can now be evaluated at the half point!
Third Order Schemes!
�
∂f i∂x
= 1h
fi+1/ 2 − f i−1/ 2( )
Computational Fluid Dynamics I
QUICK!Approximate the derivative:!
�
∂f i∂x
= 1h
fi+1/ 2 − f i−1/ 2( )
where the value at the half points by second order upwind interpolation!
�
∂f∂x
⎞ ⎠ ⎟ i
≈ 18h
3 f i + 6 fi−1 − f i−2[ ] − 3 fi+1 + 6 f i − fi−1[ ]{ }
Third Order Schemes!
Computational Fluid Dynamics I
The one-step Lax-Wendroff is not easily extended to non-linear or multi-dimensional problems. The split version is.!
In the Lax-Wendroff and the MacCormack methods the spatial and the temporal discretization are not independent.!
Other methods have been developed where the time integration is independent of the spatial discretization, such as the Beam-Warming and various Runge-Kutta methods!
Second Order Schemes!Computational Fluid Dynamics I
FTCS!Unconditionally
Unstable!
Upwind!Stable for!
Implicit!Unconditionally!
Stable!
Lax-Friedrichs! Conditionally consistent!
Stable for !
0=+ xt Uff
02
111
=−
+Δ− −+
+
hff
Utff n
jnj
nj
nj ( ) xxxxx fUhfUt 2
22
2162
λ+−Δ−
011
=−
+Δ− −
+
hff
Utff n
jnj
nj
nj
( )
( ) xxx
xx
fUh
fUh
1326
12
22
+−−
−
λλ
λ
1≤λ
( ) xxxxx fUhfUh 22
13
12
λλλ
−+⎟⎠⎞⎜
⎝⎛ −
( )0
2
11
11
1
=−
+Δ− +
−++
+
hff
Utff n
jnj
nj
nj
xxxxx ftUUhftU⎥⎦⎤
⎢⎣⎡ Δ+−Δ 232
2
31
61
2
( )
( )0
2
2/
11
111
=−
+
Δ+−
−+
−++
hff
U
tfff
nj
nj
nj
nj
nj
1≤λ
Summary!
Computational Fluid Dynamics I
Leap Frog!Stable for!
Lax-Wendroff I!Stable for!
Lax-Wendroff II!Same as LW-I!
Stable for!
MacCormack!Same as LW-I!
Stable for!
0=+ xt Uff
022
1111
=−
+Δ− −+
−+
hff
Utff n
jnj
nj
nj ( ) xxxf
Uh 16
22
−λ
( )
( ) xxxx
xxx
fUh
fUh
23
22
18
16
λλ
λ
−−
−−
1≤λ
1≤λ
1≤λ
( )
( )0
222
21122
111
=+−
Δ−
−+
Δ−
−+
−++
hfff
tU
hff
Utff
nj
nj
nj
nj
nj
nj
nj
02/
2/)( 112/12/1 =
−+
Δ+− ++
++
hff
Ut
fff nj
nj
nj
nj
nj
02/12/1
2/12/1
1
=−
+Δ− +
−++
+
hff
Utff n
jnj
nj
nj 1≤λ
( )01 =
−+
Δ− +
hff
Utff n
jnj
nj
tj
( ) ( )0
2/ 11
=−
+Δ+− −
+
hff
Utfff t
jtj
tj
nj
nj
Summary!Computational Fluid Dynamics I
Beam-Warming!Stable for!
QUICK!Stable for!
ENO!
WENO!
0=+ xt Uff
( )
( ) 022
243
212
2
211
=+−Δ−
+−+
Δ−
−−
−−+
nj
nj
nj
nj
nj
nj
nj
nj
fffhtU
hfff
Utff
20 ≤≤ λ
( )( )
( ) ( ) xxxx
xxx
fUh
fUh
λλ
λλ
−−−
−−
218
216
23
2
Summary!
�
f jn+1 − f j
n
Δt+
U3 f j
n + 6 f j−1n − f j−2
n( ) − 3 f j+1n + 6 f j
n − f j−1n( )
8h1≤λ
A large number of (conditionally) stable and accurate methods exists for hyperbolic equations with smooth solutions !
And Many More!!
Computational Fluid Dynamics I
Modified Equation!
Computational Fluid Dynamics I
Looking at the structure of the error terms—by deriving the Modified Equation—can often lead to insight into how the approximate solution behaves!
Computational Fluid Dynamics I
Derive modified equation for upwind difference method:!
0)( 1
1
=−+Δ−
−
+nj
nj
nj
nj ff
hU
tff
Using Taylor expansion:!
+Δ∂∂+Δ
∂∂+Δ
∂∂+=+
62
3
3
32
2
21 t
tft
tft
tfff n
jnj
+∂∂−
∂∂+
∂∂−=− 62
3
3
32
2
2
1
hxfh
xfh
xfff n
jnj
Computational Fluid Dynamics I
Substituting!
⎭⎬⎫
⎩⎨⎧
−⎥⎦⎤
⎢⎣⎡ +Δ
∂∂+Δ
∂∂+Δ
∂∂+
Δnj
nj ft
tft
tft
tff
t
621 3
3
32
2
2
062
3
3
32
2
2
=⎭⎬⎫
⎩⎨⎧
⎥⎦⎤
⎢⎣⎡ +
∂∂−
∂∂+
∂∂−−+
hxfh
xfh
xfff
hU n
jnj
Therefore,!
+−Δ−+Δ−=∂∂+
∂∂
xxxtttxxtt fUhftfUhftxfU
tf
6622
22
It helps the interpretation if all terms are written in ! xxxxx ff ,
Computational Fluid Dynamics I
Taking further derivatives (first in time, then in space): !
+−Δ−+Δ−=+ xxxtttttxxttttxttt fUhftfUhftUff6622
22
++Δ+−Δ=−− xxxxtttxxxxttxxxtx fhUftUfhUftUfUUf6622
22222+!
⎟⎠⎞⎜
⎝⎛ +−Δ+
⎟⎠⎞⎜
⎝⎛ Δ++−Δ+=
)(22
)(22
2
2
hOuUuUx
tOfUftfUf
xxxxxt
ttxttt
xxtt
Computational Fluid Dynamics I
Similarly, we get !),(3 htOfUf xxxttt Δ+−=
),(2 htOfUf xxxttx Δ+=
),( htOUff xxxxxt Δ+−=
Final form of the modified equation: !
( ) ( ) xxxxx fUhfUhxfU
tf 132
61
22
2
+−−−=∂∂+
∂∂ λλλ
+O h3,h2Δt,hΔt 2 ,Δt 3⎡⎣ ⎤⎦
htUΔ=λ
Computational Fluid Dynamics I
Numerical dissipation (diffusion)!
( ) ( ) ++−−−=∂∂+
∂∂
xxxxx fUhfUhxfU
tf 132
61
22
2
λλλ
By applying upwind differencing, we are effectively solving: !
Also note that the CFL condition ! 1<Δ=htUλ
ensures a positive diffusion coefficient !
Dissipation!( ) xxf
Dispersion!( ) xxxf
Computational Fluid Dynamics I
�
∂f∂t
= α ∂ n f∂xn
�
f (x, t) = a(t)eikx
�
da(t)dt
= (ik)nαa(t)
�
a(t) = aoe( ik )nαt
For even n we get diffusion, for odd n we get dispersion!
Consider:!
Look for solutions of the form:!
Substitute to get!
solve!
Computational Fluid Dynamics I
First-Order Methods and Diffusion!
Upwind:!
( ) ( ) xxxxx fUhfUhxfU
tf 132
61
22
2
+−−−=∂∂+
∂∂ λλλ
Lax-Friedrichs:!
( ) xxxxx fUhfUhxfU
tf 2
2
13
12
λλλ
−+⎟⎠⎞⎜
⎝⎛ −=
∂∂+
∂∂
Dissipative = Smearing!
htUΔ=λ
Computational Fluid Dynamics I
Second-Order Methods and Dispersion!
Lax-Wendroff:!∂f∂t
+U ∂f∂x
= −Uh2
21− λ2( ) fxxx − Uh
3
8λ 1− λ2( ) fxxxx
Beam-Warming:!
∂f∂t
+U ∂f∂x
=Uh2
61− λ( ) 2 − λ( ) fxxx −
Uh3
81− λ( )2 2 − λ( ) fxxxx
Dispersive = Wiggles!
htUΔ=λ
Computational Fluid Dynamics I
dt=0.25*h!
20 40 60 80-0.5
0
0.5
1
1.5Lax-WendroffUpwind
Computational Fluid Dynamics I
Conservative discretization
schemes!
Computational Fluid Dynamics I
In finite volume method, equations in conservative forms are needed in order to satisfy conservation properties.!
As an example, consider a 1-D equation!
�
∂f (x, t)∂t
+∂F[ f (x, t)]
∂x= 0
where F denotes a general advection/diffusion term, e.g.!
�
F =12f 2; F = µ(x) ∂f
∂x
Computational Fluid Dynamics I
�
∂F∂x
dxL∫ =
Fj+1/ 2 − Fj−1/ 2
Δx∑ Δx
Xj-1/2 xj+1/2 !
�
f j+1
�
f j−1
�
f j
x!
In discretized form:!
�
= + Fj−1/ 2 − Fj−3 / 2 + Fj+1/ 2 − Fj−1/ 2 + Fj+3 / 2 − Fj+1/ 2 +[ ]
�
= FL − F0
If F = 0 at the end points of the domain, f is conserved.!
Integrating over the domain L,!
�
∂f∂tdx
L∫ +
∂F∂x
dxL∫ = 0
�
F(L) − F (0) = 0
�
⇒ddt
fdxL∫ = 0
Computational Fluid Dynamics I
�
∂f∂t
+ ∂∂x
12f 2
⎛ ⎝ ⎜
⎞ ⎠ ⎟ = 0
Examples of Conservative Form!
Discretize using upwind !
�
∂∂x
12f 2
⎛ ⎝ ⎜
⎞ ⎠ ⎟ ≈
12h
fi2 − f i−1
2( ) Conservative!�
∂f∂t
+ f ∂f∂x
= 0
�
f ∂f∂x
≈ f ih
f i − f i−1( ) Non-conservative!
versus!
Computational Fluid Dynamics I
�
∂F∂x
dxL∫ ≈ Fj+1/ 2 − Fj−1/ 2∑ =
+ fi−12 − f i−2
2 + f i2 − f i−1
2 + f i+12 − fi
2 +
�
∂F∂x
dxL∫ ≈ Fj+1/ 2 − Fj−1/ 2∑ =
+ fi−12 − f i−1 f i + f i
2 − f i f i−1 + f i+12 − f i+1 f i +
�
∂∂x
12f 2
⎛ ⎝ ⎜
⎞ ⎠ ⎟ ⎞ ⎠ ⎟ i
≈ 12h
fi2 − f i−1
2( )
�
f ∂f∂x
⎞ ⎠ ⎟ i
≈ f ih
fi − f i−1( )
Computational Fluid Dynamics I
�
∂f∂t
+ ∂∂x
µ(x) ∂f∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ = 0
Another example (variable diffusion coefficient)!
Discretize !
�
∂∂x
µ(x) ∂f∂x
⎛ ⎝
⎞ ⎠
Conservative!
�
µ∂2 f∂x 2
+∂µ∂x
∂f∂x
Non-conservative!
versus!
Computational Fluid Dynamics I
�
∂f∂t
+ f ∂f∂x
= 0
�
f ∂f∂t
+ f ∂f∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ = 0
�
∂∂t
f 2
2+ ∂∂x
f 3
3= 0
�
ddt
f 2
2dx∫ = − ∂
∂xf 3
3dx∫ = f 3
3⎡
⎣ ⎢
⎤
⎦ ⎥ −∞
∞
= 0
�
f ∞( ) = f −∞( ) = 0
�
ddt
f n
ndx∫ = 0
Similarly, it can be shown that!
Conservation of higher order quantities!Consider:!
Integrate:!
Computational Fluid Dynamics I
Generally it is believed that conservative schemes are superior to non-conservative ones and that the more conserved quantities the discrete approximation preserves, the better the scheme. While mostly true, there are exceptions as we will discuss later!!
Computational Fluid Dynamics I
Numerical Methods!for Hyperbolic!Equations—III!
http://users.wpi.edu/~gretar/me612.html!
Grétar Tryggvason!Spring 2009!
Computational Fluid Dynamics I
Flows with shocks. Solutions to Burgers eqn. Entropy condition!
Conservation and shock speed!
Advecting a shock with several schemes!
Godunovʼs Theorem!
Artificial Viscosity!
Multidimensional flows!
Computational Fluid Dynamics I
Discontinuous!Solutions!Shocks-I!
Computational Fluid Dynamics I
�
∂f∂t
+U ∂f∂x
= 0
The analytic solution is obtained by characteristics!
�
dxdt
=U; dfdt
= 0;
Consider the linear Advection Equation!
t
f
f
x Discontinuity of solution is allowed!
(Weak Solution)!
( )RLR
L ffxxfxxf
xf >⎩⎨⎧
><
=0
0)0,(
�
dxdt
=U
Computational Fluid Dynamics I
( )RLR
L ffxxfxxf
xf >⎩⎨⎧
><
=0
0)0,(0=∂∂+
∂∂
xff
tf
;0; ==dtdff
dtdx
Inviscid Burgersʼ Equation!
t
x
Characteristics!
0x
Lf
Rf
??=dtdx
0x
Shock Wave!
Computational Fluid Dynamics I
( ) ( ) axa
axfaxffff
axf
xf
R
RLRL
L
<<−
⎪⎪⎩
⎪⎪⎨
⎧
>
⎥⎦⎤
⎢⎣⎡ −−+
−<
=21)0,(
A slight variation of the initial condition – formation of shock!
t
x
Shock Wave!
a− a
Lf
Rf 0=t
RL ffat−
= 2
Computational Fluid Dynamics I
( )RLR
L ffxxfxxf
xf <⎩⎨⎧
><
=0
0)0,(0=∂∂+
∂∂
xff
tf
;0; ==dtdff
dtdx
Reverse Shock (?)!
Characteristics!
0x
Lf
Rf t
x 0x
Unstable, entropy-violating!solution!
Computational Fluid Dynamics I
( )RLR
L ffxxfxxf
xf <⎩⎨⎧
><
=0
0)0,(0=∂∂+
∂∂
xff
tf
;0; ==dtdff
dtdx
Rarefaction Wave (physically correct solution)!
Characteristics!
0x
Lf
Rf t
x 0x
Computational Fluid Dynamics I
Shock Speed!
Computational Fluid Dynamics I
x
∂f∂t
=∂f∂t
+∂f∂x'
∂x'∂t
∂f∂t
+∂F∂x
= 0
∂f∂t
− C ∂f∂x'
+∂F∂x'
= 0
x' = x − Ct
∂x'∂t
= C
x’ The speed of the shock! Write:!
Substitute into:!
where!
∂f∂t
− C ∂f∂x'
+∂F∂x'
⎛ ⎝
⎞ ⎠
Δ→ 0∫ dx = 0
�
∂f∂t
⎛ ⎝ ⎜
⎞ ⎠ ⎟
Δ→0∫ dx − C ∂f
∂x'⎛ ⎝ ⎜
⎞ ⎠ ⎟
Δ→0∫ dx + ∂F
∂x'⎛ ⎝ ⎜
⎞ ⎠ ⎟
Δ→0∫ dx = 0
0
Computational Fluid Dynamics I
�
− C ∂f∂x'
⎛ ⎝ ⎜
⎞ ⎠ ⎟
Δ→0∫ dx + ∂F
∂x'⎛ ⎝ ⎜
⎞ ⎠ ⎟
Δ→0∫ dx = 0
−C fR − fL( ) + FR − FL( ) = 0
C =FR − FLfR − fL
x
x’
Rankine-Hugoniot relations!
Computational Fluid Dynamics I
∂f∂t
+ f ∂f∂x
= 0
Example!
F =12f 2
C =FR − FLfR − fL
=12fR2 − fL2
fR − fL=12
fR − fL( ) fR + fL( )fR − fL
C =12fR + fL( )
Computational Fluid Dynamics I
Discontinuous!Solutions!Shocks-II!
Computational Fluid Dynamics I
Weak solutions to hyperbolic equations may not be unique.!
How can we find a physical solution out of many weak!solutions?!
In fluid mechanics, the actual physics always includes !dissipation, i.e. in the form of viscous Burgersʼ equation:!
2
2
xf
xff
tf
∂∂=
∂∂+
∂∂ ε
Therefore, what we are truly seeking is the solution to !the viscous Burgersʼ equation in the limit of! 0→ε
Computational Fluid Dynamics I
Entropy Condition:!A discontinuity propagating with speed C satisfies the !entropy condition if!
For a conservation equation!
)()( RL fFCfF ′>>′
( ) ( ) ( ) ( )R
R
L
L
fffFfFC
fffFfF
−−≥≥
−−
0)( =∂
∂+∂∂
xfF
tf
Version I:!
Version II:!
And some others…!
Entropy Condition!
t
x
Shock Wave!
for!
fL ≥ f ≥ fR
Computational Fluid Dynamics I
Means that the characteristics on both side must “slope into” the shock!
Start with:!
)()( RL fFCfF ′>>′
0)( =∂
∂+∂∂
xfF
tf
The condition:!
Entropy Condition!
t
x
Shock Wave!
F ' = ∂F∂f
∂f∂t
+ F ' ∂F∂x
= 0where!
F 'RF 'L
Computational Fluid Dynamics I
Similarly, the shock speed is given by!
( ) ( ) ( ) ( )R
R
L
L
fffFfFC
fffFfF
−−≥≥
−−
Thus!
Entropy Condition!
t
x
Shock Wave!
C =FR − FLfR − fL
fL ≥ f ≥ fRfor!
Means that the hypothetical shock speed for values of f between the left and the right state must give shock speeds that are larger on the left and smaller on the right.!
Computational Fluid Dynamics I
In CFD, however, we do not want to solve the viscous!Burgersʼ equation with extremely small because it !becomes computationally expensive.!
Nevertheless, in many gas dynamics application, there!is need to capture discontinuous solution behavior.!
And we want to reproduce the weak solution behavior!numerically by solving inviscid Burgersʼ equation.!
ε
- Shock speed!- Entropy condition!- Wave shape (without smearing or wiggles)!
Computational Fluid Dynamics I
Examples: !!Godunov method!!Approximate Riemann solver!!Artificial dissipation!
In practice, rather than applying a separate entropy !condition to the numerical solution procedure, numerical!methods are developed first and then it can be proved!that the methods satisfy the entropy condition. !
Entropy Condition!
Computational Fluid Dynamics I
Conservative Schemes are guarantied to give the correct Shock Speed since they correspond to a direct application of the conservation principles. !
Non-conservative schemes may or may not do so.!
Computational Fluid Dynamics I
In capturing the correct solution behavior for discontinuous!Initial data, conservative methods are essential (Lax).!
Conservation and shock speed!
Example: inviscid Burgers equation:!
021or0 2 =⎟
⎠⎞⎜
⎝⎛
∂∂+
∂∂=
∂∂+
∂∂ f
xtf
xff
tf
Conservative Method!
Computational Fluid Dynamics I
Consider upwind and forward Euler scheme:!
Example: for inviscid Burgers equation!with discontinuous initial data!
0=+ xt fff
1−j
1
j 1+j
�
f jn+1 = f j
n − Δthf jn f j
n − f j−1n( ) = 0
Non-conservative form!
Never moves!!
�
ft + 12 f
2( )x = 0
�
f jn+1 = f j
n − Δt2h
( f jn )2 − ( f j−1
n )2( ) = Δt2h
Conservative form!
Conservative Method!