Lecture 34 - Ordinary Differential Equations - BVP CVEN 302 November 28, 2001
Systems of Ordinary Differential Equations - BVP Shooting Method for Nonlinear BVP Finite Difference Method Partial Differential Equations
Shooting Method for Nonlinear ODE-BVPs Nonlinear ODE Consider with guessed slope t Use the difference between u(b) and y b to adjust u’(a) m(t) = u(b, t) - y b is a function of the guessed value t Use secant method or Newton method to find the correct t value with m(t) = 0
Nonlinear Shooting Based on Secant Method Nonlinear ODE
MATLAB Example in Nonlinear Shooting Method Nonlinear shooting with secant method Convert to two first-order ODE-IVPs Update t using the secant method
Nonlinear Shooting - Secant Method y(x) y’(x)
Nonlinear Shooting Based on Newton’s Method Nonlinear ODE Check for convergence of m(t)
Nonlinear Shooting Based on Newton’s Method Nonlinear ODE-IVP Chain Rule x and t are independent 0
Nonlinear Shooting with Newton’s Method Solve ODE-IVP Construct the auxiliary equations
Nonlinear Shooting with Newton’s Method Calculate m(t) -- deviation from the exact BC Update t by Newton’s method
Finite-Difference Methods Divide the interval of interest into subintervals Replace the derivatives by appropriate finite-difference approximations in Chapter 11 Solve the system of algebraic equations by methods in Chapters 3 and 4 For nonlinear ODEs, methods in Chapter 5 may be used
Finite-Difference Method General Two-Point BVPs Replace the derivatives by appropriate finite-difference approximations xixi x i-1 x i+1 hhhh
Finite-Difference Method Central difference approximations Tridiagonal system
Finite-Difference Method Central Difference ==> Tridiagonal system
Finite-Difference Method for Nonlinear BVPs Nonlinear ODE-BVPs Evaluate f i by appropriate finite-difference approximations xixi x i-1 x i+1 hhhh
Finite-Difference Method for Nonlinear BVPs SOR method Iterative solution Convergence criterion
Example MATLAB Note error in Text f i : negative sign
Chapter 15 Partial Differential Equations
Classification of PDEs General form of linear second-order PDEs with two independent variables linear PDEs: a, b, c,….,g = f(x,y) only
Heat Equation: Parabolic PDE Heat transfer in a one-dimensional rod x = 0x = a g 1 (t)g 2 (t)
Discretize the solution domain in space and time with h = x and k = t Time (j index) space (i index) x t
Initial and Boundary Conditions Initial conditions : u(x,0) = f(x) u(0, t) = g 1 (t) u(a, t) = g 2 (t) Explicit Euler method
Heat Equation Finite-difference (i,j)(i+1,j)(i-1,j) (i,j+1) u(x,t) x x t t xixi x i+1 x i-1 tjtj t j+1 Forward-difference Central-difference at time level j
Explicit Method Explicit Euler method for heat equation Rearrange Stability:
Explicit Euler Method Stable Unstable (negative coefficients)
Heat Equation: Explicit Euler Method r = 0.5
Example: Explicit Euler Method Heat Equation (Parabolic PDE) c = 0.5, h = 0.25, k = x 60e -2t 20e -t 0 1 2
Example Explicit Euler method First step: t = 0.05
Second step: t = x 60e -2t 20e -t
Heat Equation: Time-dependent BCs r = 0.4
Stability for Explicit Euler Method It can be shown by Von Neumann analysis that Switch to Implicit method to avoid instability Numerical Stability
Explicit Euler Method: Stability Unstable !! r = 1
Implicit Euler method Initial conditions : u(x,0) = f(x) u(0, t) = g 1 (t) u(a, t) = g 2 (t) Unconditionally Stable
Implicit Method Finite-difference (i,j) (i+1,j+1)(i-1,j+1)(i,j+1) T(x,t) x x t t xixi x i+1 x i-1 tjtj t j+1 Forward-difference Central-difference at time level j+1
Implicit Euler Method Implicit Euler method for heat equation Tridiagonal matrix (Thomas algorithm) Unconditionally stable
Implicit Euler Method Unconditionally stable r = 2
Example: Implicit Euler Method Heat Equation (Parabolic PDE) c = 0.5, h = 0.25, k = x 60e -2t 20e -t 0 1
Example Implicit Euler method
Solve the tridiagonal matrix x 60e -2t 20e -t
Crank-Nicolson method Initial conditions : u(x,0) = f(x) u(0, t) = g 1 (t) u(a, t) = g 2 (t) Implicit Euler method : first-order in time Crank-Nicolson : second-order in time
Crank-Nicolson Method Crank-Nicolson method for heat equation Average between two time levels Tridiagonal matrix Unconditionally stable (neutrally stable) Oscillation may occur
General Two-Level Method General two-stage method for heat equation Weighted-average of spatial derivatives between two time levels n and n+1
Example: Crank-Nicolson Method Heat Equation (Parabolic PDE) c = 0.5, h = 0.25, k = x 60e -2t 20e -t 0 1
Example Crank-Nicolson method Tridiagonal matrix (r = 0.8)
Solve the tridiagonal matrix x 60e -2t 20e -t
Implicit Euler method Unconditionally stable r = 2
Heat Equation with Insulated Boundary No heat flux at x = 0 and x = a x = 0x = a u x (a,t) = 0 u x (0,t) = 0
Insulated Boundary No heat flux at x = a x = a x n+1 x n-1 xnxn u x (a,t)=0