Numerical Solutions to Partial Differential Equations Zhiping Li LMAM and School of Mathematical Sciences Peking University
Introduction to Hyperbolic Equations The Hyperbolic Equations n-d 1st Order Linear Hyperbolic Partial Differential Equation n 1 Scalar case (u R 1 ), u t + a i u xi + b u = ψ 0, i=1 where a i, b, ψ 0 are real functions of x = (x 1,..., x n ) and t. 2 Vector case (u = (u 1,, u p ) T R p ), n u t + A i u xi + B u = ψ 0, i=1 where A i, B R p p, ψ 0 R p are real functions of t and x = (x 1,..., x n ), and α R n, A(x, t) = n i=1 α ia i (x, t) is real diagonalizable, i.e. A(x, t) has p linearly independent eigenvectors corresponding to real eigenvalues. 3 If A(x, t) = n i=1 α ia i (x, t) has p mutually different real eigenvalues, the system is called strictly hyperbolic. 2 / 40
Introduction to Hyperbolic Equations The Hyperbolic Equations n-d 2nd Order Linear Hyperbolic Partial Differential Equation A general 2nd order scalar equation (u R 1 ), n n n u tt + 2 a i u xi t + b 0 u t a i u xi x + b i u xi + cu = ψ 0, i=1 i,=1 where a i, a i, b i, c and ψ 0 are real functions x = (x 1,..., x n ) and t, (a i ) is real symmetric positive definite. Define v = u, v 0 = u t, v i = u xi, then the above 2nd order scalar equation transforms into a first order linear system of partial differential equations for v = (v, v 0, v 1,, v n ) T n Av t + A i v xi + Bv = ψ 0, i=1 i=1 3 / 40
Introduction to Hyperbolic Equations The Hyperbolic Equations n-d 2nd Order Scalar Transforms to n-d 1st Order System (p = n + 2) 1 0 0 0 0 0 0 0 0 1 0 0 0 2a i a 1i a ni A = 0 0 a 11 a 1n, A i = 0 a 1i 0 0,........ 0 0 a n1 a nn 0 a ni 0 1 0 0 0 c b 0 b 1 b n ψ 0 B = 0 0 0 0, ψ 0 = 0...... 0 0 0 0 0 4 / 40
Introduction to Hyperbolic Equations The Hyperbolic Equations n-d 2nd Order Scalar Transforms to n-d 1st Order System (p = n + 2) 1 Let R T AR = I (A is real symmetric positive definite); 2 Introduce a new variable w = R 1 v; 3 Denote Âi = R T A i R, ˆB = R T BR, ˆψ 0 = R T ψ; 4 Â(x, t) = n i=1 α iâi(x, t) is a real symmetric matrix and thus is real diagonizable for all real α i, i = 1,..., n; 5 The 2nd order scalar equation now transforms into a 1st order linear hyperbolic system of partial differential equations for w R (n+2) : n w t + Â i w xi + ˆBw = ˆψ 0. i=1 5 / 40
Introduction to Hyperbolic Equations The Hyperbolic Equations Standard Form of n-d 1st Order Linear Hyperbolic Equations 1 The standard form of 1st order linear hyperbolic equation: n u t + a i u xi = ψ, (ψ = ψ 0 b u). i=1 2 The standard form of 1st order linear hyperbolic system: n u t + A i u xi = ψ, (ψ = ψ 0 B u); i=1 3 The equation (system) is said to be homogeneous, if ψ = 0; 6 / 40
Introduction to Hyperbolic Equations The Hyperbolic Equations Standard Form of n-d 1st Order Linear Hyperbolic Equations 4 In general, a higher order linear hyperbolic equation (system of equations) can always be transformed into a first order linear hyperbolic system of equations. 5 An equation (system) is said to be nonlinear, if at least one of the coefficients depends on the unknown or the right hand side term is a nonlinear function of the unknown. 7 / 40
Introduction to Hyperbolic Equations Example on Hyperbolic Equations and Balance Laws An Example of a Balance Law Substance balance in flowing fluid in a 1D pipe. 1 u(x, t): substance density, measured by mass per unit length. 2 f (x, t, u): mass flux, measured by mass per unit time. 3 ψ(x, t, u): the density of the mass source (or sink), measured by mass per unit length per unit time. 4 Balance law (integral form), for given x l < x r and t b < t a, xr x l u(x, t a ) dx = ta xr t b f (x r, t, u(x r, t)) dt + x l u(x, t b ) dx + ta xr t b x l ta t b f (x l, t, u(x l, t)) dt ψ(x, t, u(x, t)) dx dt. 8 / 40
Introduction to Hyperbolic Equations Example on Hyperbolic Equations and Balance Laws An Example of a Balance Law 5 Suppose u and f are sufficiently smooth, we are led to ta xr t b x l [u(x, t) t + f (x, t, u(x, t)) x ψ(x, t, u(x, t))] dx dt = 0, for all given x l < x r and t b < t a ; 6 or equivalently: u(x, t) t + f (x, t, u(x, t)) x = ψ(x, t, u(x, t)), this is the balance law in differential form. 9 / 40
Introduction to Hyperbolic Equations Example on Hyperbolic Equations and Balance Laws Convection Equation and Convection-diffusion Equation The simplest example is the 1D convection equation: u t + a u x = 0, in which the flowing velocity of the fluid is a constant a, the flux is simply f (x, t, u) = f (u) = a u, and the source term is zero. Another simple example is the 1D convection-diffusion equation: u t + a u x = σu xx, in which diffusion as well as convection is considered, and the flux is of the form f (x, t, u, u x ) = a u σ u x, where σ is the diffusion parameter. Note: convection equation is also called advection equation, convection-diffusion equation is also called advection-diffusion equation. 10 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Characteristics and Riemann Invariants In hyperbolic equations (systems), the information propagates at finite characteristic speeds. Consider a 1D constant-coefficient hyperbolic system u t + A u x = 0. 1 AR = RΛ, Λ = diag(λ 1,, λ p ) with λ 1 λ 2 λ p. 2 Define w = R 1 u, the system is transformed to w t + Λ w x = 0. 3 p families of characteristics given by p characteristic equations dx i dt = λ i, i = 1,, p. 11 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Riemann Invariants and General Solutions of Initial Value Problems 4 w i is a constant on each characteristics of the ith family: dw i (x i (t), t) dt = [w i,t + λ i w i,x ] (x i (t), t) = 0. 5 w i (x, t) = w i (x λ i t, 0), i = 1,, p. 6 w i, i = 1,, p, are called the Riemann invariants of the system with respect to the characteristics of (λ i, ξ i ), with Aξ i = λ i ξ i, i = 1,, p. 12 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Riemann Invariants and General Solutions of Initial Value Problems 7 Denote ξ i the ith column of R, and η i the ith row of R 1. 8 By definition η i u = w i, in particular w i (x, 0) = η i u 0 (x). 9 By definition u(x, t) = Rw(x, t), thus, by 5 and 8, u(x, t) = p ξ i w i (x, t) = i=1 p ξ i η i u 0 (x λ i t). i=1 13 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Domains of Dependance, Influence and Determination Since u(x, t) = p i=1 ξi η i u 0 (x λ i t), we define 1 domain of dependance of a set Ω T R R + : D(Ω T ) = {y R : y = x λ i t, i = 1,, p, (x, t) Ω T }. 2 domain of influence of a set Ω R: I (Ω) = {(x, t) R R + : 1 i p, s.t. x λ i t Ω}, 3 domain of determination of a set Ω R: K(Ω) = {(x, t) R R + : x i = x λ i t Ω, i = 1,, p}. 4 We can also define D(Ω T, t 0 ), I (Ω, t 0 ) and K(Ω, t 0 ) by replacing λ i t by λ i (t t 0 ) in the above definitions. 14 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Boundary Conditions in Initial-Boundary Value Problems For an initial-boundary value problem defined on (0, 1) R +, suppose λ 1 <... < λ l < 0 < λ r < λ p (l = r 1 or l = r 2). By the characteristics of the system, boundary conditions should be imposed in the following way: 1 p r + 1 linearly independent boundary conditions on the left boundary 0, since {w i } p i=r picks up information from left. 2 l linearly independent boundary conditions on the right boundary 1, since {w i } l i=1 picks up information from right. 15 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Boundary Conditions in Initial-Boundary Value Problems 3 The p r + 1 boundary conditions on the left boundary 0 must contain sufficient information for {w i } p i=r. 4 The l boundary conditions on the right boundary 1 must contain sufficient information for {w i } l i=1. 5 The domains of dependance, influence and determination can also be defined for initial-boundary value problems. 16 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants The Characteristic Method for the Convection Equation 1 Convection equation: u t (x, t) + a(x, t) u x (x, t) = 0, x I = (x l, x r ) R, t > 0; 2 Characteristics: x (t) = a(x, t), x I, t > 0; 3 Solution is a constant on a characteristic curve: du(x(t), t) dt = u t + u dx x dt = u t + a u x = 0. 4 Suppose a(x l, t) > 0 and a(x r, t) > 0 for all t 0. 17 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants The Characteristic Method for the Convection Equation 5 Initial-boundary conditions u(x, 0) = u 0 (x), u(x l, t) = u l (t). 6 Take x l x 1 < < x N < x r, and 0 t 1 < < t M. 7 Solving the characteristic equation with initial conditions: x(0) = x i, i = 1,, N, and x(t m ) = x l, m = 1,, M, to obtain characteristic curves; 8 On these (approximate) characteristic curves, set U i (x, t) := u 0 (x i ), i = 1,, N, and U m (x, t) := u(x l, t m ) = u l (t m ), m = 1,, M respectively. 18 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants The Characteristic Method for the Convection Equation In particular, if a(x, t) a is a constant, then, we have 9 for a > 0, u 0 ( (x at), if x at x l, u(x, t) = u l t x x ) l, if x at < x l. a 10 if a < 0, u 0 (x ( at), if x at x r, u(x, t) = u r t x x ) r, if x at > x r. a 19 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Inhomogeneous Convection Equation and Characteristic Method 1 Convection equation: u t (x, t) + a(x, t) u x (x, t) = ψ(x, t), x I = (x l, x r ) R, t > 0; 2 Characteristics: x (t) = a(x, t), x I, t > 0; 3 On a characteristic curve, the solution satisifes: du(x(t), t) dt = u t + u dx x dt = u t + a u x = ψ(x(t), t). 4 Suppose a(x l, t) > 0 and a(x r, t) > 0 for all t 0. 20 / 40
Introduction to Hyperbolic Equations Characteristics and Riemann Invariants Inhomogeneous Convection Equation and Characteristic Method 5 Initial-boundary conditions u(x, 0) = u 0 (x), u(x l, t) = u l (t). 6 Take x l x 1 < < x N < x r, and 0 t 1 < < t M. 7 Solving the characteristic equation with initial conditions: x i (0) = x i, i = 1,, N, and x m (t m ) = x l, m = 1,, M, to obtain characteristic curves; 8 Along these (approximate) characteristic curves, solving ODEs systems U i (t) = ψ(x i (t), t) and U m (t) = ψ(x m (t), t) with initial conditions U i (0) := u 0 (x i ), i = 1,, N, and U m (t m ) := u(x l, t m ) = u l (t m ), m = 1,, M respectively. 21 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Characteristic Lines and CFL Condition The Domain of Dependance of a Difference Scheme 1 Convection equation: u t (x, t) + a u x (x, t) = 0, (a = constant). 2 The simplest scheme: U m+1 U m + a Um U 1 m = 0; τ h 3 or equivalently: U m+1 = (1 ν)u m + νu 1 m, (ν = aτ/h). 4 For P = (x, t m+1 ), D(P) = Q = x a t m+1, the domain of dependance of the scheme D h (P) = {x m 1,, x 1, x }. t m+1 P m Q > m 1 Q +... 2 1 Q x 22 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Characteristic Lines and CFL Condition The CFL Condition of a Difference Scheme Simple observation: if Q = Q > < x m 1, or Q = Q > x, then U m+1 can not properly approximate u(x, t m+1 ). CFL condition: a necessary condition for a numerical scheme to converge is that the domain of dependence of the the real solution is contained, at least in the sense of limit, in the domains of dependence of the numerical scheme. t m+1 P m Q > m 1 Q +... 2 1 Q x 23 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Characteristic Lines and CFL Condition The CFL Condition is a Necessary Condition for Stability The CFL condition is often used as a necessary condition for the stability of finite difference schemes for hyperbolic differential equations. In general, the CFL condition is not a sufficient condition for the stability of a numerical method. 24 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Characteristic Lines and CFL Condition CFL Condition is not a Sufficient Condition for Stability Consider the finite difference scheme of the convection equation U m+1 U m + a Um +1 Um 1 = 0, a R 1 \ {0}. τ 2h The CFL condition for the scheme is ν = a τ/h 1. The Fourier modes solution U m = λ m k with amplification factor λ k = 1 i ν sin kπ N. Since λ k > 1 for all ν 0, the scheme is always unstable, whether the CFL condition is satisfied or not. kπ ei N Note: For initial value problems or initial-boundary value problems with periodic boundary conditions of a constant coefficient convection equation, a necessary and sufficient condition for L 2 -stability is the so called von Neumann condition: λ k 1 + Kτ, for all N + 1 k N. 25 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation The Upwind Scheme The Upwind Scheme for the Convection Equation For the convection equation u t (x, t) + a(x, t) u x (x, t) = 0, by the CFL condition, the simplest difference scheme is { U m+1 U m ν m + U m, if a m 0, = U m ν m U m, if a m 0, where ν m = a m τ/h satisfies ν m 1, or equivalently { U m+1 (1 + ν m )U m ν m U+1 m =, if am 0, (1 ν m )U m + ν m U 1 m, if am 0, which may be viewed as obtained by using +t / t to approximate / t; +x / x (a < 0) or x / x (a > 0) to approximate / x. 26 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation The Upwind Scheme The Upwind Scheme for the Convection Equation Characteristic method + Linear interpolation Upwind scheme. Let a > 0 be a constant, assume ν = aτ/h 1. 1 By the characteristic method: u(x, t m+1 ) = u(x a τ, t m ); 2 By linear interpolation: u(x a τ, t m ) x (x aτ) h 3 Hence u(x, t m+1 ) νu m 1 + (1 ν)um ; u 1 m + (x aτ) x 1 u m ; h 4 This leads to the scheme: U m+1 = (1 ν)u m + νu m 1, which is exactly the upwind scheme. 27 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation The Upwind Scheme The Truncation Error of the Upwind Scheme O(τ + h) By Taylor series expansion, we have T m := um+1 u m + a um u m [ 1 u τ h t + a u ] m x = 1 2 [τu tt a h u xx ] m + 1 [ τ 2 u ttt + a h 2 ] m u xxx + 6 = [ 1 2 a h (1 ν)u xx + 1 6 a h2 (1 ν 2 )u xxx + ] m, if a > 0. Note, here a is a constant, so u tt = a 2 u xx and ν = aτ/h, and τu tt = ahνu xx. Similarly τ k t k+1 u = ( 1) k+1 ah k ν k x k+1 u. 28 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation The Upwind Scheme The Truncation Error of the Upwind Scheme O(τ + h) Similarly, we have T m := um+1 u m + a um +1 [ um u τ h t + a u ] m x = 1 2 [τu tt + a h u xx ] m + 1 [ τ 2 u ttt + a h 2 ] m u xxx + 6 = [ 1 2 a h (1 + ν)u xx + 1 6 a h2 (1 ν 2 )u xxx + ] m, if a < 0. Note, here a is a constant, so u tt = a 2 u xx and ν = aτ/h, and τu tt = ahνu xx. Similarly τ k t k+1 u = ( 1) k+1 ah k ν k x k+1 u. 29 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation The Upwind Scheme The Stability and Convergence of the Upwind Scheme The error e m = U m u m satisfies the following error equation e m+1 = { (1 ν )e m + ν e+1 m τt m, if a < 0, (1 ν )e m + ν e 1 m τt m, if a > 0. If the CFL condition is satisfied, i.e. ν 1, then, we have E m+1 := max e m+1 E m + τ max T m E 0 + t max max T m, m, (m + 1)τ t max. 30 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation The Upwind Scheme The Solutions to Nonlinear Hyperbolic Equations are Generally not Smooth Therefore, if the CFL condition is satisfied, the upwind scheme is stable in L norm, and its convergence rate is O(τ + h), if the solution u is sufficiently smooth. However, in hyperbolic problems, discontinuities are commonly seen in the physical solutions. In fact, the discontinuity creation and propagation is a focus of investigation on nonlinear problems. 31 / 40
Nonlinear Convection Equation and Blow Up of Its Classical Solution 1 Nonlinear convection equation: u t (x, t) + a(u(x, t)) u x (x, t) = 0; 2 Characteristic equation: x (t) = a(u(x, t)), t > 0; 3 Solution is a constant on a characteristic curve: du(x(t), t) dt = u t + u dx x dt = u t + a u x = 0. 4 On a characteristic curve, a(u(x, t)) is a constant. 5 Characteristic curves are straight lines (with different slopes). 6 Suppose for ξ 1 < ξ 2, a 1 := a(u 0 (ξ 1 )) > a 2 := a(u 0 (ξ 2 )), then, at time t = (ξ 2 ξ 1 )/(a 1 a 2 ) > 0, the two corresponding characteristic lines intersect: (ξ 1 + a 1 t, t) = (ξ 2 + a 2 t, t). 7 In such a case, the classical solution blows up.
Weak Solutions for Nonlinear Conservation Laws Since discontinuities are inevitable, we should take it into consideration by introducing the concept of weak solutions. Definition u L 1 loc (R R +) is called a weak solution to the following 1D initial value problem of the conservation law u t (x, t) + f (u(x, t)) x = 0, u(x, 0) = u 0 (x), if u satisfies the initial condition, and for all fixed 0 t b < t a and < x l < x r <, the following equation holds xr x l u(x, t a )dx = xr x l u(x, t b )dx + ta t b f (u(x l, t))dt ta f (u(x r, t))dt. t b
Shock Speed and Rankine-Hugoniot Jump Condition 1 Suppose there is an isolated discontinuity (i.e. a shock) x(t) propagating at speed s(t) (i.e. x (t) = s(t)); 2 By the integral form conservation law, for x 1 = x(t 1 ) and x 1 + x = x(t 1 + t), we have x1 + x x 1 = u(x, t 1 + t)dx t1 + t t 1 f (u(x 1, t))dt x1 + x x 1 t1 + t t 1 u(x, t 1 )dx f (u(x 1 + x, t))dt. 3 Denote u l = u(x 1 0, t 1 ), u r = u(x 1 + 0, t 1 ), then, we have (u l u r ) x = (f (u l ) f (u r )) t + O( t 2 ). 4 Since x (t) = s(t), we are lead to the Rankine-Hugoniot ump condition: s[u] = [f ].
FDM for 1D 1st Order Linear Hyperbolic Equation Nonlinear Hyperbolic Equations and Weak Solutions Weak Solutions of Non-viscous Burger s Equation Consider the initial value problem of the Burgers equation { u t + 1 u 2 1, if x < 0; = 0; u(x, 0) = 2 x 0, if x 0. By the Rankine-Hugoniot ump condition, s = f (u r ) f (u l ) u r u l = 1 2 u2 r 1 2 u2 l u r u l = 0 1 2 0 1 = 1 2. Hence the weak solution of the problem is given by 1, if x < t/2; u(x, t) = 0, if x t/2. 35 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Nonlinear Hyperbolic Equations and Weak Solutions Weak Solutions of Non-viscous Burger s Equation Consider the initial value problem of the equation u 2 t + 2 u 3 3 x = 0; u(x, 0) = { 1, if x < 0; 0, if x 0. Define w = u 2, by the Rankine-Hugoniot ump condition, s = f (w r ) f (w l ) w r w l = 2 3 w r 3/2 2 3 w 3/2 l = 0 2 3 w r w l 0 1 = 2 3. Hence the weak solution of the problem is given by 1, if x < 2t/3; u(x, t) = 0, if x 2t/3. 36 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Nonlinear Hyperbolic Equations and Weak Solutions Weak Solutions of Non-viscous Burger s Equation For smooth u, both the Burger s equation u t + 1 u 2 2 x = 0 and the equation u 2 t + 2 u 3 3 x = 0 are equivalent to the first order nonlinear hyperbolic equation u t + uu x = 0. 37 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Nonlinear Hyperbolic Equations and Weak Solutions Key Ingredients of a Conservation Law The key ingredients of a conservation law are the conservative quantities and the corresponding fluxes; the integral form equations based on physical conservation laws; Entropy condition to distinguish the physical solution from the others. Remark: For a nonlinear problem, the weak solution is generally not unique even for a conservation law (see Exercise 3.4). 38 / 40
FDM for 1D 1st Order Linear Hyperbolic Equation Nonlinear Hyperbolic Equations and Weak Solutions L 2 Is a Better Space to Investigate Hyperbolic Equations The upwind scheme of the convection equation satisfies the maximum principle, if CFL condition is satisfied; However, for general hyperbolic equations (systems), the solution do not satisfy the maximum principle. Hyperbolic equations (systems) are often used to characterize the propagation and evolution of waves. Fourier modes are waves of various frequencies propagating at their own characteristic speeds. It is natural to apply the Fourier method to analyze the L 2 stability and accuracy of finite difference schemes for hyperbolic equations (systems). 39 / 40
SK 3µ1, 3 Thank You!