Title: Lecture 34 Ordinary Differential Equations BVP
1Lecture 34 - Ordinary Differential Equations -
BVP
- CVEN 302
- November 28, 2001
2Systems of Ordinary Differential Equations - BVP
- Shooting Method for Nonlinear BVP
- Finite Difference Method
- Partial Differential Equations
3Shooting Method for Nonlinear ODE-BVPs
- Nonlinear
- ODE
- Consider
with guessed slope t - Use the difference between u(b) and yb to adjust
u(a) - m(t) u(b, t) - yb is a function of the guessed
value t - Use secant method or Newton method to find the
correct t value with m(t) 0
4Nonlinear Shooting Based on Secant Method
5MATLAB Example in Nonlinear Shooting Method
- Nonlinear shooting with secant method
- Convert to two first-order ODE-IVPs
- Update t using the secant method
6Nonlinear Shooting - Secant Method
y(x)
y(x)
7Nonlinear Shooting Based on Newtons Method
- Nonlinear
- ODE
- Check for convergence of m(t)
8Nonlinear Shooting Based on Newtons Method
- Nonlinear
- ODE-IVP
- Chain
- Rule
0
x and t are independent
9Nonlinear Shooting with Newtons Method
- Solve ODE-IVP
- Construct the auxiliary equations
10Nonlinear Shooting with Newtons Method
- Calculate m(t) -- deviation from the exact BC
- Update t by Newtons method
11Finite-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
12Finite-Difference Method
- General Two-Point BVPs
- Replace the derivatives by appropriate
finite-difference approximations
13Finite-Difference Method
- Central difference approximations
- Tridiagonal system
14Finite-Difference Method
- Central Difference gt Tridiagonal system
15Finite-Difference Method for Nonlinear BVPs
- Nonlinear ODE-BVPs
- Evaluate fi by appropriate finite-difference
approximations
16Finite-Difference Method for Nonlinear BVPs
- SOR method
- Iterative solution
- Convergence criterion
17Example 14.12 - MATLAB
fi negative sign
18Chapter 15
- Partial Differential Equations
19Classification of PDEs
- General form of linear second-order PDEs with two
independent variables - linear PDEs a, b, c,.,g f(x,y) only
20Heat Equation Parabolic PDE
- Heat transfer in a one-dimensional rod
x 0
x a
g1(t)
g2(t)
21Discretize the solution domain in space and time
with h ?x and k ?t
t
Time (j index)
x
space (i index)
22Initial and Boundary Conditions
Explicit Euler method
u(a, t) g2(t)
u(0, t) g1(t)
Initial conditions u(x,0) f(x)
23Heat Equation
t
tj1
u(x,t)
(i,j1)
t
tj
(i,j)
(i1,j)
(i-1,j)
x
xi
xi1
xi-1
x
Forward-difference Central-difference at time
level j
24Explicit Method
- Explicit Euler method for heat equation
- Rearrange
Stability
25Explicit Euler Method
- Stable
- Unstable (negative coefficients)
26Heat Equation Explicit Euler Method
r 0.5
27Example Explicit Euler Method
- Heat Equation (Parabolic PDE)
- c 0.5, h 0.25, k 0.05
2
60e -2t
20e -t
1
0
1
2
3
4
0
20 40 x
28Example
- Explicit Euler method
- First step t 0.05
2929.61
40
47.72
60e -2t
20e -t
30
40
50
1
2
3
4
0
20 40 x
30Heat Equation Time-dependent BCs
r 0.4
31Numerical Stability
- Stability for Explicit Euler Method
- It can be shown by Von Neumann analysis that
- Switch to Implicit method to avoid instability
32Explicit Euler Method Stability
r 1
Unstable !!
33Implicit Euler method
Unconditionally Stable
u(a, t) g2(t)
u(0, t) g1(t)
Initial conditions u(x,0) f(x)
34Implicit Method
t
(i1,j1)
(i-1,j1)
(i,j1)
tj1
T(x,t)
t
tj
(i,j)
x
xi
xi1
xi-1
x
Forward-difference Central-difference at time
level j1
35Implicit Euler Method
- Implicit Euler method for heat equation
- Tridiagonal matrix (Thomas algorithm)
- Unconditionally stable
36Implicit Euler Method
r 2
Unconditionally stable
37Example Implicit Euler Method
- Heat Equation (Parabolic PDE)
- c 0.5, h 0.25, k 0.1
1
60e -2t
20e -t
0
1
2
3
4
0
20 40 x
38Example
39- Solve the tridiagonal matrix
28.96
38.51
46.19
1
60e -2t
20e -t
0
1
2
3
4
0
20 40 x
40Crank-Nicolson method
Implicit Euler method first-order in
time Crank-Nicolson second-order in time
u(a, t) g2(t)
u(0, t) g1(t)
Initial conditions u(x,0) f(x)
41Crank-Nicolson Method
- Crank-Nicolson method for heat equation
- Average between two time levels
- Tridiagonal matrix
- Unconditionally stable (neutrally stable)
- Oscillation may occur
42General Two-Level Method
- General two-stage method for heat equation
- Weighted-average of spatial derivatives between
two time levels n and n1
43Example Crank-Nicolson Method
- Heat Equation (Parabolic PDE)
- c 0.5, h 0.25, k 0.1
1
60e -2t
20e -t
0
1
2
3
4
0
20 40 x
44Example
- Crank-Nicolson method
- Tridiagonal matrix (r 0.8)
45- Solve the tridiagonal matrix
29.42
39.30
47.43
1
60e -2t
20e -t
0
1
2
3
4
0
20 40 x
46Implicit Euler method
r 2
Unconditionally stable
47Heat Equation with Insulated Boundary
- No heat flux at x 0 and x a
x 0
x a
ux(a,t) 0
ux(0,t) 0
48Insulated Boundary
ux(a,t)0
xn1
xn-1
xn
x a