# Modern Numerical Methods for Fluid Flow

P. Colella and E. G. Puckett

3. Systems of conservation laws
Let’s now turn our attention to systems of equations which define conservation laws in one spatial dimension. We would like to solve an initial-value problem for U ( x, t ) ∈ ℜ N with F ( U ) ∈ ℜ N such that: ∂U ∂F ( U ) + = 0 ∂t ∂x
(1)

with U(x,0) = Uo given. We now know that, even for smooth Uo, the solution can develop discontinuities in finite time. So, we need a numerical method that will recognize and accommodate this limitation. For example, a weak solution will do:
xR tN N

xL

∫ [ U ( x, t

) − U ( x, t ) ] dx +
0

∫ [ F ( U ( xR, t ) ) − F ( U ( xL, t ) ) ] dt
t
0

= 0

(2)

Note that U now represents a vector, with each component of U corresponding to a conserved quantity. For the case of gas dynamics, the conserved quantities are density ρ, momentum, ρu, and energy ρE: U = ( ρ, ρu, ρE ) T F ( U ) = ( ρu, ρu 2 + p, ρuE + up )
T

The pressure p is assumed to be a function of density and internal energy e, where e is defined by: e = E− u2 2
(3)

so that pressure may be given by, for example: p = ρe γ−1
(4)

where γ is the ratio of specific heats at constant pressure to that at constant volume.

3.1 The linearized perturbation equations
Assume that U can be expressed as some base state, Uo, with a small perturbation around that state, U´, i.e., U = U o + U′
(5)

The state Uo is taken to be constant. We can substitute the expansion of equation (5) into the PDE (1):

Draft of January 30, 1998

70

A has n linearly independent right eigenvectors rk: Ar k = λ k r k (9) where λk are real eigenvalues. In this case. …. we will drop the prime on U. Colella and E. Define R to be the rectangular matrix made up of columns of n right eigenvectors: R = ( r 1. r n ) Then by equation (9) AR = RD or R −1 AR = D where D is the diagonal matrix comprised of the eigenvalues: λ1 0 0 0 … 0 0 0 λn (12) (11) (10) D = First.Modern Numerical Methods for Fluid Flow ∂U′ ∂F ( U o + U′ ) + = 0 ∂t ∂x P. 1998 71 . …. G. first use the definition of the gradient of F with respect to U to denote: A ( U o ) = ∇ UF then we can expand F by F ( U o + U′ ) = F ( U o ) + A ( U o ) U′ + … (7) U = Uo = ∂F i ∂U j (6) U = Uo Neglecting terms of higher order than the perturbation U´. This will allow us to diagonalize A and decouple the system of equations (8). What conditions on A are necessary for us to be able to solve this system of equations? Suppose that the system is hyperbolic. Puckett To write equation (5) in linearized form. Notice that A(Uo) is a constant-valued matrix since the gradient of F is evaluated at the base state Uo. we can form the linearized perturbation equation: ∂U′ ∂U′ + A ( Uo ) = 0 ∂t ∂x (8) After this point. premultiply equation (8) by R-1 (where RR-1 is the identity matrix): Draft of January 30. r k.

