Burgers equation - a first look at fluid mechanics and non-linear partial differential equations In this assignment you will solve Burgers equation, which is useo model for example gas dynamics anraffic flow, and investigate the appearance of shock waves. We will however start with the simpler linear advection equation and proceed stepwise to Burgers equation. Background The Navier-Stokes equations describe the motion of fluid substances. They are non-linear partial differential equations that can be useo model a range of systems from water flowing in pipes to hot dense astrophysical plasma. Unfortunately, the nonlinearity makes most problems difficult or impossible to solve and leads to phenomena such as turbulence. The Navier-Stokes equations is the subject of contemporary research. Burgers equation is a one-dimensional Navier-Stokes equation valid for simplified conditions. Consider a mass element of a continuous substance. We assume now that the dynamics is only taking place in one dimension. Following Newton we have then for the mass element, dm, with cross section area A, moving in the x -direction with velocity u(x, t): F x = dm a x F x = dm du x dt F x = ρ du x Adx. (1) dt The velocity can change with time in two ways. First, the velocity varies in time at a certain point in space, and in addition the mass element changes its position with time anhereby, if the velocity is space-dependent, the velocity changes: F x = ρ du x dt Adx ( F x = ρ ) x + ρ x Adx ( F x = ρ ) x + ρu x x Adx (2) To apply Newton s equation we neeo know the total force that works on the mass element. We can in principle have three different type of forces. First there might be an external force (like the gravitational force). Second a pressure gradient over the mass element gives a net force, and last there are intermolecular forces within the medium that can be approximated with the help of the concept of viscosity. We first assume that all these forces are zero and obtain the result (skipping the index x on the velocity u(x, t)) + u(x, t) = 0, (3) which is the inviscid (i.e. without viscosity) Burgers equation. This equation is non-linear and it is the simplest equation for which the solutions can develop shock waves. Alternatively the equation can be written: This is an equation of the general form + 1 ( u(x, t) 2 ) = 0. (4) 2 + f(u) = 0. (5)
With viscosity Burgers equation is + u(x, t) = ν 2 u(x, t) 2, (6) where the ν is the kinematic viscosity. The kinematic viscosity is the (more common) dynamic viscosity divided by the density. The dynamic viscosity has dimension ML 1 T 1 (Nsm 2 in SI-units), while the kinematic viscosity has dimension L 2 T 1. The linear advection equation: Before we start with Burgers equation itself we look at the simpler linear advection equation: + v(x, t) = 0, (7) where the v(x, t) is a known function, we will even put it to a constant, v(x, t) = v 0. We can get some further insight into the solution to this equation with the method of characteristics. We look for a characteristic curve along which the equation is an ordinary differential equation. Instead of Eq.(7) we search an equation of the form First d u (x (s), t (s)) ds d u (x (s), t (s)) ds and by comparison with Eq.(7) we conclude that which leads to: d x d s = η (u, x (s), t (s)). (8) = d x d s + d s, (9) = v(x, t) and d s = 1 (10) d u ds = + v(x, t) = 0. (11) With constant v(x, t) = v 0, and with appropriate boundary conditions we get further = 1, an(s = 0) = 0 t d s = s d x d s = v 0 and x(s = 0) = x 0 x(s) = x 0 + v 0 s x(t) = x 0 + v 0 t d u d s = 0, and u(0) = f(x(t = 0)) u(x(t), t) = f(x(t = 0)) = f(x(t) v 0t). (12) We have thus founhat along the lines in the (x, t)-plane, defined by x(t) x 0 = v 0 t, the values of u remains constant. Imagine now an initial velocity distribution. When t increases it will move in space with velocity v 0, and it will keep its form. For example an initial velocity as a function of x (a Gaussian centered around x = 0): u(x, t = 0) = e x2 (13) will at later time t be i.e. a Gaussian centered around x = v 0 t u(x, t) = e (x v 0t) 2, (14)
Task Use a grid in x and a grid in t. Create a initial velocity profile in the form a Gaussian u(x, t = 0) = 1 2πσ 2 e (x x 0) 2 /(2σ 2 ) (15) 1) Solve the linear advection equation, Eq.(7), (with v(x, t) = v 0 ) to get u at later times with the following methods The FTCS (Forward Time Centered Space) method (Numerical Recipes Eq. 20.1.11). This method does not work, but it is really interesting to see how bad it is! The Lax Method (Numerical Recipes chapter 20.1.2). Note the small difference compareo FTCS. The Upwind Method ((Numerical Recipes Eq. 20.1.27). The Lax-Wendroff scheme (Numerical Recipes chapter 20.1.4 and below) 2) Solve the Burgers equation Eq.(4) with the Upwind method anhe Lax-Wendroff scheme (see below). Look at the velocity profile for rather small t to see the onset of shock waves. If you want to see shock waves in real life you can look at this article http://www.newscientist.com/article/dn13402 (includes a video). The methods for the linear advection equation Forward Time Centered Space (FTCS). With a two point formula for the derivatives we can write which is the forward form of the derivative, and which is the centered form. From Eq. (7) we then get: u(x j, t n+1 = u(x j, t n ) 1 2 This method can be shown to diverge regardless of the time-step. The Lax method; a slight change of the FTCS method where leads to u(x j, t n+1 ) u(x j, t n ), (16) t u(x j+1, t n ) u(x j 1, t n ), (17) 2 t (u(x j+1, t n ) u(x j 1, t n )). (18) u(x j, t n ) 1 2 (u(x j+1, t n ) + u(x j 1, t n )) (19) u(x j, t n+1 ) = 1 2 (u(x j+1, t n ) + u(x j 1, t n )) 1 2 (u(x j+1, t n ) u(x j 1, t n )), (20) which works much better. Why? Adding u(x j, t n ) on both sides of the equation we find: u(x j, t n+1 ) u(x j, t n ) = 1 2 (u(x j+1, t n ) 2u(x j, t n ) + u(x j 1, t n )) 1 2 Eq. (20) is thus identical to Eq. (18) up to the term (u(x j+1, t n ) u(x j 1, t n )). (21) 1 2 (u(x j+1, t n ) 2u(x j, t n ) + u(x j 1, t n )) 2 2 u(x j, t n ) 2 2. (22) This last term has the form of a viscosity term (cf. Eq. (6)). Viscosity models dissipation (loss of mechanical energy) and acts like a damping term. What happen with the velocity profile now? Try
and check! The Lax method give stable results for v < / t. The Upwind Method; Along the characteristic curves u stays constant. If (x x, t n ) lies on the same characteristic curve as (x j, t n + 1) u(x j, t n+1 ) = u(x x, t n ). (23) Now x x x j (which is exact if v is a constant, but otherwise it is the first approximation), and we can Taylor expand u(x x, t n ) around x j 1. u(x x, t n ) = u(x j 1 + (x x x j 1 ), t n ) u(x x, t n ) = u(x j 1, t n ) + (x j x j 1 ) (x j 1, t n ) +... u(x x, t n ) u(x j 1, t n ) + ( ) u(x j, t n ) u(x j 1, t n ) u(x j, t n+1 ) u(x j, t n ) v(x j, t n ) t (u(x j, t n ) u(x j 1, t n )). (24) This is the upwind method for v(x j, t n ) > 0. In the case when / t = v the method is in fact exact. For v(x j, t n ) < 0 we get in the same way, (see also Numerical Recipes) u(x j, t n+1 ) u(x j, t n ) v(x j, t n ) t (u(x j+1, t n ) u(x j, t n )). (25) The idea here was to get the values x x through linear interpolation between the known points. We can get higher numerical accuracy if we use three points instead of two. This is the Lax Wendroff scheme. The Lax Wendroff scheme: It is most easily understood if we note that knowing the solutions u(x j 1, t n ), u(x j, t n ), u(x j+1, t n ), we can construct a second order polynomial, p(x, t n ), which goes through these three points. p(x, t n ) = (x x j )(x x j+1 ) (x j 1 x j )(x j 1 x j+1 ) u(x j 1, t n ) + (x x j 1)(x x j+1 ) (x j x j 1 )(x j x j+1 ) u(x j, t n ) + (x x j 1 )(x x j ) (x j+1 x j 1 )(x j+1 x j ) u(x j+1, t n ). (26) We have further from the characteristic lines that if (x x, t n ) lies on the same line as (x j, t n + 1), and with v = constant: x x x j 1 = (1 v t ) x x x j = v t x x x j+1 = (1 + v t ). (27) Combining Eq.(26) and Eq.(27) we get: u(x j, t n+1 ) = u(x x, t n ) u(x j, t n+1 ) p(x x, t n ) u(x j, t n+1 ) 1 2 + (1 + v t 1 2 v t v t (1 + )u(x j 1, t n ) )(1 v t )u(x j, t n ) v t v t (1 )u(x j+1, t n ). (28)
Rearranging the terms we see that this equals u(x j, t n+1 ) u(x j, t n ) 1 v t 2 (u(x j+1, t n ) u(x j 1, t n )) + 1 ( ) v t 2 (u(x j+1, t n ) 2u(x j, t n ) + u(x j 1, t n )), (29) 2 The same expression would be obtained by centered finite difference formula for the space derivatives in the equation u(x j, t n+1 ) u(x j, t n ) v t (x j, t n ) + (v t) 2 2 u(x j, t n ) 2 (30) and again we finhus that the numerical method gives us a viscosity type term. The methods for the Burgers equation The upwind scheme scheme for Burgers equation: For an equation of the type + f(u) (as Burgers equation) we can generalize the upwind method; = 0. (31) u(x j, t n+1 ) u(x j, t n ) t {f(u(x j, t n )) f(u(x j 1, t n ))}, for f(u(x j+1/2, t n )) > 0 u(x j, t n+1 ) u(x j, t n ) t {f(u(x j+1, t n )) f(u(x j, t n ))}, for f(u(x j 1/2, t n )) < 0. (32) Note that with f = v 0 u we recover Eq. 24-25. To get the Lax Wendroff scheme for Burgers equation we can proceed as follows, (see also Numerical Recipes 20.1.37-20.1.38, but note then that there is a misprint in 20.1.37; there is a factor 1/2 missing in the seconerm on the right-hand side). Use first the Lax scheme to take half a step in t, first for x j+1/2 anhen for x j 1/2 u(x j+1/2, t n+1/2 ) = 1 2 (u(x j+1, t n ) + u(x j, t n )) 1 t 2 (f(x j+1, t n ) f(x j, t n )) (33) u(x j 1/2, t n+1/2 ) = 1 2 (u(x j, t n ) + u(x j 1, t n )) 1 t 2 (f(x j, t n ) f(x j 1, t n )) (34) we use Eq.(33-34) to calculate f(x j+1/2, t n+1/2 ) and f(x j 1/2, t n+1/2 ) anhen calculate u(x j, t n+1 ) = u(x j, t n ) t (f(x j+1/2, t n+1/2 ) f(x j 1/2, t n+1/2 )) (35) with f = vu(x, t) expression (29) is re-obtained. For Burgers equation we should use f = u 2 (x, t)/2.