Computational Fluid Dynamics
Grétar Tryggvason !Spring 2013!
http://www.nd.edu/~gtryggva/CFD-Course/!
Advection!
Computational Fluid Dynamics 2!
Higher Order and more recent methods!
Computational Fluid Dynamics 3!
In many cases we have solutions that require a high order method away from the discontinuity to represent a rapidly varying but smooth solution.!
Beyond linear: Reconstruction of higher order approximations for the function in each cell (ENO and WENO). !
The critical step in the methods discussed so far is the construction of a linear slope in each cell and the limitation of this slope to prevent oscillations. For higher order methods, a higher order profile needs to be constructed!
ENO/WENO!Computational Fluid Dynamics
Example: Second order ENO!
f j+1/2 =f j + 1
2 amin Δf j+ ,Δf j
−( ), if 12 uj + uj+1( ) > 0
f j − 12 amin Δf j+1
+ ,Δf j+1−( ), if 1
2 uj + uj+1( ) < 0⎧⎨⎪
⎩⎪
Δf j+ = f j+1 − f j Δf j
− = f j − f j−1 j ! j+1 !j-1 !
1+jf
jf1−jff j−1/2 f j+1/2
U>0!
1. Construct left and right slopes by connecting the average values in adjacent cells!
2. Select the downstream flux by using the smaller slope!
ENO/WENO!
Computational Fluid Dynamics
∂ f∂t
+ u∂ f∂x
= 0
f j* = f j
n −Δthu jn f j+1/2
n − f j−1/2n( )
f jn+1 = f j
n −Δth12ujn f j+1/2
n − f j−1/2n( ) + uj
* f j+1/2* − f j−1/2
*( )( )
f j+1/2 =f j + 1
2 amin Δf j+ ,Δf j
−( ), if 12 uj + uj+1( ) > 0
f j − 12 amin Δf j+1
+ ,Δf j+1−( ), if 1
2 uj + uj+1( ) < 0⎧⎨⎪
⎩⎪
Δf j+ = f j+1 − f j Δf j
− = f j − f j−1
amin a,b( ) =a, a < bb, b ≤ a
⎧⎨⎪
⎩⎪
Second order ENO scheme for the linear advection equation!
ENO/WENO!Computational Fluid Dynamics
∂ f∂t
+ u∂ f∂x
= 0
Second order ENO scheme for the linear advection equation!
Blue: 2nd order ENO!
Red: 1st Upwind!
ENO/WENO!
Computational Fluid Dynamics
Generalize to higher order!
Computational 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 9!
Constructing an interpolation polynomial from the cell averages: For anything higher than second order (linear) the problem is that the average value in the cell is not equal to the value at the center. !
To get around this we look at the primitive function:!
The lower bound is arbitrary and can be replaced!
V x( ) ≡ v ξ( )
−∞
x
∫ dξ
ENO/WENO!
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
Computational Fluid Dynamics 10!
Since this is the integral over the cells, the discrete version is exact at the cell boundaries!
V xi+1/ 2( ) = v ξ( )
x j−1/2
x j+1/2∫ dξj=−∞
i
∑ = fiΔxj=−∞
i
∑
V xi−3/ 2( ); V xi−1/ 2( ); V xi+1/ 2( ); V xi+3/ 2( );
ENO/WENO!
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
Computational Fluid Dynamics 11!
A polynomial interpolating the edge values is given by P(x) and we denote its derivative by p(x)
Then it can be shown that!
That is, the integral of p(x) over the cell is equal to the cell average fi
p(x) = P '(x)
p ξ( )xi−1/2
xi+1/2∫ dξ = P ' ξ( )xi−1/2
xi+1/2∫ dξ = P(xi+1/2 ) − P(xi−1/2 )
=V (xi+1/2 ) −V (xi−1/2 ) = v ξ( )xi−1/2
xi+1/2∫ dξ = fiΔx
ENO/WENO!Computational Fluid Dynamics 12!
Thus, p(x) gives the correct average value in each cell and the integrated value gives the exact values of the primitive function at the cell boundaries.!
We need to write down a polynomial P(x) that interpolates the values of the primitive function of the cell boundaries and then differentiate this polynomial to get p(x), which lets us compute the variables at the cell boundary!
ENO/WENO!
Computational Fluid Dynamics
The interpolation polynomial is often taken to be the Lagrangian Polynomial !
P(x) = V (xi− r+m−1/ 2 )x − xi− r+ l−1/ 2
xi− r−1/ 2 − xi− r+ l−1/ 2l=0l≠m
k
∏m=0
k
∑
Where r determines where we start and k is the order!
ENO/WENO!
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
Computational Fluid Dynamics 14!
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
The question is now which point we select. We start by interpolating over one cell (linear). To add one point we can add either the point to the left or the right. In ENO we select the points based on the minimum absolute value of the divided differences of the function values!
ENO/WENO!
ENO: Essential Non-Oscillatory!
Computational Fluid Dynamics
WENO!
Reference: C-W Shu. High Order Weighted Essential Nonoscillatory Schemes for Convection Dominated Problems. SIAM Review, Vol. 51 (2009), 82-126.!
ENO/WENO!
Weighted Essential Non-Oscillatory!
Computational 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( )
fi+l =1Δx
pj (x)dx; l = −k + j,…, jVi+l∫
fi+l =1Δx
Q(x)dx; l = −k,…,kVi+l∫
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
Find the cell average by integrating polynomial representation of the function, first over a subset of the points and then over all the points!
ENO/WENO!
Computational Fluid Dynamics
p0 (xi+1/2 ) =13fi−2 −
76fi−1 +
116fi
p1(xi+1/2 ) = − 16fi−1 +
56fi +
13fi+1
p2 (xi+1/2 ) =13fi +
56fi+1 −
16fi+2
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
For a polynomial of order three, over the three intervals indicated we get!
ENO/WENO!Computational Fluid Dynamics
Q(xi+1/2 ) = γ j pj (xi+1/2 )j=0
k
∑
Q(xi+1/2 ) =130
fi−2 −1360
fi−1 +4760
fi +020
fi+1 −130
fi+2
γ 0 =110; γ 1 =
610; γ 2 =
310;
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
A polynomial for the whole interval is given by!
Which is a weighted average of the lower order polynomials!
ENO/WENO!
Computational Fluid Dynamics
β j = Δx2l−1Vi∫
∂l
∂xlpj (x)
⎛⎝⎜
⎞⎠⎟
2
dxl=1
k
∑
β0 =1312
fi−2 − 2 fi−1 + fi( )2 + 14 3 fi−2 − 4 fi−1 + fi( )2
β1 =1312
fi−1 − 2 fi + fi+1( )2 + 14 3 fi−1 − 4 fi + fi+1( )2
β2 =1312
fi − 2 fi+1 + fi+2( )2 + 14 3 fi − 4 fi+1 + fi+2( )2
Introduce a smoothness measure!
For our case this gives:!
ENO/WENO!Computational Fluid Dynamics
ω j =ω j
ω jj∑
; ω j =γ j
(ε + β j )j∑
fi+1/2− ≈ ω j pj (xi+1/2 )
j=0
k
∑
Then compute weights to find the smoothes approximation to the value of f at the cell boundary.!
First find:!
Then compute:!
The value on the other side is found in the same way!
ENO/WENO!
Computational Fluid Dynamics 21!
In the WENO (weighted essentially non-oscillating) scheme we use all the points but weigh the contribution of each according to a smoothness criteria. High-order WENO represents the current state-of-the-art in computing of flows with sharp interfaces!
Other smoothness criteria, weights, and interpolation functions have been studies, as well as how to implement the method on non-structured grids.!
ENO/WENO!
i-2 i-1 i i+1 i+2 i-3/2 i-1/2 i+1/2 i+3/2
Computational Fluid Dynamics
Other Approaches!
Computational Fluid Dynamics
xx = 0
qL qRq
ADER Schemes: Arbitrary DERivatives!
Solve a higher order (generalized) Riemann problem for smooth data on either side represented by polynomials !
Computational Fluid Dynamics
The CIP (Constrained Interpolation Polynomial) !Method (Yabe)!In addition to advecting the marker function f, its derivative is advected by fitting a third order polynomial through the function and its derivatives.!Start with!
Introduce!In 1D, the advection of the derivative is given by!
Therefore, the derivative is translated with velocity u, just as the function. In 2D splitting is used to separate translation and deformation!
f and g given!
New f and g!
CIP-gradient augmentation!
Computational Fluid Dynamics
The CIP method results in very accurate advection and for a sharp interface it greatly reduces overshoots, but does not eliminate them completely!
CIP-gradient augmentation!Computational Fluid Dynamics
Although most high-order finite volume methods are based on updating the average value and reconstruct a higher order approximation, advecting more information is gaining some popularity!
Computational Fluid Dynamics
Semi-Lagrangian
Schemes!
Computational Fluid Dynamics
∂ f∂t
+U ∂ f∂ x
= 0
dfdt
= 0 on dxdt
=U
t
x
f (t, x) = f (t − Δt, x −UΔt)
Δt
UΔt
For the linear advection equation the solution is advected without change!
Computational Fluid Dynamics
t
x
f (t, x) = f (t − Δt, x −UΔt)
Δt
UΔt
f jn+1 = Intp( f n (x j
o ))
x jo = x j −UΔt
Interpolate the solution at the old time level, at a point given by tracing back the characteristic!
Computational Fluid Dynamics
t
x
x jo = x j − u(x(t),t)dt
t
t+Δt
∫
Δt
UΔt
f jn+1 = Intp( f n (x j
o ))
x jo = x j −
Δt2
u(x j ,t) + u(x jo,t + Δt)( )
∂ f∂t
+ u(x, t)∂ f∂ x
= 0
dfdt
= 0 on dxdt
= u
For higher order methods an iteration is necessary!
Computational Fluid Dynamics
For two and three-dimensional flows a multidimensional interpolation is necessary!
Linear interpolation is usually too diffusive but several higher order ones have been used!
Computational Fluid Dynamics
Semi-Lagrangian schemes are widely used in weather forecasting and simulations of plasma, for example!
Computational 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 Splitting!
Computational 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
Enormous progress has been made in solution techniques for hyperbolic systems with shocks in the last twenty years. Advanced methods are now able to resolve complex shocks within a grid space or two, even in multidimensional situations for a large range of governing parameters and physical complexity.!
Here, we have only examined relatively elementary aspects of methods for hyperbolic systems, but this short introduction should have taught you methods to solve such systems and introduced you to literature.!
Computational Fluid Dynamics
Increasingly we see methods developed for the inviscid Euler equation with shocks being used for the advection part of the Navier-Stokes solvers. !