NUMERICAL SOLUTION OF PARTIALDIFFERENTIAL EQUATIONS

341 168 0
NUMERICAL SOLUTION OF PARTIALDIFFERENTIAL EQUATIONS

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

NUMERICAL SOLUTION OF PARTIAL DIFFERENTIAL EQUATIONS MA 3243 SOLUTIONS OF PROBLEMS IN LECTURE NOTES B Neta Department of Mathematics Naval Postgraduate School Code MA/Nd Monterey, California 93943 January 22, 2003 c 1996 - Professor Beny Neta Contents Introduction and Applications 1.1 Basic Concepts and Definitions 1.2 Applications 1.3 Conduction of Heat in a Rod 1.4 Boundary Conditions 1.5 A Vibrating String 1 5 11 Separation of Variables-Homogeneous Equations 2.1 Parabolic equation in one dimension 2.2 Other Homogeneous Boundary Conditions 13 13 13 Fourier Series 3.1 Introduction 3.2 Orthogonality 3.3 Computation of Coefficients 3.4 Relationship to Least Squares 3.5 Convergence 3.6 Fourier Cosine and Sine Series 3.7 Full solution of Several Problems 26 26 26 26 36 36 36 47 91 91 91 96 103 107 114 127 131 131 136 142 160 160 160 167 176 176 176 180 205 PDEs in Higher Dimensions 4.1 Introduction 4.2 Heat Flow in a Rectangular Domain 4.3 Vibrations of a rectangular Membrane 4.4 Helmholtz Equation 4.5 Vibrating Circular Membrane 4.6 Laplace’s Equation in a Circular Cylinder 4.7 Laplace’s equation in a sphere Separation of Variables-Nonhomogeneous Problems 5.1 Inhomogeneous Boundary Conditions 5.2 Method of Eigenfunction Expansions 5.3 Forced Vibrations 5.4 Poisson’s Equation 5.4.1 Homogeneous Boundary Conditions 5.4.2 Inhomogeneous Boundary Conditions 5.4.3 One Dimensional Boundary Value Problems Classification and Characteristics 6.1 Physical Classification 6.2 Classification of Linear Second Order PDEs 6.3 Canonical Forms 6.4 Equations with Constant Coefficients i 6.5 6.6 Linear Systems 219 General Solution 221 Method of Characteristics 7.1 Advection Equation (first order wave equation) 7.2 Quasilinear Equations 7.2.1 The Case S = 0, c = c(u) 7.2.2 Graphical Solution 7.2.3 Numerical Solution 7.2.4 Fan-like Characteristics 7.2.5 Shock Waves 7.3 Second Order Wave Equation 7.3.1 Infinite Domain 7.3.2 Semi-infinite String 7.3.3 Semi-infinite String with a Free End 7.3.4 Finite String 230 230 245 245 263 263 263 263 275 275 280 280 290 Finite Differences 8.1 Taylor Series 8.2 Finite Differences 8.3 Irregular Mesh 8.4 Thomas Algorithm 8.5 Methods for Approximating PDEs 8.5.1 Undetermined coefficients 8.5.2 Polynomial Fitting 8.5.3 Integral Method 8.6 Eigenpairs of a Certain Tridiagonal Matrix 291 291 291 298 302 302 302 302 302 302 Finite Differences 9.1 Introduction 9.2 Difference Representations of PDEs 9.3 Heat Equation in One Dimension 9.3.1 Implicit method 9.3.2 DuFort Frankel method 9.3.3 Crank-Nicolson method 9.3.4 Theta (θ) method 9.3.5 An example 9.3.6 Unbounded Region - Coordinate Transformation 9.4 Two Dimensional Heat Equation 9.4.1 Explicit 9.4.2 Crank Nicolson 9.4.3 Alternating Direction Implicit 9.4.4 Alternating Direction Implicit for Three Dimensional Problems 9.5 Laplace’s Equation 303 303 303 310 313 313 313 313 313 313 313 313 313 313 316 316 ii 9.5.1 Iterative solution Vector and Matrix Norms Matrix Method for Stability Derivative Boundary Conditions Hyperbolic Equations 9.9.1 Stability 9.9.2 Euler Explicit Method 9.9.3 Upstream Differencing 9.9.4 Lax Wendroff method 9.9.5 MacCormack Method 9.10 Inviscid Burgers’ Equation 9.10.1 Lax Method 9.10.2 Lax Wendroff Method 9.10.3 MacCormack Method 9.10.4 Implicit Method 9.11 Viscous Burgers’ Equation 9.11.1 FTCS method 9.11.2 Lax Wendroff method 9.11.3 MacCormack method 9.11.4 Time-Split MacCormack method 9.6 9.7 9.8 9.9 iii 316 316 320 320 320 320 325 325 325 328 328 328 328 328 330 335 335 335 335 335 List of Figures 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 Graphical solution of the eigenvalue problem Graph of f (x) = Graph of its periodic extension Graph of f (x) = x2 Graph of its periodic extension Graph of f (x) = ex Graph of its periodic extension Graph of f (x) Graph of its periodic extension Graph of f (x) Graph of its periodic extension Graph of f (x) = x Graph of its periodic extension graph of f (x) for problem 2c Sketch of f (x) and its periodic extension for 1a Sketch of the odd extension and its periodic extension for 1a Sketch of the even extension and its periodic extension for 1a Sketch of f (x) and its periodic extension for 1b Sketch of the odd extension and its periodic extension for 1b Sketch of the even extension and its periodic extension for 1b Sketch of f (x) and its periodic extension for 1c Sketch of the odd extension and its periodic extension for 1c Sketch of f (x) and its periodic extension for 1d Sketch of the odd extension and its periodic extension for 1d Sketch of the even extension and its periodic extension for 1d Sketch of the odd extension for Sketch of the periodic extension of the odd extension for Sketch of the Fourier sine series for Sketch of f (x) and its periodic extension for problem Sketch of the even extension of f (x) and its periodic extension for problem Sketch of the periodic extension of the odd extension of f (x) (problem 5) Sketch of domain Domain fro problem of 7.4 Domain for problem of 7.4 Maple plot of characteristics for 6.2 2a Maple plot of characteristics for 6.2 2a Maple plot of characteristics for 6.2 2b Maple plot of characteristics for 6.2 2b Maple plot of characteristics for 6.2 2c Maple plot of characteristics for 6.2 2d Maple plot of characteristics for 6.2 2d Maple plot of characteristics for 6.2 2f iv 25 27 27 28 28 29 29 30 30 31 31 32 32 34 37 37 38 38 38 39 40 40 41 41 42 42 43 43 44 45 46 74 104 105 192 192 193 193 194 195 195 196 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 Maple plot of characteristics for 6.3 2a Maple plot of characteristics for 6.3 2c Maple plot of characteristics for 6.3 2f Characteristics for problem Solution for problem Domain and characteristics for problem Characteristics for problem Solution for Solution for Sketch of initial solution Solution for Solution for Domain for problem Domain for problem Domain of influence for problem Domain for problem domain for problem section 9.3 domain for problem section 9.4.2 Computational Grid for Problem v 3b 216 217 218 237 238 250 267 270 271 271 272 274 282 284 287 288 310 313 330 CHAPTER 1 Introduction and Applications 1.1 Basic Concepts and Definitions Problems Give the order of each of the following PDEs a b c d e uxx + uyy = uxxx + uxy + a(x)uy + log u = f (x, y) uxxx + uxyyy + a(x)uxxy + u2 = f (x, y) u uxx + u2yy + eu = ux + cuy = d Show that u(x, t) = cos(x − ct) is a solution of ut + cux = Which of the following PDEs is linear? quasilinear? nonlinear? If it is linear, state whether it is homogeneous or not a b c d e f g h i uxx + uyy − 2u = x2 uxy = u u ux + x uy = u2x + log u = 2xy uxx − 2uxy + uyy = cos x ux (1 + uy ) = uxx (sin ux )ux + uy = ex 2uxx − 4uxy + 2uyy + 3u = ux + ux uy − uxy = Find the general solution of uxy + uy = (Hint: Let v = uy ) Show that is the general solution of y u = F (xy) + x G( ) x x2 uxx − y uyy = 1 a Second order b Third order c Fourth order d Second order e First order u = cos(x − ct) ut = −c · (− sin(x − ct)) = c sin(x − ct) ux = · (− sin(x − ct)) = − sin(x − ct) ⇒ ut + cux = c sin(x − ct) − c sin(x − ct) = a Linear, inhomogeneous b Linear, homogeneous c Quasilinear, homogeneous d Nonlinear, inhomogeneous e Linear, inhomogeneous f Quasilinear, homogeneous g Nonlinear, inhomogeneous h Linear, homogeneous i Quasilinear, homogeneous uxy + uy = Let v = uy then the equation becomes vx + v = For fixed y, this is a separable ODE dv = −dx v ln v = − x + C(y) v = K(y) e− x In terms of the original variable u we have uy = K(y) e− x u = e− x q(y) + p(x) You can check your answer by substituting this solution back in the PDE u = F (xy) + x G ux = y F (xy) + G y x y x − uxx = y F (xy) + − y G x2 y x +x − y x uxx = y F (xy) + y x2 G y2 G x3 y x − uy = x F (xy) + x G x y x G x y x uyy = x2 F (xy) + x2 uxx − y uyy = x2 y F + y2 G x3 y x y G x2 y x + − y x2 F + y G x2 y x G x Expanding one finds that the first and third terms cancel out and the second and last terms cancel out and thus we get zero Use a von Neumann stability analysis to show for the wave equation that a simple explicit Euler predictor using central differencing in space is unstable The difference equation is = unj − c un+1 j Δt Δax unj+1 − unj−1 Substitute a Fourier mode λn eikm jΔx where km = we get mπ L , Δx = , m = 0, 1, , N L N ν λn+1 eikm jΔx = λn eikm jΔx − λn eikm (j+1)Δx − e−ikm (j−1)Δx or ⎛ λ=1− ⎞ ν ⎜ ikm Δx ⎟ − e−ikm Δx ⎠ ⎝e 2i sin km Δx Taking absolute value |λ| = Re(λ)2 + Im(λ)2 = + ν sin2 km Δx > This is always greater than since the second term under the radical is positive Therefore the method is unstable Now show that the same difference method is stable when written as the implicit formula un+1 = unj − c j Δt Δx n+1 un+1 j+1 − uj−1 As before λ = − iνλ sin km Δx or λ= 1 − iν sin km Δx = + iν sin km Δx + ν sin2 km Δx Taking absolute value |λ| = Re(λ)2 + Im(λ)2 = ν sin2 km Δx + (1 + ν sin2 km Δx)2 (1 + ν sin2 km Δx)2 so ≤1 + sin2 km Δx This is always less than or equal since the denominator is larger than numerator Therefore the method is always stable |λ| = ν2 321 Prove that the CFL condition is the stability requirement when the Lax Wendroff method is applied to solve the simple 1-D wave equation The difference equation is of the form: un+1 j = unj cΔt n c2 (Δt)2 n n n n − uj+1 − uj−1 + uj+1 − 2uj + uj−1 2Δx (Δx) Substitute a Fourier mode as before we get ⎛ ⎞ ⎛ ⎞ ν ν ⎜ iβ iβ −iβ ⎟ −iβ ⎟ λ=1− ⎜ e − e + ⎝ ⎠ ⎝e − + e ⎠ 2 2i sin β cos β−2 Take the absolute value ⎡ |λ|2 = ⎤2 ⎢ ⎢1 + ν (cos β ⎣ ⎥ − 1)⎥ ⎦ ⎛ ⎞2 ⎜ ⎟ + ⎝−ν sin β ⎠ =Im(λ) =Re(λ) |λ|2 = + 2ν (cos β − 1) + ν (cos β − 1)2 + ν sin2 β =−2 sin2 β =−2 sin2 |λ|2 = + 4ν sin4 β (ν − 1) In order to get stability, we must have ν2 − ≤ or ν2 ≤ which is the CFL condition 322 β Determine the stability requirement to solve the 1-D heat equation with a source term ∂2u ∂u = α + ku ∂t ∂x Use the central-space, forward-time difference method Does the von Neumann necessary condition make physical sense for this type of computational problem? The method is = (1 + kΔt − 2r) unj + r unj+1 + unj−1 un+1 j Substitute a Fourier mode and we get the following equation for λ λ = + kΔt − 2r + 2r cos β = + 2r(cos β − 1) + kΔt =−2 sin2 λ = − 4r sin2 If r ≤ then β β + kΔt λ ≤ + O(Δt) The Δt term makes sense since ku term allows the solution to grow in time and thus λ (and the numerical solution) must be allowed to grow 323 In attempting to solve a simple PDE, a system of finite-difference equations of the form ⎡ un+1 j 1+ν ⎢ = ⎣ -ν ⎤ ν 1+ν 0 n ν ⎥ ⎦ uj 1+ν Investigate the stability of the scheme For the stability, we need ||A|| ≤ or that |eig(A)| ≤ To compute the eigenvalues we need to solve 1+ν−λ ν 0 1+ν −λ ν =0 −ν 1+ν −λ or (1 + ν − λ)3 − ν = So ⎧ ⎪ ⎨ ν + ν − λ = νe2πi/3 ⎪ ⎩ νe4πi/3 ⎧ ⎪ ⎪ ⎨ λ=⎪ ⎪ ⎩ 1 + ν − e2πi/3 + ν − e4πi/3 Note that the last two eigenvalues are complex conjugate of each other Now clearly the absolute value of the first is The absolute value of the other two is the same and it is + ν − cos 2π + −ν sin or 2π ⎛ + 2ν + ν − 2ν(1 + ν) cos ⎜ 2π 2π 2π ⎟ +ν ⎜ cos2 + sin2 ⎟ ⎝ 3 3⎠ − 12 So |λ| = √ ⎞ + 3ν + 3ν In order for this to be less than or equal 1, we have + 3ν + 3ν ≤ 3ν + 3ν ≤ ν(1 + ν) ≤ Therefore −1 ≤ ν ≤ 324 =1 9.9.2 Euler Explicit Method 9.9.3 Upstream Differencing 9.9.4 Lax Wendroff method Problems Derive the modified equation for the Lax Wendroff method 325 Derive the modified equation for the Lax Wendroff method unj+1 − unj−1 − unj un+1 c2 Δt n j +c = u − 2unj + unj−1 (1) Δt 2Δx 2Δx2 j+1 Expand each fraction in Taylor series (all terms on the right side of the following equations are evaluated at the point (j, n) − unj un+1 Δt Δt2 j = ut + utt + uttt + O(Δt3 ) Δt unj+1 − unj−1 Δx2 = cux + c uxxx + O(Δx4 ) c 2Δx c2 c2 c2 unj+1 − 2unj + unj−1 = + Δt Δtu ΔtΔx2 uxxxx xx Δx2 24 Now substitute these expansions in the Lax Wendroff scheme (1) Δt Δt2 Δx2 c2 c2 ut + utt + uttt + cux + c uxxx = Δtuxx + ΔtΔx2 uxxxx 6 24 Reorganize ut = −cux + Δt Δt2 Δx2 c uxx − utt − uttt − c uxxx + higher order terms 6 (2) Differentiate this (2) with respect to t utt = −cuxt + Δt c uxxt − uttt + quadratic terms (3) Substitute in (2) ut = −cux + Δt Δt c uxx + cuxt − c uxxt − uttt 2 − Δt2 Δx2 uttt − c uxxx 6 Collect terms ut = −cux + c Δt c2 Δx2 (cuxx + uxt ) + Δt2 − uxxt + uttt − c uxxx + cubic terms 12 (4) Differentiate (2) with respect to x utx = −cuxx + Δt c uxxx − uttx + quadratic terms (5) Substitute in (4) ut = −cux + c + Δt2 Δt Δt cuxx − cuxx + c uxxx − uttx 2 + c2 Δx2 − uxxt + uttt − c uxxx + cubic terms 12 326 (6) Differentiate (2) with respect to x twice utxx = −cuxxx + linear terms Linear terms are enough because we have Δt2 in front Also get uttx = −cuxxt + linear terms = −c (−cuxxx ) + linear terms = c2 uxxx + linear terms uttt = −cuxtt + linear terms = −c3 uxxx + linear terms Substitute in (6) ut = −cux + c + Δt2 − − c Δt2 c uxxx − c2 uxxx + linear terms + c2 (−cuxxx + linear terms) + −c3 uxxx 12 Δx2 uxxx + cubic terms Collect terms: ut = −cux + Δt2 or c3 Δx2 c3 uxxx − uxxx − c uxxx + cubic terms 12 Δx2 ut = −cux + Δt uxxx − c uxxx + cubic terms 6 2c In terms of ν ut = −cux + c ν − Δx2 uxxx + cubic terms 327 9.9.5 MacCormack Method 9.10 Inviscid Burgers’ Equation 9.10.1 Lax Method 9.10.2 Lax Wendroff Method 9.10.3 MacCormack Method Problems Determine the errors in amplitude and phase for β = 90◦ if the MacCormack scheme is applied to the wave equation for 10 time steps with ν = 328 Determine the errors in amplitude and phase for β = 90◦ if the MacCormack scheme is applied to the wave equation for 10 time steps with ν = Recall that |G| = − ν (1 − cos β) − iν sin β [1 − ν (1 − cos β)]2 + (−ν sin β)2 = Given that β = 90◦ then cos β = and sin β = Substitute these values and the given ν = in |G|, we have |G| = = [1 − 52 (1 − 0)]2 + (−.5 · 1)2 [1 − 25]2 + 25 = After 10 steps ⎡ |G|10 ⎤10 13 ⎦ =⎣ 16 = 13 16 + = 16 13 16 ∼ 354 The error in amplitude is − 354 = 646 π Phase error is given by 10(φe − φ) where φe = −βν = − Now −ν sin β ν tan φ = =− = − 23 = − 2 − ν (1 − cos β) 1−ν Therefore φ ∼ −.588 So the phase error is 10(− π + 588) ∼ 1.974 radians 329 9.10.4 Implicit Method Problems Apply the two-step Lax Wendroff method to the PDE ∂3u ∂u ∂F + +u = ∂t ∂x ∂x where F = F (u) Develop the final finite difference equations Apply the Beam-Warming scheme with Euler implicit time differencing to the linearized Burgers’ equation on the computational grid given in Figure 61 (use c = 2, μ = 2, Δx = 1) and determine the steady state values of u at j = and j = the boundary conditions are and the initial conditions are un1 = 1, un4 = u12 = 0, u13 = Do not use a computer to solve this problem t u=1 u=4 n=0 j=1 x Figure 61: Computational Grid for Problem 330 Apply the two-step Lax Wendroff method to the PDE ∂u ∂F ∂3u + +u = ∂t ∂x ∂x where F = F (u) Develop the final finite difference equations Recall that for ut + Fx = μuxx we had Step 1: n n+1/2 uj − unj+1/2 Δt + unj−1/2 + − Δx n Fj+1/2 n Fj−1/2 uxx =μ n j+1/2 + uxx j−1/2 Step 2: n+1/2 n+1/2 Fj+1/2 − Fj−1/2 un+1 − unj j + = μuxx Δt Δx n j In our case we have uuxxx instead of μuxx , so Step 1: n n+1/2 uj − unj+1/2 Δt + unj−1/2 + − Δx n Fj+1/2 n Fj−1/2 uuxxx + n j+1/2 + uuxxx Step 2: n+1/2 n+1/2 Fj+1/2 − Fj−1/2 un+1 − unj j + = uuxxx Δt Δx n =0 j We need uuxxx approximated to O(Δx2 ), one can show n uxxx j 4unj+1 − 8unj+1/2 + 8unj−1/2 − 4unj−1 = + O(Δx2 ) Δx Using this approximation shifted to j ± 1/2, we get n uxxx j+1/2 n uxxx j−1/2 4unj+3/2 − 8unj+1 + 8unj − 4unj−1/2 = Δx3 4unj+1/2 − 8unj + 8unj−1 − 4unj−3/2 = Δx3 Substitute these in step 331 j−1/2 =0 Step 1: n+1/2 uj − unj+1/2 + unj−1/2 Δt n n − Fj−1/2 Fj+1/2 + Δx 4unj+1/2 − 8unj + 8unj−1 − 4unj−3/2 + unj−1/2 Δx3 4unj+3/2 − 8unj+1 + 8unj − 4unj−1/2 + unj+1/2 Δx3 =0 Multiply through by Δt and collect terms Step 1: n Δt n+1/2 n uj − uj+1/2 + unj−1/2 + Fn − Fj−1/2 2 Δx j+1/2 + Δt un −8unj + 8unj−1 − 4unj−3/2 Δx3 j−1/2 + unj+1/2 4unj+3/2 − 8unj+1 + 8unj =0 Step 2: − unj + un+1 j + Δt n+1/2 n+1/2 Fj+1/2 − Fj−1/2 Δx Δt n uj 4unj+1 − 8unj+1/2 + 8unj−1/2 − 4unj−1 = Δx Another possibility is to include uuxxx term into F Let G = uuxx − u2x then ∂G = ux uxx + uuxxx − 2ux uxx = uuxxx ∂x So now the equation is ut + Fx + Gx = or ut + (F + G)x = For this equation we can use Lax Wendroff method as in class 332 Apply the Beam-Warming scheme with Euler implicit time differencing to the linearized Burgers’ equation on the computational grid given in Figure 61 (use c = 2, μ = 2, Δx = 1) and determine the steady state values of u at j = and j = the boundary conditions are and the initial conditions are un1 = 1, un4 = u12 = 0, u13 = Do not use a computer to solve this problem − unj un+1 j + cux Δt Let ν = c n+1 j n+1 = μuxx j Δt Δt and r = μ then Δx Δx ν n+1 n+1 n+1 = unj − u − un+1 + un+1 un+1 j j−1 + r uj−1 − 2uj j+1 j+1 or − ν ν n+1 n + r un+1 − r un+1 + j−1 + (2r + 1)uj j+1 = uj 2 In our case c = 2, μ = 2, Δx = and so if we let Δt = 1, then r = ν = Using these values in the above equation, we get n+1 n − un+1 −3un+1 j−1 + 5uj j+1 = uj For n = (don’t forget to employ the boundary conditions) −3 · + 5u22 − u23 = −3u22 + 5u23 − = The solution of this system of two equations is u22 = 19 22 u23 = 29 22 Now go to the next time step n = = 19 22 −3u32 + 5u33 − = 29 22 −3 + 5u32 − u33 The solution of this system of two equations is 333 542 ∼ 1.1198 484 u33 ∼ 1.7355 u32 = The next time step n = 4, we have u42 ∼ 1.1970 u43 ∼ 1.8653 The next time step n = 5, we have u52 ∼ 1.2205 u53 ∼ 1.9053 The next time step n = 6, we have u62 ∼ 1.2276 u63 ∼ 1.9176 Analytic steady state solution: cux = μuxx u(0) = u(3) = u=1+ (1 − ex ) − e3 so u(1) = u2 ∼ 1.2701 u(2) = u3 ∼ 2.0043 We are getting there, it may require few more steps Since the method is unconditionally stable, we can choose a larger time step 334 9.11 Viscous Burgers’ Equation 9.11.1 FTCS method 9.11.2 Lax Wendroff method 9.11.3 MacCormack method 9.11.4 Time-Split MacCormack method 335 ... Domain for problem Domain for problem Domain of influence for problem Domain for problem domain for problem section 9.3 domain for problem section 9.4.2... extension for problem Sketch of the even extension of f (x) and its periodic extension for problem Sketch of the periodic extension of the odd extension of f (x) (problem 5) Sketch of. .. B2 sinh −λx The other two forms are may be less known, but easily proven The solution can be written as a shifted hyperbolic cosine (sine) The proof is straight forward by using the formula for

Ngày đăng: 18/11/2018, 17:37

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan