ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler...

8
Computational Fluid Dynamics Grétar Tryggvason Spring 2011 http://www.nd.edu/~gtryggva/CFD-Course/ Solving the Euler Equations Computational Fluid Dynamics The Euler equations for 1D flow: 0 ) / ( 2 = + + + ρ ρ ρ ρ ρ ρ ρ p E u p u u x E u t E = e + u 2 /2 Ideal Gas: where The Euler Equations p = ρRT; e = eT ( ) ; c v = de / dT h = hT ( ); c p = dh / dT R = c p c v ; γ = c p / c v ; p = γ 1 ( ) ρe h = e + p / ρ; H = h + u 2 /2 = E + p / ρ; Define Computational Fluid Dynamics The Euler equations for 1D flow: 0 ) / ( 2 = + + + ρ ρ ρ ρ ρ ρ ρ p E u p u u x E u t The Euler Equations f = ρ ρu ρ E ; F = ρu ρu 2 + p ρu( E + p / ρ) t f + x F = 0 or where Computational Fluid Dynamics f j n +1/2 = f j n Δt 2h F j +1/2 n F j 1/2 n ( ) f j n +1 = f j n Δt h F j +1/2 n +1/2 F j 1/2 n +1/2 ( ) F j +1/2 n +1/2 = F f L ( ) j +1/2 n +1/2 , f R ( ) j +1/2 n +1/2 ( ) Predictor step Variables f j +1/2 L = f j n +1/2 + 1 2 Ψ L f j n +1/2 f j 1 n +1/2 ( ) f j +1/2 R = f j +1 n +1/2 1 2 Ψ R f j +1 n +1/2 f j n +1/2 ( ) Final step Predictor-corrector method: Limiting the variables Find: The Euler Equations Computational Fluid Dynamics 5 The Euler equations can be solved using the flux limited high order methods described earlier by finding the fluxes using solutions to the Riemann problem F j +1/2 n +1/2 = F f L ( ) j +1/2 n +1/2 , f R ( ) j +1/2 n +1/2 ( ) In principle we can solve this problem, the Riemann problem, exactly by assuming constant states and then integrate the fluxes over the time step. In the last lecture we did so for the case when the fluids are initially at rest. The Euler Equations Computational Fluid Dynamics 6 Although the Riemann problem can be solved for the general case when the fluids are not stationary, the solution is expensive (involving solving a nonlinear equation for the pressure ratio across the shock) and the only information that we need from the solution is the flux across the cell boundary. Therefore, usually we use approximate Riemann solvers. Different approximations are possible but generally the result is a complex process. Here we will only outline it briefly The Euler Equations

Transcript of ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler...

Page 1: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics

Grétar Tryggvason !Spring 2011!

http://www.nd.edu/~gtryggva/CFD-Course/!

Solving the Euler

Equations!

Computational Fluid Dynamics

