computational fluid dynamics - university of notre …gtryggva/cfd-course2017/lecture-8-2017.pdf ·...
TRANSCRIPT
Computational Fluid Dynamics
Computational Fluid Dynamics
http://www.nd.edu/~gtryggva/CFD-Course/
Grétar Tryggvason
Lecture 8February 6, 2017
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
Diffusion versus dispersion
Godunov Theorem
Godunov Method
Upwind and Flux Splitting
Higher order schemes
Artificial viscosity
Computational Fluid Dynamics
Modified Equation
Computational Fluid Dynamics
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
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
xf
hxf
ff nj
nj
Computational Fluid Dynamics
Substituting
⎭⎬⎫
⎩⎨⎧
−⎥⎦⎤
⎢⎣⎡ +Δ
∂∂+Δ
∂∂+Δ
∂∂+
Δnj
nj ft
tft
tft
tff
t
621 3
3
32
2
2
062
3
3
32
2
2
=⎭⎬⎫
⎩⎨⎧
⎥⎦⎤
⎢⎣⎡ +
∂∂−
∂∂+
∂∂−−+
hxfh
xf
hxf
ffhU n
jnj
Therefore,
+−Δ−+Δ−=∂∂+
∂∂
xxxtttxxtt fUh
ft
fUh
ft
xf
Utf
6622
22
It helps the interpretation if all terms are written in xxxxx ff ,
Computational Fluid Dynamics
Taking further derivatives (first in time, then in space):
+−Δ−+Δ−=+ xxxtttttxxttttxttt fUh
ft
fUh
ft
Uff6622
22
++Δ+−Δ=−− xxxxtttxxxxttxxxtx fhU
ftU
fhU
ftU
fUUf6622
22222+
ftt =U2 fxx + Δt − fttt
2+U2fttx +O(Δt)
⎛⎝⎜
⎞⎠⎟
+Δx U2fxxt −
U 2
2fxxx +O(h)
⎛⎝⎜
⎞⎠⎟
Computational Fluid Dynamics
Similarly, we get ),(3 htOfUf xxxttt Δ+−=
),(2 htOfUf xxxttx Δ+=
),( htOUff xxxxxt Δ+−=
Final form of the modified equation:
( ) ( ) xxxxx fUh
fUh
xf
Utf 132
61
22
2
+−−−=∂∂+
∂∂ λλλ
+O h3,h2Δt,hΔt 2 ,Δt 3⎡⎣ ⎤⎦
htUΔ=λ
Computational Fluid Dynamics
Numerical dissipation (diffusion)
( ) ( ) ++−−−=∂∂+
∂∂
xxxxx fUh
fUh
xf
Utf 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
�
∂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
First-Order Methods and Diffusion
Upwind:∂f∂t+U ∂f
∂x=Uh21−λ( ) fxx −
Uh2
62λ 2 −3λ +1( ) fxxx
Lax-Friedrichs:
∂f∂t+U ∂f
∂x=Uh2
1λ−λ
#
$%
&
'( fxx +
Uh2
31−λ 2( ) fxxx
Dissipative = Smearing
htUΔ=λ
Computational Fluid Dynamics
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
dt=0.25*h
20 40 60 80-0.5
0
0.5
1
1.5Lax-WendroffUpwind
Computational Fluid Dynamics
First-Order Methods and Diffusion
Upwind:∂f∂t+U ∂f
∂x=Uh21−λ( ) fxx −
Uh2
62λ 2 −3λ +1( ) fxxx
Lax-Wendroff:∂f∂t+U ∂f
∂x= −
Uh2
21−λ 2( ) fxxx −Uh
3
8λ 1−λ 2( ) fxxxx
Dispersive = Wiggles
Dissipative = Smearing
�
λ = UΔth
Computational Fluid Dynamics
Godunov Theorem
Computational Fluid Dynamics
Question: How can we avoid oscillatory behavior?(How can we preserve monotonicity)
Godunov Theorem (1959):
“Monotone behavior of a numerical solution cannot be assured for linear finite-difference methods with more than first-order accuracy.”
Godunov’s Theorem
Computational Fluid DynamicsGodunov Theorem - 1
0=∂∂+
∂∂
xf
Utf
For linear equation
we have:2
22
2
2
;xf
Utf
xf
Utf
∂∂=
∂∂
∂∂−=
∂∂
A general linear scheme can be written as:
∑ ++ =
k
nkjk
nj fcf 1
Expanding in Taylor series aroundnkjf +
njf
)(2
32
222
hOxfhk
xfkhff n
jnkj +
∂∂+
∂∂+=+
Computational Fluid DynamicsGodunov Theorem - 2
Substituting
Also, can be Taylor expanded in time around
∑ ∑∑ +∂∂+
∂∂+=+
k kk
kkk
nj
nj hOck
xfhkc
xfhcff )(
232
2
221
(a)=(b) (2nd order accurate):2
2;;1 ⎟⎠⎞⎜
⎝⎛ Δ=Δ−== ∑∑∑ h
tUckhtUkcc
kk
kk
kk
1+njf
njf
)(2
32
221 tO
tft
tftff n
jnj Δ+
∂∂Δ+
∂∂Δ+=+
)(2
32
222 tO
xftU
xftUf nj Δ+
∂∂Δ+
∂∂Δ−=
(a)
(b)
Computational Fluid DynamicsGodunov Theorem - 3
Condition for monotonicity:11
11 then,If ++++ >> n
jnj
nj
nj ffff
Since ∑ ++ =
k
nkjk
nj fcf 1
( )∑ +++++
+ −=−k
nkj
nkjk
nj
nj ffcff 1
111
> 0 The above should be valid for arbitrary
00 111 >−⇔> ++
+nj
njk ffc
njf
Is it possible?
Computational Fluid DynamicsGodunov Theorem - 4
Hence we get:
22;;1 ⎟
⎠⎞⎜
⎝⎛ Δ=Δ−== ∑∑∑ h
tUckhtUkcc
kk
kk
kk
ckk∑⎛⎝⎜
⎞⎠⎟
k2ckk∑⎛⎝⎜
⎞⎠⎟= kck
k∑⎛⎝⎜
⎞⎠⎟
2
ek2
k∑⎛⎝⎜
⎞⎠⎟
k2ek2
k∑⎛⎝⎜
⎞⎠⎟= kek
2
k∑⎛⎝⎜
⎞⎠⎟
2
Define: )0(2 >= kkk cec
This violates Cauchy inequality a ⋅a( ) b ⋅b( ) ≥ a ⋅b( )2
Monotone 2nd Order scheme is impossible!
a
ba = e1,e2,e3,…,ek,…( ); b = 1e1, 2e2,3e3,…,kek,…( )
a ⋅a( ) b ⋅b( ) = a ⋅b( )2or
where
Computational Fluid Dynamics
The key word in Godunov’s theorem is linear. To overcome its limitations, look for nonlinear scheames:
1. Use central differencing and introduce numericalviscosity where needed (Artificial viscosity)
2. Limit the fluxes in such a way that oscillations are avoided (high-order Godunov methods, flux-corrected transport, TVD shemes, etc.)
Computational Fluid Dynamics
Godunov’s Method
Computational Fluid Dynamics
Godunov Method – Finite Volume Method + Riemann solver
∂f∂t
+∂∂x
F( f )[ ] = 0
Consider a 1-D Conservation Eq:
Integrating across the j-th cell:
Godunov Method
Fj-1/2 Fj+1/2
1+jff j−1
jf
xj j+1 j-1
0)()( 2/12/1
2/1
2/1=−+
∂∂
−+∫+
−jj
x
xxFxFfdx
tj
j
Define the cell-average: fav =1Δx j
f dxxj−1/2
x j+1/2∫Δx j
∂fav∂t
+ F(x j+1/2 ) − F(x j−1/2 ) = 0
Δx j = x j+1/2 − x j−1/2
Computational Fluid Dynamics
Integrating over time
where the time integration is done by solving Riemann Problem for each cell boundary:
favn+1 = fav
n −ΔtΔx j
1Δt
Fj+1/2 dt −1Δt
Fj−1/2 dtt
t+Δt
∫t
t+Δt
∫⎡⎣⎢
⎤⎦⎥
tΔ
[ ] 0)( =∂∂+
∂∂
fFxt
f
⎪⎩
⎪⎨⎧
>≤
=++
+
2/11
2/1)0,(jj
jj
xxf
xxfxf 1+jf
jf
xj j+1
t
2/1+= jcdtdx
t+Δt
Godunov Method
Computational Fluid Dynamics
Wave Diagram:
1+jff j−1
jf
j j+1 j-1
ShockShockRarefaction
Wave
Godunov MethodComputational Fluid Dynamics
Godunov Method: The Procedure
1. Construct a cell average value
fav =1Δx j
f dxxj−1/2
x j+1/2∫2. Solve a Riemann problem to find the time integration of fluxes
3. Construct new
4. Go to 1.
avf
ttt Δ+=
Godunov Method
Computational Fluid Dynamics
Special Case: Linear Advection Equation
0,0 >=∂∂+
∂∂
Uxf
Utf
for which the Riemann problem is trivial and we get
( )nj
nj
njav
njav ff
htUff 1,
1, −+ −Δ−=
jj UfF =+ 2/1
1st Order Upwind Scheme
Godunov MethodComputational Fluid Dynamics
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 )
Godunov Method
Computational Fluid DynamicsGodunov Method
Advect—Average—Advect—Average—etcThe averaging leads to numerical diffusion, even though the advection is exact!
Computational Fluid DynamicsGodunov Method
Numerical versus exact solution
Computational Fluid Dynamics
For nonlinear equations and systems the full Rieman problem must be solvedSince only the fluxes are needed, often approximate solvers are used
Godunov MethodComputational Fluid Dynamics
Flux Vector Splitting
Computational Fluid Dynamics
For upwind schemes, it is necessary to determine the upstream direction. For systems with many characteristics running both left and right, there is not one “upstream” direction
Computational Fluid Dynamics
Generalized Upwind Scheme (for both U > 0 and U < 0 )
0),( 11 >−Δ−= −
+ UffhtUff n
jnj
nj
nj
0),( 11 <−Δ−= +
+ UffhtUff n
jnj
nj
nj
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 )[ ]
Upwind Scheme - Revisited
Where we have split the flux in an “upwind” and “downwind” part
Computational Fluid Dynamics
For a system of equations there are generally waves running in both directions. To apply upwinding, the fluxes must be decomposed into left and right running waves
Computational Fluid Dynamics
Steger-Warming (1979)
A system of hyperbolic equations
Flux Splitting
�
∂f∂t
+ ∂F∂x
= 0
can be written in the form
�
∂f∂t
+ A[ ] ∂f∂x
= 0; A[ ] = ∂F∂f
The system is hyperbolic if
�
T[ ]−1 A[ ] T[ ] = λ[ ]; T[ ]−1 =q1T
qNT
⎡
⎣
⎢ ⎢ ⎢
⎤
⎦
⎥ ⎥ ⎥
Computational Fluid Dynamics
�
F = A[ ]f = T[ ] λ[ ] T[ ]−1fThe matrix of eigenvalues is divided into two matrices
�
A[ ] = A+[ ] + A−[ ] = T[ ] λ+[ ] T[ ]−1 + T[ ] λ−[ ] T[ ]−1Hence
[ ]λ
�
λ[ ] = λ+[ ] + λ−[ ]
Define
�
F = F + + F−
�
F + = A+[ ]f, F− = A−[ ]f( )Conservation law becomes
�
∂f∂t
+ ∂F+
∂x+ ∂F−
∂x= 0
Flux SplittingComputational Fluid Dynamics
Example: 1-D Hyperbolic Equation
�
∂2 f∂t 2
− c 2 ∂2 f∂x 2
= 0
xf
wtf
v∂∂=
∂∂= ;
vtwt
⎛⎝⎜
⎞⎠⎟+0 − c2
−1 0⎛⎝⎜
⎞⎠⎟vxwx
⎛⎝⎜
⎞⎠⎟= 0
Leading to
f =vw
⎛⎝⎜
⎞⎠⎟; F =
−c2w−v
⎛⎝⎜
⎞⎠⎟; A[ ] = ∂F
∂f⎡⎣⎢
⎤⎦⎥=
0 − c2
−1 0⎡
⎣⎢
⎤
⎦⎥
Flux Splitting
Computational Fluid Dynamics
Leading to:
�
T[ ]−1 =q1T
q2T
⎡
⎣ ⎢
⎤
⎦ ⎥ =
1 − c1 c⎡
⎣ ⎢
⎤
⎦ ⎥
�
λ+[ ] =c 00 0⎡
⎣ ⎢
⎤
⎦ ⎥ ; λ−[ ] =
0 00 − c⎡
⎣ ⎢
⎤
⎦ ⎥
�
F + = 12cv − c 2w−v + cw
⎡
⎣ ⎢
⎤
⎦ ⎥ ; F− = 1
2−cv − c 2w−v − cw
⎡
⎣ ⎢
⎤
⎦ ⎥
�
A+[ ] = T[ ] λ+[ ] T[ ]−1; A−[ ] = T[ ] λ−[ ] T[ ]−1
�
F + = A+[ ]f; F− = A−[ ]f
Flux Splitting
For a nonlinear system of equations such as the Euler equations, there is some arbitrariness in how the system is split
Computational Fluid Dynamics
Solve using first order upwinding with flux splitting
�
∂f∂t
+ ∂F+
∂x+ ∂F−
∂x= 0
�
F + = 12cv − c 2w−v + cw
⎡
⎣ ⎢
⎤
⎦ ⎥ ; F− = 1
2−cv − c 2w−v − cw
⎡
⎣ ⎢
⎤
⎦ ⎥
vw⎡
⎣⎢
⎤
⎦⎥j
n+1
=vw⎡
⎣⎢
⎤
⎦⎥j
n
− Δth12
cv − c2w−v + cw⎡
⎣⎢
⎤
⎦⎥j
n
−cv − c2w−v + cw⎡
⎣⎢
⎤
⎦⎥j−1
n
+−cv − c2w−v − cw⎡
⎣⎢
⎤
⎦⎥j+1
n
−−cv − c2w−v − cw⎡
⎣⎢
⎤
⎦⎥j
n⎛
⎝⎜
⎞
⎠⎟
xf
wtf
v∂∂=
∂∂= ;
vtwt
⎛⎝⎜
⎞⎠⎟+0 − c2
−1 0⎛⎝⎜
⎞⎠⎟vxwx
⎛⎝⎜
⎞⎠⎟= 0
Finite volume upwind approximation:
Computational Fluid Dynamics
Higher Order Schemes
Computational Fluid Dynamics
Even though the fluxes were computed EXACTLY, the solution was very inaccurate due to numerical diffusion. Since the advection is exact, the problem must lie with the averaging of the solution and the assumption of a constant state in each cell
To generate more accurate schemes, we need to reconstruct a more accurate representation of the function in each cell.
Higher Order Methods
Computational Fluid Dynamics
For the first order spatial fluxes, the value in each cell was assumed to be a constant. For higher order computations of the spatial fluxes, the slope inside each cell is found
�
Fj+1/ 2n+1/ 2 = F f L( ) j+1/ 2
n+1/ 2, f R( ) j+1/ 2
n+1/ 2( )
Once the value at the cell boundary has been found, the flux is found using these values
Higher Order MethodsComputational Fluid Dynamics
For the Lax-Wendroff scheme the time and space discretization are closely linked.
In the Beam-Warming method, on the other hand, the time integration is independent of the spatial discretization
Higher Order Methods
Computational Fluid Dynamics
The separation of space and time discretization is generalized in the Method of Lines, where we convert the PDE into a set of ODEs for each grid point by writing:
df jdt
=−1Δx
Fj+1/2n − Fj−1/2
n( )The time integration can, in principle, be done by any standard ODE solver, although in practice we often use second order Runge-Kutta methods
Higher Order MethodsComputational Fluid Dynamics
To get a second order time integration, use a half-step predictor to give second order accuracy in time:
f jn+1/2 = f j
n −Δt2Δx
Fj+1/2n −Fj−1/2
n( )
f jn+1 = f j
n −ΔtΔx
Fj+1/2n+1/2 −Fj−1/2
n+1/2( )
Then correct by a midpoint rule:
where the fluxes are found at the half step
j-1 j j+1
Higher Order Methods
Computational Fluid Dynamics
For a method that is second order in time we therefore must find the fluxes twice. For the method on the last slide we find
�
Fj+1/ 2n = F f j
n, f j+1n( )
at the beginning of the step.And
at the half step. For a first order in space methods we take the values on either side to be the cell averages but for higher order methods the variables are extrapolated to the cell boundaries to give higher order fluxes.
�
Fj+1/ 2n+1/ 2 = F f L( ) j+1/ 2
n+1/ 2, f R( ) j+1/ 2
n+1/ 2( )
Higher Order MethodsComputational Fluid Dynamics
∂ f∂t
+ ∂F∂ x
= 0 fi (t) =1Δx
f (x, t)dxVi∫
ddtfi (t) =
1Δx
F( f (xi+1/2 ,t) − F( f (xi+1/2 ,t)( )
=1Δx
Fi+1/2 − Fi−1/2( ) = L( f )i
For high order methods the time integration is often done using high order Runge-Kutta methods, such the following third order method:
f (1) = f n + Δt L( f n )
f (2) = 34f n + 1
4f (1) + 1
4Δt L( f (1) )
f n+1 = 13f n + 2
3f (2) + 2
3Δt L( f (2) )
Computational Fluid Dynamics
A fairly general family of higher order methods can be constructed by weighing the slopes in each cell in different ways:
Higher Order MethodsComputational Fluid Dynamics
j j+1 j-1 j+2
1+jf 2+jf
jf1−jf
Ljf 2/1+
f j+1/2L = f j +
h2
1−κ2
⎛⎝⎜
⎞⎠⎟S− +
1+κ2
⎛⎝⎜
⎞⎠⎟S+⎡
⎣⎢⎤⎦⎥
Higher order fluxes
�
f j+1/ 2L = f j + h
2S
�
S+ =f j+1 − f j
hS− =
f j − f j−1h
Define slopes:
Define a weighted average:
�
k = 0 use 12 S
+ + S−( )k =1 use S+ only
k = −1 use S− only
Higher Order Methods
Computational Fluid Dynamics
f j+1/2L = f j +
h2
1−κ2
⎛⎝⎜
⎞⎠⎟S− +
1+κ2
⎛⎝⎜
⎞⎠⎟S+⎡
⎣⎢⎤⎦⎥
= f j +h2
1−κ2
⎛⎝⎜
⎞⎠⎟
f j − f j−1h
⎛⎝⎜
⎞⎠⎟+1+κ2
⎛⎝⎜
⎞⎠⎟
f j+1 − f jh
⎛⎝⎜
⎞⎠⎟
⎡
⎣⎢
⎤
⎦⎥
= f j +1−κ4
f j − f j−1( ) + 1+κ4 f j+1 − f j( )
Using
�
S+ =f j+1 − f j
hS− =
f j − f j−1h
We find
Higher Order MethodsComputational Fluid Dynamics
Rjf 2/1+
�
f j+1/ 2R = f j+1 −
1−κ4
f j+1 − f j( ) − 1+ κ4
f j+2 − f j+1( )
Similarly
�
f j+1/ 2R = f j+1 −
h2S
�
S+ =f j+2 − f j+1
hS− =
f j+1 − f jh
j j+1 j-1 j+2
1+jf 2+jf
jf1−jf
Higher Order Methods
Computational Fluid Dynamics
j j+1 j-1 j+2
1+jf 2+jf
jf1−jf
Ljf 2/1+
Rjf 2/1+
�
f j+1/ 2L = f j + 1−κ
4f j − f j−1( ) + 1+ κ
4f j+1 − f j( )
�
f j+1/ 2R = f j+1 −
1−κ4
f j+1 − f j( ) − 1+ κ4
f j+2 − f j+1( )
1for −=κ
Evaluation of the function at the cell boundary:
Different values of k give different second order schemes
Higher Order MethodsComputational Fluid Dynamics
Selecting k differently allows us to recover a number of standard schemes:
�
f j+1/ 2L = f j + 1−κ
4f j − f j−1( ) + 1+ κ
4f j+1 − f j( )
κ = −1κ = 0κ = 1 / 2κ = 1 / 3κ = 1
Second order upwindFromm’s schemeQUICKThird order upwindCentered scheme
Higher Order Methods
Computational Fluid Dynamics
�
f jn+1/ 2 = f j
n − Δt2h
Fj+1/ 2n − Fj−1/ 2
n( )
�
f jn+1 = f j
n − Δth
Fj+1/ 2n+1/ 2 − Fj−1/ 2
n+1/ 2( )
�
Fj+1/ 2n+1/ 2 = F f L( ) j+1/ 2
n+1/ 2, f R( ) j+1/ 2
n+1/ 2( )
Predictor step
Final step
where is a higher order flux
Can use first order fluxes for the predictor step
10 20 30 40 50 60 70 80-0.5
0
0.5
1
1.5
upwind
K=-1
K=0
K=1Example: Linear Advection
Higher Order MethodsComputational Fluid Dynamics
Notice that we can also write the flux as
�
f j+1/ 2L = f j + 1−κ
4f j − f j−1( ) + 1+ κ
4f j+1 − f j( )
f j+1/ 2
L =12
f j + f j+1( ) − 1−κ4
f j+1 − 2 f j + f j−1( )Where the fluxes appear as centered approximations with a stabilizing artificial dissipation
Higher Order Methods
Computational Fluid Dynamics
An even more general family of schemes can be constructed by writing
Where
f j+1/ 2
L = f j +12
B f j − f j−1, f j+1 − f j( )
f j+1/ 2
L = f j +12Ψ(r) f j − f j−1( )
r =
f j+1 − f j
f j − f j−1
Where B is a function of the slopes to the left and the right. Often we take
B f j − f j−1, f j+1 − f j( ) = Ψ(r) f j − f j−1( )
Giving
Later we will consider adjusting this function. Sometimes called limiter
Higher Order MethodsComputational Fluid Dynamics
The k scheme can be written in terms of the limiter
Ψ(r) =
1+κ2
r + 1−κ2
f j+1/ 2L = f j +
12Ψ(r) f j − f j−1( )
= f j +12
1+κ2
r + 1−κ2
⎛⎝⎜
⎞⎠⎟
f j − f j−1( )
= f j +12
1+κ2
f j+1 − f j
f j − f j−1
⎛
⎝⎜
⎞
⎠⎟ +
1−κ2
⎛
⎝⎜⎜
⎞
⎠⎟⎟
f j − f j−1( )
= f j +1+κ
4f j+1 − f j( ) + 1−κ
4f j − f j−1( )
r =
f j+1 − f j
f j − f j−1
As can be seen by substitution:
Higher Order Methods
Computational Fluid Dynamics
For the k scheme we have:
Ψ(r) =
1+κ2
r + 1−κ2
r =
f j+1 − f j
f j − f j−1
Ψ(r) =12
; κ = −1
Ψ(r) =r2+
12
; κ = 0
Ψ(r) = r; κ = 1
Second order upwind
Fromm’s scheme
Centered scheme
f j+1/ 2
L = f j +12Ψ(r) f j − f j−1( )
Higher Order MethodsComputational Fluid Dynamics
We can also write other schemes in this way. For example:
r =
f j+1 − f j
f j − f j−1
First order upwindLax-WendroffBeam-Warming
f j+1/ 2
L = f j +12Ψ(r) f j − f j−1( )
Ψ(r) = 0Ψ(r) = 1Ψ(r) = r
Higher Order Methods
Computational Fluid Dynamics
But what about the oscillations?
Computational Fluid Dynamics
Artificial Viscosity
Computational Fluid Dynamics
Use centered difference method (e.g. Lax-Wendroff) - Second order accuracy- Oscillation near discontinuity
In order to “damp out” oscillation, we can either- Use implicit numerical viscosity (upwind) or- Add an explicit numerical viscosity
Artificial Viscosity Computational Fluid Dynamics
Von Neumann and Richtmyer (1950)
0=∂∂+
∂∂
xF
tf
xf
Dhxf
FF∂∂=
∂∂−=′ 2; αα
Artificial Viscosity
Replace the flux by:
�
∂f∂t
+ ∂F∂x
= − ∂∂x
−α ∂f∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ = ∂
∂xDh2 ∂f
∂x∂f∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟ Giving:
O(1) coefficient
→ 0 as h → 0 - Simulates the effect of the physical viscosity on the grid scale, concentrated around discontinuity and negligible elsewhere.
- h2 is necessary to keep the viscous term of higher order.
Consider:
Computational Fluid DynamicsArtificial Viscosity
�
∂f∂t
+U ∂f∂x
= ∂∂x
Dh2 ∂f∂x
∂f∂x
⎛ ⎝ ⎜
⎞ ⎠ ⎟
Example: Linear Advection Equation:
f jn+1 = f j
n −UΔt2h
f j+1n − f j−1
n( ) + 12UΔth
⎛⎝⎜
⎞⎠⎟2
f j+1n − 2 f j
n + f j−1n( )
+Δth
Dh2∂f∂x
∂f∂x
⎛⎝⎜
⎞⎠⎟ j+1/2
− Dh2∂f∂x
∂f∂x
⎛⎝⎜
⎞⎠⎟ j−1/2
⎡
⎣⎢⎢
⎤
⎦⎥⎥
Discretization by Lax-Wendroff
Computational Fluid DynamicsArtificial Viscosity
Dh2∂f∂x
∂f∂x
⎛⎝⎜
⎞⎠⎟ j+1/2
= D fj+1n − f j
n f j+1n − f j
n( )Approximate:
f jn+1 = f j
n −UΔt2h
f j+1n − f j−1
n( ) + 12UΔth
⎛⎝⎜
⎞⎠⎟2
f j+1n − 2 f j
n + f j−1n( )
+ D Δth
f j+1n − f j
n f j+1n − f j
n( ) − f jn − f j−1
n f jn − f j−1
n( )⎡⎣ ⎤⎦
gives
1+jff j−1
jf
xj j+1 j-1
Computational Fluid DynamicsArtificial Viscosity
% Artificial Viscosity by LaxWendroff n=161; nstep=250; length=4.0;h=length/(n-1);dt=0.25*h; y=zeros(n,1);f=zeros(n,1);f(1)=1;time=0; for m=1:nstep,m hold off;plot(f,'linewidt',2); axis([1 n -0.5, 1.5]);hold on; plot([1,dt*(m-1)/h+1.5,dt*(m-1)/h+1.5,n],[1,1,0,0],'r','linewidt',2);pause; y=f; time=time+dt; for i=2:n-1, f(i)=y(i)-(0.5*dt/h)*(y(i+1)-y(i-1))+... (0.5*dt*dt/h/h)*(y(i+1)-2.0*y(i)+y(i-1))+...
+0.5*(dt/h)*(abs(y(i+1)-y(i))*(y(i+1)-y(i))-... abs(y(i)-y(i-1))*(y(i)-y(i-1)) );
end; end;
Computational Fluid Dynamics
20 40 60 80 100 120 140 160-0.5
0
0.5
1
1.5
20 40 60 80 100 120 140 160-0.5
0
0.5
1
1.5
20 40 60 80 100 120 140 160-0.5
0
0.5
1
1.5
upwind
Lax-Wendroff D=0
Lax-Wendroff D=0.5
Artificial Viscosity
Computational Fluid Dynamics
20 40 60 80-0.5
0
0.5
1
1.5Upwind Lax-Wendroff
Nonlinear advection equation
Computational Fluid Dynamics
Artificial viscosity can be used with most other centered difference schemes and was, for a while, THE way aeronautical computations were done. Other types, including higher order, have been used.
Computational Fluid Dynamics
What we know so far:
First-order methods result in a low accuracy and dissipative solution, particularly at a shock. The solution does, however, not oscillate (preserves monotonicity).
Second-order methods capture shocks better but produce wiggly solutions.
For the nonlinear advection equation, the first order captures the solution reasonably well, since the characteristics terminate in the shock
Computational Fluid Dynamics
The “Modern” view
Computational Fluid Dynamics
The formulation of second order schemes in terms of slopes allows us to understand the reason for oscillations near discontinuity. The construction of slopes leads to overshoots:
j j+1 j-1 j+2
1+jf 2+jf
jf1−jf
OscillationsComputational Fluid Dynamics
To prevent oscillations near shocks when using high order schemes, we have already talked about artificial viscosity where we attempt to smooth out oscillations around the shocks.
The more modern approach is to prevent the apparence of oscillations by either:
Limit the slopes when the variables are extrapolated to the cell boundaries
Limit the fluxes near shocks to prevent under or over shoot
Oscillations
Computational Fluid Dynamics
j j+1 j-1 j+2
1+jf 2+jf
jf1−jf
Near shocks the linear reconstruction leads to over and undershoots.
To prevent oscillations, apply LIMITERS to reduce the slopes where they will cause oscillations but leave then where they do not
Many possible limiters can be designed
OscillationsComputational Fluid Dynamics
Example: Linear Advection Equation
∂f∂t
+ U∂f∂x
= 0
�
F =Uf
�
Fj+1/ 2 =Uf j+1/ 2L
�
Ψ r( ) =r + r1+ r
rj+1/ 2 =
f j − f j−1
f j+1 − f j
�
Ψ = 2 if f j+1 − f j = 0
j j+1 j-1
1+jf
jf1−jf
Oscillations
Computational Fluid Dynamics
10 20 30 40 50 60 70 80-0.5
0
0.5
1
1.5
upwind Second order
Limited
OscillationsComputational Fluid Dynamics
The realization that we could enforce monotonicity in otherwise high order schemes using nonlinear limiters revolutionized the computation of flows with shocks. The idea originated with Bram van Leer and Jay Boris but has since been taken further by a large number of researchers. It is still an active area of research.
A large number of limiters have been proposed and we will examine a few of those in more detail.
Oscillations
Computational Fluid Dynamicshttp://www.nd.edu/~gtryggva/CFD-Course/
Diffusion versus dispersion
Godunov Theorem
Godunov Method
Upwind and Flux Splitting
Higher order schemes
Artificial viscosity