Puckett R −1 Since R-1 is a constant. 0 ) The idea is to work for as long as we can in U variables.1 Perturbations of the Riemann problem Let’s now consider some small perturbations δUL. w k. The initial conditions on W are W ( x. …. then we obtain the system of equations. it can be taken inside the derivatives. Colella and E.R to the Riemann problem about the base states UL. w n ) . If x l k δU L = 0…for… ( λ k > ) t and x l k δU R = 0…for… ( λ k < ) t then U ( x. Let U P = U L + δU L L U P = U R + δU R R Pick some point x/t. (15) 3. …. 1998 72 . t ) = U P ( x. t ) (20) (19) (18) (16) (17) Draft of January 30.Modern Numerical Methods for Fluid Flow ∂U ∂U + R −1 ARR −1 =0 ∂t ∂x P. G. 0 ) = R −1 U ( x. Now use equation (11) above for D to obtain: ∂ ( R −1 U ) ∂ ( R −1 U ) +D = 0 ∂t ∂x If we define W = R −1 U = ( w 1.R. ∂W ∂W +D = 0 ∂t ∂x which can also be written as n uncoupled scalar advection equations. ∂w k ∂w k + λk = 0 ∂t ∂x (14) (13) Note that the eigenvalues represent the wavespeed of the kth component of W.1.

using the definition of αk α P = α k − l k δU L k Substituting this expression into equation (21) we find U P ( x. Colella and E. Puckett x λk < t ∑ αP rk k (21) (22) x λk < t ∑ αk rk − x λk < t ∑ l k δU L r k and. t ) = U L + δU L + or finally Draft of January 30. so that ∑ ( lk δUL ) rk k = δU L (24) Putting equation (24) into (23) U P ( x.Modern Numerical Methods for Fluid Flow Proof: U P ( x. t ) = U L + δU L + P. t ) = U L + δU L + where α P = l k ( U R + δU R − U L − δU L ) k but l k δU R = 0 for λk < x/t so that the above equation is α P = l k ( U R − U L − δU L ) k = l k ( U R − U L ) − l k δU L Or. using the fact that l k δU L = 0 for λk > x/t U P ( x. RL = I. G. 1998 73 x λk < t ∑ α k r k − δU L . t ) = U L + δU L + But since x λk < t ∑ α k r k − ∑ ( l k δU L ) r k k (23) ∑ ( lk δUL ) rk = ∑ ( LδUL ) k rk k k = RLδU L By construction.

t ) = U ( x. we use a piecewise linear interpolation function. Colella and E. G. (27) (ii) solve the PDE exactly along the cell edge. 1 ( j + ) ∆x 2 Un ≈ j 1 ∆x 1 ( j − ) ∆x 2 ∫ U ( x. ∂U n. Puckett (25) 3. we can think of the function U as a sequence of constant states separated by jumps at the cell edges. n + 1 ∂U n. (iii) use conservative ﬁnite differencing to interpolate the new solution onto the grid: Un + 1 = Un + j j where the ﬂux F is given by: F j + 1 ⁄ 2 = AU j + 1 ⁄ 2 (30) ∆t [F − Fj + 1 ⁄ 2 ] ∆x j − 1 ⁄ 2 (29) For first-order Godunov. n∆t ) dx (26) We then: (i) ﬁnd the interpolation function UI(x) subject to the constraint that 1 ( j + ) ∆x 2 U n ∆x = j 1 ( j − ) ∆x 2 ∫ U I ( x ) dx . We then solve the Riemann problem at the cell edges with the values in adjacent cells corresponding to the left and right states (depending on the sign of the wavespeed λk): U ( x. we know how much conserved “stuff” is in each cell.Modern Numerical Methods for Fluid Flow U P ( x. n + 1 I I +A = 0 ∂t ∂x (28) where the double superscript indicates that this solution for UI(x) exists between time levels n∆t and (n+1)∆t. i.e.2 The ﬁrst order Godunov method The methodology for solving a scalar uncoupled system of equations like this one is very similar to the approach we used for a single scalar equation.1. 0 ) = { or UL … ( x < 0 ) UR … ( x > 0 ) (31) Draft of January 30. 1998 74 . t ) P. At each time step.

Draft of January 30. t ) = w k ( x − λ k t. What happens to U? First. Puckett wkL … ( x < 0 ) . 0 ) = { R −1 U L … ( x < 0 ) P. t ) = U L + where αk = lk ( UR − UL ) (39) (37) x λk < t ∑ αk rk (38) We are now in a position to show that multiplying U on the left by lk will yield the components of w that travel at speed λk. 0 ) = { wkR … ( x > 0 ) R −1 U R … ( x > 0 ) The exact solution to the hyperbolic equation for wk given by equation (14) above is w k ( x. Colella and E. define a left-eigenvector matrix. analogous to R. 1998 75 . w k ( x. L. 0 ) (32) Consider the case of an isolated wave with constant speed λk. which is made up of n rows of left eigenvectors which satisfy: lk A = λk lk so that L looks like: l1 = … ln (33) L = R −1 (34) Find the left and right states for the Riemann solver: UL = { and UR = { U j …if… ( λ k > 0 ) U j + 1 …if… ( λ k < 0 ) UL … ( x < 0 ) UR … ( x > 0 ) (36) U j − 1 …if… ( λ k > 0 ) U j …if… ( λ k < 0 ) (35) Then solve the Riemann problem with: U ( x. 0 ) = { so that U ( x. G.Modern Numerical Methods for Fluid Flow W ( x.

To see this multiply equation (42) on the left by lk and observe what happens to the flux: Draft of January 30. Puckett x λ k′ < t ∑ α k′ r k′ (40) We can think of wk as the amplitude of the traveling disturbance for the kth wave. Colella and E. we can update the solution by Un + 1 = Un + j j where F j + 1 ⁄ 2 = AU RP 1 ⁄ 2 j+ Define for discrete values wn = lk Un k j j ∆t [F − Fj + 1 ⁄ 2 ] ∆x j − 1 ⁄ 2 (41) (42) (43) Then  wn +  kj =   wn +  kj ∆t λ k ( w n − w n ) …if… ( λ k > 0 ) kj kj − 1 ∆x ∆t λ ( w n − w n ) …if… ( λ k < 0 ) kj + 1 ∆x k kj wn + 1 k j (44) The second terms on the right represent the flux in and out of the cell.3 The ﬁrst-order Godunov method (continued) If we define URP as the solution to the Riemann problem with left and right states as Ujn and Unj+1.1. In this analysis. t ) = l k U L = wk And for λk < x/t: l k U ( x. t ) = l k U L + l k ( U L − U R ) = lk UR = wk R L P. t ) = l k U L + l k For λk ≥ x/t: l k U ( x. 1998 76 . G. since there is no global analog like wk for general nonlinear problems. we would like to keep things in terms of U as far as possible. 3. The way to extract that amplitude from the “primitive” variables U is to perform the vector multiplication lkU.Modern Numerical Methods for Fluid Flow l k U ( x.

The steps which we must follow are: (i) Interpolate for UI(x).4 The second-order Godunov method By now. Colella and E. (a) Compute that left and right states at the cell edges. To calculate the limiter we must define right.1. 1998 77 . Let n α L = l k ( U n − U n− 1 ) = w n − w k j j k k j j j−1 (47) Draft of January 30.Modern Numerical Methods for Fluid Flow P. G.and second-order Godunov is the use of limiting. (ii) Solve for UI(x) exactly. In terms of the amplitudes wk we have: wk ( x ) = lk Un + lk j I ( x − j∆x ) ∆U j ∆x = wn + k j ( x − j∆x ) l k ∆U j ∆x ( x − j∆x ) ∆w k j ∆x = wn + k j We use a slope limiter to prevent oscillations in wk. Puckett l k F j + 1 ⁄ 2 = l k AU RP 1 ⁄ 2 j+ = λ k l k U RP 1 ⁄ 2 j+ n  λ k w kj …if… ( λ k > 0 ) =  n  λ k w kj + 1 …if… ( λ k < 0 ) 3. (b) Solve the Riemann problem.j. similar to van Leer. (iii) Update the solution onto the grid with conservative ﬁnite differencing. We interpolate in a piecewise linear fashion by: UI ( x ) = Un + j ( x − j∆x ) ∆U j ∆x (45) where ∆Uj is the finite-difference approximation to ∆U j ≈ ∆x ∂U ∂x (46) j∆x when the solution is smooth and which includes limiting when it is not. left and center αk. the routine should be fairly clear. The big difference between first.

this is precisely the Godunov predictor that we want. evaluated at x/t = 0 to obtain U j + 1 ⁄ ⁄2 . compute the solution to the Riemann n+1 2 problem. G. To compute the predictor for second-order Godunov on the wk’s. use an upstream-centered Taylor expansion: n+1 2 U j + 1 ⁄ ⁄2 = U n + j L ∆t ∂U ∆x ∂U + +… 2 ∂t 2 ∂x ≈ Un + j so that ∆t ∂U 1 ( I − A ) ∆x 2 ∆x ∂x n+1 2 U j + 1 ⁄ ⁄2 = U n + j L ∆t 1 ( I − A ) ∆U j 2 ∆x (51) ∆t 1 +1 2 U n+ 1 ⁄ ⁄2 = U n+ 1 − ( I + A ) ∆U j + 1 j j R 2 ∆x (52) Using equations (51) and (52) above as input states. Puckett n n α C = l k ( U j + 1 − U n− 1 ) = w k j k j j+1 n − wk j−1 (48) (49) n n αR = lk ( Uj + 1 − Un ) = wk j k j j+1 − wn k j Further define αk = { j ( sign ( α C ) ) min ( 2 α L . we obtain: +1 2 l k ( U n+ 1 ⁄ ⁄2 = U n + j j L ∆t 1 ( I − A ) ∆U j ) 2 ∆x (53) n wk + 1 ⁄ 2 = wn + k j+1⁄2 L j ∆t 1 ( 1 − λ k ) l k ∆U j 2 ∆x (54) For λk > 0. 1998 78 . Colella and E. 2 α R ) …if… ( α L α R > 0 ) k k k k k k j j j j j j (50) 0…otherwise When the solution is smooth. if we premultiply equation (51) for the left state above by lk. To compute the left kj and right states. Draft of January 30. α C . we would expect α C to be a minimum.Modern Numerical Methods for Fluid Flow P. we would like to claim that  wn + kj  =   wn +  kj + 1 ∆t 1 ( 1 − λ k ) ∆w n …if… ( λ k > 0 ) kj 2 ∆x ∆t 1 n ( 1 − λ k ) ∆w k …if… ( λ k < 0 ) j+1 2 ∆x +1 2 n l k U n+ 1 ⁄ ⁄2 = w k + 1 ⁄ 2 j j+1⁄2 However.

Draft of January 30.1.1 Stability of the method P. Note ˜ ˜ that UEj + 1 ⁄ 2 picks out the positive eigenvalues. is LTE = U n + 1 − L ( U n ) E E where L(UEn) is given by L ( Un ) = Un + E E ∆t ˜ ˜ ( AU Ej − 1 ⁄ 2 − AU Ej + 1 ⁄ 2 ) ∆x (59) (58) The second and third terms on the RHS of equation (59) come from the evaluation of the Riemann problem with left and right states given by ∆t 1 ˜ ( ∆U n ) j I−A U Ej + 1 ⁄ 2 = U n + E Ej 2 L ∆x ∆t 1 ˜ ( ∆U n ) j U Ej + 1 ⁄ 2 = U n − I + A E Ej 2 R ∆x (60) (61) We would like to use the Lax equivalence theorem to show that this method converges and that the rate of convergence is O(∆x2).4. Thus we need to prove that the following difference is the sum of a smooth function of order ∆x2 plus higher-order terms: 1 ˜ U Ej + 1 ⁄ 2 − U n + 1 ⁄ 2 = C ( ( j + ) ∆x ) ∆x 2 + O ( ∆x 3 ) Ej + 1 ⁄ 2 2 (62) ˜ It is easy to show that UEj + 1 ⁄ 2 − Un j++ 1 ⁄⁄22 is O(∆x2) by keeping a few more terms of the Taylor E 1 L expansion and using the PDE. 1998 79 . Thus. n∆t ) E j (57) We further assume the solution is smooth. LTE.2 Local truncation error Assume that we know the exact solution evaluated at discrete points in space and time U n = U ( j∆x.4. The local truncation error. We know that lk Un + 1 = wn + 1 j k j (55) and that the wk’s satisfy wn + 1 = wn + k k j j ∆t n ( λ wn + 1 ⁄ 2 − λk wk + 1 ⁄ 2 ) j+1⁄2 ∆x k kj − 1 ⁄ 2 (56) 3. G.Modern Numerical Methods for Fluid Flow 3. as was done for the linear scalar equation previously. Colella and E. Let’s analyze the case for λ k ≠ 0 . Puckett Since we are dealing with a system of uncoupled scalar equations the stability of this scheme can be proved exactly as for scalars.1. while UEj + 1 ⁄ 2 picks out the negative eigenL R values.

∂U ∂U + A ( U) = 0 ∂t ∂x (64) where A ( U ) = ∇ U F . G. We can rewrite equation (64) as.2. Then. 3. Recall from our previous discussion that have n eigenvalues λk and right eigenvectors rk. Puckett ˜ w kj + 1 ⁄ 2 (63) n+1⁄2 ˜ so that w kj + 1 ⁄ 2 − w Ej + 1 ⁄ 2 is O(∆x2).1 The general case Given the system of n equations in the vector U. as an illustration of why this is useful. The derivatives can then be transformed by: ∂V ∂U = ∇V U ∂t ∂t ∂U ∂V = ∇V U ∂x ∂x From the inverse function theorem ( ∇ V U ) −1 = ∇ U V Let AU = A(U). Colella and E. 1998 80 (65) (66) (67) ∂V ∂V + AU ∇V U = 0 ∂t ∂x (68) .Modern Numerical Methods for Fluid Flow ˜  w kj + 1 ⁄ 2L …for… ( λ k > 0 ) =  ˜  w kj + 1 ⁄ 2R …for… ( λ k < 0 ) P. ∇V U Premultiplying by ( ∇ V U ) −1 ∂V ∂V + ( ∇ V U ) −1 A U ∇ V U = 0 ∂x ∂t If we define AV by A V = ( ∇ V U ) −1 A U ( ∇ V U ) then we have obtained the equation: Draft of January 30. How do the eigenvectors and eigenvalues transform under a nonlinear changes of variable? Let’s begin by examining the general case. we will examine the specific case of gasdynamics. 3.2 The effect of a nonlinear change of variables Consider the following question. We would like to find a nonlinear change of variables V(U).

how can we figure out what rUk. e. A V r V = ( ∇ V U ) −1 A U ( ∇ V U ) r V k k = ( ∇ V U ) −1 A U ( ∇ V U ) ( ∇ V U ) −1 r U k = ( ∇ V U ) −1 A U r U k = λ k ( ∇ V U ) −1 r U k = λk rV k Thus we find that the eigenvalues do not change under this transformation. Therefore.g. (71) (70) 3. momentum and energy in one dimension are: ∂u Dρ +ρ = 0 ∂x Dt Du 1 ∂p + = 0 Dt ρ ∂x De p ∂u + = 0 Dt ρ ∂x (72) (73) (74) where ρ is the density of the fluid medium. it only changes what we measure it to be. 1998 81 .2. The eigenvalues represent the amplitude of that wave traveling in space. e is the internal energy and the pressure p is given by a constitutive relation p = p(ρ. Recall that Draft of January 30. and λVk. it makes sense that rU = ( ∇V U ) rV k k or equivalently ( ∇ V U ) −1 r U = r V k k Multiply equation (68) on the right by rVk to obtain. In nonconservate form the governing equations of continuity.Modern Numerical Methods for Fluid Flow ∂V ∂V + AV = 0 ∂t ∂x P. Puckett (69) If we can easily find AV.2 Gasdynamics We begin with a quick review. Changing our dependent variables does not change the physical wave speed. and λUk are supposed to be? We first consider what the rk’s tell us by examining the propagation of an isolated wave. rVk.e). u is the velocity. p = (γ-1)ρe.. Colella and E. Note that as a consequence we can save ourselves some work by finding acoordinate system in which the eigenvalues are easy to find. G.

u. u. You can verify for yourself that ρ 0 pe 1 A ( U ) = ρ pρ u ρ p 0 u ρ u (79) We would now like to get from these variables to the “primitive” variables by a nonlinear transformation. G. We defined the U variables as: U = (ρ.Modern Numerical Methods for Fluid Flow P. momentum ρu. Colella and E. uo. e): Draft of January 30. e)T We now define the transformed variables to be: V(U) = (ρ. and energy ρE. 1998 82 . eo and the subscripts denote differentiation with respect to that variable. p)T We can relate the two by V(U) = V(Uo) + ∇UVU´ (82) (81) (80) How can we accomplish this change? The governing equations for density and velocity above do not change. U is ρ U = u e Compare to the form used previously ρ ρ +A u u e et = 0 x u2 2 (75) (76) (77) (78) where A results from linearization about the base state of ρo. Puckett the conserved quantities are density. and that the energy is related to the internal energy by E = e+ and that the material derivative is defined by ∂ ∂ D = +u ∂x Dt ∂t For this case. Since p = p(ρ. but we need to do something different for the pressure.

G. 1998 83 (87) . As an exercise one can verify that the eigenvalues of both AU and AV are u+c. and u-c. the second matrix on the RHS reduces to a simple 2 by 2 system. using continuity ∂u Dp = − ρc 2 Dt ∂x so. This is the beauty of this change of variables. The right eigenvectors for AV are given by: 1 1 1 c c R = − 0 ρ ρ c2 0 c2 Draft of January 30. u. then these eigenvalues correspond to three waves: one moves backward relative to the disturbance’s speed. the matrix AV can be written as: 0 ρ 0 100 1 AV = u 0 1 0 + 0 0 ρ 001 2 0 ρc 0 (85) (84) (86) The eigenvectors of AV can be easily found by considering only the eigenvectors of the second matrix on the RHS. if we think of the initial data as an isolated disturbance (or ‘blip’). Denoting differentiation by subscripts ∂u ˙ Dp p ∂u = −pe 2 ρ − pρ ρ ∂x Dt ρ ∂x Since the speed of sound is defined by c2 = pe ˙ p + pρ ρ2 P.Modern Numerical Methods for Fluid Flow ∂p De ∂p Dρ Dp = + Dt ∂e ρ Dt ∂ρ e Dt by the chain rule. and one moves ahead of the disturbance. in V variables. Colella and E. since the first term on the RHS simply represents a shift in the propagation speed. Puckett (83) the material derivative of the pressure can be written as ∂u Dp = −c2 Dt ∂x or. Physically. one moves with the disturbance.