The Euler equations for 1D flow:! 0

)/(

2 =⎟⎟⎟

⎜⎜⎜

++

∂∂+

⎟⎟⎟

⎜⎜⎜

∂∂

ρρρρ

ρρρ

pEupu

u

xEu

t

E = e + u2 /2

Ideal Gas:!

where!

The Euler Equations!

p = ρRT; e = e T( ); cv = de /dT

h = h T( ); cp = dh /dT

R = cp − cv; γ = cp /cv; p = γ −1( )ρe

h = e + p / ρ; H = h + u2 / 2 = E + p / ρ;Define!

Computational Fluid Dynamics

The Euler equations for 1D flow:! 0

)/(

2 =⎟⎟⎟

⎜⎜⎜

++

∂∂+

⎟⎟⎟

⎜⎜⎜

∂∂

ρρρρ

ρρρ

pEupu

u

xEu

t

The Euler Equations!

f =ρρuρE

⎜⎜⎜

⎟⎟⎟

; F =ρuρu2 + pρu(E + p / ρ)

⎜⎜⎜

⎟⎟⎟

∂∂t

f + ∂∂x

F = 0or!

where!

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!

Variables!

f j+1/ 2L = f j

n+1/ 2 + 12ΨL f j

n+1/ 2 − f j−1n+1/ 2( )

f j+1/ 2R = f j+1

n+1/ 2 − 12ΨR f j+1

n+1/ 2 − f jn+1/ 2( )

Final step!

Predictor-corrector method: Limiting the variables!

Find:!

The Euler Equations!

Computational Fluid Dynamics 5!

The Euler equations can be solved using the flux limited high order methods described earlier by finding the fluxes using solutions to the Riemann problem!

Fj+1/ 2n+1/ 2 = F f L( ) j+1/ 2

n+1/ 2, f R( ) j+1/ 2

n+1/ 2( )In principle we can solve this problem, the Riemann problem, exactly by assuming constant states and then integrate the fluxes over the time step. In the last lecture we did so for the case when the fluids are initially at rest.!

The Euler Equations!Computational Fluid Dynamics 6!

Although the Riemann problem can be solved for the general case when the fluids are not stationary, the solution is expensive (involving solving a nonlinear equation for the pressure ratio across the shock) and the only information that we need from the solution is the flux across the cell boundary.!

Therefore, usually we use approximate Riemann solvers. Different approximations are possible but generally the result is a complex process. Here we will only outline it briefly!

The Euler Equations!

Page 2: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics 7!

The Roe approximate Riemann solver was one of the first method to compute the fluxes in a “simpler” way.!

It is based on approximating the Euler equation by a linear equation !

whose fluxes can be found analytically. The linearization is done in such a way that the correct wave speed is preserved. The jump in the solution across a shock can be written in terms of the eigenvectors:!

∂f∂t

+ A ∂f∂x

= 0

fR − fL = α p

p=1

3

∑ Rp

The Euler Equations!Computational Fluid Dynamics 8!

Roe introduced the following matrix A!

u =

ρLuL + ρR uR

ρL + ρR

; H =ρL HL + ρR HR

ρL + ρR

A =

0 1 0γ − 3

2u 2 3− γ( )u γ −1

γ −12

u 3 − uH H − γ −1( )u 2 γ u

⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥

where the average variables are defined by!

The Euler Equations!

Computational Fluid Dynamics 9!

The fluxes are given by!

where the eigenvalues are the same as for the original !

and the scaled eigenvectors are given by!

Fi+1/ 2 =

12

F L + F R( ) − 12

λp α pp=1

3

∑ Rp

R1 =1

u − cH − u c

⎜⎜⎜

⎟⎟⎟

; R1 =

1u

12

u 2

⎜⎜⎜⎜

⎟⎟⎟⎟

; R1 =1

u + cH + u c

⎜⎜⎜

⎟⎟⎟

;

λ1 = u − c ; λ2 = c ; λ3 = u + c ;

The Euler Equations!Computational Fluid Dynamics 10!

u =

ρLuL + ρR uR

ρL + ρR

; H =ρL HL + ρR HR

ρL + ρR

; c 2 = γ −1( ) H −12

u 2⎛⎝⎜

⎞⎠⎟

α1

α2

α3

⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥

=

u4c

2 + γ −1( )uc

⎛⎝⎜

⎞⎠⎟

−1

2c1+ γ −1( )u

c⎛⎝⎜

⎞⎠⎟

γ −12

1c 2

1−γ −1

2u 2

c 2 γ −1( ) uc 2 − γ −1( ) u

c 2

−u4c

2 − γ −1( )uc

⎛⎝⎜

⎞⎠⎟

12c

1− γ −1( )uc

⎛⎝⎜

⎞⎠⎟

γ −12

1c 2

⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥

Δρ j+1/ 2

Δρuj+1/ 2

ΔρE j+1/ 2

⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥⎥⎥

The alphas are given by!

Δρ j+1/ 2 = ρ j+1/ 2

R − ρ j+1/ 2L ; Δρuj+1/ 2 = ρuj+1/ 2

R − ρuj+1/ 2L ; ΔρE j+1/ 2 = ρE j+1/ 2

R − ρE j+1/ 2L

Where the jumps across the cell boundary are:!

and (again)!

The Euler Equations!

Computational Fluid Dynamics 11!

Fi+1/ 21 =

12

ρu( ) j+1/ 2

R+ ρu( ) j+1/ 2

L( ) − 12λ1α1 −

12λ2α2 −

12λ3α3

Fi+1/ 22 =

12

γ −1( ) ρE( ) j+1/ 2

R−

12γ − 3( ) ρu( ) j+1/ 2

R( )2

ρ( ) j+1/ 2

R⎛⎝⎜

+

γ −1( ) ρE( ) j+1/ 2

L−

12γ − 3( ) ρu( ) j+1/ 2

L( )2

ρ( ) j+1/ 2

L ⎞⎠⎟

−12λ1α1 u − c( ) − 1

2λ2α2u −

12λ3α3 u + c( )

Fi+1/ 23 =

12

ρu( ) j+1/ 2

RH R + ρu( ) j+1/ 2

LH L( )

−12λ1α1 h − u c( ) − 1

2λ2α2u

2 −12λ3α3 h + u c( )

The fluxes are given by!

The Euler Equations!Computational Fluid Dynamics 12!

f (1) = f n + ΔtL f n( )f (2) =

34

f n +14

f (1) +14ΔtL f (1)( )

f n+1 =13

f n +23

f (2) +23ΔtL f (2)( )

3rd order Runge-Kutta!

f (1) = f n + ΔtL f n( )f (2) = f (1) + ΔtL f (1)( )f n+1 =

12

f n + f (2)( )

2rd order Runge-Kutta!

f (0) = f n

f (1) = f (0) +14ΔtL f n( )

f (2) = f (0) +13ΔtL f (1)( )

f (3) = f (0) +12ΔtL f (2)( )

f n+1 = f (0) + ΔtL f (2)( )

4rd order Runge-Kutta!

Time Integration!

The Euler Equations!

Page 3: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics 13!

Results from:!

PRINCIPLES OF COMPUTATIONAL !FLUID DYNAMICS by P. Wesseling, !Delft University of Technology, !The Netherlands !

Matlab codes available at the website!

http://ta.twi.tudelft.nl/users/wesselin/cfdbook.html!

The Euler Equations!Computational Fluid Dynamics 14!

48 gridpoints!

The Euler Equations!

Computational Fluid Dynamics 15!

148 gridpoints!

The Euler Equations!Computational Fluid Dynamics 16!

The Roe approximate Riemann solver generally gives well behaved results but it does allow for expansion shocks in some cases. This can be corrected by the so-called “entropy fix” (see Wesseling)!

The Euler Equations!

Computational Fluid Dynamics 17!

The TVD property gives monotonic behavior for 1D scalar conservation laws but generally not for nonlinear systems or multidimensional flows. However, generally it is found that schemes that satisfy the TVD property when applied to 1D scalar equation do well for systems. When used for multidimensional flows by splitting, they are also generally found to be well behaved.!

The Euler Equations!Computational Fluid Dynamics 18!

Several variants of similar methods have been proposed. !

One of the better known is the AUSM (Advection Upstream Splitting Method) family of methods, originally due to Liou and Steffen (1993), where the fluxes are split into convective and a pressure part. The method and its derivatives have been used widely for many aerospace and other applications, including multiphase flows. !

The Euler Equations!

Page 4: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics

The Euler Equations in two-

dimensions!

Computational Fluid Dynamics

For the Euler equations:!

∂∂t

ρρuρvρE

⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟

+ ∂∂x

ρuρu2 + pρuv

ρu(E + p /ρ)

⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟

+ ∂∂y

ρvρuv

ρv 2 + pρv(E + p /ρ)

⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟

= 0

E = e + (u2 + v 2) /2; p = (γ −1)ρe

In vector form!

where!

∂f∂t

+ ∂F∂x

+ ∂G∂y

= 0

The Euler Equations!

Computational Fluid Dynamics

Two-dimensional problems are almost always solved by splitting where we apply one-dimensional methods to each direction in sequence!

The Euler Equations!Computational Fluid Dynamics

F ± = ± ρ4c

u ± c( )2

1

γ −1( )u ± 2cγv

v 2

2+

γ −1( )u ± 2c[ ]22 γ 2 −1( )

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

G± = ± ρ4c

v ± c( )2

1u

γ −1( )v ± 2cγ

u2

2+

γ −1( )v ± 2c[ ]22 γ 2 −1( )

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

∂f∂t

+ ∂F+

∂x+ ∂F−

∂x+ ∂G+

∂y+ ∂G−

∂y= 0Flux vector splitting!

The Euler Equations!

Computational Fluid Dynamics

Shock!Computational domain!

Outflow!Given inflow!

wall!

1!3!

Results from a review paper:!

P. Woodward and P. Colella:!

The Numerical Simulation of two-Dimensional Fluid Flow with Strong Shocks. !

J. Comput. Phys. 54 (1984), 115-173.!

The Euler Equations!Computational Fluid Dynamics

Godunovʼs method! MacCormacʼs method!

h

0

h=1/30

h=1/60

h=1/120

The Euler Equations!

Page 5: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics

MUSCL! PPM!

h

0

h=1/30

h=1/60

h=1/120

The Euler Equations!Computational Fluid Dynamics 26!

Higher Order and more recent methods!

Computational Fluid Dynamics 27!

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 28!

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ξ

j-2 j-1 j j+1 j+2 j-3/2 j-1/2 j+1/2 j+3/2

ENO/WENO!

Computational Fluid Dynamics 29!

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

j-2 j-1 j j+1 j+2 j-3/2 j-1/2 j+1/2 j+3/2

V xi−3/ 2( ); V xi−1/ 2( ); V xi+1/ 2( ); V xi+3/ 2( );

ENO/WENO!Computational Fluid Dynamics 30!

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 ξ( )x j−1/2

x j+1/2∫ dξ = P ' ξ( )x j−1/2

x j+1/2∫ dξ = P(x j+1/ 2 ) − P(x j−1/ 2 )

=V (x j+1/ 2 ) −V (x j−1/ 2 ) = v ξ( )x j−1/2

x j+1/2∫ dξ = fiΔx

ENO/WENO!

Page 6: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics 31!

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 32!

j-2 j-1 j j+1 j+2 j-3/2 j-1/2 j+1/2 j+3/2

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!

Computational Fluid Dynamics 33!

j-2 j-1 j j+1 j+2 j-3/2 j-1/2 j+1/2 j+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!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!

Page 7: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics 37!

j-2 j-1 j j+1 j+2 j-3/2 j-1/2 j+1/2 j+3/2

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!

For a recent reference on WENO see, for example:!C-W Shu. High Order Weighted Essential Nonoscillatory Schemes for Convection Dominated Problems. SIAM Review, Vol. 51 (2009), 82-126.!

ENO/WENO!Computational Fluid Dynamics 38!

Increasingly we see methods developed for the inviscid Euler equation with shocks being used for the advection part of the Navier-Stokes solvers. !

Computational Fluid Dynamics

Other Approaches!

39! 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!

40!

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!

41!

CIP-gradient augmentation!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.!

Page 8: ρup Solving the x ρρ uEp (/) Euler Equationsgtryggva/CFD-Course/2011-Lecture-17.pdf · The Euler equations can be solved using the flux ... Flux vector splitting! =0 The Euler

Computational Fluid Dynamics 43!

A few words about the project:!

I asked you to select your own parameters. In doing so keep in mind that while Nature usually presents us with problems that have multiphysics problems with a large range of scales and extreme values of the physical properties, in CFD we prefer single physics, small range of scales and O(1) values for the physical properties. In the project you are simply showing that the code works and looking at trends. Using Matlab you are limited to modest resolution and run-time so you should select you parameters commensurate with the resolution you are using! !