Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Perturbation theory wikipedia , lookup
History of numerical weather prediction wikipedia , lookup
Inverse problem wikipedia , lookup
Routhian mechanics wikipedia , lookup
Numerical weather prediction wikipedia , lookup
Numerical continuation wikipedia , lookup
Least squares wikipedia , lookup
Mathematical descriptions of the electromagnetic field wikipedia , lookup
Data assimilation wikipedia , lookup
215 Numerical Analysis of Differential Equations 6 Numerical Solution of Parabolic Equations 6 Numerical Solution of Parabolic Equations TU Bergakademie Freiberg, SS 2012 216 Numerical Analysis of Differential Equations 6.1 The One-Dimensional Model Problem We consider the following initial boundary value problem (IBVP) modelling heat flow in a thin rod, i.e., in one space dimension: x ∈ (0, 1), t > 0, (6.1a) u(0, t) = g0 (t), t > 0, (6.1b) u(1, t) = g1 (t), t > 0, (6.1c) u(x, 0) = u0 (x), x ∈ [0, 1] (6.1d) ut = κuxx , with given (constant) heat conductivity κ (which we set to one in the following) as well as (possibly time-dependent) Dirichlet boundary values g0 , g1 and initial data u0 . 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 217 Numerical Analysis of Differential Equations • Steady-state version: uxx = 0, u(0) = g0 , u(1) = g1 . • Analogous IBVP in 2D and 3D: ut = ∆u + initial and boundary data. • Related: linear ordinary differential equation ut = Au, u : t 7→ u(t) ∈ Rn . Here linear differential operator ∂xx in place of matrix A. 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 218 Numerical Analysis of Differential Equations Series solution by separation of variables: in special cases an analytic representation of the (exact) solution may be constructed using the technique of separation of variables. This is helpful for checking numerical approximations and provides important insight into the structure of the solution. Inserting the special trial solution u(x, t) = f (x)g(t) into the PDE ut = uxx results in 0 00 f g = f g, i.e. f 00 g0 = = const. =: −k 2 . g f For each value of k we obtain a solution 2 uk (x, t) = e−k t sin(kx) of ut = uxx . The boundary condition u(0, t) = u(1, t) = 0 constrains k to the discrete values k = km := mπ, m ∈ N. 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 219 Numerical Analysis of Differential Equations Due to the linearity and homogeneity of ut = uxx any linear combination of these solutions is also a solution. If we succeed in finding coefficients am in such a way that ∞ X u0 (x) = am sin(mπx), m=1 then the series u(x, t) := ∞ X am e−m 2 π2 t sin(mπx) m=1 solves the complete IBVP (6.1). Since the functions {sin(mπx)}∞ m=1 form a complete orthogonal system of the function space L2 (0, 1), this is possible for all u0 ∈ L2 (0, 1). The coefficients are given by Z am = 2 1 u0 (x) sin(mπx) dx. 0 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 220 Numerical Analysis of Differential Equations Example: 1 u0 (x) = 1 − 2|x − 1 2 |. Here the coefficients are am 8 mπ = 2 2 sin , m π 2 m ∈ N. N=1 N=3 N=5 N=19 u0(x) 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 x P Partial sums N m=1 am sin(mπx) of the Fourier series of u0 . 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 221 Numerical Analysis of Differential Equations 0 10 t=0 t=1/2 −20 10 −40 1 −60 0.8 −80 0.6 −100 0.4 −120 0.2 10 10 10 10 10 0 1 2 3 4 5 6 7 m Decay of first 4 nonzero Fourier coefficients of u0 . 0 1 0 0.2 0.5 0.4 0.6 0 x 0.8 1 t Fourier series solution of IBVP (6.1) with κ = 1 and u0 (x) = 1 − 2|x − 21 | in domain (x, t) ∈ [0, 1] × [0, 1]. 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 222 Numerical Analysis of Differential Equations We first discretize the IBVP (6.1) in the spatial variable x only, leaving time t continuous. To this end we proceed as in the elliptic case and introduce the grid points 0 = x0 < x1 < · · · < xJ < xJ+1 = 1 using a fixed grid spacing ∆x = 1/(J + 1) and approximate uxx |x=xj ≈ [A∆x u]j , with A∆x j = 1, 2, . . . , J, 1 tridiag(1, −2, 1). = ∆x2 (6.2) If u = u(t) denotes the vector with components uj (t) ≈ u(xj , t), 6.1 The One-Dimensional Model Problem t > 0, j = 1, 2, . . . , J, TU Bergakademie Freiberg, SS 2012 223 Numerical Analysis of Differential Equations then (6.1) is transformed into the semi-discrete system of ODEs u 0 (t) = A∆x u(t) + g (t), (6.3a) u(0) = u0 , (6.3b) with [u0 ]j = u0 (xj ), j = 1, 2, . . . , J as well as g (t) = 1/(∆x2 )[g0 (t), 0, . . . , 0, g1 (t)]> ∈ RJ . We can now solve (6.3) with known numerical methods for solving ODEs. Introducing the fixed time step ∆t > 0, we set Ujn ≈ [u(tn )]j ≈ u(xj , tn ), tn = n∆t. The approximation of the solution of a time-dependent PDE as a system of ODEs along the “lines” {(xj , t) : t > 0} is known as the method of lines. 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 224 Numerical Analysis of Differential Equations Applying the explicit Euler method to (6.3) (setting g0 (t) = g1 (t) = 0 for now) leads to Ujn+1 = Ujn ∆t n n n Uj−1 − 2Uj + Uj+1 , + 2 ∆x 1 ≤ j ≤ J, n = 0, 1, 2 . . . . This corresponds to the finite difference approximation n n Ujn+1 − Ujn Uj−1 − 2Ujn + Uj+1 = 2 ∆t ∆x | {z } | {z } ≈ut (6.4) ≈uxx of the differential equation (6.1a). In matrix notation: U n+1 = (I + ∆t A∆x )U n , n = 0, 1, 2, . . . , with U n = [U1n , U2n , . . . , UJn ]> . 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 225 Numerical Analysis of Differential Equations We define the local discretisation error of the difference scheme (6.4) to be the residual obtained on inserting the exact solution into the difference scheme: d(x, t) := u(x, t + ∆t) − u(x, t) u(x − ∆x, t) − 2u(x, t) + u(x + ∆x, t) − . 2 ∆t ∆x Using Taylor expansions in (x, t) one easily obtains: 2 ∆t ∆x deE (x, t) = − uxxxx + O(∆t2 ) + O(∆x4 ). 2 12 (6.5) Terminology: the explicit Euler method for solving the heat equation is consistent of first order in time and of second order in space. 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 226 Numerical Analysis of Differential Equations Besides the asymptotic statement (6.5) we also require upper bounds for d. Truncating the Taylor expansions with a remainder term, we obtain in time ∆t2 u(x, t + ∆t) = (u + ∆t ut ) |(x,t) + utt (x, τ ), 2 τ ∈ (t, t + ∆t). Proceeding analogously in x yields ∆x2 ∆t utt (x, τ ) − uxxxx (ξ, t), d (x, t) = 2 12 eE and we obtain, setting µ := ξ ∈ (x − ∆x, x + ∆x), ∆t ∆x2 , ∆t ∆x2 ∆t eE |d (x, t)| ≤ Mtt − Mxxxx = 2 12 2 1 Mtt + Mxxxx , 6µ (6.6) assuming |utt | ≤ Mtt und |uxxxx | ≤ Mxxxx on [0, 1] × [0, T ]. 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 227 Numerical Analysis of Differential Equations Applying the implicit Euler method to (6.3) one obtains, in place of (6.4), the implicit difference scheme n+1 n+1 Ujn+1 − Ujn Uj−1 − 2Ujn+1 + Uj+1 = . ∆t ∆x2 (6.7) The calculation of u n+1 from u n is seen to require the solution of a linear system of equations with coefficient matrix I − ∆tA∆x . Here Taylor expansion results in a local discretization error of 2 ∆t ∆x + uxxxx + O(∆t2 ) + O(∆x4 ). diE (x, t) = − 2 12 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 228 Numerical Analysis of Differential Equations Applying instead the trapezoidal rule, which for an ODE y 0 (t) = f (t, y (t)) is given by y n+1 ∆t n n+1 =y + f (tn , y ) + f (tn+1 , y ) 2 n yields another implicit scheme n n+1 n+1 n+1 n n Ujn+1 − Ujn U − 2U + U U − 2U + U 1 j−1 j j+1 j−1 j j+1 = + , 2 2 ∆t 2 ∆x ∆x which in this context is known as the Crank-Nicolson schemea . This method is also implicit, requiring in each time step the solution of a linear system of equations with the coefficient matrix I − ∆t 2 A∆x . For Crank-Nicolson (CN) there holds dCN (x, t) = O(∆t2 ) + O(∆x2 ). a J. C RANK AND P. N ICOLSON (1947) 6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012 229 Numerical Analysis of Differential Equations 6.2 Convergence All three methods considered so far are consistent, i.e., at all points (x, t) of the domain we have d(x, t) → 0 as ∆x → 0 and ∆t → 0. To analyze their convergence, we proceed as in the case of numerical methods for ODEs and consider a finite time interval t ∈ [0, T ], T > 0 as well as a sequence of grids with grid spacings ∆x → 0, ∆t → 0 and determine whether at every fixed grid point (xj , tn ) also the global error u(xj , tn ) − Ujn tends to zero uniformly. A sequence of grid spacings {(∆x)k , (∆t)k } can approach the point (0, 0) in different ways. The following figure shows different “refinement curves” in the (∆x, ∆t)-plane. We will see that the explicit Euler method converges only if the refinement satisfies ∆t 1 µ := ≤ . ∆x2 2 6.2 Convergence TU Bergakademie Freiberg, SS 2012 230 Numerical Analysis of Differential Equations 0.5 ∆ t = ∆ x2/4 2 0.45 ∆ t = ∆ x /2 0.4 ∆ t = ∆ x2 ∆t=∆x ∆ t = ∆ x/2 0.35 ∆t 0.3 0.25 0.2 0.15 0.1 0.05 0 0 0.1 0.2 0.3 ∆x 0.4 0.5 0.6 0.7 Different refinement curves ∆t, ∆x → 0: red: ∆t/∆x2 = const, blue: ∆t/∆x = const. 6.2 Convergence TU Bergakademie Freiberg, SS 2012 231 Numerical Analysis of Differential Equations Theorem 6.1 If a sequence of grids satisfies (∆t)k 1 µk = ≤ (∆x)2k 2 for all k sufficiently large, and if for the corresponding sequences {jk } and {nk } there holds nk (∆t)k → t ∈ [0, T ], jk (∆x)k → x ∈ [0, 1], then, under the assumption that |uxxxx | ≤ Mxxxx uniformly in [0, 1] × [0, T ], the approximations generated by the explicit Euler method (6.4) converge to the exact solution u(x, t) as k → ∞ uniformly on [0, 1] × [0, T ]. 6.2 Convergence TU Bergakademie Freiberg, SS 2012 232 Numerical Analysis of Differential Equations −2 10 expl. Euler dx=1/10 expl. Euler dx=1/20 Crank Nicolson, dx = 1/10 Crank Nicolson, dx = 1/20 −3 10 −4 En 10 −5 10 −6 10 −7 10 0 0.2 0.4 0.6 0.8 1 t n Error E(tn ) = maxj |un j − Uj | of numerical solution of model problem(6.1) with g0 = g1 = 0 and u0 (x) = x(1 − x) obtained with explicit Euler method with ∆t = ∆x2 /2 and the Crank-Nicolson method with ∆t = ∆x/2. 6.2 Convergence TU Bergakademie Freiberg, SS 2012 233 Numerical Analysis of Differential Equations 6.3 Stability In the method of lines, an ODE solver is applied to the semidiscrete system (6.3). Recalling the regions of absolute stability of the explicit and implicit Euler and trapezoidal methods, we are led to investigate the behavior of the eigenvalues of the matrix A∆x in (6.2) as ∆x → 0. 2 2 2 1.5 1.5 1.5 1 1 1 0.5 0.5 0.5 0 0 0 −0.5 −0.5 −0.5 −1 −1 −1 −1.5 −1.5 −1.5 −2 −3 −2 −1 explicit Euler b =1+λ b R(λ) 6.3 Stability 0 1 −2 −1 0 1 implicit Euler b = 1 R(λ) b 1−λ 2 3 −2 −2 −1 0 1 2 trapezoidal b b = 1+λ/2 R(λ) b 1−λ/2 TU Bergakademie Freiberg, SS 2012 234 Numerical Analysis of Differential Equations The eigenvalues of A∆x (cf. (5.7)) are given by λj = − 4 2 jπ∆x sin , ∆x2 2 j = 1, 2 . . . , J. The eigenvalue of largest magnitude is 4 −4 2 π 2 2 λJ = − sin + π + O ∆x . (1 − ∆x) = ∆x2 2 ∆x2 Therefore, in order to satisfy |R ∆t λj | ≤ 1 for all j = 1, 2, . . . , J in the explicit Euler method, it is necessary that ∆t 1 ≤ . ∆x2 2 (6.8) Both implicit Euler and the trapezoidal rule are absolutely stable methods. Therefore, as all eigenvalues of A∆x lie in the left half plane, the requirement of absolute stability places no constraints on the time step ∆t. Since the CN scheme (trapezoidal rule) is consisten of order 2 in both x and t, this suggests a time step ∆t ≈ ∆x. 6.3 Stability TU Bergakademie Freiberg, SS 2012 235 Numerical Analysis of Differential Equations Absolute stability describes the behavior of a numerical approximation u n at time tn of the solution of an ODE as n → ∞. The appropriate stability concept for the convergence analysis of numerical methods for solving IVPs for PDEs was developed by Laxa and Richtmyerb . All three methods considered so far can be written in the formc U n+1 = B(∆t)U n + g n (∆t), n = 0, 1, . . . (6.9) with different matrices B(∆t) given in each case by B eE (∆t) = I + ∆t A∆x , (6.10a) B iE (∆t) = (I − ∆t A∆x )−1 , −1 ∆t ∆t B CN (∆t) = I − A∆x I+ A∆x . 2 2 (6.10b) (6.10c) a P ETER D. L AX (∗ 1906) b R OBERT DAVIS R ICHTMYER (1910–2003) c We assume that ∆t is chosen as a fixed given function of ∆x. 6.3 Stability TU Bergakademie Freiberg, SS 2012 236 Numerical Analysis of Differential Equations A linear finite difference scheme of the form (6.9) is called Lax-Richtmyer stable, if for any fixed stopping time T there exists a constant KT > 0 such that kB(∆t)n k ≤ KT , ∀∆t > 0 and n ∈ N, n∆t ≤ T. Theorem 6.2 (Lax-Richtmyer equivalence theorem) A consistent linear finite difference scheme (6.9) is convergent if, and only if, it is Lax-Richtmyer stable. Examples: For the explicit Euler method applied to (6.1) the resulting matrix (6.10a) is normal, implying kB(∆t)k2 = ρ(B(∆t)). If condition (6.8) is satisfied, we have kB(∆t)k2 ≤ 1, implying that the explicit Euler method is Lax-Richtmyer stable and therefore convergent. The implicit Euler and Crank-Nicolson schemes are also Lax-Richtmyer stable but without constraints on the mesh ratio or time step. 6.3 Stability TU Bergakademie Freiberg, SS 2012 237 Numerical Analysis of Differential Equations Remark 6.3 In all three schemes considered so far we were able to show the stronger statement kB(∆t)k ≤ 1, which is sometimes called strong stability. However, strong stability is not necessary for Lax-Richtmyer stability. More precisely, for Lax-Richtmyer stability it is necessary that there exist a constant α such that kB(∆t)k ≤ 1 + α∆t (6.11) for all sufficiently small time steps ∆t, which is evident from the inequality kB(∆t)n k ≤ (1 + α∆t)n ≤ eαT , 6.3 Stability ∀ n∆t ≤ T. TU Bergakademie Freiberg, SS 2012 238 Numerical Analysis of Differential Equations 6.4 Von-Neumann Analysis A formal procedure based on Fourier analysis for determining stability bounds was introduced by von Neumann a . In general, von Neumann analysis only yields necessary conditions, which are also sufficient only in special cases, among these linear PDEs with constant coefficients, unbounded spatial domain (Cauchy problem) or periodic boundary conditions, uniform grid. Fundamental fact: in the continuous case (x ∈ R) the functions eiξx , ξ ∈ R, are eigenfunctions of the differential operator ∂x , i.e., ∂x eiξx = iξ eiξx , and thus are also eigenfunctions of any linear differential operator with constant coefficients. a J OHN VON 6.4 Von-Neumann Analysis N EUMANN (1903–1957) TU Bergakademie Freiberg, SS 2012 239 Numerical Analysis of Differential Equations On the unbounded spatial grid {xj = j∆x}j∈Z the grid function vj := eiξxj = eiξj∆x , j ∈ Z, is an eigenfunction of any difference operator with constant coefficients. Example: For the central difference operator δ0 defined as (δ0 v)j := (vj+1 − vj−1 )/(2∆x) there holds eiξ(j+1)∆x − eiξ(j−1)∆x eiξ∆x − e−iξ∆x iξj∆x δ0 vj := (δ0 v)j = = e 2∆x 2∆x i = sin(ξ∆x) vj ∆x The power series expansion (ξ∆x)3 i i sin(ξ∆x) = ξ∆x − + O (ξ∆x)5 = iξ + O(∆x2 ξ 3 ) ∆x ∆x 6 shows that the eigenvalue of δ0 approximates the corresponding eigenvalue of ∂x . 6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012 240 Numerical Analysis of Differential Equations Any grid function on {xj = j∆x : j ∈ Z} can be represented as the superposition π/∆x Z 1 vj = 2π −π/∆x of “grid waves” eiξj∆x , ξ ∈ [ −π , ∆x vb(ξ) = ∆x vb(ξ)eiξj∆x dξ, π ] ∆x ∞ X j∈Z with Fourier coefficients vb(ξ) given by −iξj∆x vj e , j=−∞ h −π π i . ξ∈ , ∆x ∆x If the magnitude of grid functions and their Fourier coefficients are measured by kvk = ∆x ∞ X !1/2 |vj |2 Z and !1/2 π/∆x |b v (ξ)|2 dξ kb vk = , −π/∆x j=−∞ then Parseval’s identity states that kb vk = 6.4 Von-Neumann Analysis √ 2πkvk. (6.12) TU Bergakademie Freiberg, SS 2012 241 Numerical Analysis of Differential Equations The bound kBk ≤ 1 + α∆t requires verifying kBuk ≤ (1 + α∆t)kuk ∀u. According to (6.12), an equivalent condition is c ≤ (1 + α∆t)kb kBuk uk ∀b u, (6.13) which is easier to show because the Fourier coefficients are decoupled. For a one-step method one obtains u bn+1 (ξ) = g(ξ) u bn (ξ) with a so-called amplification factor g(ξ). If we are able to show that |g(ξ)| ≤ 1 + α∆t. with a constant α which is independent of ξ, then this implies (6.13). 6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012 242 Numerical Analysis of Differential Equations Examples: (a) For the explicit Euler scheme applied to (6.3) we obtain the amplification factor 4∆t 2 ξ∆x g(ξ) = 1 − . sin ∆x2 2 (b) For Crank-Nicolson, 1 + z(ξ) g(ξ) = , 1 − z(ξ) 6.4 Von-Neumann Analysis ∆t z(ξ) = −1 + cos(ξ∆x) ≤ 0 2 ∆x ∀ξ. TU Bergakademie Freiberg, SS 2012