1
Lecture #01
Finite Difference-based Numerical Methods in Chemical Engineering
Recommended Books:
1) Numerical Methods for Engineers (SKG)
2) Numerical Methods for Engineering Application (Ferziger)
3) Linear Algebra (Strang)
Objective: Learn a few basic numerical techniques (Finite Difference) to solve simple
ODEs/PDEs/algebraic equations derived from a variety of heat and mass transfer related
conservation equations.
Analytical methods yield exact solutions, often in infinite series; use mathematical functions.
Numerical methods yield approximate solutions; use numbers, computations; results are dependent
on the method accuracies and limited by computers machine errors.
Course focuses on
Algebra (Matrix Operation)
Methods (Finite Difference)
Requires knowledge of
Computer Programming (because large # of iterations)
(there are engineering software, e.g., Matlab, NAG, IMSL, Polymath)
No numerical analysis in this course!
Examples: (Applications in chemical engineering)
1. Distillation:
๐1 ๐ฟ๐
1
2
๐ โ 1 ๐๐๐ข๐๐๐๐๐๐๐ข๐ ๐ ๐ ๐ ๐ + 1
๐
Trays ๐๐+1 ๐ฟ๐
Assume: Constant molar flowrates of vapor & liquid.
Binary components: A, B
(more volatile)
Species balance on ๐๐๐ plate:
2
๐ฟ๐ = ๐ฅ๐ ๐ฟ ๐๐ = ๐ฆ๐ ๐ ๐ฆ๐ = ๐๐๐ฅ๐ (๐๐๐ข๐๐๐๐๐๐๐ข๐)
Therefore, ๐๐ = (๐ฆ๐
๐ฅ๐) (
๐
๐ฟ)๐ฟ๐
or ๐๐ = ๐ด๐โฒ๐ฟ๐
And, ๐๐ + ๐ฟ๐ = ๐๐+1 + ๐ฟ๐โ1 (๐๐ = ๐๐ข๐ก)
๐๐ โ ๐๐โ1
๐๐+1 โ ๐๐ โฏ ๐๐กโ ๐๐๐๐ก๐
๐๐ + ๐๐ ๐ด๐โฒโ โ
๐๐โ1
๐ด๐โ1โฒ โ ๐๐+1 = 0
Re-arrange ๐ด๐โ1๐๐โ1 + (1 โ ๐ด๐)๐๐ โ ๐๐+1 = 0
๐ = 1,๐
Thus, there are โNโ equations and (N+2) variables (๐๐ โฏโฏ๐๐+1)
However, ๐๐+1 ๐๐๐ ๐ฟ๐ are known (inlet or boundary conditions)
Re-arrange for all trays ๐ = 1,๐
(1 โ ๐ด1)๐1 โ ๐2 = โ๐ด๐๐๐(= ๐ฟ๐) (๐๐๐๐ค๐)
๐ด1๐1 + ( 1 โ ๐ด2)๐2 โ ๐3 = 0 (1)
โฎ
๐ด๐โ1๐๐โ1 + ( 1 โ ๐ด๐+1)๐๐ = ๐๐+1 (๐๐๐๐ค๐) (๐)
We have a set of algebraic equations (linear/non-linear) represented as
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
coefficient matrix column vectors or (๐ ร 1) ๐๐๐ก๐๐๐ฅ
rows column
๐ด =
[ ( 1 โ ๐ด1) โ1 0 0 0 0
๐ด1 ( 1 โ ๐ด2) โ1 0 0 00 ๐ด2 (1 โ ๐ด3) โ1 0 00 0 0 0 ๐ด๐โ1 (1 โ ๐ด๐+1)]
๐ร๐
rows columns
3
๏ฟฝ๏ฟฝ = {
๐1
๐2
โฎ๐๐
} , ๏ฟฝ๏ฟฝ = {
๐ฟ0
โฎโฎ
๐๐+1
} (Known)
column vectors
Alternatively*,
[ ( 1 โ ๐ด1) โ1 0 0 0 0( 1 โ ๐ด1) โ1 0 0 0 0
๐ด1 ( 1 โ ๐ด2) โ1 0 0 0โฎ โฎ โฎ โฎ โฎ โฎ0 0 0 0 ๐ด๐โ1 (1 โ ๐ด๐+1)]
๐ร๐
[
๐1
๐2
โฎ๐๐
]
๐ร1
= [
๐ฟ๐
โฎ๐๐+1
]
๐ร1
โ represented as matrix multiplication
Note:
o Most of the finite difference methods lead to the discretization of ODEs/PDEs and a set
of algebraic equations.
o You have to solve a set of algebraic equations using Gauss Elimination, G-Jordan etc.
Example 2: Particle settling
(๐๐, ๐๐ , ๐ฃ๐, ๐ด๐, ๐๐)
๐
๐ป ๐๐๐๐ข๐๐/๐๐๐
๐ก =?
(๐๐ , ๐ฃ๐)
Force balance on the particle:
๐๐๐๐ฃ
๐๐ก= ๐๐๐ โ ๐ฃ๐๐๐๐ โ ๐ถ๐ท (
1
2๐๐๐ฃ
2)๐ด๐
๐ค๐๐๐โ๐ก ๐๐ข๐๐ฆ๐๐๐๐ฆ ๐๐๐๐
๐๐ฃ
๐๐ก= ๐ โ
๐๐
๐๐๐ โ ๐ถ๐ท (
1
2๐๐๐ฃ
2) (๐๐๐2
4)
4
๐๐ฃ
๐๐ก= ๐ด โ ๐ต๐ถ๐ท(๐ฃ)๐ฃ2 ๐ถ๐ท 24 ๐ ๐ ,โ ๐
= ๐ด โ ๐ตฮฆ(๐ฃ) 0.44
๐ก = 0, ๐ฃ = 0 ๐ ๐ , ๐
Therefore, you have to solve an initial value problem (ODE)
Solution: linear or non-linear
๐ฃ๐ก homogeneous or non-homogeneous
or a set of ODEs.
v Methods: RK-4, Euler Forward, etc.
0 t
Example 3: Heating or cooling of a moving particle (๐๐ป(๐) = ๐)
๐ก = 0 ๐ฃ๐ = 0
๐ ๐๐ ๐ = ๐๐ > ๐๐(๐๐๐๐ ๐ก๐๐๐ก)
๐๐ โ๐ (๐๐๐ข๐๐ ๐ก๐๐๐๐๐๐๐ก๐ข๐๐)
๐(๐ก) =? (๐๐๐๐ฃ๐๐๐ก๐๐ฃ๐ โ๐๐๐ก ๐ก๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ก)
Assume/ Apply lump body approach (๐ฉ๐ โ ๐)
1. Energy balance over entire particle โ๐๐
๐๐โ 0 , ๐๐ >> โ๐๐
๐๐ถ๐๐๐
๐๐ก= โโ๐ด๐ (๐ โ ๐๐)
(๐ด๐ = ๐๐๐2)
(๐๐ ๐ก๐๐๐๐๐๐๐ก๐ข๐๐ ๐๐๐๐๐๐๐๐ก ๐๐๐ ๐๐๐ ๐กโ๐ ๐๐๐๐ก๐๐๐๐)
โ = โ(๐๐ข) โ โ๐๐
๐๐= ๐(๐ ๐,๐,๐๐)
๐๐ โ = โ (๐ฃ๐ ); ๐ ๐ = ๐ฃ1๐๐๐๐
๐๐, ๐๐ = (
๐ถ๐๐
๐)๐
2 Time-dependence of velocity (see previous example) and energy balance equation can be
written as
5
๐๐ฃ๐
๐๐ก= ๐ด โ ๐ตฮฆ(๐ฃ๐)
๐๐๐๐ก
= ๐ถ ๐ท(๐ฃ๐) โ ๐ธ} ๐ก = 0 ๐ฃ๐ = 0, ๐ = ๐๐Type equation here.
In this example, two ODEs are to be solved; first y1 and then y2.
๐๐ฆ1
๐๐ก= ๐(๐ฆ1)
๐๐ฆ2
๐๐ก= ฮฆ(๐ฆ1, ๐ฆ2)
} ๐๐ค๐ ๐๐ท๐ธ๐
Example 4: Heating or cooling of a stationary solid (๐๐ป โ ๐) in a moving fluid
๐ก = 0 ๐ = ๐๐ > ๐๐(๐ถ๐๐๐ ๐ก๐๐๐ก)
๐๐ ๐๐๐ข๐๐ ๐ก๐๐๐๐๐๐๐ก๐ข๐๐
๐
๐(๐ก, ๐) =? ๐๐ ๐๐
โ๐(๐๐๐๐ฃ๐๐๐ก๐๐ฃ๐ โ๐๐๐ก ๐ก๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ก)
Assume โ๐(๐) = 0, ๐. ๐. , ๐กโ๐๐๐ ๐๐ ๐ก๐๐๐๐๐๐๐ก๐ข๐๐ ๐๐๐๐๐๐๐๐ก ๐๐๐ ๐๐๐ ๐กโ๐ ๐๐๐๐ก๐๐๐๐
Energy balance within the particle:
๐๐ถ๐๐๐
๐๐ก=
๐
๐2
๐
๐๐(๐2 ๐๐
๐๐)
๐ก = 0 ๐ = ๐๐ ๐๐ โฅ ๐ โฅ 0 (๐ผ๐๐๐ก๐๐๐ ๐๐๐๐๐๐ก๐๐๐)
= 0+ ๐ = 0 ๐๐
๐๐= 0 (๐ต๐๐ข๐๐๐๐๐ฆ ๐๐๐๐๐๐ก๐๐๐๐ )
๐ = ๐๐, โ ๐๐๐
๐๐= โ(๐ โ ๐๐)
Now, we have to solve a PDE equation (unsteady โ state 1D on space-problem)
Under the steady-state condition with/without a source term, the equation will be
reduced to a 2nd order ODE or a boundary value problem.
6
Example 5: Mass transfer in a tubular liquid flow (steady- state)
๐ถ๐ด = ๐ถ๐๐ ๐
๐ (๐ค๐๐ก๐๐ โ ๐๐๐๐ค) ๐ฃ๐ง(๐)
๐ก = 0 z
tube length = L
For ๐ ๐ < 2100
๐ฃ๐ง(๐) = 2๐ฃ๐(1 โ๐2
๐ 2)
๐(๐ก, ๐ง, ๐) =?
Species (A) balance in the CV (2๐๐ โ๐ง โ๐)
CV
๐๐ถ๐ด
๐๐ก+ ๐ฃ๐ง. โ๐ถ๐ด = ๐ทโ2๐ถ๐ด + ๐(= 0)
(no reaction)
๐๐ถ๐ด
๐๐ก+ 2๐ฃ๐ (1 โ
๐2
๐ 2)๐๐ถ๐ด
๐๐ง+ ๐ฃ๐
๐๐ถ๐ด
๐๐= ๐ท (
๐๐ถ๐ด
๐๐ง2+
1
๐
๐
๐๐(๐
๐๐ถ๐ด
๐๐))
๐ก = 0 , ๐ถ๐ด = 0 ๐๐ฃ๐๐๐ฆ๐คโ๐๐๐
0+ ๐ง = 0 ๐ถ๐ด = ๐ถ๐๐
๐ง = ๐ฟ ๐๐ถ๐ด
๐๐ง= 0 (๐๐๐๐ ๐ก๐ข๐๐ ๐๐๐๐๐๐ฅ๐๐๐๐ก๐๐๐)
๐ = 0 , ๐๐ถ๐ด
๐๐= 0 (๐ ๐ฆ๐๐๐๐ก๐๐๐)
= ๐ โ ๐๐ถ๐ด
๐๐= 0 (๐๐๐ โ ๐๐๐๐๐ก๐๐ฃ๐ ๐ค๐๐๐)
In this example, we have a transient/unsteady-state 2D (space) problem or a PDE to solve.
Under the steady-state condition with/without a source term, the equation will be
reduced to an elliptic PDE or 2nd order (in both z and r) PDE.
1
Lecture #02
Linear Algebraic Equations
๐1(๐1, ๐2, โฏโฏ๐๐) = 0๐2(๐1, ๐2, โฏโฏ๐๐) = 0โฎ
๐๐(๐1, ๐2,โฏโฏ๐๐) = 0
} system of ๐ linear algebraic equations
or
๐11๐1 + ๐12๐2 +โฏโฏ+ ๐1๐๐๐ = ๐1
๐๐๐ค ๐๐๐๐ข๐๐ ๐21๐1 + ๐22๐2 +โฏโฏ+ ๐2๐๐๐ = ๐2โฎ
๐๐1๐1 + ๐๐2๐2 +โฏโฏ+ ๐๐๐๐๐ = ๐๐ }
๐ # ๐๐ ๐๐๐๐๐๐๐๐๐๐๐ก ๐๐๐ข๐๐ก๐๐๐๐ ๐ก๐ ๐ ๐๐๐ฃ๐ ๐ # ๐๐๐ฃ๐๐๐๐๐๐๐๐
or ๐ด๐ = ๐ ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
๐คโ๐๐๐ ๐ด = ๐๐๐๐๐๐๐๐๐๐๐ก ๐๐๐ก๐๐๐ฅ
= [
๐11 ๐12 โฏ ๐1๐๐21 ๐22 โฏ ๐2๐โฎ โฎ โฎ โฎ๐๐1 ๐๐2 โฏ ๐๐๐
]
๐ร๐
(๐๐๐ ๐๐ ๐ ๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ก; ๐, ๐ = 1 ๐ก๐ ๐)
row column
๐ = ๐๐๐ก๐๐๐ฅ = [
๐1๐2โฎ๐๐
]
๐ร1
๐ = ๐๐๐ก๐๐๐ฅ = [
๐1๐2โฎ๐๐
]
๐ร1
or,
๏ฟฝ๏ฟฝ = ๐๐๐๐ข๐๐ ๐ฃ๐๐๐ก๐๐ = {
๐1๐2โฎ๐๐
} , ๏ฟฝ๏ฟฝ = ๐๐๐๐ข๐๐ ๐ฃ๐๐๐ก๐๐ = {
๐1๐2โฎ๐๐
}
2
{
Note: In general, a matrix has ๐ ร ๐ elements
Therefore, aij: i = 1 to n
j = 1 to mIf n = m, there may be unique solution and the rank of the matrix = m
In general, rank >,=,< m (3 cases)(For more, refer a book on matrix operation)
In this course,we will be interested in solving number of equations with as many variables:
3x + 2y = 5x โ y = 6
} or 3x + 2y + z = 5x + y โ z = 2
2x + 2y โ 2z = 4} etc.
Some properties of a matrix and operation
(1) Symmetric matrix, ๐๐๐ = ๐๐๐
Square matrix, n = m
Diagonal matrix, [โฑ 00 โฑ
] (๐๐๐๐ฆ ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ก๐ )
Banded matrix (tridiagonal)
[ ๐11 ๐12 0 0 โฏ 0๐21 ๐22 ๐23 0 โฏ 00 ๐32 ๐33 ๐34 โฏ 0โฎ โฎ โฎ โฎ โฎ โฎ0 0 0 0 ๐๐๐โ1 ๐๐๐]
๐ร๐ ๐๐๐ก๐๐๐ฅ
(First and last rows have only two elements and all other rows have 3 elements, one on
the diagonal and the other two on each side of the diagonal element)
Upper/Lower triangular matrix:
(All elements below and above the diagonal are zero, respectively)
UTM:
[ ๐11 ๐12 ๐13 โฏ ๐1๐
๐22 ๐23 โฏ ๐2๐โฑ โฑ โฎ
๐ โฑ ๐๐โ1๐๐๐๐ ]
๐ร๐
LTM:
[ ๐11๐21 ๐22๐31 ๐32 โฑ ๐
โฎ โฎ โฑ โฑ๐๐1 ๐๐2 โฏ ๐๐๐โ1 ๐๐๐]
๐ร๐
(2) Operation:
Summation: [๐ด]๐ร๐ = [๐ต]๐ร๐ + [๐ถ]๐ร๐
3
Multiplication (rules):
[๐ด]๐ร๐ ร [๐ต]๐ร๐ = [๐ถ]๐ร๐
same
Therefore, multiplication is not permissible for [๐ต] ร [๐ด]
{
๐ ร ๐ ๐ ร ๐
๐๐๐๐๐๐๐๐๐ก๐ โ ๐
Also, these multiplications are permissible
[5 13 20 3
]
3ร2
ร [โ3 01 0
]2ร2
; [5 13 20 3
]
3ร2
ร [โ4 โ3 22 7 โ3
]2ร3
; [1 3 2]1ร3 ร [05โ8]
3ร1
Rule: ๐ช๐๐ = โ ๐๐๐ ร ๐๐๐๐๐=๐
examples: [3 18 60 4
]
3ร2
ร [5 67 2
]2ร2
= [
(3 ร 5 + 1 ร 7) 3 ร 6 + 1 ร 2(8 ร 5 + 6 ร 7) (8 ร 6 + 6 ร 2)0 ร 5 + 4 ร 7) (0 ร 6 + 4 ร 2
]
3ร2
Inverse of a matrix:
[๐ด]โ1 โ [๐ด]๐ร๐ ร [๐ด ]๐ร๐โ1 = [๐ผ] โก [
1 0 00 1 00 0 1
]
Identity matrix
For ๐ ร ๐ matrix
[๐ด]โ1 =1
|๐ด|[๐22 โ๐12โ๐21 ๐11
] ๐คโ๐๐๐ ๐ด = [๐11 ๐12๐21 ๐22
]
Note: |๐ด| = (๐11 ร ๐22 โ ๐12 ร ๐21) โ 0
else, matrix A is considered to be singular.
For bigger size matrices, there are special methods to determine[๐ด]โ1, discussed later.
Transpose of a matrix [๐จ]๐ป:
[๐ด] = [๐11 ๐12 โฏ ๐1๐๐๐1 ๐๐2 โฏ ๐๐๐
], [๐ด]๐ = [๐11 ๐21 โฏ ๐๐1๐1๐ โฏ โฏ ๐๐๐
]๐ร๐
(rows have been interchanged with columns)
4
example: [๐ด] = [
๐1๐2โฎ๐๐
]
๐ร1
โ [๐ด]๐ = [๐1 ๐2 โฏ ๐๐]1ร๐
Let us get back to solving a set of algebraic equations:
[๐ด]{๐} = {๐}
๐๐ [๐ด][๐] = [๐]
๐๐ ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
} ๐๐ = [๐1 ๐2โฏโฏ๐๐], ๐๐ = [๐1 ๐2โฏโฏ๐๐]
๐ฟ = ๐จโ๐๐
โ {
๐น๐๐๐๐๐๐ ๐ ๐๐๐ข๐ก๐๐๐ ๐ก๐ ๐กโ๐ ๐ ๐๐ก ๐๐ ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐ ๐๐๐ข๐๐ก๐๐๐ ๐๐ ๐๐๐กโ๐๐๐ ๐๐ข๐ก ๐๐๐๐๐๐๐ ๐๐๐ฃ๐๐๐ ๐ ๐๐ ๐กโ๐ ๐๐๐๐๐๐๐๐๐๐๐ก ๐๐๐ก๐๐๐ฅ, ๐๐๐๐๐๐ค๐๐ ๐๐ฆ
๐๐ข๐๐ก๐๐๐๐๐๐๐ก๐๐๐ ๐ค๐๐กโ ๐.
Generally, Cremerโs rule works nicely for small matrix:
๐ฟ๐ =|๐จ๐|
|๐จ|
๐ด๐ is determined by replacing ๐๐กโ column of A by b.
Therefore, if ๐ด = [3 5 72 0 8โ1 2 5
] ; ๐ = {732}
๐2 = [3 7 72 3 8โ1 2 5
] |๐ด|โ ; |๐ด| โ 0
๐3 = [3 5 72 0 3โ1 2 2
] |๐ด|โ , ๐๐ก๐.
Let us briefly discuss unique solution, singularity, and rank (r) of a (๐ ร ๐) matrix. (Read the
textbook for details)
Consider the following set of equations:
(1) 2๐ฅ1 + 3๐ฅ2 = 11
4๐ฅ1 + 6๐ฅ2 = 22
Note: Two equations are not independent.
and |๐ด| = [2 34 6
]2ร2
= 0
5
Therefore, there is no unique solution, coefficient matrix is singular and ๐ of such matrix =
1 < 2 ๐๐ ๐(# ๐๐ ๐๐๐ข๐๐ก๐๐๐๐ ) < ๐(# ๐๐ ๐ฃ๐๐๐๐๐๐๐๐ )
(2) 2๐ฅ1 + 3๐ฅ2 = 11
๐ฅ1 + ๐ฅ2 = 4
Note: Two equations are independent.
|๐ด| = [2 31 1
]2ร2
โ 0; ๐๐๐ ๐ = ๐, ๐ = 2(๐)
There is a unique solution.
Geometrically, two equations represent two straight lines intersecting at a unique point.
Similarly, 3 independent equations for ๐2
3 variables will represent 3 planes on a โ
geometrical space; two planes intersecting
will yield a straight line, and two straight lines ๐1
intersecting will yield a point (๐1, ๐2, ๐3), or the unique solution to the equations.
(3) 2๐ฅ1 + 3๐ฅ2 โ ๐ฅ3 = 11
๐ฅ1 + ๐ฅ2 + ๐ฅ3 = 4
๐ฅ1 + 2๐ฅ2 + 2๐ฅ3 = 7
Note: There are three linearly independent equations representing three non-parallel
equations. In this case, m = ๐, ๐ = 3(๐).
1
Lecture #03
Gauss Elimination
It is the most widely used method to solve a set of linear algebraic equations. The method
reduces the original matrix to an upper triangular matrix which can also be used to determine
the determinant of the matrix. Interestingly, one can also inspect the intermediate
steps/solutions to determine singularity, rank, and number of independent equations.
General steps: ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ ๐คโ๐๐๐ ๐ด ๐๐ ๐ 3 ร 3 ๐๐๐ก๐๐๐ฅ
๐11๐ฅ1 + ๐12๐ฅ2 + ๐13๐ฅ3 = ๐1 โฏโฏโฏ๐ 1
๐21๐ฅ1 + ๐22๐ฅ2 + ๐23๐ฅ3 = ๐2 โฏโฏโฏ๐ 2
๐31๐ฅ1 + ๐32๐ฅ2 + ๐33๐ฅ3 = ๐3 โฏโฏโฏ๐ 3
or [
๐11 ๐12 ๐13๐21 ๐22 ๐23๐31 ๐32 ๐33
] {
๐ฅ1๐ฅ2๐ฅ3} = {
๐1๐2๐3
}
๐ 1, first row is called pivot row and first non-zero element (๐11) is called pivotal element.
Subsequent operations are performed around pivot row and pivotal element.
Step 1: [
๐11 ๐12 ๐130 ๐22
โฒ ๐23โฒ
0 ๐32โฒ ๐33
โฒ] {
๐ฅ1๐ฅ2๐ฅ3} = {
๐1๐2โฒ
๐3โฒ}
where
๐22โฒ = ๐22 โ (
๐21
๐11) ร ๐12
๐23โฒ = ๐23 โ (
๐21
๐11) ร ๐13
๐2โฒ = ๐2 โ (
๐21
๐11) ร ๐1 }
(2)
Briefly, the first equation is divided by a11, multiplied by a21, and substractedfrom the second equation to yield the
modified equation (2)
๐11 โ 0
Similarly,
๐32โฒ = ๐32 โ (
๐31
๐11) ร ๐12
๐33โฒ = ๐33 โ (
๐31
๐11) ร ๐13
๐3โฒ = ๐3 โ (
๐31
๐11) ร ๐1 }
(3)
Briefly, the first equation is divided by a11, multiplied by a31, and substracted
from the 3rd equation to yield the modified equation (3)
or, in the simplest form ๐ 2โฒ = ๐ 2 โ ๐ 1 (
๐21
๐11)
2
๐ 3โฒ = ๐ 3 โ ๐ 1 (
๐31
๐11)
Note: Multiplication or division of an equation, or subtraction or addition of one independent
equation from/to another independent equation does not yield a new independent equation.
Therefore, at the end of step 1 we still have three linearly independent equations, although
modified, to solve.
Geometrically, two planes (non-parallel) will intersect to yield a straight line. Therefore, step1
has yielded two straight lines by the intersections of plane/(eq 1) with plane 2 (eq 2) and with
plane 3 (eq 3).
Step2: Follow the similar procedure. Now ๐ 2โฒ(2nd row) becomes pivotal equation and
๐22โฒ becomes pivotal element.
[
๐11 ๐12 ๐130 ๐22
โฒ ๐23โฒ
0 0 ๐33โฒโฒ] {
๐ฅ1๐ฅ2๐ฅ3} = {
๐1๐2โฒ
๐3โฒโฒ}
where,
๐33โฒโฒ = ๐33
โฒ โ (๐32
โฒ
๐22โฒ) ร ๐23
โฒ
๐3โฒโฒ = ๐3
โฒ โ (๐32
โฒ
๐22โฒ) ร ๐2
โฒ
or in the simplest form, ๐ 3โฒโฒ = ๐ 3
โฒ โ ๐ 2โฒ (๐32
โฒ
๐22โฒ)
Geometrically, two straight lines (๐ 2โฒ ๐๐๐ ๐ 3
โฒ) intersect at a point.
Note: At the end of step (2) an upper triangular matrix is obtained. The three modified
algebraic equations are as follows:
๐11๐ฅ1 + ๐12๐ฅ2 + ๐13๐ฅ3 = ๐1 ๐22
โฒ๐ฅ2 + ๐23โฒ๐ฅ3 = ๐2
โฒ
๐33โฒโฒ๐ฅ3 = ๐33
โฒโฒ}
This is a new set of three linearly independent algebraic equations to solve! Here โnewโ means
โmodifiedโ.
3
Reverse (back) substitution (to determine๏ฟฝ๏ฟฝ):
๐ฅ3 = ๐3โฒโฒ ๐33
โฒโฒโ (from the last row)
๐ฅ2 =๐2โฒโ๐23
โฒ๐ฅ3
๐22โฒ (from the 2nd last row)
๐ฅ1 =๐1โ๐12๐ฅ2โ๐13๐ฅ3
๐11 (from the 1st row)
In general, for the ith variable of โnโ equations
๐ฅ๐ =๐๐(๐โ1)
โ โ ๐๐๐(๐โ1)
๐ฅ๐๐ ๐=๐+1
๐๐๐(๐โ1)
A large number of equations (๐ > 3) requires a programming code to solve.
Evaluation of determinant:
Consider a simple 2 ร 2 matrix
๐ด = [๐11 ๐12๐21 ๐22
]2ร2
โ ๐๐๐ก๐ด = (๐11 ร ๐22 โ ๐21 ร ๐12)
Apply GE method
๐ดโฒ = [๐11 ๐120 ๐22
โฒ]2ร2 ; ๐22
โฒ = (๐22 โ (๐21
๐11) ร ๐12)
The determinant of the modified matrix ๐ดโฒ = (๐11 ร ๐22 โ ๐21 ร ๐12) = ๐ ๐๐๐ ๐๐ det (๐ด)
โValue of determinant is not changed by the forward elimination step of GEโ. This must be
true because forward step only modifies the equations.
Take 3 ร 3 matrix:
[
๐11 ๐12 ๐13๐21 ๐22 ๐23๐31 ๐32 ๐33
]๐บ๐ธโ [
๐11 ๐12 ๐130 ๐22
โฒ ๐23โฒ
0 0 ๐33โฒโฒ]
[๐ด] [๐ดโฒ]
๐๐๐ก[๐ด] = ๐๐๐ก[๐ดโฒ] = ๐11๐22โฒ๐33
โฒโฒ (can be checked)
Therefore,
๐๐๐ก[๐ด] โ ๐๐๐๐๐ข๐๐ก ๐๐ ๐กโ๐ ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ก๐ ๐๐ ๐๐ก๐ ๐ข๐๐๐๐ ๐ก๐๐๐๐๐๐ข๐๐๐ ๐๐๐ก๐๐๐ฅ
4
Note that swapping of rows of a matrix does not alter values of determinant. However, sign
changes: (โ1)๐, where k is the number of times rows are swapped.
Re-visit
๐๐๐ก[๐ด]3ร3 = ๐11๐22โฒ๐33
โฒโฒ (๐๐๐๐๐ข๐๐ก ๐๐ ๐กโ๐ ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ก๐ ๐๐ ๐๐๐ ๐๐ ๐ด)
Note: 1. For a matrix to be non-singular ๐๐๐ก[๐ด] โ 0
๐๐ ๐11๐22โฒ๐33
โฒโฒ โ 0
Alternatively, the corresponding three equations are linearly independent; rank of
[๐ด] = #๐๐ ๐ฃ๐๐๐๐๐๐๐๐ = #๐๐ ๐๐๐๐ = 3.
Geometrically, three planes intersect at a unique point in space, or none of them is โฅ to the
other.
Alternatively,
If a33โฒโฒ = 0, det[A] = 0 โ the matrix is singular; rank of the matrix = 2(< 3); only first
two equations are linearly independent; the problem is under-determined and one more
equation is required to solve(๐ฅ1, ๐ฅ2, ๐ฅ3). Algebraically, 3rd plane is โฅ to one of the other two
planes.
Pivoting and ill-conditioning:
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ โ ๏ฟฝ๏ฟฝ = ๐ดโ1๏ฟฝ๏ฟฝ ; ๐ดโ1 =๐ด๐๐|๐ด|
|๐ด|
Therefore, for ๏ฟฝ๏ฟฝ to be solved or A to be invertible, |๐ด| โ 0. Yet if |๐ด| โ
0 (๐๐ ๐๐ก ๐๐ ๐ ๐ ๐๐๐๐ ๐๐ข๐๐๐๐), a small change in |๐ด| will lead to a large change in ๐ดโ1.
[Note: ๐ = 1 ๐โ , ๐๐
๐๐= โ
1
๐2
In other words, a small change in X will lead to large change in Y]
In such case, the problem is said to be ill-conditioned. To invert such a matrix, large machine
precision may be required, and one has to be careful with round-off errors.
Recall, determinant of a matrix is the product of the diagonal elements of UTM. Therefore,
pivotal elements should not only be zero, but also large, or the matrix should be โdiagonally
strongโ.
5
Example: 0.0001๐ฅ1 + ๐ฅ2 = 1 (๐ด)
๐ฅ1 + ๐ฅ2 = 2
Working with 4th decimal, apply GE with 0.0001 as the pivotal element to obtain
๐๐ = [0.0000 1.0000] which is wrong. Now, swap the equations as
๐ฅ1 + ๐ฅ2 = 2
0.0001๐ฅ1 + ๐ฅ2 = 1
Apply GE to obtain ๐ฅ๐ = [1.0000 1.0000] which is 4th decimal accurate.
This is called pivoting. Swap the row, so that the pivotal element is relatively larger. Also,
scaling (or multiplying equation (A) by 10000) can be done before applying GE.
Example: Solve by GE:
[1 โ1 22 โ2 31 1 1
] {
๐ฅ1๐ฅ2๐ฅ3} = {
โ8โ20โ2}
Step 1: [1 โ1 20 0 โ10 2 โ1
] {
๐ฅ1๐ฅ2๐ฅ3} = {
โ8โ4+6}
Row pivoting is required (or swap 2nd equation with 3rd so that pivotal elemental is non โ zero).
[1 โ1 20 2 โ10 0 โ1
] {
๐ฅ1๐ฅ2๐ฅ3} = {
โ8+6โ4}
We have now UTM. Reverse substitution will yield
๐ฅ๐ = [โ11 5 4]
(a) ๐๐๐ก[๐ด] = โ1 ร 2 ร โ1 = 2 โ 0 (matrix is singular, rank = 3, all 3 equations are
linearly independent ). Also, note that we swapped one time. So, there is the
multiplication with -1.
Column pivoting (generally it should be avoided)
[1 2 โ10 โ1 00 โ1 2
] {
๐ฅ1๐ฅ2๐ฅ3} = {
โ8โ4+6}
6
Column 2 is replaced with column 3 to make the pivotal element โ 0. However, note that the
variables ๐ฅ2 ๐๐๐ ๐ฅ3 are also swapped in the column vector ๏ฟฝ๏ฟฝ, else you would be solving a
different set of equations!
๐ฅ1 + 2๐ฅ2 โ ๐ฅ3 = โ8 โ๐ฅ2 = โ4
โ๐ฅ2 + 2๐ฅ3 = +6}(left) original equation/(right) swapped equation:
๐ฅ1 + 2๐ฅ3 โ ๐ฅ2 = โ8 โ๐ฅ3 = โ4
2๐ฅ2 โ ๐ฅ3 = +6}
Proceed as follows:
[1 โ2 โ10 โ1 00 0 2
] {
๐ฅ1๐ฅ3๐ฅ2} = {
โ8โ410}
Reverse substitution will yield ๐ฅ๐ = [โ11 , 5 , 4]
1
Lecture #04
Gauss-Jordan
1. Procedure is similar to that of GE
2. Normalizer the pivotal element
3. Eliminate the unknown from all rows, below and above the pivot row
4. No back substitution is required as required in GE.
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
[
๐11 ๐12 ๐13๐21 ๐22 ๐23๐31 ๐32 ๐33
]
3ร3
{
๐ฅ1๐ฅ2๐ฅ3} = {
๐1๐2๐3
}
Step 1: ๐1๐โฒ =
๐1๐
๐11 ๐ = 1,3 (๐๐๐๐๐๐๐๐ง๐ ๐11(๐๐๐ฃ๐๐ก๐๐ ๐๐๐๐๐๐๐ก) to 1.0)
๐1โฒ = ๐1 ๐11โ
๐2๐โฒ = ๐2๐ โ ๐1๐
โฒ ร ๐21๐3๐
โฒ = ๐3๐ โ ๐1๐โฒ ร ๐31
๐2โฒ = ๐2 โ ๐1
โฒ ร ๐21๐3โฒ = ๐3 โ ๐1
โฒ ร ๐31 }
๐ ๐๐๐ ๐๐ ๐กโ๐ ๐บ๐ธ ๐๐๐กโ๐๐;๐๐๐๐๐๐๐กโ๐ ๐๐๐๐ ๐ก ๐๐๐๐ข๐๐ ๐๐๐๐๐ค ๐กโ๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐ค ๐ก๐ ๐๐ 0.
[
1 ๐12โฒ ๐13
โฒ
0 ๐22โฒ ๐23
โฒ
0 ๐32โฒ ๐33
โฒ]
3ร3
{ ๏ฟฝ๏ฟฝ } = {
๐1โฒ
๐2โฒ
๐3โฒ
}
Step2: ๐2๐โฒโฒ =
๐2๐โฒ
๐22โฒ ๐ = 2,3 (๐๐๐๐๐๐๐๐ง๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐๐๐๐๐ก ๐๐ 2๐๐ ๐๐๐ค to 1.0)
๐2โฒโฒ = ๐2
โฒ ๐22โฒโ
๐1๐โฒโฒ = ๐1๐
โฒ โ ๐2๐โฒ ร ๐12
โฒ
๐1โฒโฒ = ๐1
โฒ โ ๐2โฒ ร ๐12
โฒ}๐ ๐ข๐๐ก๐๐๐๐ก ๐กโ๐ ๐๐๐๐๐๐๐๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐ค ๐๐๐๐ ๐กโ๐ ๐๐๐ค ๐๐๐๐ฃ๐.
๐ต๐๐๐ ๐๐๐๐ ๐๐ ๐๐๐ ๐๐๐๐๐ ๐๐๐๐ ๐๐ ๐ฎ๐ฌ.
๐3๐โฒโฒ = ๐3๐
โฒ โ ๐2๐โฒ ร ๐32
โฒ
๐3โฒโฒ = ๐3
โฒ โ ๐2โฒ ร ๐32
โฒ}
๐ ๐ข๐๐ก๐๐๐๐ก ๐กโ๐ ๐๐๐๐๐๐๐๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐ค ๐๐๐๐ ๐กโ๐ ๐๐๐ค ๐๐๐๐๐ค.๐โ๐๐ ๐๐ ๐กโ๐ ๐ ๐๐๐ ๐ ๐ก๐๐ ๐๐ ๐๐ ๐บ๐ธ.
2
[
1 0 ๐13โฒโฒ
0 1 ๐23โฒโฒ
0 0 ๐33โฒโฒ] ๏ฟฝ๏ฟฝ = {
๐1โฒโฒ
๐2โฒโฒ
๐3โฒโฒ
}
Step 3: ๐3โฒโฒโฒ = ๐3
โฒโฒ ๐33โฒโฒโ (normalize pivotal element to 1)
๐2โฒโฒโฒ = ๐2
โฒโฒ โ ๐3โฒโฒโฒ๐23
โฒโฒ
๐1โฒโฒโฒ = ๐1
โฒโฒ โ ๐3โฒโฒโฒ๐13
โฒโฒ}๐ ๐ข๐๐ก๐๐๐๐ก ๐๐๐กโ ๐๐๐ค๐
1 ๐๐๐ 2 ๐๐๐๐ฃ๐ ๐๐๐๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐ค. ๐โ๐๐๐ ๐๐ ๐๐ ๐๐๐ค ๐๐๐๐๐ค ๐กโ๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐ค.
[1 0 00 1 00 0 1
] {
๐ฅ1๐ฅ2๐ฅ3} = {
๐1โฒโฒโฒ
๐2โฒโฒโฒ
๐3โฒโฒโฒ
}
Therefore, ๐๐ = ๐(โฒโฒโฒ)๐: ๐ ๐๐๐ข๐ก๐๐๐.
No back substitution is required for a unit matrix!
Make a note that G-J method can also be used to determine inverse of the matrix, if
working on the augmented matrix. Check text books for more details.
example: [1 โ1 21 1 12 โ2 3
] { ๏ฟฝ๏ฟฝ } = {โ8โ2โ20
}
โ [1 โ1 20 2 โ10 0 โ1
] [
๐ฅ1๐ฅ2๐ฅ3] = [
โ8 6โ4] (pivotal element already had โ1โ โ no need to normalize!)
โ [1 โ1 20 1 โ0.50 0 โ1
] [
๐ฅ1๐ฅ2๐ฅ3] = [
โ83โ4] (pivotal row was divided by 2 to make pivotal element to be 1)
โ [1 0 1.50 1 โ0.50 0 โ1
] [
๐ฅ1๐ฅ2๐ฅ3] = [
โ5 3โ4] (rows were subtracted above and below from the pivotal row)
โ [1 0 1.50 1 โ0.50 0 1
] [
๐ฅ1๐ฅ2๐ฅ3] = [
โ534] (pivotal element was made to be 1)
โ [1 0 00 1 00 0 1
] [
๐ฅ1๐ฅ2๐ฅ3] = [
โ1154] (rows 1 & 2 subtracted from the pivotal row)
๐๐ = [โ11 5 4]๐
You should ensure that the programming code for G-J is written by modifying the code for GE,
instead of writing afresh, by changing the indices for i and j.
3
LU Decomposition: Two similar/identical methods
Dolittle Croutโs
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
(This method is considered to be the best if only right hand side ๏ฟฝ๏ฟฝ changes from problem/case
to problem/case)
๐ด = ๐ฟ๐ โ๐๐๐๐๐๐๐๐ ๐๐ก๐๐๐๐ ๐๐๐ก๐ ๐ฟ ๐๐๐ ๐
{
[
1 0 0๐21 1 0๐31 ๐32 1
] [
๐11 ๐12 ๐130 ๐22 ๐230 0 ๐33
]
๐ท๐๐๐๐ก๐ก๐๐
[
๐11 0 0๐21 ๐22 0๐31 ๐32 ๐33
] [1 ๐12 ๐130 1 ๐230 0 1
]
๐ถ๐๐๐ข๐ก
In either case, steps are as follows:
1. ๐ด = ๐ฟ๐ (๐๐๐๐๐๐๐๐ ๐)
2. ๐ฟ๐ ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
๏ฟฝ๏ฟฝ
} โ ๐ฟ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ, ๐ ๐๐๐ฃ๐ ๐๐๐ ๏ฟฝ๏ฟฝ ๐๐๐๐ ๐ก
3. ๐๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ โ ๐ ๐๐๐ฃ๐ ๐๐๐ ๏ฟฝ๏ฟฝ
example: [1 โ1 21 1 12 โ2 3
] { ๏ฟฝ๏ฟฝ } = {โ8โ2โ20
}
๐ด = [1 0 0๐21 1 0๐31 ๐32 1
]
3ร3
[
๐11 ๐12 ๐130 ๐22 ๐230 0 ๐33
]
3ร3
=
[ ๐11 ๐12 ๐13
๐21๐11 (๐21๐12+๐22
) (๐21๐13+๐23
)
๐31๐11 (๐31๐12+
๐32๐22
)
(
๐31๐13+
๐32๐23+๐33 )
]
3ร3
Match,
๐11 = 1, ๐12 = โ1, ๐13 = 2
4
๐21๐11 = 1, ๐21๐12 + ๐12 = 1, ๐21๐13 + ๐23 = 1
๐31๐11 = 2, ๐31๐12 + ๐32๐23 = โ2, ๐31๐13 + ๐32๐23 + ๐33 = 3
Therefore, there are 9 unknown & 9 equations to solve and the problem is well defined.
How do we obtain LU?
Well, use GE to reduce A to an upper triangular matrix U.
However, in addition, store multiplication coefficients of GE as the coefficients ๐21, ๐31, ๐๐๐ ๐32
of lower triangular matrix
as: ๐๐๐ =๐๐๐
๐๐๐;
๐ = 1 ๐ก๐ ๐ โ 1๐ = ๐ + 1 ๐ก๐ ๐
}
It is clear that the programming code used for GE to reduce the matrix A to UTM (U) is the
same as that for determining U of LU decomposition method. In addition, the coefficients of L
are also determined automatically by defining an extra coefficient ๐๐๐(see above) in the same
programming code.
Example:
๐ด = [1 โ1 21 1 12 โ2 3
]
Step 1:
= [
1 0 0๐21 1 0๐31 ๐32 1
] [
๐11 ๐12 ๐130 ๐22 ๐230 0 ๐33
]
L U
= [
1 0 0๐21 = 1 1 0๐31 = 2 ๐32 = 0 1
] [1 โ1 20 2 โ10 0 โ1
]
{
๐๐๐ก๐ ๐21 ๐๐ ๐กโ๐ ๐๐๐๐ข๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ก ๐ก๐ ๐๐๐๐ ๐กโ๐ ๐๐๐๐๐๐๐๐๐๐๐ก๐12 = 0. ๐๐๐๐๐๐๐๐๐ก๐ฆ,
๐31 ๐๐๐ ๐32 ๐๐๐ ๐๐๐ก๐๐๐๐๐๐๐
L U
Therefore, [1 โ1 21 1 12 โ2 3
] = [1 0 01 1 02 0 1
] [1 โ1 20 2 โ10 0 โ1
]
A L U
5
Step 2: ๐ฟ๐ = ๏ฟฝ๏ฟฝ
[1 0 01 1 02 0 1
] [
๐1๐2๐3
] = [โ8โ2โ20
]
๐1 = โ8 ; ๐2 = โ2 + 8 = 6; ๐3 = โ20 + 16 = โ4
๐๐ = [โ8 6 โ 4]
(Note: you have done forward substitution or solved a LTM, which is just opposite to
solving an UTM or reverse/backward substitution step of GE)
Step 3: ๐๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
[1 โ1 20 2 โ10 0 โ1
] {๐1๐2๐3
} = {โ8 6โ4}
(Note this is the reverse/backward substitution of GE)
๐3 = 4, ๐2 = (6 + 4) 2โ = 5, ๐1 = โ8 + 5 โ 8 = โ11
๐๐ = [โ11 5 4]๐ Ans.
You should ensure that you are not writing a fresh code for the LU decomposition method.
Rather, you simply modify the code you wrote earlier for the 1st part (forward substitution) of
GE, or the code to reduce A to UTM. Then, write a code for inverting LTM and use the
previously written code for the back-substitution or the reverse substitution of GE. In other
words, the code of LU decomposition has three sub-parts.
1
Lecture #05
Matrix Inverse ๐จ ๐จโ๐ = ๐ฐ(๐ ๐๐๐๐๐๐๐๐๐ ๐๐๐ ๐จโ๐)
[1 0 00 1 00 0 1
]
If ๐ด = [
๐11 ๐12 ๐13
๐21 ๐22 ๐23
๐31 ๐32 ๐33
], then
[
๐11 ๐12 ๐13
๐21 ๐22 ๐23
๐31 ๐32 ๐33
] [
๐11 ๐12 ๐13
๐21 ๐22 ๐23
๐31 ๐32 ๐33
] = [1 0 00 1 00 0 1
]
๐ด ๐ดโ1 ๐ผ
Making use of the rule of matrix multiplication (rowรcolumn), it is clear that
[
๐11 ๐12 ๐13
๐21 ๐22 ๐23
๐31 ๐32 ๐33
] [
๐11
๐21
๐31
] = [100] โ ๐ด๐1 = [
100]
and [ ] [
๐12
๐22
๐32
] = [010] โ ๐ด๐2
= [0 1 0]๐
[ ] [
๐13
๐23
๐33
] = [001] โ ๐ด๐3
= [0 0 1]๐
Therefore, ๐๐๐ can be calculated from as many equations.
However, LU decomposition can be used to determine ๐ดโ1as well:
๐ด๐1 = ๐ฟ๐ ๐1 = [1 0 0]๐
๐1
or ๐ฟ ๐1 = [1 0 0]๐ โ ๐๐๐ก๐๐๐๐๐๐ ๐1
So, ๐๐1 = ๐1 โ ๐๐๐ก๐๐๐๐๐๐ ๐1
Similarly,
๐ด๐2 = ๐ฟ๐ ๐2
= [0 1 0]๐
or ๐ฟ ๐2 = [0 1 0]๐ โ ๐๐๐ก๐๐๐๐๐๐ ๐2
2
So, ๐๐2 = ๐2
โ ๐๐๐ก๐๐๐๐๐๐ ๐2 , ๐ ๐ ๐๐๐๐กโ,
Example: [๐ด] = [25 5 164 8 1144 12 1
] = ๐ฟ๐
[25 5 164 8 1144 12 1
]
Apply GE (Forward step)
[25 5 10 โ4.8 0.560 โ16.8 โ4.36
] โ
๐๐๐๐๐๐๐๐๐๐๐ก๐ ๐ข๐ ๐๐ ๐ก๐ ๐๐๐๐
1๐ ๐ก ๐๐๐๐๐๐๐ก๐ ๐๐ ๐กโ๐ ๐๐๐ค๐ , ๐๐๐ก๐ก๐๐๐๐ ๐กโ๐ ๐๐๐ฃ๐๐ก๐๐ ๐๐๐ค ๐ก๐ ๐๐ ๐ง๐๐๐
= 64 25โ ๐๐๐ 144
25
๐๐ 2.56 ๐๐๐ 5.76
[25 5 10 โ4.8 โ1.560 0 0.7
] โ
๐โ๐๐ ๐๐ ๐๐ ๐๐๐ .๐๐๐๐๐๐๐๐๐๐๐ก ๐ข๐ ๐๐ ๐ก๐ ๐๐๐๐ ๐กโ๐
1๐ ๐ก ๐๐๐๐๐๐๐ก ๐๐ ๐กโ๐ ๐๐๐ ๐ก ๐๐๐ค๐ก๐ ๐๐ ๐ง๐๐๐
= 16.8 4.8 = 3.5โ
Therefore,
๐ฟ = [1 0 0
2.56 1 05.76 3.5 1
]
or,
[25 5 164 8 1144 1 1
] = [1 0 0
2.56 1 05.76 3.5 1
] [25 5 10 โ4.8 โ1.560 0 0.7
]
A L U
Now, determine ๐ดโ1
Step 1: ๐ฟ๐ ๐1 = [1 0 0]๐
๐1
3
[1 0 0
2.56 1 05.76 3.5 1
] {
๐1
๐2
๐3
} = {100}
L ๐ ๐
๐1 = 1, ๐2 = 0 โ 2.56 = โ2.56, ๐3 = 0 โ 5.76 + 3.50 ร 2.56 = 3.2
2. [25 5 10 โ4.8 โ1.560 0 0.7
] {
๐11
๐21
๐31
} = {
๐1
๐2
๐3
}
U ๐๐
๐31 = 3.20.7โ = 4.571, ๐21 = (โ2.56 โ 4.571 ร (โ1.56))/โ4.8 = โ0.9524
๐11 = (1 โ 4.571 โ 5 ร (โ0.9524))/25.0 = 0.04762
or, ๐1๐ = [0.04762 โ 0.9524 4.571]๐
3. [1 0 0
2.56 1 05.76 3.5 1
] {
๐1
๐2
๐3
} = {010} โ ๐1 = 0, ๐2 = 1, ๐3 = โ3.5
L ๐ ๐
[25 5 10 โ4.8 โ1.560 0 0.7
] {
๐12
๐22
๐32
} = {01
โ3.5}
U ๐๐
๏ฟฝ๏ฟฝ2๐
= [โ0.0833 1.417 โ 5.0]๐
Similarly,
๏ฟฝ๏ฟฝ3๐
= [0.03571 โ 0.4643 1.429]๐
๐ดโ1 = [0.04762 โ0.0833 0.03571โ0.9524 1.417 โ0.46434.571 โ0.5 1.429
]
โ Methods so far to solve ๐จ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ and programming codes:
(a) GE: To solve a large number of algebraic equations, a programming code is
required. As earlier shown, GE contains two distinct steps: (1) forward
elimination to convert ๏ฟฝ๏ฟฝ to an upper triangular matrix (UTM), (2)
4
Backward/reverse substitution to solve UTM. Therefore, while writing the code;
it is recommended that one clearly distinguishes the two steps as โsubroutinesโ
(# 1 and 2). You will later see that the other methods also often require one or
both of the steps/codes.
(b) GJ: The programming code for GJ is similar to that (code 1) of the forward
elimination of GE, with some modification. The second part (code) of GE, ie.
reverse substitution is not required. The modification or extra step is simple.
First, pivotal elements should be normalized to 1; in addition to subtracting the
modified pivotal row from the rows below the โ๐๐กโโ row of GE, the pivotal row is
also subtracted from the rows above. Therefore, one extra line is included in the
code for GJ.
(c) The code to determine the determinant of the matrix A is the same as that (code
1) for converting A to UTM, ie. the first or forward elimination step of GE. Further, add a line to determine the โ ๐๐๐
๐๐=1 product of the diagonal elements of
the UTM ie. one can put the flag to check if any of the ๐๐๐ is zero, the matrix is
singular and cannot be inverted. One can also write a simple code to check the
number # of zeros on the diagonal elements and therefore, determine the rank
of the matrix as (๐ โ #).
(d) LU method: The programming code (# 3) is similar to that (code 1) of the forward step of GE, to determine UTM. An extra line in the programming loop is
required to store the coefficients ๐๐๐ = (๐๐๐
๐๐๐), used to make the elements of the
first column of the UTM to be zero, as the elements of the empty columns of the LTM.
๐ด = [๐11
๐21 ๐22
] ร [ ]
LTM UTM
(e) Inverse of the matrix: First, the programming code (# 3) of LU is to be used. The forward substitution on LTM will yield/give ๏ฟฝ๏ฟฝ (๐๐๐๐ข๐๐ ๐๐๐ก๐๐๐ฅ) and the backward substitution on UTM will yield ๏ฟฝ๏ฟฝ(๐๐๐๐ข๐๐ ๐๐๐ก๐๐๐ฅ)(already available; # 2). Therefore, one new code/subroutine (# 4) is required for the forward substitution on LTM, which is not different from that (# 2) for the reverse substitution on UTM:
๐ด = ๐ฟ๐ (๐๐๐๐ # 3)
๐น๐๐๐ค๐๐๐ ๐ ๐ข๐๐ ๐ก๐๐ก๐ข๐ก๐๐๐ โ ๏ฟฝ๏ฟฝ (๐๐๐๐ #4)
๐ต๐๐๐๐ค๐๐๐ ๐ ๐ข๐๐ ๐ก๐๐ก๐ข๐ก๐๐๐ โ ๏ฟฝ๏ฟฝ (๐๐๐๐ # 2)
1
Lecture #06
Thomas Algorithm (Tridiagonal matrix)
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
[ ๐11 ๐12 0 โฏ 0 0 0 0๐21 ๐22 ๐23 โฏ 0 0 0 00 ๐32 ๐33 ๐34 0 โฏ 0 00 0 ๐43 ๐44 ๐45 โฏ 0 0
0 0 0 0 0 0 ๐๐๐โ1 ๐๐๐]
{
๐1๐2๐3โฎ๐๐}
=
{
๐1๐2๐3โฎ๐๐}
Tridiagonal matrix has 3 non-zero elements in all of its rows, except in the 1st and last row,
with one element each on the left and right of the diagonal element. The 1st and last rows have
one element on the right and left of the diagonal elements, respectively. It is a banded matrix
around its diagonal:
[
]
{
๐1๐2๐3โฎ๐๐}
=
{
๐1๐2๐3โฎ๐๐}
Therefore, a tridiagonal matrix can be represented using single subscripted indices for its
elements:
[ ๐1 ๐1 0 0 โฏ 0๐2 ๐2 ๐2 0 โฏ 00 ๐3 ๐3 ๐3 โฏ 0
๐4 ๐4 ๐4๐ง๐๐๐
๐๐ ๐๐]
Zero
Note that the element in the ๐๐กโ row is represented as (๐๐, ๐๐, ๐๐). All bs are on the diagonal.
Therefore, ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ, where ๐ด is a tridiagonal matrix and it represents the following set of linear
algebraic equations:
2
๐1๐ฅ1 + ๐1๐ฅ2 = ๐1๐2๐ฅ1 + ๐2๐ฅ2 + ๐2๐ฅ3 = ๐2๐3๐ฅ2 + ๐3๐ฅ3 + ๐3๐ฅ4 = ๐3๐4๐ฅ3 + ๐4๐ฅ4 + ๐4๐ฅ5 = ๐4
๐๐๐ฅ๐โ1 + ๐๐๐ฅ๐ = ๐๐}
โ You must have noted that for the ๐๐กโ row, ๐๐ is the diagonal element multiplied with the
variable ๐ฅ๐ in the some row, whereas ๐๐ is multiplied with ๐ฅ๐โ1(the variable above ๐๐กโ row) and
๐๐ is multiplied with ๐ฅ๐+1(the variable below ๐๐กโrow). Naturally, the first and last rows have
only two variables.
โ(Tridiagonal system is quite common when using Finite Difference 2nd order method to solve
boundary value problems or partial differential ๐๐๐๐ .)
Thomas algorithm to solve such system:
Step 1:
๐๐ is eliminated : (๐2 โ๐1
๐1๐2) ๐ฅ2 + ๐2๐ฅ3 = (๐2 โ
๐1
๐1๐2)
(by dividing 1st row with ๐1, multiplying with ๐1 and subtracting from row 2)
๐๐ is eliminated : (๐3 โ๐2
๐2๐3) ๐ฅ3 + ๐3๐ฅ4 = (๐3 โ
๐2
๐2๐3)
โฎ
โฎ
๐๐โ๐ is eliminated : (๐๐ โ๐๐โ1
๐๐โ1๐๐) ๐ฅ๐ + ๐๐๐ฅ๐+1 = (๐๐ โ
๐๐โ1
๐๐โ1๐๐)
It is clear that;
๐ด๐๐ ๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐ก๐๐๐ด๐๐ ๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐ด๐๐ ๐๐ ๐๐๐ ๐ข๐๐๐๐ก๐๐๐๐๐ด๐๐ ๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐
}
Last row: ๐๐ = ๐๐ โ๐๐โ1
๐๐โ1๐๐; ๐๐ = ๐๐ โ
๐๐โ1
๐๐โ1๐๐
(Note that ๐๐ has moved to RHS, leaving behind ๐๐๐ฅ๐ only on the LHS)
3
(It is important to note that ๐๐กโ row uses the latest modified values of ๐๐ and ๐๐ from the
previous (k-1) step. Therefore, there is no need to store the previous values of (a, b, d) while
writing the code)
Back-substitution: ๐๐ =๐๐
๐๐ (๐๐กโ ๐๐๐ค โ๐๐ ๐๐๐๐ฆ ๐๐ ๐๐๐ ๐๐)
๐๐โ1 =๐๐โ1โ๐๐โ1๐ฅ๐
๐๐โ1 (๐ โ 1 ๐๐๐ค โ๐๐ ๐๐โ1, ๐๐โ1, ๐๐๐ ๐๐โ1)
โ A pseudo programming code can be written as follows:
Tridiagonal (N, a, b, c, d, X)
๐๐ ๐ = 1,๐
๐(๐) =
๐(๐) =
๐(๐) =
๐(๐) =
end do
๐๐ ๐ = 2, ๐
๐(๐) = ๐(๐) โ ๐(๐)๐(๐ โ 1)
๐(๐ โ 1)
๐(๐) = ๐(๐) โ ๐(๐)๐(๐ โ 1)
๐(๐ โ 1)}
๐๐๐๐ค๐๐๐ ๐ ๐ข๐๐ ๐ก๐๐ก๐ข๐ก๐๐๐
end do
๐๐ =๐(๐)
๐(๐)
๐๐ (๐) = ๐ โ 1, 1, โ1
๐๐ =๐(๐) โ ๐(๐)๐๐+1
๐(๐)} ๐๐๐ฃ๐๐๐ ๐ ๐ ๐ข๐๐ ๐ก๐๐ก๐ข๐ก๐๐๐
end do
4
Indirect Methods
GE, GJ, LU decomposition are the direct methods to solve ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ. Simple iterations
can also be done to solve a set of algebraic equations, Jacobi and Gauss-Seidel being the two
commonly used indirect methods.
Ex. [2 1 01 2 10 1 1
] {๐1๐2๐3
} = {124}
Make a guess ๐1(1), ๐2
(1), ๐3
(1)
Jacobi Gauss-Seidel
๐1(2)=
1โ๐2(1)
2 =
1โ๐2(1)
2
๐2(2)=
2โ๐1(1)โ๐3
(1)
2 =
2โ๐1(2)โ๐3
(1)
2
๐3(2) =
4โ๐2(1)
1 =
4โ๐2(2)
1
Takes all ๐๐ (๐โ1)
of the previous iteration Uses the most latest iterated values of ๐๐ .
In general: ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
Jacobi: ๐๐(๐+1) =
๐๐โโ ๐๐๐๐๐(๐)๐
๐=1
๐๐๐(โ 0) (๐ โ ๐)
diagonal elements
G-S: ๐๐(๐+1) =
{
๐๐ โ โ ๐๐๐๐๐
(๐+1)โ โ ๐๐๐๐๐
(๐)๐๐=๐+1
๐โ1๐=1
๐ข๐๐๐๐ก๐๐ ๐๐๐ ๐๐๐ก๐๐ ๐ก ๐ฃ๐๐๐ข๐๐ ๐ฃ๐๐๐ข๐๐
๐๐๐(โ 0)
5
At any ๐๐กโ row:
1โฏโฏ ๐ โ 1 ๐ ๐ + 1โฏโฏ ๐
๐ข๐๐๐๐ก๐๐๐ฃ๐๐๐ข๐๐ (๐ + 1)
๐๐๐
๐ฃ๐๐๐ข๐๐ (๐)
Schematically,
elements multiply with the variables 1 to ๐ฅ๐โ1
[
1 โฏ ๐ โ 1 ๐ ๐ + 1 โฏ ๐
]
{
๐1๐2โฎ๐๐โฎโฎ๐๐}
elements multiply with the๐ฃ๐๐๐๐๐๐๐๐ ๐ฅ๐+1 ๐ก๐ ๐ฅ๐.
G-S (modified)
๐๐ = ๐๐๐(๐๐๐ค) + (1 โ ๐)๐๐
(๐๐๐)
๐ = 1 (๐ข๐๐๐๐๐๐๐๐๐)
0 < ๐ < 1 โ ๐ข๐๐๐๐ โ ๐๐๐๐๐ฅ๐๐ก๐๐๐ ๐๐๐๐ก๐๐
1 < ๐ < 2 โ ๐๐ฃ๐๐ โ ๐๐๐๐๐ฅ๐๐ก๐๐๐ ๐๐๐๐ก๐๐
(โฒ๐โฒ๐๐ ๐๐๐ก๐๐ ๐๐ ๐ ๐ข๐๐๐ ๐๐๐๐๐๐๐๐๐ ๐ข๐๐๐ ๐๐ข๐๐ ๐๐ , ๐๐ก๐)
Look differently! : LDU method
6
[ ๐11 ๐12 โฏ ๐1๐โฎโฎโฎ๐๐1 โฏ โฏ ๐๐๐]
๐ร๐
=
[ 0๐21 0
00
๐๐1 โฏ ๐๐โ1 ]
+
[ ๐11
โฑโฑ
๐๐๐]
+
[ 0 โฏ โฏ ๐1๐
00
๐๐โ1๐0 ]
strictly lower๐ก๐๐๐๐๐๐ข๐๐๐ ๐๐๐ก๐๐๐ฅ
(๐ฟ) +
๐ท(๐๐๐๐๐๐๐๐
๐๐๐๐๐๐๐ก๐ ๐๐๐๐ฆ) +
๐ ๐ก๐๐๐๐ก๐๐ฆ ๐ข๐๐๐๐๐ก๐๐๐๐๐๐ข๐๐๐ ๐๐๐ก๐๐๐ฅ
(๐)
๐ด = ๐ฟ + ๐ท + ๐
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
(๐ฟ + ๐ท + ๐)๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ โ ๐ท๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ โ ๐ฟ๏ฟฝ๏ฟฝ โ ๐๏ฟฝ๏ฟฝ
๐๐ ๏ฟฝ๏ฟฝ =๏ฟฝ๏ฟฝ โ ๐ฟ๏ฟฝ๏ฟฝ โ ๐๏ฟฝ๏ฟฝ
๐ท
Jacobi:
๏ฟฝ๏ฟฝ(๐+1) =๏ฟฝ๏ฟฝ โ (๐ฟ + ๐)๏ฟฝ๏ฟฝ(๐)
๐ท
๐๐ ๐๐(๐+1)
=๐๐ โ โ ๐๐
(๐)๐๐๐
๐๐=1
๐๐๐ ; ๐ โ ๐ (๐ = ๐ ๐ค๐๐๐ ๐๐๐๐๐๐ ๐๐๐ก ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ก)
๐ โ ๐ โถ (๐ฟ + ๐ท)๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ โ ๐๏ฟฝ๏ฟฝ
(๐ฟ + ๐ท)๏ฟฝ๏ฟฝ(๐+1) = ๏ฟฝ๏ฟฝ โ ๐๏ฟฝ๏ฟฝ(๐)
๐ท๏ฟฝ๏ฟฝ(๐+1) = ๏ฟฝ๏ฟฝ โ ๐๏ฟฝ๏ฟฝ(๐) โ ๐ฟ๏ฟฝ๏ฟฝ(๐+1)
๐๐(๐+1)
=๐๐โโ ๐๐
(๐+1)๐๐๐โโ ๐๐
๐๐๐๐๐๐=๐+1
๐โ1๐=1
๐๐๐
(๐ ๐๐๐ ๐๐ ๐๐๐๐๐๐ ) ( ๐๐๐ โ 0 )
Both methods will lead to the same solutions, with different # of iterations.
1
Lecture #07
Homogeneous linear algebraic equations
-Represents a special class of problems, also known as the Eigenvalue or Characteristic type of
problems
- Mathematically represented as ๐ด๏ฟฝ๏ฟฝ = 0 or ๏ฟฝ๏ฟฝ = 0 (๐๐ข๐๐ ๐ฃ๐๐๐ก๐๐)
๐๐ (
๐11๐ฅ1 + ๐12๐ฅ2 +โฏโฏ๐1๐๐ฅ๐ = 0โฎ โฎ ๐๐1๐ฅ1 + ๐๐2๐ฅ2 +โฏโฏ๐๐๐๐ฅ๐ = 0
)
Naturally, a trivial solution is ๏ฟฝ๏ฟฝ = 0 . In the simplest geometrical term, two straight lines or
three planes intersect at the origin:
๐ฅ1 โ ๐ฅ2 = 0 ๐ฅ1 โ 0.3๐ฅ2 = 0
} โ ๐ฅ2
๐ฅ1
โ A more interesting problem to solve is in seeking a non-trivial solution when ๐๐๐ก(๐ด) =
0 ๐๐ ๐ < ๐. Such simultaneous set of homogeneous linear equations when ๐๐๐ก(๐ด) = 0 is
common in several engineering and mechanics applications, and also in the initial and boundary
value problems. Such situation is better known as the eigenvalue problem and is represented by
eigenvalues and the corresponding eigenvectors.
Compare this situation to the earlier discussed set of non-homogeneous linear algebraic
equation ๐ด๏ฟฝ๏ฟฝ = ๐ , where we sought a unique solution, when ๐๐๐ก|๐ด| โ 0. Comparatively,
Non-homogeneous Homogeneous equations
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ ๐ด๏ฟฝ๏ฟฝ = 0
det (๐ด) โ 0 det(๐ด) = 0
๐ = ๐ ๐ < ๐
Unique solution Non-trivial solution
๐ธ๐๐๐๐๐ฃ๐๐๐ข๐ ๐๐๐๐๐๐๐
2
Let us look at
๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ 1 where A is the coefficient matrix and โฒ๐โฒ is a non-zero number.
matrix scalar quantity
or (๐ด โ ๐๐ผ)๏ฟฝ๏ฟฝ = 0 2 where ๐ผ is an identity matrix
๐ผ = [1 0 00 1 00 0 1
]
Equation 1 or 2 represents eigenvalue problem and such equations commonly occur in several
dynamic studies of distillation, adsorption and CSTR, viz. in solving ๐๏ฟฝ๏ฟฝ
๐๐ก= 0. Equation (2) can
also be written as
{
(๐11 โ ๐)๐1 + ๐12๐2 +โฏโฏ๐1๐๐๐ = 0
๐21๐1 + (๐22 โ ๐)๐2 +โฏโฏ๐2๐๐๐ = 0โฎ โฎ
๐๐1๐1 + ๐๐2๐2 +โฏโฏ(๐๐๐ โ ๐)๐๐ = 0}
or
[
๐11 ๐12 โฏ ๐1๐โฎโฎ๐๐1 ๐๐2 โฏ ๐๐๐
] {
๐1๐2โฎ๐๐
} = ๐{
๐1๐2โฎ๐๐
}
๐ด(๐๐๐๐๐๐๐๐๐๐๐ก ๐๐๐ก๐๐๐ฅ) ๐๐๐๐ข๐๐๐ฃ๐๐๐ก๐๐
๐ ๐ ๐๐๐๐๐๐๐ข๐๐๐ก๐๐ก๐ฆ
๐๐๐๐ข๐๐๐ฃ๐๐๐ก๐๐
Re-visit ๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ - eigenvalue problem
Most vectors ๏ฟฝ๏ฟฝ will not satisfy such an equation. A common vector (๐๐1 + ๐๐2) will change
direction and magnitude to (๐๐1 + ๐๐2) on the transformation by A. Only certain special
vectors ๏ฟฝ๏ฟฝ, called eigenvectors, corresponding to only special numbers, ๐ (๐๐๐กโ๐๐ + ๐ฃ๐ ๐๐ โ
๐ฃ๐), called eigenvalues, will satisfy the above equation. In such case, the eigenvector ๏ฟฝ๏ฟฝ does not
change its direction or does not rotate when transformed by the coefficient matrix A, but is
only scaled by the eigenvalue ๐. See the geometrical representation below:
3
๐2
๐2
๏ฟฝ๏ฟฝ
๏ฟฝ๏ฟฝ ๐๏ฟฝ๏ฟฝ
๏ฟฝ๏ฟฝ
๐1 ๐1
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ ๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ
(๐๐๐ก ๐๐ ๐๐๐๐๐๐ฃ๐๐๐ข๐ ๐๐๐๐๐๐๐)
(๐๐๐๐๐๐ฃ๐๐๐ข๐ ๐๐๐๐๐๐๐)
(๏ฟฝ๏ฟฝ ๐๐ ๐กโ๐ ๐๐๐๐๐๐ฃ๐๐ก๐๐ ๐๐ ๐ด; ๐๐ ๐กโ๐ ๐๐๐๐๐๐ฃ๐๐๐ข๐ ๐๐ ๐ด)
๐
It turns out that (๐ ร ๐) matrix ๐ด will give โ๐โ ๐๐ (๐๐๐๐๐๐ฃ๐๐๐ข๐๐ ), and each eigenvalue will give
โ๐โ eigenvectors that will also be linearly independent. As an example,
[๐11 ๐12๐21 ๐22
]2ร2
will have 2 ๐๐ (๐1 & ๐2) โ ๐1 โ {๐}1๐2 โ {๐}2
Both vectors {๐}1, & {๐}2 will satisfy ๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ. They will also be linearly independent so that
they can be used as a basis for the space-description. They may be orthogonal or non-
orthogonal.
๐2
๐1
๐2
๐1
In the figure above, dotted and solid lines represent two vectors scaled by the respective
eigenvalues1 and 2, respectively.
Similarly, (3 ร 3) A matrix will give 3๐๐ (๐1, ๐2, ๐3). Each ๐ will give three independent
vectors {๐}1, {๐}2, {๐}3 satisfying ๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ.
4
or (๐ด โ ๐๐ผ)๏ฟฝ๏ฟฝ = 0
Linear algebra tells us that for ๏ฟฝ๏ฟฝ to have a non-trivial solution ๐๐๐ก|(๐ด โ ๐๐ผ)| = 0.
Example: ๐ด = [2 11 2
] ๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ(๐ด โ ๐๐ผ)๏ฟฝ๏ฟฝ = 0
๐๐๐ก [2 โ ๐ 11 2 โ ๐
] = 0 โ (2 โ ๐)2 โ 1 = 0
๐1 = 1, 3
๐1 = 1: [2 11 2
] {๐1๐2} = 1 {
๐1๐2}
Both equations yield ๐1 = โ๐2 ๐๐ ๐1 + ๐2 = 0 (๐ = 1)
So, ๏ฟฝ๏ฟฝ (๐1 = 1): (๐ โ ๐) โก { 1โ1}
๐2 = 3: [2 11 2
] {๐1๐2} = 3 {
๐1๐2}
Both equations yield ๐1 = ๐2 ๐๐ ๐1โ๐2 = 0 (๐ = 1)
๏ฟฝ๏ฟฝ (๐2 = 3): (๐ + ๐) โก {11}
Note two vectors (๐ โ ๐) ๐๐๐ (๐ + ๐) are linearly independent and can be used as a basis for
defining 2D space. They need not be orthogonal! They can be used as a linear combination of
any other vector ๏ฟฝ๏ฟฝ in 2D space:
๐2
๏ฟฝ๏ฟฝ = ๐1(๐ + ๐) + ๐2(๐ โ ๐)
๐ + ๐
๐1
(๐ โ ๐)
5
System of ODEs
It may represent dynamics, i.e. how a system behaves due to a perturbation around steady state
value. Such situation is common in kinetics and the heat and mass transfer related problems in
chemical engineering.
๐๐1
๐๐ก= ๐1(๐1โฆโฆ๐๐)
๐๐2
๐๐ก= ๐2(๐1โฆโฆ๐๐)
โฎ ๐๐๐
๐๐ก= ๐๐(๐1โฆโฆ๐๐) }
โ dynamics
๏ฟฝ๏ฟฝ ๐3
๐๏ฟฝ๏ฟฝ
๐๐ก= ๐(๏ฟฝ๏ฟฝ) [๏ฟฝ๏ฟฝ]๐ โก [๐1, โฆโฆ . ๐๐] ๐2 ๐1
Under SS, ๐(๏ฟฝ๏ฟฝ) = 0 โ ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ๐ 0 ๐ก
๐๐
๐1(๐1โฆโฆ๐๐) = 0
๐2(๐1โฆโฆ๐๐) = 0โฎ ๐๐(๐1โฆโฆ๐๐) = 0
} These sets of algebraic equationsmay represent energy or species
balance under SS.
๏ฟฝ๏ฟฝ(๐ก) = ?
Define, ๐(๐ก) = ๏ฟฝ๏ฟฝ(๐ก) โ ๏ฟฝ๏ฟฝ๐ (๐๐๐ฃ๐๐๐ก๐๐๐ ๐๐๐๐๐๐ก๐ข๐๐/๐๐๐๐๐ ๐ฃ๐๐๐๐๐๐๐๐ )โ
๐ธ๐๐๐๐๐๐ก โ ๐ค๐๐ ๐ ๐1(๐ก) = ๐1(๐ก) โ ๐1๐
๐๐ ๐๐(๐ก) = ๐๐(๐ก) โ ๐๐๐ (๐ = 1โฆโฆโฆ๐)
๐๐, ๐๏ฟฝ๏ฟฝ
๐๐ก=
๐๏ฟฝ๏ฟฝ(๐ก)
๐๐ก= ๐(๏ฟฝ๏ฟฝ)
๐๐, ๐๐๐
๐๐ก= ๐๐(๐1โฆโฆ๐๐) (๐ = 1โฆโฆ๐)
= ๐๐(๐1๐ + ๐1, ๐2๐ + ๐2, โฆโฆ๐๐๐ + ๐๐)
= ๐๐(๐1๐ , ๐2๐ , ๐3๐ , โฆโฆ๐๐๐ ) +
๐๐๐
๐๐1|๐1๐
๐1 +๐๐๐
๐๐2|๐2๐
๐2 +โฏโฏ๐๐๐
๐๐๐|๐๐๐
๐๐
(๐๐)0
6
๐1 = (๐1 โ ๐1๐ ), ๐2 = (๐2 โ ๐2๐ )โฆโฆ . , ๐๐ = (๐๐ โ ๐๐๐ )
(Taylor series expansion for multivariables: retain 1st order terms only, i.e. small departure from SS)
{
๐๐1๐๐ก....๐๐๐๐๐ก}
=
[ ๐๐1๐๐1
๐๐1๐๐2
โฏ๐๐1๐๐๐
๐๐2๐๐1
๐๐2๐๐2
โฏ๐๐2๐๐๐
โฎ๐๐๐๐๐1
๐๐๐๐๐2
โฏ๐๐๐๐๐๐]
{
๐1๐2โฎ . . . . ๐๐}
(๐๐๐ค ร ๐๐๐๐ข๐๐ ๐๐ข๐๐ก๐๐๐๐๐๐๐ก๐๐๐ ๐๐ข๐๐)
๐๐๐ก๐: ๐น๐๐ ๐ก๐ค๐ ๐ฃ๐๐๐๐๐๐๐๐ ๐1 ๐๐๐ ๐2
๐๐1๐๐ก
=๐๐1๐๐1
|๐1๐
(๐1 โ ๐1๐ ) +๐๐1๐๐2
|๐2๐
(๐2 โ ๐2๐ )
๐๐2๐๐ก
=๐๐2๐๐1
|๐1๐
(๐1 โ ๐1๐ ) +๐๐2๐๐2
|๐2๐
(๐2 โ ๐2๐ )}
1๐ ๐ก ๐๐๐๐๐๐ก๐๐๐ ๐๐๐๐ฆ
{
๐๐1๐๐ก๐๐2๐๐ก
} =
[ ๐๐1๐๐1
๐๐1๐๐2
๐๐2๐๐1
๐๐2๐๐2]
{๐1 โ ๐1๐ = ๐1๐2 โ ๐2๐ = ๐2
}
or,
๐๏ฟฝ๏ฟฝ
๐๐ก= ๐ด๐ ๐๐ ๐โฒ = ๐ด๐
๐คโ๐๐๐ ๐ด =
[ ๐๐1
๐๐1โฏ
๐๐1
๐๐๐
โฎ๐๐๐
๐๐1โฏ
๐๐๐
๐๐๐]
; ๐ด ๐๐ ๐๐๐๐๐๐ ๐กโ๐
๐ฝ๐๐๐๐๐๐๐ ๐๐๐ก๐๐๐ฅ ๐๐ ๐ด.
}
Thus, we started from
๐๏ฟฝ๏ฟฝ
๐๐ก= ๐(๏ฟฝ๏ฟฝ)
And derived:
๐๏ฟฝ๏ฟฝ
๐๐ก= ๐ด๐
where ๐ = (๏ฟฝ๏ฟฝ โ ๏ฟฝ๏ฟฝ๐ ), and A is the Jacobian matrix of ๐ as
[ ๐๐1
๐๐1โฏ
๐๐1
๐๐๐
โฎ๐๐๐
๐๐1โฏ
๐๐๐
๐๐๐]
1
Lecture #08 (continue..)
Seeking solution to ๐๏ฟฝ๏ฟฝ
๐๐ก= ๐ด๐ ๐๐ ๐โฒ = ๐ด๐
Let us assume, ๐๐ = ๐ง๐๐๐๐ก, ๐ = 1โฆโฆ๐ (๐ ๐๐๐ข๐ก๐๐๐)
(This is the most plausible solution to a simple ODE)
or, ๐ = ๐ง๐๐๐ก (๐ = ๐ ๐๐๐๐๐, ๐ง = ๐๐๐๐ ๐ก๐๐๐ก ๐ฃ๐๐๐ก๐๐)
Substitute,
๐ง๐๐๐๐๐ก = ๐๐1๐ง1๐
๐๐ก + ๐๐2๐ง2๐๐๐ก +โฏโฏ๐๐๐๐ง๐๐
๐๐ก (๐ = 1โฏโฏโฏ๐)
or,
๐11๐ง1 + ๐12๐ง2 +โฏโฏโฏ๐1๐๐ง๐ = ๐๐ง1โฎ ๐๐1๐ง1 + ๐๐2๐ง2 +โฏโฏโฏ๐๐๐๐ง๐ = ๐๐ง๐
} ๐ ๐๐๐ข๐๐ก๐๐๐๐ .
(โ ๐๐๐๐ง๐ = ๐๐ง๐; ๐ = 1, โฏโฏ๐)๐๐=1
or, ๐ด๐ง = ๐๐ง ๐ง๐ = [๐ง1โฏโฏ๐ง๐]
or, (๐ด โ ๐๐ผ)๐ง = 0 ๐คโ๐๐๐ ๐ด = [
๐11 โฏ ๐1๐โฎ๐๐1 โฏ ๐๐๐
]
Thus, we have got a set of homogeneous equations which describes the characteristics of the
system dynamics AND this equation can represent an eigenvalue problem. In summary, we
started from
and got
๐๏ฟฝ๏ฟฝ
๐๐ก= ๐(๏ฟฝ๏ฟฝ)
๐๐
๐๐ก= ๐ด๐
Now, we have (๐ด โ ๐๐ผ)๐ง = 0}
๐คโ๐๐๐, ๐ด = ๐ฝ๐๐๐๐๐๐๐ ๐๐๐ก๐๐๐ฅ ๐๐ ๐ ๐๐๐
๐ = ๐ง๐๐๐ก
Therefore, for a non-trivial solution (eigenvalue problem)
det|๐ด โ ๐๐ผ| = 0 (๐ < ๐)
2
or ๐๐๐ก |
๐11 โ ๐ ๐12 โฏ ๐1๐โฎโฎ๐๐1 โฏ โฏ ๐๐๐โ๐
| = 0
Solve for ๐ ๐๐ โฒ (eigenvalues) from the ๐๐กโ degree polynomial on โฒ๐โฒ after you have expanded the
(๐ ร ๐) |๐ด โ ๐๐ผ|matrix to determine its determinant. Recall, every ๐๐(๐ = 1โฏโฏ๐) will give
one ๐ง(๐) eigenvector so that ๐ด๐ง(๐) = ๐๐๐ง(๐) . In other words,
๐1 โ ๐ง(1)๐๐1๐ก
๐2 โ ๐ง(2)๐๐2๐ก
โฎ ๐๐ โ ๐ง(๐)๐๐๐๐ก }
And all these eigenvectors are linearly
independent
Therefore, we have a general solution:
๐ = ๐1๐ง(1)๐๐1๐ก + ๐2๐ง
(2)๐๐2๐กโฏ+ ๐๐๐ง(๐)๐๐๐๐ก
where, ๐1, ๐2โฏ๐๐ are arbitrary constants to be determined from initial conditions.
{
๐1๐2โฎ๐๐
} = ๐1๐๐1๐ก {
๐ง1๐ง2โฎ๐ง๐
}
(1)
+ ๐2๐๐2๐ก {
๐ง1๐ง2โฎ๐ง๐
}
(2)
+โฏ๐๐๐๐๐๐ก {
๐ง1๐ง2โฎ๐ง๐
}
(๐)
(๐๐๐ก๐ ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ๐ + ๐)
Numerical values of โฒ๐โฒ decides how solution will behave i.e. error ๐ or perturbation or
deviation from SS will grow or decay. If the real part of ๐ ๐๐ โฒ โ ๐ฃ๐โฒ, ๐ฆ โ ๐ฆ๐ or solution will
decay; if โฒ + ๐ฃ๐โฒ solution will grow โ (unstable)
Example: Study the dynamics
๐1โฒ = โ3๐1 + 2๐2
๐2โฒ = ๐1 โ 2๐2
}
๐๐จ๐ญ๐: If there is a non โ homogeneous part inthe equations, ignore it because only homogenous parts
contribute to the growth or decay of the solution.
๐๐ ๐๏ฟฝ๏ฟฝ
๐๐ก= ๐ด๏ฟฝ๏ฟฝ, ๐ด = [
โ3 2 1 โ2
]
Determine ๐๐ : det [โ3 โ ๐ 2 1 โ2 โ ๐
] โ ๐2 + 5๐ + 4 = 0 (๐โ๐๐๐๐๐ก๐๐๐๐ ๐ก๐๐ ๐๐๐๐ฆ๐๐๐๐๐๐)
๐1 = โ1, ๐2 = โ4 (two unique solutions or eigenvalues)
3
Determine corresponding eigenvectors:
๐1 = โ1: [โ3 2 1 โ2
] {๐1๐2} = โ1 {
๐1๐2}
or โ 3X1 + 2X2 = โX1and X1 โ 2X2 = โX2
} โ๐1 = ๐2 โ ๏ฟฝ๏ฟฝ(1) = {
11}
(๐ = 1 < ๐)
๐2 = โ4 ๐1 = โ2๐2 โ ๏ฟฝ๏ฟฝ(2) = {โ2 1}
Check ๏ฟฝ๏ฟฝ1(1) and ๏ฟฝ๏ฟฝ(2) are linearly independent.
โ Note: both ๐๐ are โ๐ฃ๐. Therefore, the solutions will decay to the SS values or perturbation
will die/decay, or solutions will not grow, or the systems will be stable.
General solution:
๏ฟฝ๏ฟฝ = ๐ถ1๏ฟฝ๏ฟฝ(1)๐๐1๐ก + ๐ถ2๏ฟฝ๏ฟฝ
(2)๐๐2๐ก
๐๐ {๐1๐2} = ๐ถ1๐
โ๐ก {11} + ๐ถ2๐
โ4๐ก {โ2 1}
๐๐ ๐1 = ๐ถ1๐โ๐ก โ 2๐ถ2๐
โ4๐ก
๐2 = ๐ถ1๐โ๐ก + ๐ถ2๐
โ4๐ก }
(Note: For repeat or complex ๐, check the books for the methods to determine ๏ฟฝ๏ฟฝ)
Ex. [๐ด] = [ 0 2 3โ10 โ1 2โ2 4 7
] determine all ฮปs and Xs.
From ๐๐๐ก[๐ด โ ๐๐ผ] = 0 โ ๐1 = 1, ๐2 = 2, ๐3 = 3
(A 3 ร 3 matrix will give 3ฮปs )
๐1 = 1 [๐ด โ ๐๐ผ]๏ฟฝ๏ฟฝ = 0 โ [ โ1 2 3โ10 โ2 2โ2 4 6
] {๐1๐2๐3
} = 0
Apply Gauss Elimination:
[ โ1 2 3 0 โ22 โ28 0 0 0
] {๐1๐2๐3
} = 0
4
You will get only 2 independent ๐๐๐๐ : (๐๐๐๐ ๐ = 2 < ๐, ๐๐๐ก( ) = 0)
๐1 = 2๐2 + 3๐3โ22๐2 โ 28๐3 = 0
} โ
choose ๐3 = 1
๐1 = 5 11โ
๐2 = โ14 11โ
Therefore,
๏ฟฝ๏ฟฝ(1) = {5 11โ
โ14 11โ1
}
Similarly for
๐2 = 2: [๏ฟฝ๏ฟฝ(2)]
๐= [1 2 โ 1 1โ ]
๐3 = 3: [๏ฟฝ๏ฟฝ(3)]๐= [1 2 โ3 4โ 1โ ]
Note: These are all linearly independent vectors (๏ฟฝ๏ฟฝ0(1) โ ๐ถ1๏ฟฝ๏ฟฝ
(2) + ๐ถ2๏ฟฝ๏ฟฝ(3)). They may not be
orthogonal.
Spring-problem (2nd order ODEs can also describe/represent an eigenvalue problem)
๐1 ๐2
๐1 ๐2
๐พ๐1 ๐พ(๐1 โ ๐2)
Force balance or mass ๐1 ๐๐๐ ๐2, when the two blocks are displaced by ๐1 & ๐2 in the right
direction from its original position:
5
๐1 ๐2๐1๐๐ก2
= โ๐พ๐1 + ๐พ(๐2 โ ๐1)
๐2 ๐2๐2๐๐ก2
= โ๐พ(๐2 โ ๐1) โ ๐พ๐2}
๏ฟฝ๏ฟฝ = {
๐1๐2}
๐๐ = ๐ด๐๐ ๐๐(๐๐ก) (๐๐ ๐ ๐ข๐๐ ๐ ๐ ๐๐๐ข๐ก๐๐๐)
( ๐๐ ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ ๐ ๐๐(๐๐ก))
Therefore,
๐๐โฒโฒ = โ๐ด๐๐
2๐ ๐๐๐๐ก
Substitute,
(2๐พ
๐1โ ๐2)๐ด1 โ
๐พ
๐1๐ด2 = 0
โ๐พ
๐2๐ด1 + (
2๐พ
๐2โ ๐2) ๐ด2 = 0
}
๐๐
||(2๐พ
๐1โ ๐2) โ
๐พ
๐1
โ๐พ
๐2(2๐พ
๐2โ ๐2)
|| {๐ด1๐ด2} = 0
Therefore, the characteristic equation describes an eigenvalue problem (or spring dynamics is
an eigenvalue problem). It has assumed the form of
(๐ด โ ๐2๐ผ)๏ฟฝ๏ฟฝ = 0
where ๐2 = ๐, ๐ด = |
2๐พ
๐1โ
๐พ
๐1
โ๐พ
๐2
2๐พ
๐2
| and ๏ฟฝ๏ฟฝ = {๐1๐2}
๐๐๐๐๐ ๐ฃ๐๐๐ข๐ ๐๐๐๐๐๐ฃ๐๐๐ก๐๐
Example (From Kreysig's Math book)
๐1 = ๐2 = 40 ๐๐ ; K = 200๐ ๐โ
For a non-trivial solution ๐๐๐ก(๐ด โ ๐2๐ผ)๏ฟฝ๏ฟฝ = 0
๐๐๐๐ : (10 โ ๐2)๐ด1 โ 5๐ด2 = 0
โ5๐ด1 + (10 โ ๐2)๐ด2 = 0
6
๐๐๐ก( ) : (10 โ ๐2)2 โ 25 = 0
๐1 = 15, ๐2 = 5 ๐๐ ๐1 = โ๐1, ๐2 = โ๐2
๐1 = 15 ๐ด1 = โ๐ด2 ๐๐ ๐ด(1) = {
1โ1}
๐2 = 5 ๐ด1 = ๐ด2 ๐๐ ๐ด(2) = {
11}
General solution:
๏ฟฝ๏ฟฝ = ๐ถ1๏ฟฝ๏ฟฝ(1)๐ ๐๐๐1๐ก + ๐ถ2๏ฟฝ๏ฟฝ
(2)๐ ๐๐๐2๐ก
๐๐ {๐1๐2} = ๐ถ1 {
1โ1} ๐ ๐๐๐1๐ก + ๐ถ2 {
11} ๐ ๐๐๐2๐ก
๐๐ ๐1 = ๐ถ1๐ ๐๐๐1๐ก + ๐ถ2๐ ๐๐๐2๐ก๐๐๐ ๐2 = โ๐ถ1๐ ๐๐๐1๐ก + ๐ถ2๐ ๐๐๐2๐ก
}
Graphical representation of block oscillations:
๐1=15
๐1=โ15 ๐ด1 ๐ด2
๐2=5
๐2=โ5 ๐ด1 ๐ด2
1
Lecture #09
One more example of eigenvalue or characteristic type of problem:
Let us revisit Jacobi iteration to invert a matrix.
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
โ (๐ฟ + ๐ท + ๐)๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ
โ ๐ท๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ โ (๐ฟ + ๐)๏ฟฝ๏ฟฝ
๐๐ ๏ฟฝ๏ฟฝ = ๐ทโ1๏ฟฝ๏ฟฝ โ ๐ทโ1(๐ฟ + ๐)๏ฟฝ๏ฟฝ
or ๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ + ๐ถ
๐๐ ๏ฟฝ๏ฟฝ(๐+1) = ๐๏ฟฝ๏ฟฝ(๐) + ๐ถ โถ ๐ฝ๐๐๐๐๐ ๐ผ๐ก๐๐๐๐ก๐๐๐ ๐๐๐๐๐ข๐๐
S is called stationary matrix because very often, matrix ๐ด ๐๐ (๐ฟ, ๐ท, ๐) do not change and are
fixed. It is ๏ฟฝ๏ฟฝ (right hand side) that varies from one problem to the other, as a forcing function.
Define, error vector ๏ฟฝ๏ฟฝ(๐) = ๏ฟฝ๏ฟฝ(๐) โ ๏ฟฝ๏ฟฝ
Approximate
๐ฃ๐๐๐ข๐ ๐๐ก ๐๐ก๐๐๐๐ก๐๐๐# ๐
๐๐๐ข๐ ๐ฃ๐๐๐ข๐
Similarly,
๏ฟฝ๏ฟฝ(๐+1) = ๏ฟฝ๏ฟฝ(๐+1) โ ๏ฟฝ๏ฟฝ
= ๐(๏ฟฝ๏ฟฝ(๐) โ ๏ฟฝ๏ฟฝ) = ๐๏ฟฝ๏ฟฝ(๐)
๐๐ ๏ฟฝ๏ฟฝ(๐+1) = ๐๏ฟฝ๏ฟฝ(๐)
๐๐ ๏ฟฝ๏ฟฝ(๐) = ๐๐ ๏ฟฝ๏ฟฝ(0)
(๐ฆ๐๐ข ๐ โ๐๐ข๐๐ ๐๐๐๐๐๐ง๐ ๐กโ๐๐ก ๐๐ก
๐๐ ๐๐ ๐๐๐๐๐๐ฃ๐๐๐ข๐ ๐๐๐๐๐๐๐ ๐๐๐ข๐๐ก๐๐๐โ
๐ด๏ฟฝ๏ฟฝ = ๐๏ฟฝ๏ฟฝ ๐ค๐๐กโ ๐ = 1)
For ๐ โ โ ๐๐ โ 0 ๐๐๐ ๐๐๐๐ฃ๐๐๐๐๐๐๐ ๐๐๐๐๐ข๐ ๐ ๏ฟฝ๏ฟฝ(๐) โ 0 ๐๐ ๐(0) โ 0
Therefore, criteria for the convergence: ๐๐ โ 0 ๐๐ ๐ โ โ
Let {๐๐}๐=1,๐ be the eigenvectors corresponding to the ๐๐ eigenvalue of the stationary matrix
2
๐(๐ ร ๐). Recall eigenvectors are linearly independent. So, they can form the basis of n
dimensional space. Alternatively, any vector can be represented as the linear combination of the
eigenvectors.
Therefore,
๐(0) = โ ๐๐๐๐ ๐๐=1
where Sฮฝj = ฮปjฮฝj
or Sฮฝ1 = ฮป1ฮฝ1, etc.
๐(1) = ๐๐(0) = โ ๐๐๐๐๐๐ ๐๐=1
๐(2) = ๐2๐(0) = โ ๐๐๐๐๐๐2 ๐
๐=1
(๐ข๐ ๐ ๐๐๐ = ๐๐๐๐)
โฎ
๐(๐) = โ ๐๐๐๐๐๐๐ ๐
๐=1
For convergence, ๐ โ โ ๐(๐) โ 0 ๐๐ |๐๐| < 1 (๐ = 1โฏ๐)
For a ๐ ร ๐ S matrix, there will be ๐1 โฏ๐๐ eigenvalues.
If |๐๐๐๐ฅ| < 1 ๐กโ๐๐ ๐๐๐ ๐๐ < 1
Therefore, for Jacobi Iteration to converge: |๐๐๐๐ฅ| < 1
(๐๐๐ฅ (๐๐) โก ๐ ๐๐๐๐ก๐๐๐ ๐๐๐๐๐ข๐ ๐(๐) < 1)
There is the Gershgorin Theorem (Check the book by Strang) which states that in such case
โ|๐๐๐| < |๐๐๐|
๐๐๐ โ ๐๐๐๐๐๐๐๐
๐๐๐๐๐๐๐ก๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ก๐
Such matrix is said to be diagonally strong. It is a desirable characteristic of a matrix to be
inverted. Compare two extreme situations:
and
non-zero
Note that zero or no iterations are required to solve an identity matrix! Also, a diagonally
strong matrix will require relatively fewer number of iterations. On the other hand, the above
right hand matrix is a singular matrix and cannot be inverted. Similarly, a matrix with smaller
3
value-numbers on its diagonal relative to the other elements in the same row will require a
relatively larger number of iterations to converge.
Power Method
The previous examples have shown that the โdynamicsโ of a 1st order system can be
inspected or characterized by determining ๐๐๐๐ฅ ๐๐๐ ๐๐๐๐, instead of all ๐๐ . Therefore, a ๐ ร ๐
matrix will have ๐๐๐ , and the overall response of the system will be the least sensitive to
๐๐๐๐and most sensitive to ๐๐๐๐ฅ. The response corresponding to the other ๐๐ will be
intermediate. Power method is commonly used to determine ๐๐๐๐ฅ and also, ๐๐๐๐.
If [๐ด]๐ร๐ matrix has ๐ ๐๐ (๐๐๐๐๐๐ฃ๐๐๐ข๐๐ ), then one can write |๐1| > |๐2| > โฏโฏ |๐๐|
๐๐๐๐ฅ ๐๐๐๐
And AX = ฮปmaxX and AX = ฮปminX
Method: Make a guess of ๐๐ = [1 0 1] ๐๐ [1 1 0] (say, for a 3 ร 3 matrix)
Then ๐ด๏ฟฝ๏ฟฝ(0) โ ๏ฟฝ๏ฟฝ(1)
Use ๏ฟฝ๏ฟฝ(1) = ๏ฟฝ๏ฟฝ(1)
โ๏ฟฝ๏ฟฝ(1)โ=
๐ด๐(0)
โ๐ด๐(0)โ
(
magnitude (you are scaling or normalizing the vector,
i. e. a |a|โ or a โa12 + a2
2 + a32โ
)
๏ฟฝ๏ฟฝ(๐) =๐ด๏ฟฝ๏ฟฝ(๐โ1)
โ๐ด๏ฟฝ๏ฟฝ(๐โ1)โ , ๐ = 1, 2,3 (# ๐๐ ๐๐ก๐๐๐๐ก๐๐๐๐ )
Can be shown that when ๐ โ โ โ๐ด๏ฟฝ๏ฟฝ(๐โ1)โ โ |๐๐๐๐ฅ|
In other words, after sufficient # of iterations, one obtains maximum eigenvalue and the vector
๏ฟฝ๏ฟฝ(๐โ1) when transformed by โAโ matrix does not rotate and is just scaled by ๐๐๐๐ฅ, i.e.
๐ด๏ฟฝ๏ฟฝ(๐โ1) = ๐๐๐๐ฅ๏ฟฝ๏ฟฝ(๐)
In other wors, X(kโ1) and X(k) have the same directions.
๐๐๐๐ฅ ๏ฟฝ๏ฟฝ(๐+1)
๏ฟฝ๏ฟฝ(๐)
4
Example: Determine ๐๐๐๐ฅ of ๐ด = [ 0 2 3โ10 โ1 2โ2 4 7
]
๐(1) = {100} โก [1 0 0]๐ (1๐ ๐ก ๐๐ข๐๐ ๐ )
๐(2) =[ 0 2 3โ10 โ1 2โ2 4 7
]{100}
โ๐ด๐(1)โ=
{0
โ10โ2
}
โ100+4= {
0.0000โ0.9806โ0.1961
}
|๐| = โ104 = 10.198
๐(3) =
[A]{0.0000โ0.9806โ0.1961
}
โAฮฝ(2)โ=
{โ2.54950.5884โ5.2951
}
โ2.54952+.58842+5.29512= { }
๐2 = 5.9063
After 20 iterations,
๐(20) = {โ0.3714 0.556980.7428
} with ฮป(20) = 3.0014
You will see a gradual convergence from 10.198 to 3.0014.
The basics remains the same:
๐ด๐(19) = ๐๐๐๐ฅ๐(20) and ๐(19) ๐๐๐ ๐(20) will have approximately the same direction.
It can be shown that ๐๐๐๐๐จ๐ ๐ = ๐๐๐๐๐
โ ๐๐๐๐๐ ๐๐๐๐ is the highest eigenvalue of the
inverse of matrix ๐จ ๐๐ ๐จโ๐:
AX = ฮปmaxX
or X = Aโ1(ฮปmaxX) = ฮปmax(Aโ1X)
or Aโ1X = (1 ฮปmaxโ )X
or BX โก ฮปโฒmaxX
where B is Aโ1 and ฮปmin of A is (1ฮปโฒmax
โ ) of B where ฮปโฒmax is the highest ฮป of B.
5
The ฮปmax to ฮปmin ratio is known as stiffness ratio and indicates the stiffness (maximum rate of
change in the functional value corresponding to ฮปmax relative to minimum rate corresponding to
ฮปmin) of the system. A ratio > 10 indicates the system to be stiff requiring a fine step size for
calculations (to be discussed later)
Notes (From Strang's book):
(1) If X is an eigenvector of A corresponding to ๐๐๐๐ฅ and A is invertible, then X is also an
eigenvector of ๐ดโ1 corresponding to the inverse of its ๐๐๐๐ฅ.
(2) Eigenvectors corresponding to different ๐๐ are linearly independent.
(3) A matrix and its transpose have the same eigenvalues.
(4) A matrix is singular if and only if it has zero ๐ . A non-singular matrix has all non zero
๐๐ .
(5) โ๐๐ = ๐ก๐๐๐๐ ๐๐ ๐ด = โ ๐๐๐๐๐=1
(6) โ๐๐ = det (๐ด)
(7) The ๐๐ of an upper or lower triangular matrix are the elements on its main diagonal.
[It also follows that det A = det (UTM of A) = โ(๐๐๐)๐๐๐]
Quiz 1
1
Lecture #10
Nonlinear Algebraic Equations
Solving
๐น1(๐1 โฏ โฏ ๐๐) = 0
๐น2(๐1 โฏ โฏ ๐๐) = 0โฎ ๐น๐(๐1 โฏ โฏ ๐๐) = 0
} ๐๐ ๏ฟฝ๏ฟฝ(๏ฟฝ๏ฟฝ) = 0
๐๐ ๏ฟฝ๏ฟฝ(๏ฟฝ๏ฟฝ) = {๐น1(๏ฟฝ๏ฟฝ)โฎ ๐น๐(๏ฟฝ๏ฟฝ)
} = 0
where, ๐น1(๏ฟฝ๏ฟฝ) takes the form such as (๐1 โ sin ๐1) = 0
๐๐ ๐1 โ sin ๐2 = 0
and ๐1 = ๐๐2}
Solving a set of nonlinear algebraic equations is naturally difficult.
Let us begin with solving one nonlinear equation:
๐(๐ผ) = 0 (๐ ๐๐๐ก ๐๐๐๐๐๐๐) ๐ผ =?
Closed Methods
1. Bracketing method (for a monotonically increasing or decreasing function)
๐(๐)
๐(๐ผ) = 0
๐ผ
๐๐1 ๐๐2
๐๐2 ๐๐1 ๐๐ ๐
Step 1: Corner the root. Find ๐๐ ๐๐๐ ๐๐ such that
๐(๐๐)๐(๐๐) < 0 โถ
All it means is that one root is cornered or bracketed. Some functions may have multiple
2
roots (be careful and corner all three roots separately by plotting the function qualitatively but
accurately).
๐๐๐ก๐: ๐โ๐๐ ๐๐ข๐๐๐ก๐๐๐ ๐กโ๐๐๐ ๐๐๐๐ก๐
๐๐๐ก๐ค๐๐๐ ๐๐ ๐๐๐ ๐๐.
๐๐
๐๐
Step 2: ๐๐(1) =
๐๐+๐๐
2= ๐๐๐๐
Check f(Xm) = 0. If true, you have the root or Xm = ฮฑ
If not, check โ if f(Xm)f(Xl) < 0. If true,
XU = Xm (replace XU with Xm)
else Xl = Xm (replace Xl with Xm)
(This way, you are cornering the root or coming closer to the root)
(Note: The other check f(X)f(XU) < 0 will also work. If โ ve Xl = Xm else
XU = Xm)
Step 3: Xm(2) =
XU+Xl
2= Xnew (XU & Xl are new values)
{
you can begin errorchecks after 2nditerations only
Check |ฮพa| = |Xm
newโXmold
Xmold | ร 100 <โ (specified by user)
else go to step 2 (keep iterating)
till |X(i+1)โX(i)
X(i) | ร 100 <โ
Example: Van der Waals gas law/equation:
(P +a
V2) (V โ b) = constant
3
It is clear that this equation is polynomial in V with ๐ = 3.
Let us assume that the other variables and constants are known and the simplified
equation takes the following form:
f(V) = 0
V3 โ 0.165V โ 3.993 ร 10โ4 = 0
Calculate V or find the roots
Step 0: Bracket the root: V{0, 0.11} f(V) Xm(1)
Xl = 0, XU = 0.11 by plotting
0.11
1. Check f(Xl)f(XU) < 0 V
So that the root is bracketed (cornered)
2. Xm(1) =
0+0.11
2= 0.055 (3 digits accurate after decimal)
f(0.055)f(0) = 3.993 ร 10โ4 ร 6.655 ร 10โ5 > 0
(You would have checked whether f(0.055) x f(0.11) < 0 or not as well!)
Xl = 0.055, XU = 0.11 (remains the same)
3. Xm(2) =
Xl+Xu
2=
0.055+0.011
2= 0.0825 = Xnew
f(Xm(2)) = โ1.622 ร 10โ4
Check f(Xl)f(Xm) < 0
XU = 0.0825, Xl = 0.055
4: Check โa= |0.0825โ0.055
0.055| ร 100 = 50.00% > 0.2% (โs)
Therefore, Xm =0.055+0.0825
2 = 0.00875
Do 10 iterations to obtain Xm = 0.0625 with โa= 0.1721% < 0.2%
4
Ans. V (root) = 0.0625.
You should also prepare a table while solving:
Xl XU Xm โ f(Xm)f(Xl)
> < 0
or f(Xm)f(XU)> 0<
}your
decision
1. Yes
2. Xm No
โฎ
10.
2. False โ Position method (Regular-Falsi)
(This method is similar to the previous one, except draw a straight line connecting
XU and Xm to determine the intersection on X axis as the approximate value for the root)
Step1: Bracket root
f(X) f(XU)f(Xl) < 0
2. Xr(1) = XU โ
f(XU)
f(Xl) โ f(XU)ร (Xl โ XU)
X (f(XU)
XU โ Xr=
0 โ f(Xl)
Xr โ Xl)
ฮฑ(root)
Xl Xr(1)
=XUf(Xl) โ Xlf(XU)
f(Xl) โ f(XU)= Xold
3. Check: f(Xr)f(Xl) < 0 or f(Xr)f(XU) < 0
XU = Xr or Xl = Xr
Xr(2) =
XUf(Xl) โ Xlf(XU)
f(Xl) โ f(XU)= Xnew
Check โa<โs else go to 2; iterate till convergence. Note that it is difficult to choose
between two methods. In general, this method is faster. There are always exceptions. Try
f(X) = X10 โ 1!
5
Open Methods
1. Fixed Point Iteration.
Step1. f(X) = 0 โ Modify transform it toโ
f(X) = X โ g(X) = 0
eg. f(X) = X โ cos X
or X โ eX
(Try for x2 โ 1 as X โ g(X) = 0 or X = g(X)
Sometimes it is not straight forward & there may be more than one combination.
The working formula is
Y = X = g(X) (2 equations and find its interaction)
Y = X f(X) = 0 split into
Y Y = X and Y = g(X)
Y = g(X)
Therefore, a sequence is generated.
X3X2 X1 X0 Xn+1 = g(Xn)
Sometimes, one has to start from left to the root; sometimes there is a divergence or
spiral convergence, depending on type of functions.
Y or
๐(๐)
๐0 ๐1๐2
fast convergence slow convergence divergence
(spiral)
Criterion for convergence: |๐ โฒ(๐)| < ๐โฒ(๐) = ๐ at ๐ = ๐๐ง
6
Note: Closed methods often generate at least one root. Open methods may sometimes result in
divergence depending upon type of function and starting guess, Xo. However, if they converge,
they will do more quickly than the closed methods.
Step 2: Start with Xo
X1 = g(Xo)
Step 3: Check โa= |X1โX0
X1| <โs
If not, Xold = Xr(iterated value)
Xr = g(Xold)
Check โa= |Xr โXold
Xold| <โs
Else keep on iterating, keeping in mind the sequence Xn+1 = g(Xn).
2. Newton-Raphson Method
(Most popular method to solve a non-linear algebraic equation)
f(X) = 0 tangent Step1: Choose
tangent Xr = Xo (guess)
2. f โฒ(Xr) = tangent at Xr = f(Xr)
X0 โ X1
X2 X0 X1 = Xr โf(Xr)
fโฒ(Xr)
(Note: f โฒ(Xr) โ 0)
3. If โa= |X1โXr
Xr| ร 100 <โs stop
ฮฑ = X1 (root)
else Xr = X1 (repeat the steps)
Sequence: Xi+1 = Xi โf(Xi)
fโฒ(Xi); f โฒ(Xi) โ 0
and โi+1= |Xi+1โXi
Xi| ร 100
7
Notes: โ
f โฒ(X) โ 0 is the major drawback of the method. There is a price for computing f โฒ(X)
Simple to code and convergence is fast (see later)
There are cases of divergence and โmissingโ roots, depending on function and initial guess
divergence
Y missing root
X0
X1 X3 X2X0 X X1
root
In all such cases, the best strategy is to plot and locate all roots graphically (qualitatively but
accurately), and also, start close to the root.
The NR method can be derived from the Taylor series expansion showing the order of error
in the method.
f(Xi+1) = f(Xi) + f โฒ(Xi)(Xi+1 โ Xi) +fโฒโฒ(Xi)
2!(Xi+1 โ Xi)
2 + โฏ โฏ
โ f(Xi) + f โฒ(Xi)(Xi+1 โ Xi) + 0(h2)
(error)
If f(Xi+1) = 0, root is located
Xi+1 = Xi โf(Xi)
fโฒ(Xi)
Example (NR) : ๐(๐) = ๐3 โ 0.165๐2 + 3.993 ร 10โ4
๐โฒ(๐) = 3๐2 โ 0.33๐
Step 1. ๐0 = 0.05: ๐๐๐๐ก ๐(๐)๐๐๐ ๐โ๐๐๐ ๐ ๐0 ๐๐๐๐ ๐ ๐ก๐ ๐กโ๐ ๐๐๐ก๐๐๐ ๐๐๐ก๐๐๐ ๐๐ ๐(๐) ๐ค๐๐กโ ๐ โ axis
2. ๐โฒ(๐0) = 3๐02 โ 0.33๐0
๐1 = ๐0 โ๐(๐0)
๐โฒ(๐0)= 0.06242
3. โ = |0.06242โ0.0500
0.0500| ร 100 = 24.84%
8
4. ๐2 = ๐1 โ๐(๐1)
๐โฒ(๐1)= 0.06238
โ = 0.06411 โ ๐ผ = 0.06238 (๐๐๐๐ก)
(accurate to the 1st significant digit after decimal)
1
Lecture #11
Newton-Raphson (Multi-variables)
F1(X1, X2โฏXn) = 0
F2(X1, X2โฏXn) = 0โฎ
Fn(X1, X2โฏXn) = 0
] โF (X) = ๐
or Fi(X) = 0, i = 1โฏn or Fi(Xi) = 0, i = 1โฏn
Taylor-expansion of multi-variables:
๐น1(๏ฟฝ๏ฟฝ(๐+1)) โ ๐น1(๏ฟฝ๏ฟฝ
(๐)) +๐๐น1๐๐1
|(๐1
(๐+1) โ ๐1(๐)) +
๏ฟฝ๏ฟฝ(๐) โ ๐1
๐๐น1๐๐2
|(๐2
(๐+1) โ ๐2(๐)) +
๏ฟฝ๏ฟฝ(๐) โ ๐2
โฏโฏ๐๐น1๐๐๐
(๐๐
(๐+1) โ ๐๐(๐))
๏ฟฝ๏ฟฝ(๐) โ ๐๐ (1๐ ๐ก๐๐๐๐๐ ๐๐๐๐ข๐๐๐ก๐)
๐น2(๏ฟฝ๏ฟฝ(๐+1)) โ ๐น2(๏ฟฝ๏ฟฝ
(๐)) +๐๐น2๐๐1
|(๐1
(๐+1) โ ๐1(๐)) +
๏ฟฝ๏ฟฝ(๐) โ ๐1
๐๐น2๐๐2
|(๐2
(๐+1) โ ๐2(๐)) +
๏ฟฝ๏ฟฝ(๐) โ ๐2
โฏโฏ๐๐น2๐๐๐
(๐๐
(๐+1) โ ๐๐(๐))
๏ฟฝ๏ฟฝ(๐) โ ๐๐
.
.
.
๐น๐(๏ฟฝ๏ฟฝ(๐+1)) โ ๐น๐(๏ฟฝ๏ฟฝ
(๐)) +๐๐น๐๐๐1
|(๐1
(๐+1) โ ๐1(๐)) +
๏ฟฝ๏ฟฝ(๐) โ ๐1
๐๐น๐๐๐2
|(๐2
(๐+1) โ ๐2(๐)) +
๏ฟฝ๏ฟฝ(๐) โ ๐2
โฏโฏ๐๐น๐๐๐๐
(๐๐
(๐+1) โ ๐๐(๐))
๏ฟฝ๏ฟฝ(๐) โ ๐๐
If ๏ฟฝ๏ฟฝ(๐+1) = ๐ผ (๐๐๐๐ก ๐๐ก (๐ + 1)๐กโ ๐๐ก๐๐๐๐ก๐๐๐ ๐๐๐ ๐๐๐ ๐ฃ๐๐๐๐๐๐๐๐ ) โ ๐น๐(๏ฟฝ๏ฟฝ(๐+1)) = 0,
(๐ = 1โฏ๐)
2
{
00โฎโฎ0}
=
{
๐น1๐น2โฎโฎ๐น๐}
(๐)
+
[ ๐๐น1
๐๐1
๐๐น1
๐๐2โฏ
๐๐น1
๐๐๐๐๐น2
๐๐1โฏ โฏ โฏ
โฎโฎ๐๐น๐
๐๐1
๐๐น๐
๐๐2โฏ
๐๐น๐
๐๐๐] (๐)
{
โ๐1โ๐2โฎโฎ
โ๐๐}
(โ๐1 = ๐1(๐+1) โ ๐1
(๐), ๐๐ก๐)
๐๐
[ ๐๐น1
๐๐1โฏ
๐๐น1
๐๐๐
โฎ๐๐น๐
๐๐1โฏ
๐๐น๐
๐๐๐] (๐)
{โ๐1โฎ
โ๐๐
} = โ {๐น1โฎ๐น๐
}
(๐)
๐๐ ๐ฝ๐ฝ โ๏ฟฝ๏ฟฝ(๐) = โ๐น (๐)
๐๐ โ๏ฟฝ๏ฟฝ(๐) = โ ๐ฝ๐ฝ โ1๐น (๐)
๐๐ ๏ฟฝ๏ฟฝ(๐ + 1) = ๏ฟฝ๏ฟฝ(๐) โ ๐ฝ๐ฝ โ1๐น (๐) โ Multi-variable NR method (similar in form to single
variable NR method)
Example: ๐น1(๏ฟฝ๏ฟฝ) = 4 โ 8๐1 + 4๐2 โ 2๐13 = 0
๐น2(๏ฟฝ๏ฟฝ) = 1 โ 4๐1 + 3๐2 + ๐22 = 0
Starting guess values
๏ฟฝ๏ฟฝ(1) = [๐1 ๐2]๐(1) = [0.5 0.5]๐
Apply NR multivariable method formula:
๏ฟฝ๏ฟฝ(๐+1) = ๏ฟฝ๏ฟฝ(๐) โ ๐ฝ๏ฟฝ๏ฟฝโ1๐น (๐)
๐๐ {๐1๐2}(๐+1)
= {๐1๐2}(๐)
โ
[ ๐๐น1๐๐1
๐๐น1๐๐2
๐๐น2๐๐1
๐๐น2๐๐2]
โ1
{๐น1๐น2}(๐)
3
{๐1๐2}1
= {0.50.5} โ [
(โ8 โ 6๐12) 4
โ4 (3 + 2๐2)]โ1
{๐น1๐น2}0.5,0.5
= {0.50.5} โ [
โ9.5 4โ4 4
]โ1
{1.750.75
}
= {0.50.5} +
1
22[ 4 โ4 4 โ9.5
] {1.750.75
}
(Note: For ๐ ร ๐ matrix simple Cramerโs rule was applied to determine the inverse of
the matrix, else apply ๐ฎ โ ๐ฑ ๐๐ ๐ณ๐ผ decomposition method can be used for a large size
matrix)
๐1(1) = 0.5 +
1
22(4 ร 1.75 โ 4 ร 0.75) = 0.6818
๐2(1) = 0.5 +
1
22(4 ร 1.75 โ 9.5 ร 0.75) = 0.4943
- Continue iteration till there is a convergence. One can prepare a table like this:
# ๐1 ๐2 ๐น1 ๐น2 ๐๐น1
๐๐1
๐๐น1
๐๐2
๐๐น2
๐๐1
๐๐น2
๐๐2 ๐1 ๐2 โ๐1 โ๐2
1
2
Secant Method
(Another common open method; it does not require derivative to compute. Requires two
starting adjacent guess values instead)
Step1:
Straight line: Choose ๐๐โ1 ๐๐๐ ๐๐ adjacent guess values near the root โฒ๐ผโฒ.
2. Draw straight line connecting ๐(๐๐โ1) ๐๐๐ ๐(๐๐). Find
๐(๐ฅ) intersection on X axis โ ๐๐+1
โฒ๐ผโฒ ๐โฒ(๐๐+1) =๐(๐๐)
๐๐โ๐๐+1=
๐(๐๐โ1)
๐๐โ1โ๐๐+1
๐๐+1 ๐ ๐๐+1 = ๐๐ โ ๐(๐๐) ร(๐๐โ๐๐โ1)
๐(๐๐)โ๐(๐๐โ1)
๐๐ ๐๐+1 = ๐๐ โ๐(๐๐)
๐(๐๐)โ๐(๐๐โ1)
๐๐โ๐๐โ1
: sequence
4
Check if ๐(๐๐+1) โ (๐ฆ๐๐ข โ๐๐ฃ๐ โ๐๐ก ๐กโ๐ ๐๐๐๐ก), else repeat with ๐๐ ๐๐๐ ๐๐+1 following
the above sequence.
The method converges faster than Bisection method, but slower that NR. It is preferred
over NR to avoid ๐โฒ = 0.
If ๐๐ โ ๐๐โ1, note ๐๐+1 = ๐๐ โ๐(๐๐)
๐โฒ(๐๐) (same as NR!)
At this stage, let us look at Taylorโs series. Any function f(X) can be expanded as:
๐(๐) = ๐(๐0) + ๐โฒ(๐0)(๐ โ ๐0) +
๐โฒโฒ(๐0)
2!(๐ โ ๐0)
2 +โฏ๐๐(๐0)(๐โ๐0)
๐
๐!+โฏ ๐ก๐ โ
exact
or, ๐(๐๐+1) = ๐(๐๐) + ๐โฒ(๐๐)(๐ โ ๐๐) +
๐โฒโฒ(๐๐)
2!(๐๐+1 โ ๐๐)
2 +โฏ๐๐(๐๐)(๐๐+1โ๐๐)
๐
๐!+โฏ ๐ก๐ โ
exact
โ ๐(๐๐) +๐โฒ(๐๐)(๐๐+1โ๐๐)
1!+๐โฒโฒ(๐๐)(๐๐+1โ๐๐)
2
2!+โฏ0(โ3)
approximate
or truncation error is 0(โ3) (accurate to 2nd order)
โ ๐(๐๐) +๐โฒ(๐๐)(๐๐+1โ๐๐)
1!+ 0(โ2)
approximate
(accurate to 1st order or truncation error is 0(โ2))
(error is one order greater than the accuracy of the method)
= ๐(๐๐) + ๐โฒ(๐๐)(๐๐+1 โ ๐๐) + โฏ
๐๐(๐๐)(๐๐+1โ๐๐)๐
๐!+ ๐ ๐+1
exact!
where, ๐ ๐+1 =๐๐+1(๐)(๐๐+1โ๐๐)
๐+1
๐+1! (๐๐๐ ๐๐ ๐๐ฅ๐๐๐ก๐๐ฆ ๐๐๐ก๐๐๐๐๐๐๐)
However, ๐ is โsomeโ number between ๐๐+1๐๐๐ ๐๐.
Therefore,
๐(๐๐+1) = ๐(๐๐) +๐โฒ(๐๐)(๐๐+1โ๐๐)
1!+๐2(๐)(๐๐+1โ๐๐)
2
2!
exact
5
= ๐(๐๐) +๐โฒ(๐)(๐๐+1โ๐๐)
1! (1st Mean Value Theorem)
exact
In other words, ๐โฒ(๐) =๐(๐๐+1)โ๐(๐๐)
(๐๐+1โ๐๐)
All it means there is โฒ๐โฒ somewhere between ๐๐๐๐๐ ๐๐+1, where the tangent equals the divided
difference between two end points ๐๐ โ ๐๐+1.
Note: Taylor series is used to determine the error or accuracy of a numerical method, or to
determine the convergence of the method.
Convergent Analysis
Fixed Point Iteration method
๐(๐) = ๐ โ ๐(๐)
๐๐ ๐(๐+1) = ๐(๐(๐)) (๐๐ก๐๐๐๐ก๐๐๐)
If ๐ผ is the root then ๐ผ โ ๐(๐ผ) = 0
Error at (๐ + 1)๐กโ iteration =|True Value โ Approximate Value|
๐๐+1 = |๐ผ โ ๐(๐+1)|
= |๐(๐ผ) โ ๐(๐(๐))|
= |๐โฒ(๏ฟฝ๏ฟฝ)(๐ผ โ ๐(๐)| โถ Recall Mean Value Theorem. X is between
ฮฑ and X(n)
= |๐โฒ(๏ฟฝ๏ฟฝ)๐๐|
๐๐+1
๐๐= |๐โฒ(๏ฟฝ๏ฟฝ)| < 1 for error to decrease as ๐ โ โ where ๏ฟฝ๏ฟฝ is {๐ผ, ๐๐}
NR Convergent
๐๐+1 = ๐๐ โ๐๐
๐๐โฒ ; ๐๐
โฒ โ 0
๐(๐+1) = |๐ผ โ ๐๐+1| = |๐ผ โ ๐๐ +๐๐
๐๐โฒ|
6
๐(๐๐+1) = ๐(๐๐) + ๐๐โฒ(๐๐+1 โ ๐๐) + ๐โฒโฒ(๏ฟฝ๏ฟฝ)
(๐๐+1โ๐๐)2
2!
exact (๏ฟฝ๏ฟฝ: {๐๐, ๐๐+1})
If ๐๐+1 is the root (๐ผ)
0 = ๐(๐๐) + ๐๐โฒ(๐ผ โ ๐๐) +
(๐ผ โ ๐๐)2
2!๐โฒโฒ(๏ฟฝ๏ฟฝ)
โด ๐(๐+1) = |๐โฒโฒ(๏ฟฝ๏ฟฝ)
2๐โฒ๐
(๐ผ โ ๐๐)2|
= |๐โฒโฒ(๏ฟฝ๏ฟฝ)
2๐โฒ๐(๐๐)2|
๐(๐+1)
(๐๐)2= |
๐โฒโฒ(๏ฟฝ๏ฟฝ)
2๐โฒ(๐ผ)| ; ๐โฒ(๐ผ) โ 0
If ๐ โ โ ๐(๐+1) decreases by the square of the error in the previous step. In other words, the
method has quadratic convergence (fast convergence), although the method is only 1st order
accurate. This is the special feature of NR method.
1
Lecture #12
Function Approximation: Interpolation
Fit a line passing through the data points to
predict the functional value at an intermediate interpolated value
data. The line must pass through the data. The method is used
to interpolate, for example, certain properties such as enthalpy and
vapour pressure, at an intermediate point where the functional ๐๐
values or properties are not available.
Therefore, the data provided for the interpolation must
be reliable/accurate. ๐๐
- Mathematically, interpolating function must be smooth
(differential); continuous and pass through all data points.
- Compare it to โregressionโ (best fit to the data) when the line need not pass through each
data. Regression is used for prediction when data are experimentally measured or
approximately calculated. Therefore, the regressed data may have errors.
Yi experimental data
๐๐
๐๐
- (No regression topic to be covered in this course; no extrapolation as well!)
The main motivation for developing an interpolating function is not only to predict the
functional value at an interpolating/intermediate point, but also to approximate a continuous f(x)
or a discrete data set, y(x) as the nth degree polynomial, Pn(x); thus the name of the current topic:
function approximation. You will see in the later lessons that once you have your own
approximated simple Pn(x), you will forgo the complex f(x) and work on Pn(x) instead, not only
for calculating functional values at the intermediate points but also for computing fโ(x) and fโโ(x)
as Pnโ(x) and Pnโโ(x), respectively. Also, all formulae for integration are also derived from Pn(x).
2
Interpolating function for โnโ data points
๐๐โ1(๐) = ๐๐โ1๐๐โ1 + ๐๐โ2๐
๐โ2 +โฏ๐0: a polynomial of degree (๐ โ 1).
If there are โnโ data points, a unique polynomial of degree (n-1) passes through the points:
Ex. 1. ๐ฆ = ๐๐ฅ + ๐ (1st order polynomial) passing through two data points. Two unknown &
two equations to solve m and b:
2. Three data points
y = ax2 + bx + c (2nd order polynomial, a quadratic equation)
(3 equations to solve three unknowns ๐, ๐ & ๐)
3. Thus, โnโ data points will have a ๐ข๐๐๐๐ข๐ polynomial of degree (n โ 1) passing through the
points.
๐ฆ = ๐๐โ1๐ฅ๐โ1 + ๐๐โ2๐ฅ
๐โ2 +โฏโฏ๐0
Therefore,
๐ฆ1 = ๐๐โ1๐ฅ1๐โ1 + ๐๐โ2๐ฅ1
๐โ2 +โฏโฏ๐0๐ฆ2 = ๐๐โ1๐ฅ2
๐โ1 + ๐๐โ2๐ฅ2๐โ2 +โฏโฏ๐0
โฎ ๐ฆ๐ = ๐๐โ1๐ฅ๐
๐โ1 + ๐๐โ2๐ฅ๐๐โ2 +โฏโฏ๐0}
nequations
or
{
๐ฆ1๐ฆ2โฎ๐ฆ๐
} = ||
1 ๐ฅ1 ๐ฅ12 โฏ ๐ฅ1
๐โ1
1 ๐ฅ2 ๐ฅ22 โฏ ๐ฅ2
๐โ1
โฎ1 ๐ฅ๐ ๐ฅ๐
2 ๐ฅ๐๐โ1
|| {
๐0โฎโฎ
๐๐โ1
}
Although the problem is well defined, it is tedious to solve (๐0โฏโฏ๐๐โ1) from a large sized ๐ ร
๐ matrix.
๏ฟฝ๏ฟฝ = ๐ด๐ร๐๏ฟฝ๏ฟฝ
The common methods to fit ๐๐โ1 polynomial passing through โnโ data points, or ๐๐ through
(n + 1) data points:
(1) Newtonโs divided-difference scheme
Consider 2 data points
Let a line pass through (๐0, ๐0) & (๐1, ๐1):
P2
3
๐ โ ๐0๐ โ ๐0
=๐1 โ ๐0๐1 โ ๐0
or ๐ = ๐0 +๐1โ๐0
๐1โ๐0(๐ โ ๐0)
๐๐ ๐ = ๐0 + ๐1(๐ โ ๐0)
{
where a0 = Y0
a1 =Y1โY0
X1โX0= Y(X1, X0) defined as
Newton First DividedDifference(N1DD)
Similarly, define
๐[๐2, ๐1, ๐0] โก Newton 2nd divided difference
=๐[๐2, ๐1] โ ๐[๐1, ๐0]
๐2 โ ๐0 (๐2๐ท๐ท)
๐[๐๐, ๐๐โ1, โฏ๐0] =๐[๐๐, ๐๐โ1, โฏ๐1] โ ๐[๐๐โ1, ๐๐โ2,โฏ๐0]
๐๐ โ ๐0 (๐๐๐ท๐ท)
Take 3 data points (๐0, ๐1, ๐2):
๐(๐) โก ๐2(๐) = ๐0 + ๐1(๐ โ ๐) + ๐2(๐ โ ๐0)(๐ โ ๐1)
By fitting ๐2(๐) to three data points, the three coefficients
can be determined as
๐0 = ๐0, ๐1 =๐1โ๐0
๐1โ๐0โก ๐[๐1, ๐0]
and ๐2 =๐[๐2,๐1]โ๐[๐1,๐0]
๐2โ๐0โก ๐[๐2, ๐1, ๐0]
Similarly for (n+1) data
๐(๐) ๐๐ ๐๐(๐)
= ๐0 + ๐1(๐ โ ๐0) + ๐2(๐ โ ๐0)(๐ โ ๐1) + โฏ๐๐(๐ โ ๐0)(๐ โ ๐1)โฏ (๐ โ ๐๐โ1)
where ๐0 = ๐0
๐1 = ๐[๐1, ๐0] =๐1โ๐0
๐1โ๐0 (1st divided difference)
๐๐ = ๐[๐๐, ๐๐โ1โฏ๐0] ( nthdivided difference )
Y1
Y
Y0
X0 X1
X
X0 X1 X2
Xi
Y0
Y2
Yi Y1
4
(Substitute x = x0, x1, x2โฆxn in Pn(x) to explore the sequence of polynomial)
In the tabular form,
๐ ๐๐ ๐๐ 1๐ ๐ก 2๐๐ โฏโฏ ๐๐กโ
{
0 ๐0 ๐0 1 ๐1 ๐1 2 ๐2 ๐2 โฎ ๐ โ 1 ๐๐โ1 ๐๐โ1 ๐ ๐๐ ๐๐
๐๐ = (๐[๐๐,โฏ๐1]
โ๐[๐๐โ1, โฏ๐0])๐๐ โ ๐0
Note: Top row (circles) provides all NDD coefficients, ao, a1, a2โฆ.
2. Lagrangian Interpolation
๐ฆ(๐ฅ) = โ ๐๐(๐ฅ) ๐ฆ๐๐๐=0 (๐ + 1 ๐๐๐ก๐)
Lagrangian coefficient of the kth term
Function must be a linear combination of ๐ฆ๐.
๐๐(๐ฅ) must not depend on ๐ฆ๐
๐๐(๐ฅ) is defined as ๐๐(๐ฅ๐) = ๐ฟ๐๐ (Kronecker delta)
= 1 when i = j and 0 when i โ j
Propose, lj(๐ฅ) = ๐ถ๐(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ1)โฏ (๐ฅ โ ๐ฅ๐โ1)(๐ฅ โ ๐ฅ๐+1)โฏ (๐ฅ โ ๐ฅ๐), and
= 0 (๐ฅ โ ๐ฅ๐)
= 1 (๐ฅ = ๐ฅ๐)
Therefore, ๐ถ๐ = (๐ฅ๐ โ ๐ฅ0)โ1(๐ฅ๐ โ ๐ฅ1)
โ1โฏ(๐ฅ๐ โ ๐ฅ๐โ1)
โ1(๐ฅ๐ โ ๐ฅ๐+1)
โ1โฏ(๐ฅ๐ โ ๐ฅ๐)
โ1
and, ๐๐(๐ฅ) =(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ1)โฏ (๐ฅ โ ๐ฅ๐โ1)(๐ฅ โ ๐ฅ๐+1)โฏ (๐ฅ โ ๐ฅ๐)
(๐ฅ๐ โ ๐ฅ0)(๐ฅ๐ โ ๐ฅ1)โฏ(๐ฅ๐ โ ๐ฅ๐โ1)(๐ฅ๐ โ ๐ฅ๐+1)โฏ (๐ฅ๐ โ ๐ฅ๐)
The interpolating function is as follows:
๐๐(๐ฅ) = โ ๐๐(๐ฅ)๐๐ โก ๐๐
๐
๐=0
where
๐๐(๐ฅ) = โ(๐ฅ โ ๐ฅ๐)
(๐ฅ๐ โ ๐ฅ๐)
๐
๐=0(๐โ ๐)
5
Suppose 2 data points: (๐0, ๐0) and (๐1, ๐1)
Y1(x) = l0(x)Y0 + l1(x)Y1
l0 =xโx1
x0โx1, l1 =
xโx0
x1โx0
or Y1(x) = (xโx1
x0โx1) Y0 + (
xโx0
x1โx0) Y1
(Since ๐1(๐ฅ) is unique, it cannot be different from Newton-Divided difference formula; only
forms are different)
Suppose there are 3 data points: (X0, Y0), (X1, Y1), and (X2, Y2)
๐2(๐ฅ) = ๐0(๐ฅ)๐0 + ๐1(๐ฅ)๐1 + ๐2(๐ฅ)๐2
๐0(๐ฅ) =(๐ฅ โ ๐ฅ1)(๐ฅ โ ๐ฅ2)
(๐ฅ0 โ ๐ฅ1)(๐ฅ0 โ ๐ฅ2); ๐1(๐ฅ) =
(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ2)
(๐ฅ1 โ ๐ฅ0)(๐ฅ1 โ ๐ฅ2) ,
๐(๐ฅ) =(๐ฅ โ ๐ฅ1)(๐ฅ โ ๐ฅ2)
(๐ฅ0 โ ๐ฅ1)(๐ฅ0 โ ๐ฅ2)๐0 +
(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ2)
(๐ฅ1 โ ๐ฅ0)(๐ฅ1 โ ๐ฅ2)๐1 +
(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ1)
(๐ฅ2 โ ๐ฅ0)(๐ฅ2 โ ๐ฅ1)๐2
โก ๐ ๐๐๐ ๐๐ ๐๐ท๐ท๐ธ ๐๐ ๐๐2 + ๐๐2 + ๐
Ex. ๐1 ๐2 ๐ ๐3
Depth (m) -1 0 0.5 1.0
๐(๐ก0๐) 10.1 11.3 ? 11.9
๐2(๐ฅ) = ๐ถ0 + ๐ถ1๐ฅ + ๐ถ2๐ฅ2 (unique)
3 data points and 3 eqns to solve Cs:
[1 โ1 11 0 01 1 1
] {๐ถ0๐ถ1๐ถ2
} = {10.111.311.9
}โฆโฆ.>Solve by any previously learnt method to obtain
๐ถ0 = 11.3, ๐ถ1 = 0.9, ๐๐๐ ๐ถ2 = โ0.3 โ ๐(0.5) = 11.675
(1) ๐๐ท๐ท 1๐ ๐ก๐ท๐ท: ๐[๐0, ๐1] 2๐๐๐ท๐ท: ๐[๐0, ๐1, ๐2]
๐0 โ 1 10.1 11.3โ10.1
0+1= 1.2
1.2โ0.6
โ1โ1= โ0.3
๐1 0 11.3 11.9โ11.3
1โ0= 0.6
๐2 1 11.9
(X,Y) (X1,Y1)
(X0,Y0)
6
Therefore, Y2(x) = a0 + a1(x โ x0) + a2(x โ x0)(x โ x1)
a0 = Y0 = 10.1, a1 = FDD = 1.2, a2 = SDD = โ0.3
= 10.1 + 1.2(x + 1) โ 0.3(x + 1)x
- (Same as before, check) Y(0.5) = 11.675
(2) Lagrange Y2(x) = โ lkYk2k=0 ; lj(x) = โ (
xโxi
xjโxi)2
i=0iโ j
l0(x) =(xโx1)(xโx2)
(x0โx1)(x0โx2); l1(x) =
(xโx0)(xโx2)
(x1โx0)(x1โx2) , etc.
Y2(x) =(x โ 0)(x โ 1)
โ1 ร โ2ร 10.1 +
(x + 1)(x โ 1)
1 ร โ1ร 11.3 +
(x + 1)x
2 ร 1ร 11.9
- (Same as before, check) Y(0.5) = 11.675
Note: โ If โnโ is large, (> 4), the polynomial shows oscillation. In principle, one uses โpiece-
wiseโ interpolation for large # of data points.
โ Less smooth if data points are less or sparse.
โ โProblemโ at the end points.
โ NDD uses the previous calculations, if an extra point is to be included in finding a new
polynomial, unlike each coefficient has to be recalculated in โLIโ. However, it is easy to
program โLIโ.
Error analysis: For (n+1) data points, ๐๐(๐๐๐๐๐ ๐) is the unique polynomial to pass through
(n+1) data points. This polynomial can be used to predict ๐๐(๐) at a new data points โXโ.
How much error can be expected in this prediction/interpolation? From engineering point of
view, how much confidence an user has in the interpolated functional value? Well, in such
case one should use an additional data (๐, ๐(๐)) over the range (๐0โฏ๐๐) and check the
convergence in the re-interpolated value at ๐๐+1(๐). Note, now you have (n+2) data points
including ๐.
Theoretically, it can be shown using Taylorโs series that the error in the interpolation using
๐๐(๐) for (n+1) data is
๐ฆ๐+1(๐)
๐+1!(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ1)โฏโฏ(๐ฅ โ ๐ฅ๐)
where (๐ฅ0 < ๐ < ๐ฅ๐)
additional data pt.
7
You should have also noted that
๐ฆ[๐ฅ0, ๐ฅ1] =๐ฆ(๐ฅ1)โ๐ฆ(๐ฅ0)
๐ฅ1โ๐ฅ0= ๐ฆโฒ (accurate to the 1st order)
๐ฆ[๐ฅ0, ๐ฅ1, ๐ฅ2] = โฏโฏ = ๐ฆโฒโฒ (accurate to the 2nd order)
and ๐ฆ[๐, ๐ฅ0, ๐ฅ1, โฏ ๐ฅ๐] =๐[๐,โฏ๐ฅ๐โ1]โ๐[๐ฅ0,โฏ๐ฅ๐]
๐โ๐ฅ๐= ๐ฆ๐+1(๐)
Therefore, the error calculated is nothing but ๐ ๐+1(remainder) of the Taylorโs series. For
more on this, read the book by Ferziger.
1
Lecture #13
Similar to the Newtonโs Divided Difference and Lagrangian interpolation schemes, there is the
Newtonโs interpolation formula that makes use of โฒฮโฒ operator (Forward Difference Operator)
ฮ๐ฆ(๐ฅ) = ๐ฆ(๐ฅ + ฮ๐ฅ) โ y(๐ฅ) โถ ๐น๐๐๐ค๐๐๐ โ ๐๐๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐ก๐๐
{
๐ธ ๐ฆ(๐ฅ) = ๐ฆ(๐ฅ + ฮ๐ฅ) โถ ๐โ๐๐๐ก ๐๐๐๐๐๐ก๐๐
๐ธ2๐ฆ(๐ฅ) = ๐ธ[๐ฆ(๐ฅ + ฮ๐ฅ)] = ๐ฆ(๐ฅ + 2ฮ๐ฅ)
๐ธ๐๐ฆ(๐ฅ) = ๐ฆ(๐ฅ + ๐ฮ๐ฅ)
Therefore, ฮ๐ฆ(๐ฅ) = ๐ธ๐ฆ(๐ฅ) โ ๐ฆ(๐ฅ) = (๐ธ โ 1)๐ฆ(๐ฅ)
๐๐ ๐ธ = 1 + ฮ โถ ๐ธ & ฮ operators
๐๐ ๐ธ๐ผ = (1 + ฮ)๐ผ = 1 + ๐ผฮ +๐ผ(๐ผ โ 1)
2! ฮ2 +โฏ
๐ผ(๐ผ โ 1)โฏ (๐ผ โ ๐ + 1)
๐! ฮn+. ..
๐๐ ๐ธ๐ผ๐ฆ(๐ฅ0) = ๐ฆ(๐ฅ0 + ๐ผฮ๐ฅ) = (1 + ฮ)๐ผ๐ฆ(๐ฅ0)
= ๐ฆ0 + ๐ผฮ๐ฆ0 +๐ผ(๐ผโ1)
2! ฮ2๐ฆ0 +โฏ
๐ผ(๐ผโ1)โฏ(๐ผโ๐+1)
๐! ฮn๐ฆ0 +
If ๐ผ =๐ฅโ๐ฅ0
ฮ๐ฅ
๐ฆ(๐ฅ) = ๐ฆ(๐ฅ0 + ๐ผฮ๐ฅ) = ๐ฆ0 + ๐ผ(ฮ๐ฆ0) + ๐ผ(๐ผโ1)
2! ฮ2๐ฆ0 +โฏ
๐ผ(๐ผโ1)โฏ(๐ผโ๐+1)
๐! ฮn๐ฆ0 + ๐
๐ =๐ผ(๐ผโ1)(๐ผโ๐)
(๐+1)!ฮn+1๐ฆ(๐) ๐คโ๐๐๐ ๐ฅ๐ < ๐ < ๐ฅ๐
- Newton Forward-Difference Interpolation formula
In general
ฮ๐ฆ๐ = y(๐ฅ๐ + ฮ๐ฅ) โ ๐ฆ(๐ฅ๐) = ๐ฆ๐+1 โ ๐ฆ๐ฮ2๐ฆ๐ = ฮ(ฮ๐ฆ๐) = ๐ฆ๐+2 โ 2๐ฆ๐+1 + ๐ฆ๐
}
Similar to โฒฮโฒ, โ has been defined as backward difference operator:
โ๐ฆ๐ = ๐ฆ๐ โ ๐ฆ๐โ1 ๐๐ โ๐ฆ(๐ฅ) = ๐ฆ(๐ฅ๐ + ๐ผฮ๐ฅ), where ฮฑ =xโxn
ฮx
And, therefore, there is another Newtonโs interpolation formula! Again, note that all
interpolating functions are one and the same, but written in different forms. Considering that the
Newtonโs interpolation formula resembles Taylorโs series, it can also be used for error analysis.
To this end, we have learnt how to approximate f(x) or y(x) with Pn(x). We will see later
fโ(x) or yโ(x) and fโโ(x) or yโโ(x) will be approximated with Pโn(x) and Pnโ(x), respectively.
2
Splines
We have earlier noted that a high order polynomial (๐ โฅ 4) often shows oscillation. Therefore,
a piece-wise polynomial (๐ โค 3) is usually preferred for most engineering applications.
โ โSplineโ is a piece-wise cubic polynomial (๐ฆ = ๐๐ฅ3 + ๐๐ฅ2 + ๐๐ฅ + ๐) fitting 2 data
points in segments or pieces. Is it unique? No. Because there are two extra degrees of freedom.
In other words, two extra constraints or conditions may be imposed.
โ Let us define the problem:
๐๐ = ๐๐๐ฅ3 + ๐๐๐ฅ
2 + ๐๐๐ฅ + ๐๐ is the spline fitting the data ๐ฅ๐ ๐๐๐ ๐ฅ๐+1 . Thus, it is a
higher order polynomial for two data points.
(1) Each spline (๐๐) is a piece-wise cubic.
(2) Curve must pass through the points (๐ฅ๐ & ๐ฅ๐+1)
(3) ๐๐โฒ๐๐๐ ๐๐โฒโฒ are continuous at all โknotsโ, i.e, curve is smooth and curvature is the same
at all nodes.
or
๐๐โ1(๐ฅ๐) = ๐๐(๐ฅ๐)
๐โฒ๐โ1(๐ฅ๐) = ๐๐โฒ(๐ฅ๐)
๐๐โ1โฒโฒ(๐ฅ๐) = ๐๐โฒโฒ(๐ฅ๐)} โก
๐+ = ๐โ
๐โฒ+ = ๐โฒโ
๐โฒโฒ+ = ๐โฒโฒโ}
Therefore, for n data points there are (n-1) spline segments or 4(n-1) unknown quantities
(coefficients) to be determined:
Equations: ๐ฆ๐ = ๐๐(๐ฅ๐) โถ ๐
๐+ = ๐โ โถ (๐ โ 2) โถ only interior pts.
๐โฒ+ = ๐โฒโ โถ (๐ โ 2)
๐โฒโฒ+ = ๐โฒโฒโ โถ (๐ โ 2)
4๐ โ 6
You have two BCs specified at the end data points or knots.
Therefore, there are as many (4n-4) equations as # of unknowns.
The problem is now well defined:
Si-1 Si
Si+1
xi-1 xi xi+1
3
๐๐(๐ฅ) = โ ๐๐๐ฅ๐3
๐=0 = ?
Note that ๐๐"(๐ฅ) is a piece-wise linear and continuous (i. e. ๐๐"(๐ฅ) = 6๐๐๐ฅ + 2๐๐)
๐๐"(๐ฅ)
๐ฅ๐ ๐ฅ๐+1
๐๐(๐ฅ) โก ๐๐ข๐๐๐
Therefore, ๐๐โ(๐ฅ) = โ ๐๐(๐ฅ)๐ฆ๐1๐=0 (๐ฟ๐๐๐๐๐๐๐๐๐ ๐๐๐ก๐๐๐๐๐๐๐ก๐๐๐)
=๐ฅโ๐ฅ๐+1
๐ฅ๐ โ๐ฅ๐+1๐โ(๐ฅ๐) +
๐ฅโ๐ฅ๐
๐ฅ๐+1 โ๐ฅ๐๐โ(๐ฅ๐+1)
On integrating twice, ๐๐(๐ฅ) = (๐ฅ3
6โ ๐ฅ๐+1
๐ฅ2
2 )๐โ(๐ฅ๐)
ฮ๐+ (
๐ฅ3
6โ ๐ฅ๐
๐ฅ2
2 )๐โ(๐ฅ๐+1)
ฮ๐+1+ ๐1๐ฅ + ๐2
Apply the conditions
๐๐(๐ฅ๐) = ๐ฆ๐ and Si(๐ฅ๐+1) = ๐ฆ๐+1
โ ๐๐(๐ฅ) =๐โฒโฒ(๐ฅ๐)(๐ฅ๐+1 โ ๐ฅ)
3
6ฮ๐+๐โฒโฒ(๐ฅ๐+1)(๐ฅ โ ๐ฅ๐)
3
6ฮ๐+ (
๐ฆ๐ฮ๐โฮ๐6๐"๐(๐ฅ๐)) (๐ฅ๐+1 โ ๐ฅ)
+ (๐ฆ๐+1ฮ๐
โฮ๐6๐"๐(๐ฅ๐+1)) (๐ฅ โ ๐ฅ๐)
Apply another condition:
๐๐โ1โฒ(๐ฅ๐) = ๐๐โฒ(๐ฅ๐) on the following
๐๐โฒ(๐ฅ) = โ
๐โฒโฒ(๐ฅ๐)(๐ฅ๐+1 โ ๐ฅ)2
2ฮ๐+๐โฒโฒ(๐ฅ๐+1)(๐ฅ โ ๐ฅ๐)
2
2ฮ๐โ (
๐ฆ๐ฮ๐โฮ๐6๐๐โฒโฒ(๐ฅ๐))
+ [(๐ฆ๐+1ฮ๐
โฮ๐6๐๐โฒโฒ(๐ฅ๐+1))]
On re-arrangement it can be shown
ฮ๐โ16๐โฒโฒ(๐ฅ๐โ1) +
ฮ๐โ1 + ฮ๐3
๐โฒโฒ(๐ฅ๐) +ฮ๐6๐โฒโฒ(๐ฅ๐+1)
=๐ฆ๐+1 โ ๐ฆ๐
ฮ๐โ๐ฆ๐ โ ๐ฆ๐โ1ฮ๐โ1
,
๐ = 2, ๐ โ 1 (๐๐๐ก๐๐๐๐๐ ๐๐๐๐๐ )
(linear)
4
1 2 ๐ฅ๐โ1 ๐ฅ๐ ๐ฅ๐+1 ๐ โ 1 ๐
If ๐โฒโฒ(๐ฅ1) ๐๐๐ ๐โฒโฒ(๐ฅ๐) are pre-known as boundary conditions, we have
๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ ๐๐ ๐ด๐โฒโฒ(๐ฅ) = ๏ฟฝ๏ฟฝ where A is the tridiagonal matrix
For a โnaturalโ spline, ๐โฒโฒ(๐ฅ1) = ๐โฒโฒ(๐ฅ๐) = 0 OR ๐โฒโฒ(1) = ๐โฒโฒ(๐) = 0
If ฮ๐ = ฮ๐โ1 (๐๐๐ข๐๐๐๐ฆ ๐ ๐๐๐๐๐ ๐๐๐ก๐)
** 1
6[๐โฒโฒ(๐ฅ๐โ1) + 4๐
โฒโฒ(๐ฅ๐) + ๐โฒโฒ(๐ฅ๐+1)] = (
๐ฆ๐+1โ2๐ฆ๐+๐ฆ๐โ1
ฮ2)
Call subroutine Tridiag(๐ โ 2, 1 6โ , 2 3โ ,1
6, ๏ฟฝ๏ฟฝ)
# ๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ก๐
๐๐ ๏ฟฝ๏ฟฝ ๐ ๐ป๐ ๐๐ ๐
๐ฃ๐๐๐ก๐๐
๐๐โฒโฒ(๐ฅ๐), ๐ = 2, ๐ โ 1 are now known on solving the set of eq
ns.
Thus, ๐๐(๐ฅ) is determined from the boxed equation on the preceding page 3.
Example: -2.5 0 2.5
0 1.67 0
Fit a cubic natural spline.
Use ** above
1
6๐โฒโฒ(๐ฅ1) +
2
3๐โฒโฒ(๐ฅ2) +
1
6๐โฒโฒ(๐ฅ3) =
0โ2ร1.67+0
2.52
(You have only one linear algebraic eqn)
๐โฒโฒ(๐ฅ2) = โ0.8016 ๐ = 2 (middle node only)
๐1(๐ฅ) = โ0.05344(๐ฅ + 2.5)3 + 1.002(๐ฅ + 2.5)
๐2(๐ฅ) = 1.667 โ 0.4๐ฅ2 + 0.0533๐ฅ3)
} ๐ด๐๐ .
5
Numerical Differentiation
P2 approximated polynomial
f(x) โ Pn(x)
Given a continuous ๐(๐ฅ), numerical differentiation can be performed to determine gradient
๐โฒ(๐ฅ๐) ๐๐ก ๐ฅ๐. Fit a polynomial (๐ข๐ ๐ข๐๐๐๐ฆ ๐1โ3) and then determine ๐1โ3โฒ to estimate ๐ฆ๐
โฒ, depending
on desired order of accuracy or error. Taylorโs series can be conveniently used to derive ๐โฒ ๐๐ ๐โฒโฒ
because the series terms contain ๐โฒ ๐๐ ๐โฒโฒ .
Taylorโs series: ๐(๐ฅ + โ) = ๐(๐ฅ) + โ๐โฒ(๐ฅ) + โ2 2โ ๐โฒโฒ(๐ฅ) + โฏ (1)
๐(๐ฅ โ โ) = ๐(๐ฅ) โ โ๐โฒ(๐ฅ) + โ2 2โ ๐โฒโฒ(๐ฅ) โ โฏ (2)
2 pts
{
๐
โฒ(๐ฅ๐) =๐(๐ฅ๐+1)โ๐(๐ฅ๐)
โ+ 0(โ2) โถ ๐น๐๐๐ค๐๐๐ ๐๐๐๐๐๐๐๐๐๐ ๐๐โ๐๐๐ (๐น๐ท๐)
๐โฒ(๐ฅ๐) =๐(๐ฅ๐)โ๐(๐ฅ๐โ1)
โ+ 0(โ2) โถ ๐ต๐๐๐๐ค๐๐๐ ๐๐๐๐๐๐๐๐๐๐ ๐๐โ๐๐๐ (๐ต๐ท๐)
๐โฒ(๐ฅ๐) =๐(๐ฅ๐+1)โ๐(๐ฅ๐โ1)
2โ+ 0(โ3) โถ ๐ถ๐๐๐ก๐๐๐ ๐๐๐๐๐๐๐๐๐๐ ๐๐โ๐๐๐ (๐ถ๐ท๐)
(1) Richardsonโs extrapolation technique can be used to take 3 data pts.
๐(๐ฅ๐ + 2โ) = ๐(๐ฅ) + 2โ๐โฒ(๐ฅ) + 4 (โ2 2)โ ๐โฒโฒ(๐ฅ) + โฏโฏ (3)
๐(๐ฅ๐ โ 2โ) = ๐(๐ฅ) โ 2โ๐โฒ(๐ฅ) + 4 (โ2 2)โ ๐โฒโฒ(๐ฅ) + โฏโฏ (4)
Use 1 an 3 : Multiply eq(1) by 4 and subtract from 3 to eliminate ๐โฒโฒ(๐ฅ๐)
3๐๐๐๐๐ก๐
{
๐โฒ(๐ฅ๐) =
4๐(๐ฅ๐+1) โ 3๐(๐ฅ๐) โ ๐(๐ฅ๐+2)
2โ + 0(โ3) โถ ๐น๐ท๐
๐๐๐๐๐๐๐๐๐ฆ 2 ๐๐๐ 4 ๐ค๐๐๐ ๐๐๐ฃ๐
๐โฒ(๐ฅ๐) =โ4๐(๐ฅ๐โ1) + 3๐(๐ฅ๐) + ๐(๐ฅ๐โ2)
2โ + 0(โ3) โถ ๐ต๐ท๐
You will see later in the course that although BDS and FDS are also 2nd order accurate like CDS,
such equations are used at the boundary points or end points only to discretize Neumann or
f(x)
y(xi)
xi-1
or
xi xi+1
xi-2 xi-1 xi xi+1 xi+2
(1)
6
mixed or flux (gradient) terms: โ๐๐๐
๐๐ฅ ๐๐ โ ๐ท
๐๐ถ
๐๐ฅ ๐๐ โ ยต
๐๐ฃ
๐๐ฅ, whereas CDS is invariably used at
interior nodes.
Higher order ๐โฒ(๐ฅ๐) can also be obtained as CDS:
4๐๐๐ก๐ ๐๐๐๐๐ก๐
{๐โฒ(๐ฅ๐) =โ4๐(๐ฅ๐+2) โ 8๐(๐ฅ๐โ1) + 8๐(๐ฅ๐+1) + 4๐(๐ฅ๐+2)
12โ + 0(โ4)
( See the book by Ferziger)
Similarly, use eqns 1 & 2 to obtain
๐โฒโฒ(๐ฅ๐) =๐(๐ฅ๐+1)โ2๐(๐ฅ๐)+๐(๐ฅ๐โ1)
โ2 + 0(โ3)
= ๐โฒโฒ(๐ฅ๐โ1) = ๐โฒโฒ(๐ฅ๐+1):
๐โ๐ฆ? (๐๐๐ข โ๐๐ฃ๐ 2๐๐ ๐๐๐๐๐ ๐๐๐๐ฆ๐๐๐๐๐๐ ๐๐๐ก๐ค๐๐๐ 3 ๐๐๐ก๐ ๐๐๐๐๐ก๐ )
You should note that similar to ๐โฒ(๐ฅ๐), FDS and BDS or formulae can also be derived for
๐โฒโฒ(๐ฅ๐) using three points or manipulating Taylorโs series or equations 1-4. However, these
equations are seldom or in fact, never used for most of chemical engineering problems. Why
not? Because the N-S or species or thermal energy balance equations (PDEs) are 2nd order,
with the 1st order (flux) boundary condition. Therefore, CDS for ๐โฒโฒ(๐ฅ๐), applied at interior
nodes, suffices.
To this end, apply Richardsonโs extrapolation technique to obtain even higher order ๐โฒโฒ
๐โฒโฒ(๐ฅ๐) =โ๐(๐ฅ๐โ2) + 16๐(๐ฅ๐โ1) โ 30๐(๐ฅ๐) + 16๐(๐ฅ๐+1) โ ๐(๐ฅ๐+2)
12โ2 + 0(โ4)
(Five data points)
Note the notations: ๐(๐๐) ๐๐ง๐ ๐๐(๐๐); ๐โฒ๐๐ง๐ ๐โฒโฒ ๐๐ง๐ ๐ฒโฒ๐๐ง๐ ๐ฒโฒโฒ. ๐บ๐๐๐๐๐๐ ๐๐ ๐ ๐๐๐๐๐๐:
๐(๐) โ ๐ท๐(๐), ๐โฒ(๐) โ ๐ทโฒ๐(๐), ๐โฒโฒ(๐) โ ๐ทโฒโฒ๐(๐)
1
Lecture #14-15
Numerical Integration
Similar to numerical differentiation, the integration of ๐(๐ฅ), i.e., โซ ๐(๐ฅ)๐๐ฅ may be performed by
approximating ๐(๐ฅ) โ ๐๐(๐ฅ), usually ๐ โค 3. Therefore, first calculate ๐ฆ๐(๐ฅ๐) from ๐(๐ฅ), then
fit a polynomial through the โฒ๐โฒ data points and determineโซ๐๐๐๐ฅ ๐๐ area under the
approximated curve. Considering usual oscillations set in the fitted polynomial for ๐ โฅ 4, piece-
wise integration is performed Detailed method and analysis are as follows.
๐๐(๐ฅ) is the interpolating ๐๐ between (๐ฅ0, โฏ ๐ฅ๐)
It can be shown/proposed that
โซ ๐(๐ฅ)๐๐ฅ = โ ๐ค๐๐(๐ฅ๐); ๐(๐ฅ๐) = ๐ฆ(๐ฅ๐)๐๐=0
๐
๐
where, ๐ is the number of segments between โaโ and โbโ
and โ๐ค๐โ is the respective weight at ๐ฅ๐ . It is also known
as Quadrature formula. Let us look at the proposed formula differently. Apply Lagrange
interpolation between (๐ + 1) data points or ๐ segments:
๐๐(๐ฅ) = โ ๐๐(๐ฅ)๐ฆ๐ (๐ฆ๐ โก ๐ฆ(๐ฅ๐) โก ๐ฆ๐(๐ฅ๐))๐๐=0
โซ ๐(๐ฅ)๐๐ฅ = โซ โ ๐๐(๐ฅ)๐ฆ๐๐๐ฅ = โ โซ ๐๐(๐ฅ)๐ฆ๐๐๐ฅ๐
๐๐๐=0
๐๐=0
๐
๐
๐
๐
= (๐ โ ๐)โ ๐ถ๐๐ฆ๐; ๐ถ๐ =
1
(๐โ๐)โซ ๐๐(๐ฅ)๐๐ฅ๐
๐๐๐=0
Cotes number
- It is the same as the Quadrature formula ; n โก parameter(degree of polynomial)
(It can be shown โ ๐ถ๐ = 1 (๐๐ข๐ก ๐(๐ฅ) = 1))๐๐=0
Therefore, we can have a table as follows:
๐ ๐ ๐ฅ๐
๐(๐ฅ)
๐๐(๐ฅ)
2
Newton-Cotes Coefficients (ends points included)
๐ ๐ ๐๐ถ0๐ ๐๐ถ1
๐ ๐๐ถ2๐โฏโฏ ๐๐ถ0
๐ ๐ธ๐๐๐๐
12345
26890288
111719
1433275
131250
13250
775
19
. 0183ฮ3๐โฒโฒ
. 0035ฮ5๐โฒโฒโฒโฒ
. 00016ฮ5๐โฒโฒโฒโฒโฏโฏ
These are called closed N-C formula because they use functions at the end points also (๐, ๐).
Note, ๐ or the number of segments is usually 1 or 2 or 3, or the degree of polynomial is 1 or 2
or 3, respectively. Readers may have recognized that n = 1 corresponds to Trapezoidal rule
with โ1 2โ โ coefficients of ๐ฆ๐; ๐ = 2 corresponds to Simpsonโs โ1 3โ ๐๐โ rule with
(1 6โ , 2 3โ , 1 6โ ) coefficients, etc. For more details, you can refer the book by Ferziger or SKG.
The error in the numerical integration can be calculated from the remainder term of the
polynomial:
โ ๐ผ = โซ(๐๐๐๐๐)๐๐ฅ โ ๐คโ๐๐๐ โฒ๐๐๐๐๐โฒ = ๐ฆ๐+1(๐)
๐ + 1!(๐ฅ โ ๐ฅ0)(๐ฅ โ ๐ฅ1)โฏ (๐ฅ โ ๐ฅ๐)
๐๐๐ (๐ + 1) ๐๐๐ก๐ ๐๐๐๐๐ก๐
โ SKGโs book uses Newtonโs Interpolation formula to determine the various
integration formulae:
๐ฆ (๐ฅ) = ๐ฆ(๐ฅ0 + ๐ผฮ๐ฅ) = ๐ฆ0 + ๐ผ(ฮ๐ฆ0) +๐ผ(๐ผโ1)(ฮ2๐ฆ0)
2!+
โฏโฏ๐ผ(๐ผโ1)(๐ผโ2)๐ผโฏ(๐ผโ๐)(ฮ๐+1๐ฆ0)
๐+1!
๐ ๐
To obtain the different methods for integration, viz. Trapezoidalโs rule, Simpsonโs 1 3โ๐๐
, etc, two approaches must give the identical results because polynomial of the highest degree
that can fit to (๐ + 1) data points is unique.
Take ๐ = 1
โซ ๐(๐ฅ)๐๐ฅ = (๐ โ ๐)โ ๐ถ๐๐๐(๐ฅ๐)
๐๐=0
๐
๐
= (๐ โ ๐) [1
2๐ฆ๐ +
1
2๐ฆ๐]
=(๐โ๐)
2(๐ฆ๐ + ๐ฆ๐)
๐(๐ฅ) ๐1(๐ฅ)
๐(๐)
๐(๐)
๐ ๐ฅ ๐
๐(๐ฅ)
3
[๐๐ = (๐โ๐)
2(๐(๐) + ๐(๐))]
(Trapezoidal rule)
๐ = 2
โซ ๐(๐ฅ)๐๐ฅ =(๐ โ ๐)
6[๐(๐) + 4๐ (
๐ + ๐
2) + ๐(๐)]
๐
๐
(๐๐๐ก๐: ๐2 โก (๐ + ๐๐ฅ + ๐๐ฅ2) โก ๐๐๐๐๐๐๐๐)
=ฮ๐
3[๐(๐) + 4๐ (
๐+๐
2) + ๐(๐)] ฮ๐ =
๐โ๐
2
๐ = 3
โซ ๐(๐ฅ)๐๐ฅ =(๐ โ ๐)
8[๐(๐) + 3๐(๐) + 3๐(๐) + ๐(๐)]
๐
๐
=3ฮ๐
8[ โ ๐๐๐ก๐ก๐ โ ], ฮ๐ฅ =
(๐โ๐)
3
- Simpsonโs 3 8โ๐กโ
formula.
In actual practice, applying a single Cotes formula over the entire range is rarely done.
Considering large error for large โฒฮ๐โฒ, interval is broken into sub-intervals & then applying
piece-wise quadrature formula and summing it over.
โซ ๐(๐ฅ)๐๐ฅ =โ
2[๐(๐๐โ1) + ๐(๐๐)]
๐๐๐๐โ1
โ =(๐โ๐)
๐ (๐ + 1 data points or ๐ segments)
๐(๐ฅ)
๐๐๐๐๐ ๐๐โฒ๐ 1 3โ๐๐ ๐๐๐๐๐ข๐๐
(โ๐๐โ๐๐ ๐๐๐๐๐ ๐๐๐๐ข๐๐๐ก๐)
๐ ๐ (๐ + ๐)2โ
๐2(๐ฅ)
ฮX ฮX
๐ ๐ ๐๐โ1 ๐๐ ๐๐ ๐0
4
Therefore, โซ ๐(๐ฅ)๐๐ฅ = โโ
2[๐(๐ฅ๐โ1) + ๐(๐ฅ๐)]
๐๐=1
๐
๐
=
โ
2[๐(๐ฅ0) + 2โ๐(๐ฅ๐) + ๐(๐ฅ๐)
๐โ1
๐=1
]
(๐ โ ๐)
๐[โ๐(๐ฅ๐) โ
1
2[๐(๐) + ๐(๐)]
๐
๐=0
]}
โ
* Trapezoidal rule
๐บ๐๐๐๐๐๐โ๐ ๐ ๐โ๐๐ ๐๐๐๐: (intervals must be even or data points must be odd),
๐ ๐ ๐๐ถ0๐ ๐๐ถ1
๐ ๐๐ถ2๐
2 6 1 4 1
โซ๐(๐ฅ)๐๐ฅ = (
๐โ๐
6) (๐(๐) + 4๐(๐) + ๐(๐))
โ =๐โ๐
2
๐
๐
โ =(๐โ๐)
๐ (๐ ๐๐ฃ๐๐ ๐ ๐๐๐๐๐๐ก๐ ๐๐๐ + 1 ๐๐๐ ๐๐๐ก๐ )
โซ ๐(๐ฅ)๐๐ฅ = โโ
3[๐(๐๐โ1) + 4โ๐(๐๐) + ๐(๐๐+1)]
๐
๐
=โ
3(๐(๐0) + 4โ +2๐โ1
๐=1,3,5 โ +๐(๐๐))๐โ2๐=2,4,6
(Note that all even nodes โ๐๐โ are summed/counted twice in calculating total area)
What do you do if ๐ โก odd or data are even? Apply the method to one data less so that n =
even. Add the area corresponding to the left-over segment, calculated using Trapezoidal rule!
One open NC method is popular: Mid-point rule, the method is frequently applied when the
๐๐ is discontinuous at end points: a or b or both.
โซ ๐(๐ฅ)๐๐ฅ = (๐ โ ๐) [๐ (๐+๐
2)]
๐
๐
๐ ๐ (๐+๐)
2
๐ ๐ ๐
โ =(๐ โ ๐)
2โ
๐๐ ๐๐ ๐๐+1 โ โ
๐๐โ1 ๐๐+1 ๐๐ ๐ ๐
(๐๐) (๐0)
5
ex. โซ1
1โ๐ฅ2๐๐ฅ
1
0 (Note ๐(1) โ โ)
Example:
๐ฃ = 2๏ฟฝ๏ฟฝ(1 โ๐2
๐ 2)
๐ =๐โ๐๐ค
๐๐ค= โ4๐ง โ ๐2 +
๐4
4+
7
24
(๐ง, ๐ are dimensionless quantities: ๐ ๐ โ ๐๐๐ ๐ง ๐ฟโ )
Consider the classical heat transfer/transport problem of SS heat transfer at constant wall
temperature in the fully developed region of a tubular laminar parabolic flow, often discussed in
TP lectures. The dimensionless SS temperature ๐(๐ง, ๐) in the fluid is analytically derived. See
the solution above. Determine the โmix-cupโ temperature at z = 0.5.
Soln : In a flow-system, mix-cup temperature is the radially emerged temperature, taking into
consideration the total heat (cal) carried away by the flowing fluid in unit time across the cross-
section of the tube.
๏ฟฝ๏ฟฝ =
(
โซ ๐๐ถ๐๐ฃ(๐โฒ)๐(2๐๐โฒ)๐๐โฒ
๐
0
๐๐ ๐3โ ๐๐๐ ๐๐โ โ ๐พ ๐พ
โซ ๐๐ถ๐๐ฃ(๐โฒ)2๐๐โฒ๐๐โฒ๐
0
๐๐๐ ๐ โ ๐พโ )
(๐๐๐ก๐: ๐๐ = ๐ฃ2๐๐๐๐๐3
๐ )
๐ = โซ ๐ฃ2๐๐๐๐๐
0
at a ref. temperature
In the dimensionless quantities,
๏ฟฝ๏ฟฝ(๐ง) =โซ ๐(๐, ๐ง)(1 โ ๐2)๐๐๐1
0
โซ (1 โ ๐2)๐๐๐1
0
Simpsonโs 1 3โ rule can be applied by taking odd number (5) of data points over ๐ โก (0, 1).
Therefore # of segment = 4, step size, โ =1โ0
4= 0.25, ฮ๐ โก โ = 0.25; ๐๐ = ๐ฮ๐
ฮr T(r) ๐ฃ(r)
Tw
z
fully developed region (2) for both flow and temperature
r
R
6
Numerical integration is performed for both numerator and denominator terms.
๐ผ = โซ ๐(๐)๐๐1
0โซ ฮฆ(๐)๐๐1
0โ
where ๐(๐) = ๐(๐, ๐ง)(1 โ ๐2)๐ & ฮฆ(๐) = (1 โ ๐2)๐
For both functions,
๐ผ = โ 3โ [๐(๐0) + 4โ +2โ + ๐(๐๐)๐โ2๐=2,4
๐โ1๐=1,3,5 ]
= โ 3โ [๐(๐0) + 4โ +2โ +๐(๐4)21,3 ]
Best way is to prepare a table for calculations:
๐ ๐๐ ๐๐ (1 โ ๐๐
2)๐๐or ฮฆ(๐)
๐๐(1 โ ๐๐
2)๐๐๐๐ ๐(๐)
01234
00.250.500.751.00
โ1.7083โ1.7698โ1.9427โ2.1917โ2.4583
0.0
0.0
0.0
0.0
๐น๐๐๐ โ ๐ข๐ ๐กโ๐
๐ก๐๐๐๐
โ Add โ Add
Show,
๏ฟฝ๏ฟฝ๐๐๐ฅโ๐๐ข๐(0.5) โก โ1.9976 =๐โ๐๐ค
๐๐ค
(wall is colder than bulk fluid)
What does decide the # of data points โnโ or the step size โhโ ? It is the level of desired accuracy.
Repeat the entire calculations for n = 9 and check your requirement of an improved ๏ฟฝ๏ฟฝ๐๐๐ฅโ๐๐ข๐
from the previous value -1.9976. Sometimes you have to decrease โnโ or increase โhโ if you have
exceeded accuracy limit!
Error Analysis
Let us take the simplest Trapezoidal rule applied to one segment over (a,b).
Start from Newtonโs Difference Interpolation formula:
๐๐ค
๐๐๐๐ข๐๐
๐๐ค
(๐) 4 3 2 1 ๐ = 0
7
๐(๐ฅ) = ๐(๐ฅ0) + ๐ผฮ๐(๐ฅ0) +๐ผ(๐ผ โ 1)
2!ฮ2๐(๐ฅ0) + โฏ๐ ๐
๐ ๐ =๐ผ(๐ผโ1)โฏ(๐ผโ๐)
๐+1!ฮ๐+1๐(๐) ๐คโ๐๐๐ ๐ฅ0 < ๐ < ๐ฅ
๐ผ =๐ฅโ๐ฅ0
โ ๐๐ ๐๐ฅ = โ ๐๐ผ ; ๐ฅ0 = ๐,
If there is only one segment, โ = (๐ โ ๐)
๐ผ = โซ ๐(๐ฅ)๐๐ฅ = โโซ (๐(๐ฅ0) + ๐ผฮ๐(๐ฅ0) +๐ผ(๐ผโ1)
2!ฮ2๐(๐))
1
0
๐
๐๐๐ฅ
๐1 = (๐๐ฅ + ๐)
= โ [๐(๐) +1
2(๐(๐) โ ๐(๐)) + (
๐ผ3
6โ๐ผ2
4)โซ โ2๐โฒโฒ(๐)
1
0
]
= โ [๐(๐)+๐(๐)
2] โ
1
12โ3๐โฒโฒ(๐) (๐โฒโฒ(๐) =
ฮ2๐(๐)
2โ)
Therefore, error on one segment is 1 2โ โ3๐โฒโฒ(๐) ๐๐ 0(โ3)
If there are n segments between (a & b) error should also be summed up to
1
12โ3โ ๐โฒโฒ(๐) =
1
12โ2๐โฒโฒ(๐)(๐ โ ๐) ๐๐ 0(โ2) ๐
๐๐๐ก๐: ๐โฒโฒ(๐) =โ๐โฒโฒ(๐)
๐=
โโ๐โฒโฒ(๐)
(๐โ๐).
Similarly, for the error estimation of Simpsonโs 1 3โ rule start with ๐2 = ๐๐ฅ2 + ๐๐ฅ + ๐, ๐๐
๐ ๐ =๐ผ(๐ผโ1)(๐ผโ2)ฮ3๐(๐)
3! over one segment or 3 data pts.
to show that error โก 0(โ5)๐โฒโฒโฒโฒ(๐) and if summed over โnโ segments error = 0(โ4)๐โฒโฒโฒโฒ(๐).
Simpsonโs 3 8โ ๐๐ข๐๐: error(one segment) โก 0(h5)
error( segments) โก 0(h4)
A common question is asked: Show that Simpsonโs 1 3โ ๐๐ข๐๐ gives the error corresponding to
a cubic interpolating function, although it is based on a parabola or a quadratic polynomial. See
Chhapra and Cannale's book for the details.
Mid-Term
1
Lecture #15-16
1st order ODE
A set of ODEs takes the following form:
๐๐ฆ1
๐๐ก= ๐1(๐ก, ๐ฆ1, ๐ฆ2โฏ๐ฆ๐)
โฎ ๐๐ฆ๐
๐๐ก= ๐๐(๐ก, ๐ฆ1, ๐ฆ2โฏ๐ฆ๐)
} ๐๐ ๐๏ฟฝ๏ฟฝ
๐๐ก= ๐(๐ก, ๏ฟฝ๏ฟฝ)
Requires initial conditions to solve ๏ฟฝ๏ฟฝ .
๐ก = 0, ๐ฆ1 = ๐ฆ10โฆ . . ๐ฆ๐ = ๐ฆ๐0, ๐๐ก๐ ๐๐ ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ0
Note that ODEs can also be1st order on x (space) & ๐๏ฟฝ๏ฟฝ
๐๐ฅ= ๐(๐ฅ, ๐ฆ ) with ๐ฅ = 0, ๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ0.
โ We explore numerical solution to ODEs starting with Eulerโs forward and backward
methods. These methods are basics, and also set the tone for the stability analysis. Let us begin
with one ODE.
Eulerโs Method
๐๐ฆ
๐๐ฅ= ๐(๐ฅ, ๐ฆ) ; ๐ฆ(๐ฅ0) = ๐ฆ0
๐๐ , ๐ฆ๐+1โ๐ฆ๐
โ= ๐(๐ฅ๐, ๐ฆ๐) + 0(โ
2)
(This is the general โdiscretizationโ of a derivative at the โnโ th grid. Recall the lecture on
numerical differentiation. We have used FDS.)
or ๐ฆ๐+1 = ๐ฆ๐ + โ๐(๐ฅ๐, ๐ฆ๐) + 0(โ2)
๐ฆ๐โฒ
Note: The RHS terms are known to be 1st order accurate or have 2nd order error.
From the previous calculations, start from ๐ฆ(๐ฅ = 0 ) = ๐ฆ0 โ ๐ฆ1 โ ๐ฆ2โฏ๐๐ก๐. Therefore, you
march forward and the method is called Eulerโs forward or explicit method. Think carefully.
The method is all about taking a linear slope/tangent at
(xn, yn) and moving on to (xn+1, yn+1).
๐ฆ0 ๐ฆ1 ๐ฆ๐ ๐ฆ๐+1
๐ฅ0 ๐ฅ1 ๐ฅ๐ ๐ฅ๐+1
2
Graphically,
Theoretical y(x)
}
It is all aboutcalculating true derivatives
(gradients) at xn asyou march forward:
y0โฒ = f(x0, y0)
y1โฒ = f(x1, y1)โฎ ynโฒ = f(xn, yn)
It is clear that smaller is โhโ (step-size), less is the error, or accuracy is higher: 0(โ2). However,
there is a price for long CPU time. Also, stability may become an issue. Let us look at the
stability aspect of the method.
๐๐ฆ
๐๐ฅ= ๐(๐ฅ, ๐ฆ) = ๐(๐ฅ0 + ฮ๐ฅ, ๐ฆ0 + ฮ๐ฆ)
= ๐(๐ฅ0, ๐ฆ0) + (๐ฆ โ ๐ฆ0)๐๐
๐๐ฆ|๐ฅ0,๐ฆ0
+ (๐ฅ โ ๐ฅ0)๐๐
๐๐ฅ|๐ฅ0,๐ฆ0
+ 0(ฮ๐ฅ2, ฮ๐ฆ2)
Multi-variable Taylor series can be applied to estimate gradient ๐ฆโฒ(๐ฅ0, ๐ฆ0):
= ๐ผ๐ฆ + ๐ฝ๐ฅ + ๐
gives exponential
solution
term const. for linear solution
๐๐ฆ
๐๐ฅ= ๐ผ๐ฆ โถ
Model equation for testing stability.(Note: Stability is governed by thehomogeneous part of the solution)
Let us look at differently: Introduce perturbation or find true value, ๐ฆ .
Therefore, ๐๐ฆ
๐๐ฅ= ๐ผ๏ฟฝ๏ฟฝ + ๐ฝ๐ฅ + ๐
๐๐, ๐๐
๐๐ฅ= ๐ผ(๐ฆ โ ๐ฆ) = ๐ผ๐ (๐ = ๐ฆ โ ๐ฆ)
We have the same inference: error satisfies homogeneous part of the solution. The equation
describes how โ๐โ can grow because of a small perturbation.
At ๐ฅ = ๐ฅ0, ๐ฆ = ๐ฆ0 โ exact solution: ๐ฆ = ๐ฆ0๐๐ผ๐ฅ ๐ผ๐ ๐ผ > 0, fngrows, ฮฑ < 0, fn is bounded.
Numerical calculations
๐
๐ฆ0
๐ฅ0 ๐ฅ1 ๐ฅ2 ๐
3
Now Apply Eulerโs method:
๐ฆ๐+1 โ ๐ฆ๐ = โ๐(๐ฅ๐, ๐ฆ๐) = โ๐ฆ๐โฒ = โ(๐ผ ๐ฆ๐)
๐ฆ๐+1 = ๐ฆ๐(1 + ๐ผโ)
๐ฆ1 = ๐ฆ0(1 + ๐ผโ), ๐ฆ2 = ๐ฆ0(1 + ๐ผโ)2
๐ฆ๐ = ๐ฆ0(1 + ๐ผโ)๐ โ Numerical solution
If ฮฑ > 0 function grows or unboundedIf ฮฑ < 0 function may be bounded
]
Let us write, ๐ผ = ๐ผ๐ + ๐๐ผ๐ผ
๐ฆ๐ = ๐ฆ0(1 + ๐ผ๐โ + ๐๐ผ๐ผโ)๐
For function to be bounded
|(1 + ๐ผ๐โ) + ๐๐ผ๐ผโ| < 1
(1 + ๐ผ๐โ)2 + ๐ผ๐
2โ2 < 1
0 > ๐ผ๐โ > โ2 if ฮฑi = 0 for stability
Note: ๐ผ = โ๐ฃ๐, the exact solution is always bounded! Therefore, Eulerโs forward/explicit
numerical method is conditionally stable. Example:
๐๐ฆ
๐๐ฅ= โ๐ฆ (๐ฅ = 0, ๐ฆ = 1) โ ๐ฆ = ๐โ๐ฅ
Numerical soln :
๐ผ = โ1; ๐ผ๐ = โ1, ๐ผ๐ผ = 0
0 > ๐ผ๐โ > โ2 for stability
or โ < +2
โ ๐ฆ๐+1 โ ๐ฆ๐ = โ๐(๐ฅ๐, ๐ฆ๐) = โโ๐ฆ๐ โ ๐ฆ๐ = (1 โ โ)๐
Plot to see that oscillations start creeping in h > 2
๐ 6 4 2 0 10โ7
๐
๐๐๐ 1.0 exact
(bounded)
โ = 0.001
โ = 0.1 โ = 0.8
error increases โ
2.0
1.0
0 โ2 โ1 ๐
โ = 1
โ > 5
(unbounded)
exact solution: ๐
๐
1.0 โฒbounded (theroteical)solutionโฒ
๐ (๐ผ๐โ)
Stable region(depends on โ and ฮฑr)
๐ผ(๐ผ๐โ)
โ2 โ1 0
4
Backward or Implicit Euler:
๐๐ฆ
๐๐ฅ= ๐(๐ฅ, ๐ฆ), ๐ฆ(๐ฅ0) = ๐ฆ0
๐ฆ๐+1โ๐ฆ๐
โ= ๐(๐ฅ๐+1, ๐ฆ๐+1) + 0(โ
2) (Note this BDS may require iteration)
,maybe NR method; you can not march!
๐ฆ๐+1 โ ๐ฆ๐ = โ๐(๐ฅ๐+1, ๐ฆ๐+1) โ Test it on the model eqn
dy
dx= ฮฑy for the stability analysis
๐ฆ๐+1 = ๐ฆ๐ + โ(๐ผ๐ฆ๐+1)
๐ฆ๐+1 = ๐ฆ๐ (1 โ ๐ผโ)โ
= ๐ฆ0(1 โ ๐ผ๐โ โ ๐๐ผ๐โ)โ๐
For ๐๐ to be bounded |(1 โ ๐ผ๐โ โ ๐๐ผ๐โ)| > 1
๐๐ (1 โ ๐ผ๐โ)2 + ๐ผ๐
2โ2 > 1
๐๐ |(1 โ ๐ผ๐โ)| > 1 if ๐ผ๐ = 0
Clearly, 0 > ๐ผ๐โ > 2
Draw the region:
โ {
For all (ฮฑrh) in the left half of the plane ฮฑr < 0 ๐๐๐the method is unconditionally
stable
For all โ outside the circle
the method is stable (or ฮฑrh > 2)
It is clear the stability region for the implicit Euler is much more larger than that of the explicit
Euler.
Notes: Error decreases with decreasing step sizes (h): 0(โ๐), however, at the expense of CPU
time. This is not surprising. The actual โissueโ is with increasing step sizes. There is a tendency
to speed up computation by taking large step-size. An explicit method like Euler Forward may
not permit or allow you to do so, even if the level of desired accuracy may be acceptable.
Instability may set in at large โhโ. On the other hand, Euler Backward or an implicit method
permits you to use relatively larger โhโ without instability, yielding a bounded solution.
(๐ผ๐โ)
(๐ผ๐โ) 0 1
2
5
โ โErrorโ must not be mixed up with the โinstabilityโ. A method may be relatively higher order
accurate, but may show instability at small step-size. In general, implicit methods are more
stable than explicit methods, but require iterations to compute ๐ฆ๐+1. Examples:
๐๐ฆ
๐๐ฅ= ๐(๐ฅ, ๐ฆ) = ๐ผ๐ฆ2
Explicit: ๐ฆ๐+1 โ ๐ฆ๐ = โ๐ผ๐ฆ๐2
Implicit: ๐ฆ๐+1 โ ๐ฆ๐ = โ ๐ผ๐ฆ๐+12 (requires iterations or NR method? )
โ " A method is stable if it produces a bounded solution when it is supposed to and is unstable
if it does not." Therefore, while solving ๐๐ฆ
๐๐ฅ= โ๐ฆ, if the numerical method produces a stable
solution, it is stable, else unstable. On the other hand, there is no instability โissueโ with ๐๐ฆ
๐๐ฅ=
+๐ฆ because the exact solution itself is unbounded. Therefore, both Euler Forward(explicit) or
Backward(implicit) will produce an unbounded solutions!
Get back to ๐๐ฆ
๐๐ฅ= โ๐ฆ(๐ผ = โ1) and ๐ฆ๐ = (1 + โ)โ๐
Error increases with increasing โhโ but the
solution remains stable. Compare to Forward Euler
when ๐ผ < 2 for a stable solution.
โ Trapezoidal rule (0(โ2)):
๐ฆ๐+1 โ ๐ฆ๐ =โ
2[๐(๐ฅ๐, ๐ฆ๐) + ๐(๐ฅ๐+1, ๐ฆ๐+1)]
(Implicit method)
It can also be tested on the model equation:
๐๐ฆ
๐๐ฅ= ๐ผ๐ฆ
๐๐ ๐ฆ๐+1 โ ๐ฆ๐ =๐ผโ
2[๐ฆ๐ + ๐ฆ๐+1]
๐ฆ๐+1 = ๐ฆ๐(1+๐ผโ 2)โ
(1โ๐ผโ 2)โ
๐๐ ๐ฆ๐ = ๐ฆ0(1 + ๐ผโ 2โ
1 โ ๐ผโ 2)โ)๐
error
exact
h=1
0.2
0.1 0
y
1.0
X
6
|๐ง| < 1
For stability |(1+๐ผโ 2)โ
(1โ๐ผโ 2)โ| < 1 ๐๐
Each method has a stability region for ๐ผ๐โ
selecting the step-size, โhโ for calculation without instability.
See the textbooks for details. Stability region
.
1
Lecture #17
Single Step Methods
Forward or Backward Euler is the simplest single step method to solve ODEs. The methods
are 1st order accurate. A general higher order method can be derived considering that it is all
about choosing a suitable gradient at (๐ฅ๐, ๐ฆ๐) ๐๐ (๐ก๐, ๐ฆ๐) to calculate ๐ฆ๐+1(๐ฅ๐+1):
๐๐ฆ
๐๐ก= ๐(๐ก, ๐ฆ); ๐ฆ(0) = ๐ฆ0
๐ฆ๐+1 = ๐ฆ๐ + โ๐(๐ก๐, ๐ฆ๐, โ) (โ = ๐ ๐ก๐๐ ๐ ๐๐ง๐ = ฮ๐ก)
It is all about finding: ๐(๐ก๐, ๐ฆ๐, โ) = (๐๐ฆ
๐๐ก)๐ก๐,๐ฆ๐
=?
Propose as
๐ฆ๐+1 = ๐ฆ๐ + โ[๐๐1 + ๐๐2] 1 โ ๐๐๐๐๐๐๐ ๐๐๐กโ๐๐.
Here, ๐1 and ๐2 are the slopes with weights a & b respectively ( Forward Euler may be
considered to assume ๐ = 1, ๐ = 0 and ๐1 = ๐ฆ๐ก๐,๐ฆ๐โฒ , whereas Backward Euler assumes ๐ =
0, ๐ = 1, ๐2 = ๐ฆ๐ก๐+1,๐ฆ๐+1โฒ )
Here, ๐1 = ๐(๐ก๐, ๐ฆ๐)
๐2 = ๐(๐ก๐ + ๐โ, ๐ฆ๐ + ๐(โ๐1) }Thus, the model has4 parameters; a, b, p, q.
{
Thus k2(slope)is calculated
at (tn + ph), fraction less than(tn + h) or tn+1, as x โ coordinate,
and yn + q(hk1), fraction less
than (yn + hk1) or yn+1, as y โcoordinate.
๐2 = ๐(๐ก๐, ๐ฆ๐) + ๐๐ก(๐ก๐, ๐ฆ๐). ๐โ + ๐๐(๐ก๐, ๐ฆ๐)๐โ๐1 + 0(โ2)
-Taylor multi-variable series applied on ๐2(๐ก, ๐ฆ) with ฮ๐ก = ๐โ, ฮ๐ฆ = ๐โ๐1
Substituting in (1)
๐ฆ๐+1 = ๐ฆ๐ + โ[๐๐(๐ก๐, ๐ฆ๐) + ๐๐(๐ก๐, ๐ฆ๐)] + โ2[๐๐๐๐ก(๐ก๐, ๐ฆ๐) + ๐๐๐๐๐ฆ(๐ก๐, ๐ฆ๐)] + 0(โ
3) โ (2)
(๐ ๐๐๐๐)
๐ฆ๐+1
๐ฆ๐ + ๐(โ๐1)
๐ฆ๐
๐ก๐ ๐ก๐+1
(๐ก๐ + ๐โ)
๐(โ๐1)
โ๐1 ๐2
๐1
โ
๐ฆ
2
Also, restart from ๐๐ฆ
๐๐ก= ๐(๐ก, ๐ฆ(๐ก)) as a total derivative on t.
or ๐ฆ๐+1 = ๐ฆ๐ + โ๐ +โ2
2!๐โฒ + 0(โ3): (Single variable(t) Taylor โ Series)
where ๐โฒ =๐๐
๐๐ก(๐ก๐, ๐ฆ๐) = [
๐๐
๐๐ก+
๐๐
๐๐ฆโ๐๐ฆ
๐๐ก]๐ก๐,๐ฆ๐
= [๐๐ก + ๐๐ฆ๐]
On substitution,
๐ฆ๐+1 = ๐ฆ๐ + โ๐ +โ2
2๐๐ก(๐ก๐, ๐ฆ๐) +
โ2
2๐๐ฆ๐ + 0(โ3) (3)
Thus, model equation (2) can be equated with the fundamental equation (3) derived for ๐ฆ๐+1;
(
๐ + ๐ = 1
๐๐ = 12โ
๐๐ = 1 2โ
)
Case 1: ๐ = 1 2โ , ๐ = 1 2โ , ๐ = ๐ = 1
๐ฆ๐+1 = ๐ฆ๐ +โ
2[๐(๐ก๐, ๐ฆ๐) + ๐(๐ก๐ + โ, ๐ฆ๐ + โ๐ฆ๐
โฒ)] + 0(โ3)
Write differently,
๐ฆ๐+1โ = ๐ฆ๐ + โ๐(๐ฅ๐, ๐ฆ๐) predictor full step
๐ฆ๐+1 = ๐ฆ๐ +โ
2[๐(๐ก๐, ๐ฆ๐) + ๐(๐ก๐ + โ, ๐ฆ๐+1
โ )]
} corrector full step
Look at graphically,
๐ฆ๐+1โ
Therefore, first predict ๐ฆ๐+1โ and then correct as ๐ฆ๐+1 by taking the average of the slopes,
๐1 and ๐2 โถ ๐ฆ๐+1 = ๐ฆ๐ + โ๏ฟฝ๏ฟฝ
๐ฆ๐
๐ฆ๐+1
๐ก๐ ๐ก๐+1 ๐ก
๐1
๐2
(๐1 + ๐2)2โ = ๐
๐ฆ
๐1 ๐2
๐1 ๐2
3
- This method is called Heunโs improved method or modified Euler method or Runga-
Kutta (RK-2) method.
Case 2: ๐ = 0 , ๐ = 1, ๐ = ๐ = 1 2โ
๐ฆ๐+1 = ๐ฆ๐ + โ [๐ (๐ก๐ +โ
2, ๐ฆ๐ +
โ
2๐ฆ๐โฒ)]
Write differently,
๐ฆ๐+1 2โโ โก ๐ฆ๐ +
12โ โ๐ฆ๐
โฒ (Euler predictor 1 2โ step)
๐ฆ๐+1 โก ๐ฆ๐ + โ [๐ (๐ก๐ +โ2โ , ๐ฆ
๐+1 2โโ )] : Mid โ point corrector full step
Graphically,
}
(1) Start with slope 1
Reach half step.(2) Calculate slope 2
(3)Re โ start with the slope2 to reach full step.
- This method is called midpoint method.
3. RK-4
๐ฆ๐+1 = ๐ฆ๐ +โ
6[๐1 + 2๐2 + 2๐3 + ๐4] + 0(โ
5)
๏ฟฝ๏ฟฝ = avg of four slopes withmore weights at mid points.
๐1 = ๐(๐ฅ๐, ๐ฆ๐)
๐2 = ๐(๐ฅ๐ +โ2โ , ๐ฆ๐ + ๐1
โ2โ ) ๐๐ ๐(๐ฅ๐+1 2โ ,๐ฆ๐+1 2โ
โ )
๐ฆ๐+1 2โโ โถ ๐ธ๐ข๐๐๐ ๐๐๐๐๐๐๐ก๐๐ 1 2โ ๐ ๐ก๐๐
๐3 = ๐(๐ฅ๐ +โ2โ , ๐ฆ๐ + ๐2
โ2โ ) ๐๐ ๐(๐ฅ๐+1 2โ ,๐ฆ๐+1 2โ
โโ )
๐ฆ๐
๐๐+1 2โโ
๐๐+1
๐ก๐ ๐ก๐+1 2โ ๐ก๐+1
(๐ก๐ + โ)
๐ก
1
2
๐ฆ
4
๐ฆ๐+1 2โโโ โถ ๐ต๐๐๐๐ค๐๐๐ ๐ธ๐ข๐๐๐ 1 2โ ๐ ๐ก๐๐ ๐๐๐๐๐๐๐ก๐๐๐
๐4 = ๐(๐ฅ๐ + โ, ๐ฆ๐ + ๐3โ): ๐๐๐ ๐๐๐๐๐ก ๐๐๐๐๐๐๐ก๐๐ ๐๐ข๐๐ ๐ ๐ก๐๐
๐ฆ๐+1โโโ
Write differently,
๐ฆ๐+1 2โโ = ๐ฆ๐ +
โ2โ ๐(๐ฅ๐, ๐ฆ๐) โถ ๐ธ๐
12 โ ๐ ๐ก๐๐
๐ฆ๐+1 2โโโ = ๐ฆ๐ +
โ2โ ๐ (๐ฅ๐+1 2 โ , ๐ฆ๐+1 2 โ
โ ) โถ ๐ต๐ธ 1 2 โ ๐ ๐ก๐๐ ๐๐๐๐๐๐๐ก๐๐
๐ฆ๐+1โโโ = ๐ฆ๐ + โ๐ (๐ฅ๐+1 2 โ , ๐ฆ๐+1 2 โ
โโ ) :๐๐๐ ๐๐๐๐๐ก ๐๐๐๐๐๐๐ก๐๐ ๐๐ข๐๐ ๐ ๐ก๐๐.
๐ฆ๐+1 = ๐ฆ๐ +โ
6[๐(๐ฅ๐, ๐ฆ๐) + 2๐(๐ฅ๐+1 2 โ , ๐ฆ๐+1 2 โ
โ ) + 2๐ (๐ฅ๐+1 2 โ , ๐ฆ๐+1 2 โโโ ) + ๐(๐ฅ๐+1, ๐ฆ๐+1
โโโ )]
โถ ๐๐๐๐๐ ๐๐ ๐๐ข๐๐ ๐ ๐ก๐๐ ๐๐๐๐๐๐๐ก๐๐.
Graphically,
๏ฟฝ๏ฟฝ = (๐1 + 2๐2 + 2๐3 + ๐4) 6โ
Notes: (1) RK-4 is a 4th order accurate method!
(2) The method is explicit (does not require iterations to calculate ๐ฆ๐+1). You can march ahead
from ๐ฅ๐ ๐ก๐ ๐ฅ๐+1. Yet, considering that it makes use of the value ๐ฆ๐+1 at ๐ฅ๐+1 ahead of ๐ฅ๐ via a
predictor step, the method possesses some โcharacteristicsโ of an implicit method. Therefore, the
method also produces a stable solution at a relatively larger step size.
(3) Coding (program) is simple.
๐4
๐3
๐2
๐3
๐2 ๐1
๐ฅ๐ ๐ฅ๐+1 2โ ๐ฅ๐+1 โ
2โ
โ2โ
๐
๐๐+1โโโ
๐๐+1 2โโ
๐๐+1 2โโโ
๐ฆ๐
๐
๐ฆ๐+1
๏ฟฝ๏ฟฝ
5
(4) Even if two or more number of simultaneous ODEs are coupled, the method is explicitly
applied w/o requiring iterations,
(5) Considering that the method is explicit, non-linearity is not an issue.
(6) Considering that the method is explicit, the implementation is identical for a system of
ODEs.
See example below:
Solve: ๐๐ฆ1
๐๐ก= โ100๐ฆ1
with choose ๐ฆ1(0) = 2 โ = ฮ๐ก = 0.02
๐๐ฆ2
๐๐ก= 2๐ฆ1 โ ๐ฆ2 ๐ฆ2(0) = 1
Write alternatively, solve ๐๐ฆ
๐๐ก= ๐(๐ฅ, ๐ฆ) ; ๐ฆ(๐ก, 0) = ๐ฆ
0
or {๐ฆ1โฒ
๐ฆ2โฒ } = [
โ100 02 โ1
] { ๐ฆ1 ๐ฆ2
} ; { ๐ฆ1 ๐ฆ2
}0= {
21}
or
{๐ฆ1โฒ
๐ฆ2โฒ } = {
โ100๐ฆ12๐ฆ1 โ ๐ฆ2
}; { ๐ฆ1 ๐ฆ2
}0= {
21}
(1) ๏ฟฝ๏ฟฝ1 = ๐(๐ก๐, ๐ฆ๐)
๐1 = [๐1โฒ
๐1โฒโฒ] = [
โ100 ร 22 ร 2 โ 1
] = [โ2003
]
(2) ๐2 = [๐2โฒ
๐2โฒโฒ] โ ๏ฟฝ๏ฟฝ2 = ๐(๐ก๐+1 2 โ , ๐ฆ๐ +
1
2๏ฟฝ๏ฟฝ1โ)
= ๐ [0.01, 2 +
1
2(โ200) ร 0.02
0.01, 1 +1
2(3) ร 0.02
] = ๐ [0.01, 0.000.01, 1.03
] = [0.00โ1.03
]
(3) ๐3 = [๐3โฒ
๐3โฒโฒ] โ ๏ฟฝ๏ฟฝ3 = ๐(๐ก๐+1 2 โ , ๐ฆ๐ +
1
2๏ฟฝ๏ฟฝ2โ)
= ๐ [0.01, 2 + 0 ร
. 02
2
0.01, 1 โ 1.03 ร0.02
2
] = ๐ [0.01, 2.0000.01, 0.9897
] = [โ100 ร 2
2 ร 2 โ 0.9897]
= [โ2003.0103
]
6
(4) ๐4 = [๐4โฒ
๐4โฒโฒ] โ ๏ฟฝ๏ฟฝ4 = ๐(๐ก๐+1, ๐ฆ๐ + โ๏ฟฝ๏ฟฝ3)
= ๐ [0.02, 2 โ 0.02 ร 2000.02, 1 + 0.02 ร 3.0103
] = ๐ [0.02, โ20.02, 1.060206
]
= [โ100 ร โ2
2 ร โ2 โ 1.060206] = [
200โ5.060206
]
{๐ฆ1๐ฆ2} = โ
2
1โ +
0.02
6[
โ200 + 2 ร 0 โ 2 ร 200 + 2003 โ 2 ร 1.03 + 2 ร 3.0103 โ 5.060206
]
= [0.666671.00633
] ๐ด๐๐ .
โ How to choose h? Choose a reasonable โhโ depending on the physics of the problem. Solve
and re-do the calculation for โ 2 โ and check the convergence. Sometimes, one may have to
increase the step-size if the accuracy can be relaxed.
โ There are R-K-Mersen or R-K-Fehlberg automatic step-size control method where โhโ is
adjusted (either h โ 2h or h โ h2 โ ) depending upon the error in the RK-4 solution relative
to that from error in a higher order method proposed by Mersen or Fehlberg.
In summary, the single step methods to solve 1st order ODE(s) are all about finding a
relatively โaccurateโ slope or tanำจ to reach the target at โhโ step forward. The difference
between the methods is the computation of the slopes, viz.,
(tn, yn) or (tn+1, yn+1) or (tn+1/2, yn+1/2) or a combintation of these?
Thus, the methods are called differently (explicit/implicit) and have different orders
(1st/2nd/4th, etc) of accuracy and different stability regions (smaller or bigger):
๐ฆ๐+1 = ๐ฆ๐ + โ ๐(๐ก๐, ๐ฆ๐): ๐น๐๐๐ค๐๐๐ ๐ธ๐ข๐๐๐
๐ฆ๐+1 = ๐ฆ๐ + โ ๐(๐ก๐+1, ๐ฆ๐+1): ๐ต๐๐๐๐ค๐๐๐ ๐ธ๐ข๐๐๐
๐ฆ๐+1 = ๐ฆ๐ + โ [๐(๐ก๐, ๐ฆ๐) + (๐ก๐+1, ๐ฆ๐+1)]/2: ๐๐๐๐๐๐ง๐๐๐๐๐ ๐ ๐ข๐๐
๐ฆ๐+1 = ๐ฆ๐ + โ ๐: RK-4 predictor-corrector
๐คโ๐๐๐, ๐ ๐๐ ๐ ๐๐๐ ๐ค๐๐๐โ๐ก๐๐๐ ๐๐ฃ๐๐๐๐๐ ๐๐ ๐ ๐๐๐๐๐ ๐๐๐๐๐ข๐๐๐ก๐๐ ๐๐ก ๐ ๐๐๐ ๐๐๐ก๐๐๐๐๐๐๐๐ก๐ ๐๐๐๐๐ก๐๐๐๐ .
Note: All methods predict/estimate the functional value, ๐ฆ๐+1 linearly starting with initial
condition, ๐ฆ๐ at ๐ฅ๐.
1
Lecture #18
Example 1 (RK-4)
Consider a special (diameter = 10 cm) ball made of steel k = 40
๐ ๐ โ ๐พ, ๐ = 8000 ๐๐ ๐3, ๐ถ๐ = 400 ๐ฝ ๐๐ โ ๐).โ โโ The initial temperature of the ball is
300 K. It is immersed in a large oil tank at 400 K. The convective heat transfer coefficient, h at
the sphere surface is 3000 ๐ ๐2 โ ๐โ . Assume that there is no radial temperature gradient
inside the ball. Use the R-K-4 numerical technique to solve the governing first order energy
balance equation for predicting the temperature of the sphere at ๐ก = 1 ๐๐๐ after it was
immersed in the oil tank. Use ฮ๐ก = 10 ๐ . Repeat calculations for ฮ๐ก = 5 ๐ . Draw graphical
depiction of the slopes comprising all stages of the RK method. Do calculations up to 4 digits
after decimal. Calculate the rate of temperature-decrease at ๐ก = 0, 0.5 and 1.0 min.
The energy balance (transient/unsteady equation):
๐๐ถ๐๐๐
๐๐ก= โโ๐(๐ โ ๐0)
(๐๐ ๐3โ . ๐ฝ ๐๐ โ ๐โ .๐พ
๐ ) = ๐ฝ ๐ โ ๐2 โ ๐โ (400 โ ๐) ๐พ (
4๐๐ 2
43โ ๐๐ 3)
๐2
๐3
8000 ร 400 ร๐๐
๐๐ก= +3000 ร
3
0.05(400 โ ๐)
๐๐
๐๐ก= +0.05625(400 โ ๐) = ๐(๐ก, ๐)
ฮ๐ = โ = 10 or 5 ๐
๐1 = ๐(0, 300) = +0.05625(400 โ 300) = +5.6250
๐2 = ๐(5, 300 + 5.625 ร 5) = +0.05625(400 โ 328.125) = 4.0429
๐3 = ๐(5, 300 + 4.0429 ร 5) = 0.05625(400 โ 320.2145) = 4.4879
โ ๐ด๐
๐๐
328.125
320.2145
๐ก = 0 ๐ = 300 ๐พ ๐(๐ก)
๐
๐ก
โ
๐๐ = 400 ๐พ
๐ = 5.0 ๐๐
2
๐4 = ๐(10, 300 + 4.4879 ร 10) = 0.05625(400 โ 344.879) = 3.1005
๐ = 16โ (5.6206 + 2 ร 4.0429 + 2 ร 4.4879 + 3.1005) = 4.2979
๐ = 300 + 4.2979 ร 10 = ๐๐๐. ๐๐๐๐ ๐ฒ ๐จ๐๐.
March for the next time steps ๐ก = 20, 30, 40, 50, 60 ๐ , each time using the calculated
values from the previous time steps (viz. 342.9795, etc). Repeat the entire calculations for ฮ๐ก =
5๐ .
โ In a 20-25 min quiz or examination, such problem can be solved for one time step
using calculator. One requires to write a code to solve such problem for a long time or several
steps calculations.
โ Rate at ๐ก = 0, 0.5 and 1.0 min
๐๐
๐๐ก|
0= 0.05625(400 โ ๐) = 0.05625 ร 100 = 5.6250 ๐ ๐ โ
(Note: Once the functional values or temperatures are determined or known, the
derivatives can also be calculated using the formulae you learnt! But, here is the analytical
solution.)
Plot the graph as done in the previous lecture and approximately draw the steps for
๐1, ๐2, ๐3, ๐4, ๐, and functional values (๐๐, ๐๐+1
2โโ , ๐
๐+12โ
โโ , ๐๐+1โโโ , ๐๐+1) on y-axis.
โ From the chemical engineering point of view, temperature-gradient in (steel) sphere
was neglected considering a large thermal conductivity of the material, ๐ โซ โโฒ๐ โฒ or small Biot
#. Therefore, the lump body approach was used to determine the sphere temperature, and the
resulting energy balance equation is derived to be a 1st order ODE, else.
Ex2. Consider a steady-state 1D reactive flow of a gaseous species, A in a long quartz
tubular reactor (ID = D, length = L) (Re > 5000) radiated by UV light. The average velocity in
the tube is ๐. The species ๐ด is converted to B by the 1st order homogeneous reaction (๐ =
๐๐ถ๐ด), as it flows in the tube. The inlet concentration of A is ๐ถ๐ด๐ . Determine the axial
concentration profiles of A in the reactor. The reaction is exothermic: (โฮ๐ป; ๐๐๐๐๐๐โ ).
Inlet temperature is ๐๐
344.8790
๐๐
๐ถ๐ด๐
๏ฟฝ๏ฟฝ ๐ถ๐ด(๐ฅ) =? (๐ = ๐๐ถ๐ด)
๐ฅ = ๐ฟ
3
A species balance can be derived as follows, neglecting radial concentration profiles (Pe, r>>1)
๐๐ถ๐ด
๐๐ก+ ๏ฟฝ๏ฟฝ
๐๐ถ๐ด
๐๐ฅ= ๐ท๐ฅ
๐2๐ถ๐ด
๐๐ฅ2โ ๐๐ถ๐ด (๐๐๐
๐ โ ๐3โ )
๐๐, ๏ฟฝ๏ฟฝ๐๐ถ๐ด
๐๐ฅ= ๐ท๐ฅ
๐2๐ถ๐ด
๐๐ฅ2โ ๐๐ถ๐ด โ (1)
Note that the reaction is exothermic and the rate constant is temperature dependent. Write
down the energy-balance eqn:
๐๐ถ๐ (๐๐
๐๐ก+ ๏ฟฝ๏ฟฝ
๐๐
๐๐ฅ) = ๐
๐2๐
๐๐ฅ2 + ๐๐ถ๐ด (โฮ๐ป) (๐๐๐๐ โ ๐3โ )
๐๐๐
๐๐ฅ= ๐ผ
๐2๐
๐๐ฅ2 +๐
๐๐ถ๐๐ถ๐ด (โฮ๐ป) โ (2)
Further approximation can be made if mass/ thermal diffusion terms are neglected
(๐โ๐ถ๐ด โซ ๐ทโ2๐ถ๐ด and ๐โ๐ โซ ๐ผโ2๐), considering a large axial Pe, x # for mass as well as
thermal transport. The equations (1-2) are modified as
๐๐๐ถ๐ด
๐๐ฅ= โ๐๐ถ๐ด = โ๐0 exp(โ ๐ธ
๐ ๐โ ) ๐ถ๐ด - (3)
๐๐๐
๐๐ฅ=
๐0๐๐ฅ๐(โ๐ธ๐ ๐โ )
๐๐ถ๐(โฮ๐ป)๐ถ๐ด - (4)
or ๐๐ฆ1
๐๐ฅ= ๐1(๐ฆ1, ๐ฆ2) = โ
๐0๐๐ฅ๐(โ๐ธ๐ ๐ฆ2
โ )๐ฆ1
๐= ๐ด๐๐ฅ๐ (โ
๐ต
๐ฆ2) ๐ฆ1
๐๐ฆ2
๐๐ฅ= ๐2(๐ฆ1, ๐ฆ2) =
๐0๐๐ฅ๐(โ๐ธ๐ ๐ฆ2
โ )(โฮ๐ป)๐ฆ1
๐๐๐ถ๐= ๐ถ๐๐ฅ๐ (โ
๐ต
๐ฆ2) ๐ฆ1
The two 1st order equations are coupled and the right hand side terms have non-linear
dependence on ๐ฆ1 and ๐ฆ2. RK-4 can be applied without any problem, with the conditions:
๐ = 0; ๐ฆ1 = ๐ฆ10 ๐๐๐ ๐ฆ2 = ๐ฆ20. You can choose a step-size of ฮ๐ฅ = ๐ฟ10โ .
Notes: - If the axial diffusion terms are not neglected, the governing equations will
assume a form of 2nd order ODE, which will be discussed in the next lecture as Boundary Value
Problems.
- There are higher-order RK methods and even implicit RK method discussed in
literature to solve ODE or initial value problem.
(๐๐)
4
- There are two commonly used multi-step methods for solving ODEs (Note: RK-4 is
a single step multi-stage method): Adams-Bashforth and Adams-Moulten. These
methods use a polynomial on the derivatives of a function, passing through the
single or multi-points.
Adams-Bashforth (Explicit)
๐๐ฆ
๐๐ก= ๐(๐ฆ, ๐ก) โก ๐(๐ฆ(๐ก), ๐ก)
๐ก = 0, ๐ฆ(0) = ๐ฆ0
Solve for y(t) = ?
{
๐ก0
๐ฆ0
๐ฆ0โฒ
๐ก1
๐ฆ1
๐ฆ1โฒ
๐ก๐
๐ฆ๐
๐ฆ๐โฒ
๐ก๐+1
๐ฆ๐+1
๐ฆ๐+1โฒ
: solve : gradient
We have,
๐ฆ๐+1 = ๐ฆ๐ + โซ ๐ฆโฒ๐๐ก๐ก๐+1
๐ก๐
extrapolated value between tn and tn+1
Define ๐ผ =๐กโ๐ก๐
โ: โ ๐ฆ๐+1 = ๐ฆ๐ + โ โซ ๐ฆโฒ(๐ผ)๐๐ผ (0 โค ๐ผ โค 1) โ (1)
1
0
Fit a jth order polynomial of ๐ฆ๐โฒ through ๐๐ and ๐๐โ๐ (๐ + 1 pts preceding ๐๐) using backward
difference formula (โ๐ฆ๐ = ๐ฆ๐ โ ๐ฆ๐โ1).
๐ฆโฒ(๐ผ) = [1 + ๐ผโ +๐ผ(๐ผ + 1)
2!โ2 + โฏ
๐ผ(๐ผ + 1) โฏ (๐ผ + ๐ โ 1)
๐!โ๐] ๐ฆ๐
โฒ + ๐ (๐)
(Thus, ๐ฆโฒ(๐ผ) is the polynomial between (๐๐, ๐๐โ1, ๐๐โ2 โฏ ๐๐โ๐), substituting in (1)
๐ฆ๐+1 = ๐ฆ๐ + โ [1 +1
2โ +
5
12โ2 +
3
8โ3 + โฏ ๐ถ๐โj] ๐ฆ๐
โฒ + โ โซ ๐ (๐)๐๐ฅ1
0
๐ = 0 โถ you have fitted a constant polynomial of the derivative (๐ฆโฒ)
๐ฆ๐+1 = ๐ฆ๐ + โ๐ฆ๐โฒ +
โ2
2๐ฆโฒโฒ(๐) (๐ฆ๐ < ๐ < ๐ฆ๐+1)
(Recognize it as the Euler 1st order formula/explicit)
๐ = 1, you have fitted a line (linear polynomial) between ๐๐ ๐๐๐ ๐๐โ1
๐ ๐ + 1
๐ฆ๐โฒ ๐ฆ๐+1
โฒ
๐ + 1 ๐ โ 1 ๐
๐ฆ๐โ1โฒ
๐ฆ๐โฒ
๐ฆ๐+1โฒ
5
๐ฆ๐+1 = ๐ฆ๐ + โ [๐ฆ๐โฒ +
1
2โ๐ฆ๐
โฒ ] +5
12h3๐โฒโฒ(๐)
= ๐ฆ๐ +โ
2[3๐(๐ฆ๐) โ ๐(๐ฆ๐โ1)] โ 2๐๐ ๐๐๐๐๐ (๐ด๐๐๐ โ ๐ต๐๐ โ๐๐๐๐กโ)
๐ = 2, you have a quadratic polynomial between (Xn, Xnโ1, Xnโ2)
Therefore, by taking different numbers of points preceding ๐ก๐ ๐๐ ๐๐ one can get a set of
working formulae having different 0(โ๐)
๐ฆ๐+1 = ๐ฆ๐ + โ โ ๐ฝ๐๐๐๐+1โ๐๐๐=1
๐ฝ1๐
2๐ฝ2๐
12๐ฝ3๐
๐ = 113
23
2
โ1โ16
3
5
4
โฏ
1๐ ๐ก ๐๐๐๐๐2๐๐ ๐๐๐๐๐3๐๐ ๐๐๐๐๐
Graphically,
โ
โ From the above description, it is clear that the method has a โstartingโ problem because only
one condition is known: ๐ฆ(0) = ๐ฆ0. In practice one starts with the Eulerโs forward/explicit approach to
calculate ๐ฆ1, then use 2nd order method to predict ๐ฆ2, and then use (๐ฆ0, ๐ฆ1, ๐ฆ2) to calculate ๐ฆ3. Use of the
preceding โ3โ data-points gives 3rd order accurate method.
โ Similar to the Adams-Bashforth (explicit), there is Adams-Moulton (Implicit) method
based on forward difference interpolation formula. For details, refer the textbooks.
๐ฆ๐โ2โฒ
๐ฆ๐โ1โฒ
๐ฆ๐โฒ
๐ฆ๐+1โฒ
๐ โ 2 ๐ โ 1 ๐ ๐ + 1
๐ = 1 (๐๐๐๐๐๐)
๐ = 0 (๐๐๐๐ ๐ก๐๐๐ก)
๐ฆ๐โฒ
๐ก๐โ1 ๐ก๐+1 ๐ก๐
๐ฆ๐โฒ
๐ก๐โ2 ๐ก๐โ1 ๐ก๐ ๐ก๐+1
(๐๐ข๐๐๐๐๐ก๐๐)
๐ = 2
1
Lecture #19
Instability and stiffness for a system of ODEs
In the previous lectures, we have shown that a system of ODEs (IV๐๐ ) ๐ฆ๐โฒ = ๐๐(๐ฆ1 โฏ ๐ฆ๐) ๐ =
1,2, โฏ ๐ with ๐ฆ๐(0) = ๐ฆ0 can be written as the coupled ODEs: ๐ฆ๐
โฒ= ๐ด๐ฆ, where A is the
Jacobian matrix.
It is also clear that for the ๐ ร ๐ matrix A, there are m eigenvalues: ๐ด๐๐ = ๐๐๐๐, where ๐๐ is
the eigenvector corresponding to ๐๐ eigenvalue. Now, make use of linear transformation: one
can construct a matrix, S whose columns are the eigenvectors of A such that ๐โ1๐ด๐ = ฮ, where
ฮ is the diagonal matrix of the elements which are ๐๐ of A, as [๐1
โฑ๐๐
]. Then one can
write,
๐งโฒ(defintion) = ๐โ1๏ฟฝ๏ฟฝโฒ = ๐โ1๐ด๏ฟฝ๏ฟฝ = (๐โ1๐ด๐)๐โ1๏ฟฝ๏ฟฝ = ฮz
or ๐ง๐โฒ = ๐k๐ง๐, ๐ = 1,2, โฏ ๐ โ cannonical form.
where, ๐ง๐โฒ are uncoupled linear ODEs. Therefore, all (stability) characteristics of single ODE
will also be shown by the system of ODEs.
We have also seen earlier shown that a general solution to the system of ODEs can be written
as ๐ถ1๐๐1๐ก{ } + ๐ถ2๐๐2๐ก{ } +
โฏ , where the terms in the parenthesis are the eigenvectors corresponding to the eignevalues.
In such case, the growth or decay of the function depends on ๐๐๐๐ โ ๐๐๐๐ฅ. A large numerical
value of ๐๐๐๐ฅ will cause the function to grow or decay at a faster rate than that corresponding
to
๐ฆ ๐๐๐๐
๐๐๐๐ฅ ๐ก
2
๐๐๐๐. In other words, small change in โtโ will cause a large change/variation in ๐ฆ(๐๐๐๐ฅ).
Solving such type of system of ODEs is numerically not trivial because a fine grid or step-size
ฮ๐ก ๐๐ โ is required to accurately predict change in ๐ฆ(๐๐๐๐ฅ), whereas a coarse grid can be used
to predict ๐ฆ(๐๐๐๐).
- Such equations are called stiff ODEs. In general,
Stiff ratio(๐๐ ) =๐๐๐๐ฅ
๐๐๐๐> 10 represents a system
of stiff ODEs.
- Examples:
(1) A common example is the boundary layer problem
in hydrodynamics or heat or mass transport.
Functional value changes sharply within the
boundary layer, from that at the surface to that in
the potential region far from the surface.
Therefore, a numerical computation of the
functional values in the boundary layer (bottom
region), in principle, requires fine grid size, ฮ๐ฅ1,
while that in the potential region (top region)
requires coarse grid size, ฮ๐ฅ2. However, the sets of
the conservation equations in two regions are
coupled through some interfacial boundary
conditions, and therefore, must be solved
simultaneously using ฮ๐ฅ1, which is CPU-wise
extensive!
(2) A combination of series and parallel chemical reactions with low and high rate constants:
ex: ๐๐ฆ
๐๐ก= [
โ100 02 โ1
] ๐ฆ ; ๐ฆ(0) = [2 1]๐
on coefficient matrix โAโ: (โ100 โ ๐)(โ1 โ ๐) = 0 โ ๐1 = โ100, ๐2 = โ1
๐1 = โ100 โถ [โ100 0
2 โ1] {
๐1
๐2} = {
๐1
๐2} (๐๐๐ก๐: ๐๐ = 100)
2๐1 = โ99๐2 โ ๐(1) = {1
โ 299โ }
๐2 = โ1 โถ [โ100 0
2 โ1] {
๐1
๐2} = {
๐1
๐2}
โ100๐1 = โ๐1 and 2๐1 โ ๐2 = โ๐2 โ ๐(2) = {01
}
๐ฆ
ฮ๐ฅ2
x
ฮ๐ฅ1 ๐๐๐ ๐๐๐กโ ๐๐๐๐๐๐๐
โ1
100
3
GS: ๐ = ๐ถ1๐โ100๐ก {1
โ 299โ } + ๐ถ2๐โ๐ก {
01
}
or ๐1 = ๐ถ1๐โ100๐ก
๐2 =โ2
99๐ถ1๐โ100๐ก + ๐ถ2๐โ๐ก}
Apply: ๐ =2๐โ100๐ก
103
99๐โ๐ก โ
4
99๐โ100๐ก} ๐ด๐๐๐๐ฆ๐ก๐๐๐๐ ๐ ๐๐๐ข๐ก๐๐๐.
To solve numerically, a fine grid size ฮ๐ก will be initially
required to accurately predict a fast decay in the functional
value of ๐ฆ1, which can be relaxed or step-size can be
increased only during the later part of calculations.
In other words, time change in ๐ฆ2 is gradual (slow). Therefore, one would have used a coarse grid size
for ๐ฆ2 but for a rapid change in ๐ฆ1 during initial time of calculations which requires fine grid sizes.
โ SKGโs book has given one good example of stiff equations
๐๐ฆ1
๐๐ก= 77.27(๐ฆ2 โ ๐ฆ1๐ฆ2 + ๐ฆ1 โ 8.375 ร 10โ6๐ฆ1
2)
๐๐ฆ2
๐๐ก=
โ๐ฆ2โ๐ฆ1๐ฆ2+๐ฆ3
77.23 ๐ฆ(0) = [4 1.1 4]๐
๐๐ฆ3
๐๐ก= 0.161(๐ฆ1 โ ๐ฆ3)
In this case, stiffness changes with time, requiring adaptive mesh sizes: coarse when ๐๐ values slowly
change and fine when they change rapidly.
๐ฆ
2.0
1.0 ๐ฆ2
๐ฆ1
๐ก 1 2
๐๐๐๐ก:
๐๐๐๐ ๐๐๐ โ ๐ ๐ก๐๐ โ ๐ ๐๐ง๐ ๐๐ ๐๐๐๐ข๐๐๐๐โ
๐๐๐๐ ๐๐๐ โ ๐ ๐ก๐๐ โ ๐ ๐๐ง๐ ๐๐ ๐๐๐๐ข๐๐๐๐โ
๐ก
10โ2
106
๐ฆ
4
If you use one fixed fine step-size throughout the calculations, it is a wastage of CPU time.
Gearโs Technique: Used to solve stiff ODEs, based on multiple steps but using predictor-corrector
approach:
Predictor(๐๐ฅ๐๐๐๐๐๐ก):
๐ฆ๐+1 = ๐ผ1๐ฆ๐ + ๐ผ2๐ฆ๐โ1 + โฏ ๐ผ๐๐ฆ๐โ(๐โ1) + โ๐ฝ0๐ฆ๐โฒ
Corrector(๐๐๐๐๐๐๐๐ก)
: ๐ฆ๐+1 = ๐ผ1๐ฆ๐ + ๐ผ2๐ฆ๐โ1 + โฏ ๐ผ๐๐ฆ๐โ(๐โ1) + โ๐ฝ0๐ฆ๐+1โฒ
You should note that this method also has a "starting" problem, similar to the previously discussed
multi-step methods.
Predictor Table
๐ ๐ผ1 ๐ผ2 ๐ผ3 โฏ ๐ผ6 ๐ฝ0
123โฎโฎ6
10
โ32โ
01
62โ
00
โ12โ
โฏโฏโฏ
000
1 2
62โ
Corrector Table
๐ ๐ผ1 ๐ผ2 ๐ผ3 โฏ ๐ผ6 ๐ฝ0
123โฎโฎ6
14
3โ
1811โ
0โ1
3โ
โ911โ
00
211โ
โฏโฏโฏ
000
12
3โ
611โ
The first row (k = 1) of each table represents j = 0 (no previous data in the interpolating function); the
second row (k = 2) represents j = 1 (one preceding data in the interpolating function or a linear function),
and the third row (k = 3) represents j =2 (two preceding data in the interpolating function or a quadratic
function or parabola), etc.
Quiz II
1
Lecture #20
BVP (Boundary Value Problems)/2nd order ODEs
In this lecture, we will learn how to apply finite difference (direct) methods to solve BVPs. Such
problems are common in 1 D steady-state heat and mass transport in solid or fluid. The general
form of the BVP assumes a 2nd order ODE:
๐2๐ฆ
๐๐ฅ2= ๐(๐ฅ, ๐ฆ, ๐ฆโฒ) with two boundary conditions
required at two ends of the domain (๐ฅ = 0 and ๐ฅ = ๐ฟ ๐๐ (0,1)).
A general form of BVP can also be written as:
๐ด(๐ฅ)๐2๐ฆ
๐๐ฅ2+ ๐ต(๐ฅ)
๐๐ฆ
๐๐ฅ+ ๐ถ(๐ฅ)๐ฆ + ๐ท(๐ฅ) + ๐ธ = 0; (๐ด(๐ฅ) โ 0)
The required boundary conditions at two ends of the domain can assume any form: Drichlet or
Danckwarts or Neumann. That is, either functional value or gradient or mixed condition can be
specified:
๐ฆ = ๐, or ๐ฆโฒ = c, or ๐๐ฆโฒ + ๐๐ฆ = ๐.
Let us solve a general BVP equation:
๐ด(๐ฅ)๐2๐ฆ
๐๐ฅ2+ ๐ต(๐ฅ)
๐๐ฆ
๐๐ฅ+ ๐ถ(๐ฅ)๐ฆ + ๐ท(๐ฅ) + ๐ธ = 0;
Step1: divide the domain into N equal steps/grids or grids. Therefore, there are (N+1) nodes.
Step 2: discretize the equation or each terms of the equation at โithโ grid. In this course, we will
discretize the terms using 2nd order accurate method (recall numerical differentiation).
๐ด(๐ฅ๐)๐ฆ๐โ1 โ 2๐ฆ๐ + ๐ฆ๐+1
โ2+ ๐ต(๐ฅ๐)
๐ฆ๐+1 โ ๐ฆ๐โ12โ
+ ๐ถ(๐ฅ๐)๐ฆ๐ + ๐ท(๐ฅ๐) + ๐ธ = 0
Step3: Arrange the terms:
(๐ด(๐ฅ๐)
โ2โ๐ต(๐ฅ๐)
2โ) ๐ฆ๐โ1 โ (
2๐ด(๐ฅ๐)
โ2โ ๐ถ(๐ฅ๐)) ๐ฆ๐ + (
๐ด(๐ฅ๐)
โ2+๐ต(๐ฅ๐)
2โ) ๐ฆ๐+1 = โ๐ท(๐ฅ๐) โ ๐ธ
or ๐๐๐ฆ๐โ1 + ๐๐๐ฆ๐ + ๐๐๐ฆ๐+1 = ๐๐ โ discretized form of equation
0(โ2) 0(โ2)
0 ๐ โ 1 ๐ โ 1 ๐ 1 2 ๐ ๐ + 1
2
In principle, this equation should be valid for ๐ = 0โฏ๐. However, there may be problem (!) at
the boundary nodes ๐ = 0 and ๐, because ๐ฆโ1 and ๐ฆ๐+1 may not be known or defined or
calculated. You should carefully inspect the given boundary conditions and decide to apply the
discretized equation over (๐ = 0โฏ๐) ๐๐ (๐ = 1โฏ๐)๐๐ (๐ = 1โฏ๐ โ 1)๐๐ (๐ = 0โฏ๐ โ 1) so
that the number of equations is the same as that many unknowns (๐ฆ๐). For the moment, let us
take the simplest boundary conditions, ๐ฆ(0) = ๐ฆ0 and ๐ฆ(๐) = ๐ฆ๐.
Apply the discretized equation over ๐ = 1โฏ๐ โ 1 as
๐ = 1: ๐1๐ฆ0 + ๐1๐ฆ1 + ๐1๐ฆ2 = ๐1 ๐2๐ฆ1 + ๐2๐ฆ2 + ๐2๐ฆ3 = ๐2
โฎ ๐๐โ2๐ฆ๐โ3 + ๐๐โ2๐ฆ๐โ2 + ๐๐โ2๐ฆ๐โ1 = ๐๐โ2๐ โ 1: ๐๐โ1๐ฆ๐โ2 + ๐๐โ1๐ฆ๐โ1 + ๐๐โ1๐ฆ๐ = ๐๐โ1 }
Step 4: Apply the BCs and bring the terms containing y0 and yN to RHS:
๐1๐ฆ1 + ๐1๐ฆ2 = (๐1 โ ๐1๐ฆ0) = ๐1โฒ
๐2๐ฆ1 + ๐2๐ฆ2 + ๐2๐ฆ3 = ๐2โฎ
๐๐โ2๐ฆ๐โ3 + ๐๐โ2๐ฆ๐โ2 + ๐๐โ2๐๐โ1 = ๐๐โ2 ๐๐โ1๐ฆ๐โ2 + ๐๐โ1๐ฆ๐โ1 = (๐๐โ1 โ ๐๐โ1๐๐) = ๐๐โ1
โฒ }
There are exactly (N-1) unknown and (N-1) equations. Notably, set of equations can be written as
๐ด๐ฆ = ๐ where ๐ด =
[ ๐1 ๐1 0๐2 ๐2 ๐2 0 โฏ0 0 ๐๐โ2 ๐๐โ2 ๐๐โ2
0 ๐๐โ1 ๐๐โ1]
is the tridiagonal matrix.
Step 5: Call Thomas Algorithm (learnt earlier) to invert such matrix:
Tridiagonal (๐ โ 1, ๐, ๐, ๐, ๐, ๐)
You should be able to clearly recognize that while preparing to call tridiagonal matrix,
the following coefficients were changed:
๐โฒ1 = ๐1 โ ๐1๐0 โถ 1st row (๐ = 1)
The other coefficients remained the same: (i = 2, N-2)
๐๐ =๐ด(๐ฅ๐)
โ2โ๐ต(๐ฅ๐)
2โ; ๐๐ = ๐ถ(๐ฅ๐) โ
2๐ด(๐ฅ๐)
โ2
# ๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ก๐ ๐๐ ๐๐๐ก๐๐๐ฅ ๐ด
๐๐ข๐ก๐๐ข๐ก (๐ = 1,โฏ๐ โ 1)
3
๐๐ =๐ด(๐ฅ๐)
โ2+๐ต(๐ฅ๐)
2โ; ๐๐ = โ๐ท(๐ฅ๐) โ ๐ธ ;
Also, dNโ1 was changed as dโฒNโ1 = dNโ1 โ cNโ1YN โถ last row (i = N โ 1)
โ Let us consider another example where the BVP equation is the same. At boundary, ๐ฆ(0) =
๐ฆ0(also same as before). However, at the other boundary, gradient is specified instead of
functional value: ๐ฆ๐โฒ = 0.
The boundary condition ๐ฆ๐โฒ can be discretized as
๐๐+1โ๐๐โ1
2โ= 0 (0(โ2)) ๐๐ ๐๐+1 = ๐๐โ1
Considering that YN is NOT known in this case, the coefficients (๐๐ , ๐๐, ๐๐, ๐๐) are extended to the
rows: ๐ = 1โฆ . . ๐, ๐. ๐., the matrix A will have โNโ rows and the 1st & last row will be modified as
๐1 = ๐1 โ ๐1๐0 (same as before)
and ๐๐ = ๐๐ + ๐๐; why ?
because the Nth equation
aNYNโ1 + bNYN + cNYN+1 = dN is modified as
aNYNโ1 + bNYN + cNYNโ1 = dN on substitution of the bc.
Finally, call Tridiagonal (๐, ๐, ๐, ๐, ๐, ๐); i = 1, N
โ It is recommended that you should do your best to keep consistency between the order of methods
used to discretize the equation and boundary conditions. Also note that, 2nd order discretization method
is reasonably good/accurate for engineering calculations. If you use a higher order method, the
coefficient matrix A will no more be tridiagonal that is easy and fast to invert.
Ex: Consider the steady-state one dimensional heat conduction in a fine (length L, cross-section A,
perimeter P), whose one end is at a constant temperature ๐๐ and the other end is insulated. The ambient
temperature is ๐๐ and the convective heat transfer coefficient at the fix surface is โ.
Solve the steady-state temperature profiles in the fin.
L
An energy balance over โฒ๐ดฮ๐ฅโฒ control volume will result in the following differential equation:
ฯCp (โT
โt+ V. โT) = kโ2T + S โถ cal
s โ m3โ
๐ ๐ด
๐ฅ
๐๐
ฮ๐ฅ ๐๐ โ๐
๐(๐ฅ) =?
SS Solid โh(T โ Ta)
Cals โ m2โ
. (Pฮx)(A ฮx)
๐3
๐2
4
Note that there is no source or sink of heat as such in the fin. However, considering 1D axial heat
transfer, heat dissipated from the fin surface is homogenously distributed within the ๐ถ๐: ๐ =
โโ(๐ โ ๐๐)๐๐ where ๐๐ is the surface area per unit volume of the fin.
โ ๐๐2๐
๐๐ฅ2โโ(๐โ๐๐)๐
๐ด= 0
or d2T
dx2+ BT + C = 0 where B =
โhP
kA; C =
hP
kATa and choose ฮh =
L10โ
BC: ๐(๐ฅ = 0) = ๐๐ ; โ๐โ๐ (๐ฅ = ๐ฟ) = 0 ๐๐ ๐๐
๐๐ฅ= 0
Discretize the equation using the 2nd order method.
Soln: (๐2๐
๐๐ฅ2+ ๐ต๐ + ๐ถ = 0)
๐๐โ1โ2๐๐+๐๐+1
โ2 + ๐ต๐๐ + ๐ถ = 0
๐๐โ1 + (๐ตโ2 โ 2)๐๐ + ๐๐+1 = โ๐ถโ
2 ๐ = 1,๐
Prepare the tridiagonal matrix
๐๐ = 1, ๐๐ = (๐ตโ2 โ 2), ๐๐ = 1, ๐๐ = โ๐ถโ
2, ๐ = 1,๐
Apply BC/discretize BC:
๐0 = ๐๐(๐ = 0), ๐๐+1 = ๐๐โ1 (๐ = ๐)
Therefore, 1st & last row will be modified as
๐1 = ๐1 โ ๐1๐๐
๐๐ = ๐๐ + ๐๐
How? 1st row is modified as (๐ตโ2 โ 2)๐1 + ๐2 = โ๐ถโ2 โ ๐๐
Last row is modified as ๐๐โ1 + (๐ตโ2 โ 2)๐๐ + ๐๐โ1 = โ๐ถโ
2
Therefore, you have the tridiagonal matrix A. Call the subroutine as:
Tridiagonal (๐, ๐, ๐, ๐, ๐, ๐ฆ) (Note that the total number of equations is N)
As an example, take the fin-problem of heat transfer: L = 1 cm, width of the fin = 0.1 cm, ๐๐ =
1000 ๐ถ, ๐๐ = 300 ๐ถ, โ = 100๐ค ๐2๐พ, ๐ = 20๐ ๐โ๐พ.โ โ Take ฮโ = 0.1 ๐๐, write a programming
code to obtain the solution and plot the temperature profiles:
๐ฟ = 1 ๐๐ ๐ฅ 30๐๐ถ
100๐๐ถ
๐
1 ๐ + 1 ๐ 0 ๐ โ 1 ๐ โ 1 ๐
(๐๐๐ ๐ข๐๐๐ก๐๐๐)
5
Calculate the rate of heat-loss/dissipation to atmosphere from the fin.
Note: Q (cal/s) = โซh As (T(x) - Ta) dx = โ h A (Ti โ Ta) โx, i =0, n, where n is the number of nodes of
the computational domain. Use Simpsonโs 1/3 integration or Trapezoidal formula. Recall your
knowledge of heat transfer. Q can also be calculated by determining the heat leaking into the fin at x =
0, viz. Q = -k Ac ๐๐
๐๐ฅ. You can calculate the derivative by the 2nd order FDS using i =0, 1 and 2 nodes.
With a sufficient number of nodes or grids, two computations must produce the same results (cal/s).
You should revisit Heat Transfer taught at the UG level. You can also calculate the fin-efficiency.
Ex: Consider the catalytic oxidation of ๐๐2 into ๐๐3 under the constant temperature and pressure
conditions, over a spherical (diameter ๐๐ = 1 mm) pt-dispersed porous carbon catalyst. ๐๐2 in air (1%)
diffuses (๐ท = 1 ร 10โ9 m2 sโ ) into the pores of the catalyst and is oxidized to ๐๐3 by a pseudo-zeroth
order reaction, ๐ = 0.01moles
sโm3. The convective film mass transfer coefficient is ๐๐ = 0.1m sโ .
Determine the steady-state concentration profiles of ๐๐2 within the pellet.
Soln:
๐๐ถ๐ด
๐๐ก + ๐. โ๐ถ๐ด = ๐ท๐๐๐๐โ
2๐ถ๐ด โ ๐
๐๐ Dpore
r2d
dr(r2
dCA
dr) โ k = 0 (0 โค r โค rp)
continue in the next lectureโฆโฆโฆ
๐๐๐๐๐ , ๐๐
๐ถ(๐) =?
๐๐
๐๐
๐๐2(1%)๐ถ๐ = 1%
๐, ๐ = constant
1
Lecture #21
(continuedโฆ..from the previous lecture)
๐๐ ๐ท๐๐2๐ถ๐ด
๐๐2+2๐ท๐
๐
๐๐ถ๐ด
๐๐โ ๐ = 0
๐๐ ๐2๐ฆ
๐๐2+2
๐
๐๐ฆ
๐๐+ ๐ด = 0 ; ๐ด = (
โ๐
๐ท๐)
(h =rp
N)
BCs. ๐ = 0
๐๐ถ๐ด
๐๐= 0 (symmetric)
๐ = ๐๐ โ ๐ท๐๐๐ถ๐ด
๐๐= ๐๐(๐ถ๐ด โ ๐ถ๐)
Discretized eqn:
๐ฆ๐+1โ2๐ฆ๐+๐ฆ๐โ1
โ2+
2
๐๐
๐ฆ๐+1โ๐ฆ๐โ1
2โ+ ๐ด = 0 โ (1)
(๐๐ = ๐โ)
Discretized BCs:
๐๐ = 0
(๐ = 0)
๐ฆ1โ๐ฆโ1
2โ= 0
๐ฆโ1 = ๐ฆ1
๐๐ = ๐๐ โ ๐ท๐๐ฆ๐+1โ๐ฆ๐โ1
2โ= ๐๐(๐ฆ๐ โ ๐ถ๐)
๐ฆ๐+1 = (๐ฆ๐โ1 โ2โ
๐ท๐๐๐๐ฆ๐ +
2โ๐๐
๐ท๐๐ถ๐)
Before you re-arrange the terms, you should realize that there is a clear discontinuity at ๐๐ =
0 (or 1st node). Therefore, you cannot proceed without removing discontinuity. One way of
doing this is to approximate 1
๐
๐๐ฆ
๐๐|๐=0
as ๐2๐ฆ
๐๐2|๐=0 because โy = 0 at r = 0
or ๐ฆ+1โ2๐ฆ0+๐ฆโ1
โ2 + 2
๐ฆ1โ2๐ฆ0+๐ฆโ1
โ2 + ๐ด = 0
or (3๐2๐ฆ
๐๐2+ ๐ด) = 0
or 3๐ฆ1โ2๐ฆ0+๐ฆโ1
โ2 + ๐ด = 0 at ๐ = 0
Eq. (1) is applied over the next nodes, i.e., ๐ = 1โฏ๐ without any discontinuity
0 1 2 ๐ โ 1 ๐ ๐ + 1 ๐ โ 1 ๐
(๐ = ๐)
2
Arrange the terms now,
{
๐ฆโ1 + (๐ด
โ23โ โ 2) ๐ฆ0 + ๐ฆ1 = โ๐ด ๐ = 0
(1
โ2โ
1
๐1โ) ๐ฆ0 โ
2
โ2๐ฆ1 + (
1
โ2+
1
๐1โ) ๐ฆ2 = โ๐ด ๐ = 1
(1
โ2โ
1
๐2โ) ๐ฆ1 โ
2
โ2๐ฆ2 + (
1
โ2+
1
๐2โ) ๐ฆ3 = โ๐ด ๐ = 2
โฎ
(1
โ2โ
1
๐๐โ) ๐ฆ๐โ1 โ
2
โ2๐ฆ๐ + (
1
โ2+
1
๐๐โ) ๐ฆ๐+1 = โ๐ด ๐ = ๐
Apply the BCs (๐ = 0 and ๐ = ๐)
1๐ ๐ก ๐๐๐ค: (๐ด โ2
3โ โ 2) ๐ฆ0 + 2๐ฆ1 = โ๐ด
๐ฟ๐๐ ๐ก ๐๐๐ค: 2
โ2๐ฆ๐โ1 โ (
2
โ2+2โ๐๐
๐ท๐ร (
1
โ2+
1
๐๐โ))๐๐ = โ๐ด โ
2โ๐๐
๐ท๐(1
โ2+
1
๐๐โ)๐ถ๐
From the โpreparation of tridiagonal matrixโ point of view,
๐0 = 1, ๐0 = (๐ดโ2
3โ โ 2) , ๐0 = 1, ๐0 = โ๐ด
and
๐๐ =1โ2โ โ
1
๐๐โ , ๐๐ =
โ2
โ2 , ๐๐ =
1
โ2+
1
๐๐ โ; ๐๐ = โ๐ด ; ๐ = 1 โ ๐
However, on the substitution of BCs,
๐0 = ๐0 + ๐0 (1st row @ i = 0)
๐๐ = ๐๐ + ๐๐, ๐๐ = ๐๐ โ ๐๐2โ๐๐
๐ท๐,
๐๐ = ๐๐ โ ๐๐ .2โ๐๐
๐ท๐. ๐ถ๐
} ๐๐๐ ๐ก ๐๐๐ค
Therefore, ๐ด๏ฟฝ๏ฟฝ = ๐ต. There are (๐ + 1) equations to solve (๐ + 1) unknown (๐0โฏ๐๐) and A is
the tridiagonal matrix.
call Tridiagonal (๐ต + ๐, ๐, ๐, ๐, ๐ , ๐) |
๐0 ๐0 0
0 ๐๐ ๐๐
|
Write a programming code to solve the SS profiles of CA(r) for different rp = 0.25,
0.5 and 1 mm, km = 0.01, 0.1, 0.5 m sโ and Dp = 10โ7, 10โ9, 10โ11 m2
sโ .
Plot the profiles and interpret the results.
๐ = 0โฏ๐
3
Recall the course on chemical reaction engineering. Once SS CA(r) is calculated, you can
calculate the (total) effectiveness factor considering both inter- and intraphase diffusion
resistances by computing the total rate of the consumption of the species, A within the catalyst
and that corresponding to the bulk (gas) phase concentration. The computations may require
numerical integration (maybe, Simpsonโs 1/3rd method) to calculate the volume-average
quantities and/or numerical differentiation (may be, 2nd order BDS) to calculate the flux at the
surface of the sphere.
Ex. Consider the steady-state 1D reactive flow (Re > 5000) of a gaseous species A in a 1ong
quartz tubular reactor (1D = D, length = L) radiated by UV light. Velocity in the tube is ๐.
The species A is converted into B by the 1st order homogeneous reaction (๐ = ๐๐ถ๐ด), ๐๐ it flows
in the tube. The inlet concentration of A is ๐ถ๐ด๐ . Determine the axial concentration profiles
๐ถ๐ด(๐) =?. The reaction takes place under isothermal conditions and ฮ๐ป โ 0.
Soln: ๐๐ถ๐ด
๐๐ก+ ๐. โ๐ถ๐ด = ๐ทโ2๐ถ๐ด + (๐๐ด)
๏ฟฝ๏ฟฝ๐๐ถ๐ด
๐๐= ๐ท
๐2๐ถ๐ด
๐๐2 โ ๐๐ถ๐ด
BC. ๐ = 0 ๐ถ๐ด = ๐ถ๐ด๐ , ๐ = ๐ฟ โ๐ถ๐ด = 0 or ๐๐ถ๐ด
๐๐= 0 (long tube approximation)
๐๐ถ๐ด
๐๐+ ๐ต
๐2๐ถ๐ด
๐๐2+ ๐ถ๐ถ๐ด = 0, ๐ต = โ๐ท
๏ฟฝ๏ฟฝโ ; ๐ถ =
๐
๏ฟฝ๏ฟฝ, ฮโ = ๐ฟ
๐โ
for increasingDp
๐ถ๐ด๐ ๏ฟฝ๏ฟฝ ๐
๐ฟ ๐
ฮ๐
CA(๐) =?
(r = kCA)
๐๐
0 1 2 ๐ โ 1 ๐ ๐ + 1 ๐ โ 1 ๐
4
๐ฆ๐+1 โ ๐ฆ๐โ12โ
+ ๐ต๐ฆ๐+1 โ 2๐ฆ๐ + ๐ฆ๐โ1
โ2 + ๐ถ๐ฆ๐ = 0, ๐ = 1,๐
Discretize BCs ๐ฆ0 = ๐ถ๐ด๐; ๐ฆ๐+1โ๐ฆ๐โ1
2โ= 0 โ ๐ฆ๐+1 = ๐ฆ๐โ1
Collect the terms
(๐ต
โ2โ
1
2โ) ๐ฆ๐โ1 โ (
2๐ต
โโ ๐ถ)๐ฆ๐ + (
๐ต
โ2+
1
2โ) ๐ฆ๐+1 = 0, ๐ = 1, ๐
Prepare the tridiagonal matrix:
๐๐ = (๐ต
โ2โ
1
2โ), , ๐๐ = (
2๐ต
โโ ๐ถ) , ๐๐ = (
๐ต
โ2+
1
2โ), ๐๐ = 0; ๐ = 1, ๐
On substitution of BCs,
๐1 = ๐1 โ ๐1๐ถ๐ด๐ (i = 1, 1
st row) ๐๐ = ๐๐ + ๐๐ (i = N, last row)
You have ๐ด๏ฟฝ๏ฟฝ = ๏ฟฝ๏ฟฝ, where A is the tridiagonal matrix.
๐ฆ = 1,๐
call Tridiagonal (๐ต, ๐, ๐, ๐, ๐ , ๐)
Plot (numerical solutions using reasonable values for ๐ท, ๏ฟฝ๏ฟฝ, ๐, ๐ถ๐ด๐ , ๐ฟ)
๐ฟ ๐ 0
๐ถ๐ด๐
5
๐๐๐ซ๐ญ๐ข๐๐ฅ ๐๐ข๐๐๐๐ซ๐๐ง๐ญ๐ข๐๐ฅ ๐๐ช๐ฎ๐๐ญ๐ข๐จ๐ง๐ฌ (๐๐๐๐ฌ)
- Parabolic equations
1D โถ A๐๐ฆ
๐๐ก+ B
๐2๐ฆ
๐๐2(or
๐ต
๐
๐
๐๐(๐๐๐ฆ
๐๐) or
๐ต
๐2
๐
๐๐(๐2
๐๐ฆ
๐๐)) + C
๐๐ฆ
๐๐+ Dy + E = 0
Such time dependent 1D (spatial) equations are common in heat/mass/momentum
transport. The PDE representing conservation of transport variables usually contains a
convective term (๐. โ๐ or ๐. โ๐ถ or ๐. โ๐) and a diffusion term,
(๐ผโ2๐ or ๐ทโ2๐ถ or ๐โ2๏ฟฝ๏ฟฝ ), besides the unsteady-state or transient term
(๐๐ถ๐๐๐
๐๐ก or
๐๐ถ
๐๐ก or ๐
๐๏ฟฝ๏ฟฝ
๐๐ก). Therefore,
๐๐ถ๐ด๐๐ก
+ ๐๐๐๐ถ๐ด๐๐
= ๐ท๐2๐ถ๐ด๐๐2
โ ๐๐ถ๐ด
or ๐๐ถ๐ (๐๐
๐๐ก+ ๐๐
๐๐
๐๐) = ๐
๐2๐
๐๐2 + (๐๐ถ๐ด)(โฮ๐ป)
or ๐ (๐๐๐๐๐ก
+ ๐๐๐๐๐๐๐
) = ๐๐2๐๐๐๐2
โ (๐๐
๐๐) + ๐๐๐
or ๐๐ถ๐๐๐
๐๐ก=๐
๐2๐
๐๐(๐2
๐๐
๐๐)
or ๐๐ถ๐ด๐๐ก
=๐ท
๐
๐
๐๐(๐๐๐ถ๐ด๐๐) โ ๐๐ถ๐ด }
1 DParabolicPDE
equation.
are all examples of the time-dependent 1D parabolic PDE. You may refer the book by Ferziger
for the exact mathematical definition of different types of PDE including parabolic, elliptic or
hyperbolic.
โ Why โParabolicโ? Because we march on time โendlesslyโ covering the space.
โ Note: If you drop the time-dependent equation (or the unsteady-state or transient term),
what do you get? A boundary value problem (BVP), which we covered in the previous lectures.
โ Message is clear. Solving 1D parabolic PDE is not different from solving BVP. The procedure
for discretization in the space remains the same as before; it is to be repeated on every time step
as you march by refreshing the numerical values from the previous step. In fact, you may like to
copy and paste the programming code for BVP and nest it within the time loop. The graphical
representation of the numerical calculation is as follows.
March on time
๐ก = 2
๐ก = 1
๐ก = 0 0 1
๐
๐ ๐ โ 1 ๐ + 1
๐ + 1
๐ + 1
๐ โ 1
๐ โ 1
๐
๐
6
Take a general case:
๐ด๐๐ฆ
๐๐ก+ ๐ต
๐๐ฆ
๐๐= ๐ถ
๐2๐ฆ
๐๐2+ ๐ท (or ๐ด
๐๐ฆ
๐๐ก= ๐(๐ฆ๐ , ๐ฆ๐๐ , ๐ท))
๐ก = 0 ๐ฆ = 0 for all ๐ฟ > ๐ > 0
๐ก = 0+ ๐ = 0 ๐ฆ = ๐ฆ0 ; ๐ = ๐ฟ ๐๐ฆ
๐๐= 0
}
Steps
(1) Discretize โXโ -terms as before. On time, apply trapezoidal rule for integration:
๐ด๐ฆ๐๐ก+1 โ ๐ฆ๐
๐ก
ฮ๐ก=1
2[โ๐ต (
๐ฆ๐+1 โ ๐ฆ๐โ12ฮโ
)๐ก
โ ๐ต (๐ฆ๐+1 โ ๐ฆ๐โ1
2ฮโ)๐ก+1
+๐ถ (๐ฆ๐+1 โ 2๐ฆ๐ + ๐ฆ๐โ1
โ2)๐ก
+ ๐ถ (๐ฆ๐+1 โ 2๐ฆ๐ + ๐ฆ๐โ1
โ2)๐ก+1
] + ๐ท
(Note: โDโ is a const. ๐ท๐ก+๐ท๐ก+1
2= ๐ท!) โ This method is better known as Crank-Nicolson.
Also note that you have used a 2nd order accurate scheme on both time and X.
(2) Collect all terms on (๐ก + 1) on the LHS and ๐ก on the RHS as
๐ด๐ฆ(๐ก+1) = ๐(๐ก)
1
2(โ
๐ถ
โ2โ
๐ต
2ฮโ)๐ฆ๐โ1
๐ก+1 + (๐ด
ฮ๐ก+2๐ถ
โ2) ๐ฆ๐
๐ก+1 +1
2(โ
๐ถ
โ2+
๐ต
2ฮโ)๐ฆ๐+1
๐ก+1
=1
2(๐ถ
โ2+
๐ต
2ฮโ)๐ฆ๐โ1
๐ก + (๐ด
ฮ๐กโ๐ถ
โ2) ๐ฆ๐
๐ก +1
2(๐ถ
โ2โ
๐ต
2ฮโ)๐ฆ๐+1
๐ก +๐ท ๐ = 1, ๐
Note: All terms on RHS are known/calculated from the previous time step.
0
๐ โ 1
๐ โ 1 ๐
๐ + 1
๐ + 1 ๐ โ 1 ๐
๐ ๐ โ 1 ๐
๐ก + 1
๐ก 0 1
1 ๐๐๐๐โ
๐๐ฅ๐๐๐๐๐๐ก ๐๐๐๐๐๐๐๐ก
๐๐๐๐๐๐๐๐ก ๐๐ฅ๐๐๐๐๐๐ก
1
Lecture #22
(โฆ . . ๐๐๐๐๐๐๐๐)
(3) Apply BCs on both sides (๐ก + 1) ๐๐๐ (๐ก):
๐ = 0 ๐ฆ(๐) = ๐ฆ๐ for all ๐ก๐ (๐ก + 1 ๐๐๐ ๐ก)
๐ = ๐ ๐ฆ๐+1 = ๐ฆ๐โ1 for all ๐ก๐ (๐ก + 1 ๐๐๐ ๐ก)
1st row will change as:
(
๐ด
ฮ๐ก+
๐ถ
โ2) ๐ฆ1๐ก+1 +
1
2(โ
๐ถ
โ2 +๐ต
2ฮโ) ๐ฆ2
๐ก+1 =
(๐ถ
โ2 +๐ต
2ฮโ) ๐ฆ0 + (
๐ด
ฮ๐กโ
๐ถ
โ2) ๐ฆ1๐ก +
1
2(
๐ถ
โ2 โ๐ต
2ฮโ) ๐ฆ2
๐ก + ๐ท} (๐ = 1)
Last row will change as:
โ๐ถ
โ2 ๐ฆ๐โ1๐ก+1 + (
๐ด
ฮ๐ก+
๐ถ
โ2) ๐ฆ๐๐ก+1 =
๐ถ
โ2 ๐ฆ๐โ1๐ก + (
๐ด
ฮ๐กโ
๐ถ
โ2) ๐ฆ๐๐ก + ๐ท (i = N)
The other rows (2 โฏ ๐ โ 1) will remain the same. Again the coefficient matrix is a
tridiagonal one:
๐ด๐ฆ(๐ก+1) = ๐(๐ก)
You have prepared the tridiagonal matrix as follows:
๐๐ = โ1
2(
๐ถ
โ2 +๐ต
2ฮโ) , ๐๐ = (
๐ด
ฮ๐ก+
๐ถ
โ2) , ๐๐ =1
2(โ
๐ถ
โ2 +๐ต
2ฮโ) , ๐๐ =
1
2(
๐ถ
โ2 +๐ต
2ฮโ) ๐ฆ๐โ1
๐ก +
(๐ด
ฮ๐กโ
๐ถ
โ2) ๐ฆ๐ ๐ก +
1
2(
๐ถ
โ2 โ๐ต
2ฮโ) ๐ฆ๐+1
๐ก + ๐ท; ๐ = 1, ๐
on application of BCs ๐1 = ๐1 โ ๐1๐ฆ0 (1st row , ๐ =
1) Note that y0is substituted for yiโ1t before applying BC.
๐๐ = ๐๐ + ๐๐ (last row, i = N)
๐๐ =๐ถ
โ2๐ฆ๐โ1
๐ก + (๐ด
ฮ๐กโ
๐ถ
โ2) ๐ฆ๐
๐ก + ๐ท
โ
2
(4) Start calculations: RHS is known from ๐ก = 0 (initial condition
March on timeand call
๐ด๐ฆ(1) = ๐(0)
๐ด๐ฆ(2) = ๐(1)
โฎ ๐ด๐ฆ(๐ก+1) = ๐(๐ก)
Tridiagonal subroutine at every time step, & update ๐ฆ0 โ ๐ฆ(1) โ ๐ฆ(2) โ โฏ
Tridiagonal (๐, ๐, ๐, ๐, ๐๐ก, ๐ฆ๐ก+1)
Convince yourself that the SS values will be the same as solving the corresponding BVP
by dropping the transient or unsteady-state term.
Ex:
Consider the SS flow of a liquid through a long tube. Reynolds number is 5000 and a
radially flat velocity profile may be assumed. At certain time a tracer is injected into the liquid
at the inlet. The dispersion coefficient of the tracer in the liquid may be assumed to be
๐ท ๐๐2 ๐ .โ Radial peclet number is large. Determine unsteady-state or transient axial
concentration profiles, ๐ถ๐ด(๐ก, ๐) = ?
Soln:
๐๐ถ๐ด
๐๐ก+ ๐. โ๐ถ๐ด = ๐ทโ2๐ถ๐ด + ๐
๐๐ถ๐ด
๐๐ก+ ๐๐
๐๐ถ๐ด
๐๐= ๐ท
๐2๐ถ๐ด
๐๐2 ; (neglecting radial term)
๐ก = 0, ๐ถ๐ด = 0 for all ๐ฟ > ๐ฅ > 0
0+, ๐ = 0; ๐ถ๐ด = ๐ถ๐ด,๐๐ (Inlet concentration of tracer)
๐ = 1, ๐
1 ๐ท ๐๐๐๐๐๐๐๐๐
๐ต๐๐
๐ก
๐ฆ2
๏ฟฝ๏ฟฝ0
ฮ๐
CAo
t = 0 L
X V
(no โ reaction)
(Pure liquid)
3
๐ = ๐ฟ, โ๐ถ๐ด = 0 (long โ tube approximation) ๐๐ ๐๐ถ๐ด
๐๐= 0
๐๐ถ๐ด
๐๐ก+ ๐๐
๐๐ถ๐ด
๐๐= ๐ท
๐2๐ถ๐ด
๐๐2 ; ๐๐ = ๏ฟฝ๏ฟฝ
๐ถ๐ด๐
๐ก+1 โ ๐ถ๐ด๐
๐ก
ฮ๐ก=
1
2[๐ท (
๐ถ๐ด,๐+1 โ 2๐ถ๐ด,๐ + ๐ถ๐ด,๐โ1
โ2 )
๐ก+1
+ ๐ท (๐ถ๐ด,๐+1 โ 2๐ถ๐ด,๐ + ๐ถ๐ด,๐โ1
โ2 )
๐ก
โ ๏ฟฝ๏ฟฝ (๐ถ๐ด,๐+1 โ ๐ถ๐ด,๐โ1
2โ)
๐ก+1
โ ๏ฟฝ๏ฟฝ (๐ถ๐ด,๐+1 โ ๐ถ๐ด,๐โ1
2โ)
๐ก
]
(๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐โ1
๐ก+1 โ (1
ฮ๐ก+
๐ท
โ2) ๐ถ๐ด,๐
๐ก+1 + (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐+1
๐ก+1
= โ (๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐โ1
๐ก โ (1
ฮ๐กโ
๐ท
โ2) ๐ถ๐ด,๐
๐ก โ (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐+1
๐ก
๐ = 1, ๐
๐ = 0: ๐ถ๐ด,0๐ก = ๐ถ๐ด,0
๐ก+1 = ๐ถ๐ด,๐๐ (Inlet BC)
๐ = ๐: ๐ถ๐ด,๐+1๐ก+1 = ๐ถ๐ด,๐โ1
๐ก+1 and ๐ถ๐ด,๐+1๐ก = ๐ถ๐ด,๐โ1
๐ก
* Prepare the tridiagonal matrix
๐๐ = (๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ), ๐๐ = โ (
๐ท
โ2+
1
ฮ๐ก) , ๐๐ = (
๐ท
2โ2โ
๐
4โ) , ๐๐
= โ (๐ท
2โ2+
๐
4โ) ๐ถ๐ด,๐โ1
๐ก โ (1
ฮ๐กโ
๐ท
โ2) ๐ถ๐ด,๐
๐ก โ (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐+1
๐ก
Apply BCs:
๐1 = ๐1 โ ๐1๐ถ๐ด,๐๐ : Note that ๐ถ๐ด,๐๐ is substituted for ๐ถ๐ด,๐โ1๐ก in ๐1.
๐๐ = ๐๐ + ๐๐
๐๐ = โ (1
ฮ๐กโ
๐ท
โ2) ๐ถ๐ด,๐
๐ก โ (๐ท
โ2) ๐ถ๐ด,๐โ1
๐ก
You have ๐ด๐ฆ(๐ก+1) = ๐(๐ก) ; A โก Tridiagonal matrix with i = 1, N rows
๐ = 0
๐ = 0
๐ โ 1 ๐ ๐ + 1 โ
๐
๐ ๐ก + 1
๐ก
โฒฮ๐กโฒ
4
Call Tridiagonal (N, a, b, c, d, y)
Start with ๐ก = 0: ๐ถ๐ด(๐ = 0, ๐) = 0 (pure solvent) or use a small concentration, ๐ถ๐ด๐ โช ๐ถ๐ด,๐๐๐๐๐ก.
Solve for ๐ฆ(1) ๐๐ ๐ถ๐ด(1)
๐๐ก ๐ก = 1, recalculate RHS ๐(2) and keep on marching on time till a
steady-state solution or at ๐ก = ๐ก๐๐๐๐๐ is reached.
Plot (use L = 10 cm, CA,i = 0.001, CA,inlet = 1.0, V = 0.1 cm sโ , D = 0.01 cm2 sโ )
} โ ๐๐ถ
๐๐= 0|
๐ผ=๐ฟ
Note that
Tridiagonal matrix is called at every time-step.
๏ฟฝ๏ฟฝ vector is updated with the recent most ๐ถ๐ด values.
gradient at the exit must be flat (consistent with BC)
There are two steps (โ & ฮ๐ก). How do you choose them?
No one knows! In general ฮ๐ก <ฮ๐
๐,
ฮ๐2
๐ท. Why? ?
One should choose a fixed ฮ๐, and then refine โฒฮ๐กโฒ till there is a convergence in the solution.
Again, use ฮ๐ = ฮ๐2โ , adjust โฒฮ๐กโฒ till the solution converges, and so forth!
Ex. Repeat the previous problem, assuming that some solute is irreversibly adsorbed at the
tube-wall @ ๐๐ถ๐ด rate.
Species balance equation:
๐๐ถ๐ด
๐๐ก+ ๐. โ๐ถ๐ด = ๐ทโ2๐ถ๐ด โ (๐๐ถ๐ด)๐, where a is the specific surface area per unit
volume of the tube.
or ๐๐ถ๐ด
๐๐ก+ ๏ฟฝ๏ฟฝ
๐๐ถ๐ด
๐๐= ๐ท
๐2๐ถ๐ด
๐๐2 โ ๐โฒ๐ถ๐ด;
1.0
0.001
0 ๐ฅ ๐ฟ
๐ก
๐ถ๐ด,๐๐ ๏ฟฝ๏ฟฝ ๐ถ๐ด(๐ก, ๐) =?
r = -kCA
ฮ๐ L
X
5
๐ผ๐ถ: ๐ก = 0 ๐ถ๐ด = ๐ถ๐ด,๐ ,
๐ต๐ถ 0+, ๐ = 0; ๐ถ๐ด = ๐ถ๐ด,๐๐, ๐ = ๐ฟ, โ๐ถ๐ด = 0 โ๐๐ถ๐ด
๐๐= 0
๐ถ๐ด๐๐ก+1โ๐ถ๐ด๐
๐ก
ฮ๐ก=
1
2[๐ท (
๐ถ๐ด,๐+1โ2๐ถ๐ด,๐+๐ถ๐ด,๐โ1
โ2 )
๐ก+1
+ ๐ท (๐ถ๐ด,๐+1โ2๐ถ๐ด,๐+๐ถ๐ด,๐โ1
โ2 )
๐ก
โ ๏ฟฝ๏ฟฝ (๐ถ๐ด,๐+1โ๐ถ๐ด,๐โ1
2โ)
๐ก+1
โ
๏ฟฝ๏ฟฝ (๐ถ๐ด,๐+1โ๐ถ๐ด,๐โ1
2โ)
๐ก
โ (๐โฒ๐ถ๐ด,๐๐ก+1 + ๐โฒ๐ถ๐ด,๐
๐ก )] Note: This is the extra term.
Re-arrange,
(๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐โ1
๐ก+1 โ (1
ฮ๐ก+
๐ท
โ2+
๐โฒ
2) ๐ถ๐ด,๐
๐ก+1 + (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐+1
๐ก+1
= โ (๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐โ1
๐ก โ (1
ฮ๐กโ
๐ท
โ2โ
๐โฒ
2) ๐ถ๐ด,๐
๐ก โ (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐+1
๐ก
๐ = 1, ๐
๐ต๐ถ๐ : {๐ = 0, ๐ถ๐ด,๐
๐ก = ๐ถ๐ด,๐๐ก+1 = ๐ถ๐ด,๐๐ (for all time steps)
๐ = ๐, ๐ถ๐ด,๐+1๐ก+1 = ๐ถ๐ด,๐โ1
๐ก+1 ๐๐๐ ๐ถ๐ด,๐+1๐ก = ๐ถ๐ด,๐โ1
๐ก
Prepare tridiagonal matrix:
๐๐ = (๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ), ๐๐ = โ (
1
ฮ๐ก+
๐ท
โ2+
๐โฒ
2) , ๐๐ = (
๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) , ๐๐
= โ (๐ท
2โ2+
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐โ1
๐ก โ (1
ฮ๐กโ
๐ท
โ2โ
๐โฒ
2) ๐ถ๐ด,๐
๐ก โ (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,๐+1
๐ก
Apply BCs.
๐1 = โ (๐ท
โ2+
๏ฟฝ๏ฟฝ
2โ) ๐ถ๐ด,๐๐ โ (
1
ฮ๐กโ
๐ท
โ2โ
๐โฒ
2) ๐ถ๐ด,1
๐ก โ (๐ท
2โ2โ
๏ฟฝ๏ฟฝ
4โ) ๐ถ๐ด,2
๐ก : i =1 (1st row)
(Note that this step is the same as ๐1 = ๐1 โ ๐1๐ถ๐ด,๐๐)
๐๐ = ๐๐ + ๐๐
๐๐ = โ๐ท
โ2 ๐ถ๐ด,๐โ1๐ก โ (
1
ฮ๐กโ
๐ท
โ2 โ๐โฒ
2) ๐ถ๐ด,๐
๐ก } ๐ = ๐ (๐๐๐ ๐ก ๐๐๐ค)
๐ด๐ฆ(๐ก+1) = ๐(๐ก); A is the tridiagonal matrix.
๐ = 0
0
๐ โ 1 ๐ ๐ + 1 ๐ โ 1 ๐
๐ก + 1
๐ก
๐ โ 1 ๐ + 1 ๐
1
6
Proceed as before with initial condition CA(i = 1, N) = CA,i. Evaluate d(t), solve for
y(t+1), evaluate d(t+1), solve for y(t+2) โฏ etc. Subroutine Tridiagonal (N, a, b, c, d, y) is called
at every time step. Plot qualitatively for the same conditions as before, use k = 0.1 sโ1.
The axial concentration profiles for different โฒtsโฒ will be the similar as before; however increase
in concentration with โtโ will be less than before because of the reactive/adsorptive wall.
๐ถ๐ด,๐๐
๐ถ๐ด
๐ก2 ๐ก1
๐ก1
๐ก2
(non โ reactive wall)
(reactive wall)
๐
1
Lecture #23
Example: Consider a spherical (๐๐ = 0.1 cm) steel pellet (๐ = 40W mโ K โ , ฯ =
8000 kg m3 , Cpโ = 400 J kg โ K.โ The initial temperature of the pellet is 300 ๐พ. It is
immersed in a large oil tank at 400 K. The corrective heat transfer coefficient, โ๐ at the sphere
surface is 3000 ๐ ๐2๐พ.โ Solve for unsteady- state temperature profiles in the sphere. Choose
ฮ๐ก = 1 ๐ . Determine the average temperature in the sphere and the rate of which the surface
temperature decreases at ๐ก = 20 ๐ .
* Recall: There is a discontinuity at ๐ = 0 (๐ = ๐โ)
However, the grad โ๐ = 0 at ๐ = 0. Therefore, 1
๐
๐๐
๐๐โ
๐2๐
๐๐2
Energy balance equation:
๐๐ถ๐๐๐
๐๐ก= ๐โ2๐ + ๐ (๐ผ = ๐
๐๐ถ๐โ )
๐๐
๐๐ก=
๐ผ
๐2๐
๐๐(๐2
๐๐
๐๐) ๐๐ > ๐ โฅ 0
๐ผ๐ถ: ๐ก = 0 ๐ = 300 ๐พ(๐๐) for all ๐๐ โฅ ๐ โฅ 0
๐ต๐ถ: 0+ ๐ = 0 โ๐ = 0 ๐๐ ๐๐
๐๐= 0
๐ = ๐๐ โ ๐๐๐
๐๐= โ(๐ โ ๐๐)
or ๐๐๐
๐๐= โ(๐๐ โ ๐)
๐ก
๐ก = 0 300 ๐พ
400 (๐๐) ๐
ฮ๐ hf
rp
๐๐
2
The equation is re-written as ๐๐
๐๐ก= ๐ผ
๐2๐
๐๐2 +2๐ผ
๐
๐๐
๐๐
Apply Crank-Nicholson discretization scheme:
๐๐๐ก+1 โ ๐๐
๐ก
ฮ๐ก=1
2[๐ผ (
๐๐+1 โ 2๐๐ + ๐๐โ1โ2
)๐ก+1
+ ๐ผ (๐๐+1 โ 2๐๐ + ๐๐โ1
โ2 )๐ก
+2๐ผ
๐๐(๐๐+1 โ ๐๐โ1
2โ)๐ก+1
+2๐ผ
๐๐(๐๐+1 โ ๐๐โ1
2โ)๐ก
]
Arrange: (๐ผ
2โ2โ
๐ผ
2๐๐โ)๐๐โ1
๐ก+1 โ (1
ฮ๐ก+
๐ผ
โ2)๐๐
๐ก+1 + (๐ผ
2โ2+
๐ผ
2๐๐โ)๐๐+1
๐ก+1 = (๐ผ
2๐๐โโ
๐ผ
2โ2)๐๐โ1
๐ก +
(๐ผ
โ2โ
1
ฮ๐ก)๐๐
๐ก โ (๐ผ
2โ2โ
๐ผ
2๐๐โ)๐๐+1
๐ก ๐ = 1, ๐
Note ๐ = 0 requires a modified equation as (why?): ๐๐
๐๐ก= 3๐ผ
๐2๐
๐๐2
The modified equation is discretized:
๐0๐ก+1 โ๐0
๐ก
ฮ๐ก=
3๐ผ
2[(๐1โ2๐0+๐โ1
โ2 )๐ก+1
+ (๐1โ2๐0+๐โ1
โ2)๐ก
]: i = 0
(3๐ผ
2โ2)๐โ1
๐ก+1 โ (3๐ผ
โ2+
1
ฮ๐ก) ๐0
๐ก+1 + (3๐ผ
2โ2) ๐1
๐ก+1 = โ(3๐ผ
2โ2)๐โ1
๐ก + (3๐ผ
โ2โ
1
ฮ๐ก)๐0
๐ก โ (3๐ผ
2โ2)๐1
๐ก; i =0
Prepare tridiagonal matrix:
๐0 =3๐ผ
2โ2 , ๐0 = โ(
3๐ผ
โ2+1
ฮ๐ก) , ๐0 =
3๐ผ
2โ2
๐0 = โ(3๐ผ
2โ2) ๐โ1
๐ก + (3๐ผ
โ2โ1
ฮ๐ก) ๐0
๐ก โ (3๐ผ
2โ2) ๐1
๐ก
} ๐ = 0
๐๐ = (๐ผ
2โ2โ
๐ผ
2๐๐โ), ๐๐ = โ(
๐ผ
โ2+1
ฮ๐ก) , ๐๐ = (
๐ผ
2โ2+
๐ผ
2๐๐โ) , ๐๐
= (๐ผ
2๐๐โโ
๐ผ
2โ2) ๐๐โ1
๐ก + (๐ผ
โ2โ1
ฮ๐ก) ๐๐
๐ก โ (๐ผ
2โ2+
๐ผ
2๐๐โ)๐๐+1
๐ก
๐ = 1, ๐
Discretize BCs (1) ๐ = 0 ๐๐
๐๐= 0 โ ๐ = 0; ๐โ1 = ๐+1
(2) ๐ = ๐๐ ๐๐๐
๐๐= โ๐(๐๐ โ ๐) ๐ = ๐;
0 1 ๐ + 1
๐
๐ โ 1 ๐
(๐๐ = ๐โ) 0 1
๐ โ 1
๐ ๐ โ 1
๐ก + 1
๐ โ 1
๐
๐ + 1
3
๐๐+1 โ๐๐โ1
2h=
โ๐
๐(๐๐ โ ๐๐)
or, ๐๐+1 = ๐๐โ1 +2โ๐โ
๐พ(๐๐ โ ๐๐)
Apply BC
๐0 = ๐0 + ๐0
๐0 = (3๐ผ
โ2โ
1
ฮ๐ก)๐0
๐ก โ3๐ผ
โ2๐1๐ก} ๐ = 0
๐๐ = ๐๐ + ๐๐
๐๐ = โ๐ผ
โ2๐๐โ1๐ก + (
๐ผ
โ2โ
1
ฮ๐ก)๐๐
๐ก + (๐ผ
2โ2โ
๐ผ
2๐๐โ)2โ๐โ
๐๐๐๐ก โ (
๐ผ
2โ2+
๐ผ
2๐๐โ)2โ๐โ
๐๐๐
Call Tridiagonal(N+1, a,b,c,d,y)
Solve ๐ด๐ฆ(๐ก+1) = ๐(๐ก) , ๐ = 0, ๐ with initial condition: ๐ = ๐๐๐๐ = 300
๐ด๐ฆ(1) = ๐(0) โ ๐ด๐ฆ(2) = ๐(1) โ ๐ด๐ฆ(3) = ๐(2), ๐๐ก๐.
Once the functional values or y(t,r) or yit, i = 0, N are computed, the average
temperature of the sphere at any time, t can be calculated as the volume-average quantity
(why?), as follows:
3 โyiri2โr/R3, i = 0, N and ri = ih (assuming the constant or average thermophysical properties
i,.e., ฯ, Cp of the material). You can use the Simpsonโs 1/3rd or Trapezoidal rule of integration.
Similarly, the rate of decrease of the surface temperature, viz. ๐๐
๐๐ก @ ๐ = ๐ at any
time, t can be calculated using CDS as ๐ฆ(๐ก๐+1)โ๐ฆ(๐ก๐โ1)
2โ๐ก or BDS as
4๐ฆ(๐ก๐+1)โ3๐ฆ(๐ก๐)โ๐ฆ(๐ก๐+2)
2โ๐ก or FDS
as โ4๐ฆ(๐ก๐โ1)+3๐ฆ(๐ก๐)+๐ฆ(๐ก๐โ2)
2โ๐ก , depending upon the time, t. Therefore, you must use FDS at the
initial time, t = 0, etc.
4
Example: Consider the catalytic oxidation of ๐๐2 into ๐๐3 over a spherical Pt-dispersed porous
carbon catalyst (radius = ๐๐). The atmospheric concentration of ๐๐2 is 1%. The rate of
reaction is ๐ = ๐ (= 0.1) ๐ถ๐ดmole s โ m3โ . The film mass transfer coefficient is ๐๐(๐ ๐ ).โ
Determine the time-development of concentration profiles within the catalyst. The pore
diffusion coefficient of ๐๐2 is estimated to be ๐ท๐2 ๐ โ .
๐๐ถ๐ด
๐๐ก=
๐ท
๐2๐
๐๐(๐2
๐๐ถ๐ด
๐๐) โ ๐๐ถ๐ด (1)
๐ก = 0 ๐ถ๐ด = ๐ถ๐ด๐ โช< ๐ถ๐ for all ๐๐ โฅ ๐ โฅ 0
0+ โ๐ถ๐ด = 0 @ ๐ = 0
โ๐ท๐๐ถ๐ด
๐๐= ๐๐(๐ถ๐ด โ ๐ถ๐) @ ๐ = ๐๐
Before you solve, two clarifications follow:
(1) The steady-state solution of eq(1) is the same as that of the equation solved in the
previous lectures for BVP. Therefore, one way of checking the present code for this
unsteady-state 1D parabolic equation is to compare its SS solution with that from the
BVP-code. In the latter lectures you will see that very often it is better to artificially
introduce the transient term (๐ฃ๐๐ง.๐๐
๐๐ก ,๐๐ถ
๐๐ก ,๐๐
๐๐ก) in the BVPs and solve the entire time-
profiles, even when one is asked to solve the SS solution only. This strategy is often
followed for solving elliptic PDE.
(2) You should also compare this mass transport example with the previous example on
heat transfer. But for the non-homogenous term (๐๐ถ๐ด), two equations are identically the
same, including the IC and BCs.
Recall:
๐ถ๐ = 0.01 ๐ถ(๐ก, ๐) =?
๐๐
๐๐
๐๐
5
๐๐
๐๐ก=
๐ผ
๐2๐
๐๐(๐2
๐๐
๐๐)
๐ผ๐ถ โถ ๐ก = 0 ๐ = ๐๐
๐ต๐ถ 1 โถ ๐ = 0 ๐๐
๐๐= 0
2 โถ ๐ = ๐๐ โ ๐๐๐
๐๐= โ๐(๐ โ ๐๐)
๐๐ถ๐ด
๐๐ก=
๐ท
๐2๐
๐๐(๐2
๐๐ถ๐ด
๐๐)
๐ถ๐ด = ๐ถ๐ด๐ for all ๐๐ > ๐ > 0๐๐ถ๐ด
๐๐= 0
โ๐ท๐๐ถ๐ด
๐๐= ๐๐(๐ถ๐ด โ ๐ถ๐)
All it means is that their non-dimensionalized forms are identically the same:
๐๐
๐๐=1
๐2๐
๐๐(๐2
๐๐
๐๐)
where,
{
๐ =
๐ โ ๐๐๐๐ โ ๐๐
, ๐ถ๐ด โ ๐ถ๐ด๐๐ถ๐ด,๐ โ ๐ถ๐ด๐
๐ = ๐๐๐โ
๐ = ๐ก ๐ก๐ โ ; ๐ก๐ =๐๐2
๐ผ ,
๐๐2
๐ท
๐ผ๐ถ. ๐ = 0 ๐ = 0
๐ต๐ถ 1. ๐ = 0 ๐๐
๐๐= 0
2. ๐ = 1 โ๐๐
๐๐= ๐ด(๐ โ 1) , where A = Nu or Sh
Therefore, it is clear that their (non-dimensional) solutions will also be the same.
It also follows that one should non-dimensionalize the transport equations, as a good practice,
before solving the equations. Apart from learning about transport phenomena from the analogy
between heat, mass and momentum, there is a possibility that the non-dimensional forms of the
conservation equations & the respective bcs being the same, the non-dimensionalized solutions
will also be the same. In such cases or similar cases, the programming code written for one
problem will be the same or similar, requiring small modifications.
Let us continue with the non-dimensionalized form of the present mass transport problem:
๐๐
๐๐=
1
๐2๐
๐๐(๐2
๐๐
๐๐) โ ๐ต๐ โ ๐ถ , where ๐ต = ๐๐ก๐ , ๐ถ = ๐๐ก๐
๐ถ๐ด๐
๐ถ๐ด,๐โ๐ถ๐ด๐
Discretize:
๐ = 0 ๐ โ 1 ๐ + 1 ๐ ๐
๐ ๐ + 1
๐
6
๐๐๐+1 โ ๐๐
๐
ฮ๐=1
2[(๐๐+1 โ 2๐๐ + ๐๐โ1
ฮ๐2 )๐+1
+ (๐๐+1 โ 2๐๐ + ๐๐โ1
ฮ๐2 )๐
+2
๐๐(๐๐+1 โ ๐๐โ12ฮ๐
)๐+1
+2
๐๐(๐๐+1 โ ๐๐โ12ฮ๐
)๐
โ ๐ต(๐๐๐+1 + ๐๐
๐)] โ ๐ถ
๐ = 0,๐
@๐ = 0 there is a discontinuity in the equation. Therefore,
๐0๐+1 โ๐0
๐
ฮ๐=
3
2[(๐1โ2๐0+๐โ1
ฮ๐2 )๐+1
+ (๐1โ2๐0+๐โ1
ฮ๐2 )๐
+๐ต
2(๐0
๐+1 + ๐0๐)] โ ๐ถ for i = 0
Apply BCs
๐ = 0 ๐โ1 = ๐1
๐ = ๐ โ๐๐+1โ๐๐โ1
2ฮ๐ = ๐ด(๐๐ โ 1)
๐๐ ๐๐+1 = ๐๐โ1 โ 2๐ดฮ๐(๐๐ โ 1)
}
๐ = 0: (1
ฮ๐+
3
ฮ๐2โ๐ต
2)๐0
๐+1 โ3
ฮ๐2๐1๐+1 = (
1
ฮ๐โ
3
ฮ๐2+๐ต
2)๐0
๐ +3
2ฮ๐2๐1๐ โ ๐ถ
๐ = ๐: (1
ฮ๐2) ๐๐โ1
๐+1 โ (1
ฮ๐2+๐ต
2+1
ฮ๐) ๐๐
๐+1 = โ(1
ฮ๐2) ๐๐โ1
๐ โ (1
ฮ๐โ
1
ฮ๐2โ๐ต
2)๐๐
๐ + ๐ถ
๐ = 1, ๐ โ 1 (1
2ฮ๐2โ
1
2ฮ๐๐๐) ๐๐โ1
๐+1 โ (1
ฮ๐+
1
ฮ๐2โ๐ต
2)๐๐
๐+1 + (1
2ฮ๐2โ
1
2๐ฮ๐) ๐๐+1
๐+1
= (โ1
2ฮ๐2+
1
2ฮ๐๐) ๐๐โ1
๐ โ (1
ฮ๐โ
1
ฮ๐2โ๐ต
2)๐๐
๐ + (โ1
2ฮ๐2โ
1
2ฮ๐๐) ๐๐+1 + ๐ถ
d
Solve ๐ด๐๐+1 = ๐๐ , ๐ = 0, ๐ with ๐ผ๐ถ ๐ = 0 @ ๐ = 0 (same as before, ๐ด โก Tridiagonal matrix)
Here, we skipped the steps for preparing tridiagonal matrix and directly substituted
discretized BCs into the discretized equations! As an exercise, prepare tridiagonal matrix and
see if you get the same discretized equations post substitution of BCs, as before.
Quiz III
1
Lecture #24-25
Elliptic PDE (Method of Lines)
The model equations may be recognized by the following examples:
(1) ๐ (๐2๐
๐๐2+
๐2๐
๐๐ฆ2) + ๐ = 0 ; ๐ โก ๐ผ
2๐ โโ ๐๐๐
๐ โ ๐3โ
(2) ๐ (๐2๐
๐๐2+1
๐
๐
๐๐(๐
๐๐
๐๐)) + ๐ = 0
--- SS 2D temperature profiles in a (1) rectangular plate and (2) cylindrical wire because of
uniform heating
(3) ๐๐๐๐ถ
๐๐= ๐ท
๐2๐ถ
๐๐2+๐ท
๐(๐
๐๐(๐
๐๐ถ
๐๐)) โ ๐๐ถ
---- SS 2D concentration distributions of a solute in the reactive flow in a tube
(4) ๐๐๐๐
๐๐= ๐ผ
๐2๐
๐๐2+ ๐ผ
๐2๐
๐๐ฆ2
- SS 2D temperature distributions in a flow through rectangular channel.
(5) ๐๐๐๐๐๐
๐๐= ๐ (
๐2๐๐
๐๐2+1
๐
๐
๐๐(๐
๐๐๐
๐๐)) โ
๐๐
๐๐ฅ
- SS 2D velocity profiles of an incompressible NF in a pressure-driven horizontal flow.
By now, you must have realized that we are referring to an elliptic PDE which describes a SS
2D (no time-dependent term) heat/mass/momentum transport. Why is the equation called
elliptic? Because one has to solve the entire 2D space. Considering that there is the SS
consideration, there is no โmarchingโ on time as such and the updating of the solutions from the
previous time-step, as we earlier discussed for the parabolic PDEs. The solution in this case
must be sought one-time only under SS conditions. You will see later that solving elliptic
equations is computational extensive requiring iterations.
- The best way of understanding the numerical technique for solving an elliptic PDE is to
directly take the example (1) above.
2
Ex: A rectangular plate (๐ฟ ร ๐ค ร ๐กโ) fabricated from stainless steel (๐ = 40 ๐ ๐ โ ๐โ , ๐ =
8000 ๐๐ ๐3,โ ๐ถ๐ = 400 ๐ฝ ๐๐ ๐พ)โ is uniformly heated using an electric power source (100 ๐).
The top and bottom ends are insulated, whereas the side surfaces are exposed to atmosphere
(๐๐ = 300 ๐ถ, โ = 100๐ ๐2๐โ ). Determine the SS temperature profiles in the plate.
2D energy balance over โฒฮ๐ฅฮ๐ฆ๐กโโฒ๐ถ๐ under SS:
๐๐ถ๐ (๐๐
๐๐ก+ ๐. โ๐) = ๐โ2๐ + ๐: ๐ ๐3โ
๐ (๐2๐
๐๐ฅ2+
๐2๐
๐๐ฆ2) + ๐ = 0; S = 100 W/m3 of the plate volume
BCs: ๐ฅ = 0 ๐or ๐ค > ๐ฆ > 0 ; โ๐๐๐
๐๐ฅ= โโ๐(๐ โ ๐๐)
= ๐ฟ for ๐ค > ๐ฆ > 0 ; โ๐๐๐
๐๐ฅ= โ๐(๐ โ ๐๐)
๐ฆ = 0 and ๐ค for ๐ฟ > ๐ฅ > 0, โ ๐๐๐
๐๐ฆ= 0(insulation)
๐ฆ
๐
๐ค โ๐
(๐๐)300๐ถ
๐
30 0๐ถ(๐๐)
โ๐ ๐ฟ
โ๐๐๐
๐๐ฆ= 0
โ๐
โ๐๐๐
๐๐ฆ= 0
(๐, ๐ + 1)
(๐ + 1, ๐) (๐, ๐) (๐ โ 1, ๐)
(๐, ๐ โ 1)
ฮ๐ฅ
ฮ๐ฆ
N X
S (๐ ๐3)โ = (100 ๐
๐ฟ ร๐ ร ๐กโ)
(โ๐๐๐ก ๐ ๐๐ข๐๐๐)
๐๐ 0, ๐ ๐๐๐๐
3
Computational molecule:
Discretize equations over (๐, ๐). Note that it is a 2D problem. Therefore, one will have to
discretize in both directions (๐ฅ, ๐ฆ) using steps ฮ๐ฅ and ฮ๐ฆ, respectively. They need not be equal.
๐ [(๐2๐
๐๐2)๐,๐+ (
๐2๐
๐๐ฆ2)๐,๐] + ๐๐,๐ = 0
(๐๐โ1,๐ โ 2๐๐,๐ + ๐๐+1,๐
ฮ๐ฅ2) + (
๐๐,๐โ1 โ 2๐๐,๐ + ๐๐,๐+1
ฮ๐ฆ2) +
๐๐,๐
๐= 0
(As expected, when discretizing ๐2๐
๐๐2, ๐ is constant, and when discretizing
๐2๐
๐๐ฆ2, ๐ is constant)
There are two ways to arrange the discretized terms to
๐ด๏ฟฝ๏ฟฝ = ๐ form โถ
(1)1
ฮ๐ฅ2(๐๐โ1,๐ โ 2๐๐,๐ + ๐๐+1,๐) = โ
1
ฮ๐ฆ2(๐๐,๐โ1 โ 2๐๐,๐ + ๐๐,๐+1) โ
๐๐,๐
๐
(2) 1
ฮ๐ฆ2(๐๐,๐โ1 โ 2๐๐,๐ + ๐๐,๐+1) = โ
1
ฮ๐ฅ2(๐๐โ1,๐ โ 2๐๐,๐ + ๐๐+1,๐) โ
๐๐,๐
๐
Notes: 1. Although the linear algebraic equations have taken the form of ๐ด๏ฟฝ๏ฟฝ = ๐ in both cases,
๐ or RHS terms are not known. Therefore, in principle ๏ฟฝ๏ฟฝ ๐๐ ๏ฟฝ๏ฟฝ cannot be solved by inverting
the โmatrixโ formed on LHS, the way we did in the previous cases. In other words, there is no
way one can march in ๐ฅ ๐๐ ๐ฆ direction and solve the unknown variables, because marching in
either direction (๐ ๐๐ ๐) creates unknown variables in the other direction (๐ ๐๐ ๐). In fact, one
has to solve the โentire spaceโ at one time (without marching). This is the problem in solving an
elliptic PDE!
(2) The only way to solve an elliptic PDE or ๐ด๏ฟฝ๏ฟฝ = ๐ , where ๐ด is the tridiagonal matrix, is by
making guess for all variables (๐๐,๐) to start with, so that ๐ (RHS term) is known. Then, ๏ฟฝ๏ฟฝ
(which is similar to ๐ ) can be solved. Next, compare the newly calculated values with the guess
values and iterate till there is the convergence:
(๐ โ 1)
(๐ + 1)
(๐ + 1)
(๐ โ 1)
(๐, ๐)
ฮ๐ฅ = ๐ฟ ๐โ
ฮ๐ฆ = ๐ ๐โ
๐ = 0โฆ ๐๐ = 0โฆ ๐
}
4
๐ด๐ฆ๐+1 = ๐๐ b0 = initial guess for (Ti,j)
k = # of iterations.
(3) Either of the two discretized schemes (1) & (2) can be used to solve ๐๐,๐. In general, one
should sweep the discretized set of equations in the direction the expected solution (functional
value) is lesser stiff than in the other direction. In the present example, ๐ค โช ๐ฟ and the y-ends
are insulated. One should use scheme (1). The convergence will be relatively faster.
1
ฮ๐ฅ2(๐๐โ1,๐ โ 2๐๐,๐ + ๐๐+1,๐) = โ
1
ฮ๐ฆ2(๐๐,๐โ1 โ 2๐๐,๐ + ๐๐,๐+1)
๐โ๐๐,๐
๐พ (1)
Prepare tridiagonal matrix:
๐(๐, ๐) =1
ฮ๐ฅ2 ; ๐(๐, ๐) = โ
2
ฮ๐ฅ2, ๐(๐, ๐) =
1
ฮ๐ฅ2
๐(๐, ๐) = โ1
ฮ๐ฆ2(๐๐,๐โ1 โ 2๐๐,๐ + ๐๐,๐+1)
๐โ๐๐,๐
๐ }
๐ = 0,๐๐ = 0,๐
The superscript "g" stands for the guess values. Once the initial guess is made, one can now
march along โ๐โ direction, solving ๐๐,๐ at every โ๐๐กโ โ step as ๐ด๏ฟฝ๏ฟฝ๐ = ๐,where ๐ด is the
tridiagonal matrix containing the discretized โ๐ฆโ along โ๐โ direction for a fixed ๐, and ๐ is known
from the guess.
Discretize BCs
{
(๐ = 0), ๐: โ ๐
๐1,๐ โ ๐โ1,๐
2ฮ๐ฅ= โโ๐(๐0,๐ โ ๐๐)
or ๐โ1,๐ = ๐1,๐ โ2โ๐ฮ๐ฅ
๐ (๐0,๐ โ ๐๐)
(๐ = ๐), ๐: ๐๐+1,๐ = ๐๐โ1,๐ โ2โ๐ฮ๐ฅ
๐ (๐๐,๐ โ ๐๐)
(๐ = 0), ๐: ๐๐,โ1 = ๐๐,1
(๐ = ๐), ๐: ๐๐,๐+1 = ๐๐,๐โ1
Apply BCs
๐ = 0
๐ = 0 1 ๐ โ 1 ๐ ๐ + 1 ๐ โ 1 ๐
5
๐(0,0) = ๐(0,0) + ๐(0,0)
๐(0,0) = ๐(0,0) โ2โ๐ฮ๐ฅ
๐๐(0,0)
๐(0,0) =2
ฮ๐ฆ2(๐0,0 โ ๐0,1)
๐โ๐0,0๐โ2โ๐ฮ๐ฅ
๐. ๐๐. ๐(0,0)}
๐ = 0
๐(๐, 0) =2
ฮ๐ฆ2(๐๐,0 โ ๐๐,1)
๐โ๐๐,0
๐; ๐ = 1, ๐ โ 1
๐(๐, 0) = ๐(๐, 0) + ๐(๐, 0)
๐(๐, 0) = ๐(๐, 0) โ2โ๐ฮ๐ฅ
๐๐(๐, 0)
๐(๐, 0) =2
ฮ๐ฆ2(๐๐,0 โ ๐๐,1)
๐โ๐๐,0๐โ2โ๐ฮ๐ฅ
๐๐๐ ๐(๐, 0)}
๐ = ๐
Tridiag(๐ + 1, ๐, ๐, ๐, ๐, ๐๐,0) (๐ = 0,๐)
๐ = 1,๐ โ 1
๐(0, ๐) = ๐(0, ๐) + ๐(0, ๐)
๐(0, ๐) = ๐(0, ๐) โ2โ๐ฮ๐ฅ
๐๐(0, ๐)
๐(0, ๐) = ๐(0, ๐) โ (2โ๐ฮ๐ฅ
๐)๐๐๐(0, ๐)
}
๐ = 0
โ No coefficients will change for the rows, ๐ = ๐,๐ต โ ๐, because all of these
correspond to interior nodes:
๐ โ 1
๐
๐ฝ
๐ โ 1
๐ ๐ 0,0
6
๐(๐, ๐) = ๐(๐, ๐) + ๐(๐, ๐)
๐(๐, ๐) = ๐(๐, ๐) โ (2โ๐ฮ๐ฅ
๐) ๐(๐, ๐)
๐(๐, ๐) = ๐(๐, ๐) โ (2โ๐ฮ๐ฅ
๐)๐๐ ๐(๐, ๐)
}
๐ = ๐
Tridiag(๐ + 1, ๐, ๐, ๐, ๐, ๐๐,๐) (๐ = 0, ๐)
๐ = ๐
๐(0, ๐) = ๐(0, ๐) + ๐(0, ๐)
๐(0, ๐) = ๐(0, ๐) โ2โ๐ฮ๐ฅ
๐๐(0, ๐)
๐(0, ๐) =2
ฮ๐ฆ2(โ๐0,๐โ1 + ๐0,๐)
๐โ๐0,๐๐
โ (2โ๐ฮ๐ฅ
๐)๐๐๐(0, ๐)
}
๐ = 0
๐(๐, ๐) = โ2
ฮ๐ฆ2(โ๐๐,๐โ1 + ๐๐,๐)
๐โ๐๐,๐
๐; ๐ = 1, ๐ โ 1
๐(๐, ๐) = ๐(๐, ๐) + ๐(๐, ๐)
๐(๐, ๐) = ๐(๐, ๐) โ2โ๐ฮ๐ฅ
๐๐(๐, ๐)
๐(๐, ๐) =2
ฮ๐ฆ2(โ๐๐,๐โ1 + ๐๐,๐)
๐โ๐๐,๐๐
โ2โ๐ฮ๐ฅ
๐๐๐๐(๐, ๐)}
๐ = ๐
Tridiag(๐ + 1, ๐, ๐, ๐, ๐, ๐๐,๐) (๐ = 0, ๐)
You have, therefore, called Tridiagonal subroutine โ๐ + 1โ times as you marched along โ๐โ
direction. At the end, entire โ๐ฅ โ ๐ฆโ grids have been solved for ๐๐,๐(๐ = 0,๐; ๐ = 0,๐).
Compare solved values with the guess values and keep iterating till there is a convergence.
โ Solving an elliptic PDE is indeed computational extensive because there is a convergence
issue using the guesses.
โ There is another twist in solving an elliptic PDE. Do you update your guess values of ๏ฟฝ๏ฟฝ
(RHS terms) at โ๐โ with the ones solved at โ๐ โ 1โ as you march in y-direction, or do you wait till
you have solved till โ๐โ (the last boundary)? This question should remind you of the G-S and
Jacobi iterations. Choice is yours. A fast convergence is the criterion. Also, the relaxation
factor, โ๐คโ can be used to update the functional values in either case: ๐๐,๐ = ๐ค๐โฒ๐,๐ + (1 โ ๐ค)๐๐,๐
, where Tโ and T are the new and old values, respectively.
1
Lecture #25-26
Ex 2: Consider the fully developed SS flow (Re = 200) of an incompressible NF in a long
horizontal tube (L, D). The inlet temperature of the liquid is ๐๐ . The heat is supplied to the
flowing liquid at constant flux ๐๐ค(๐ ๐2โ ) through the tube walls. Determine the 2D (๐, ๐ฅ) SS
temperature profiles in the tube.
Energy balance over โฒ2๐๐ฮ๐ฮ๐โฒ ๐ถ๐:
๐๐ถ๐๐๐. โ๐ = ๐โ2๐ + ๐ ( ๐ฝ ๐๐ ๐๐๐ ๐ โ ๐3โ )
๐(๐)๐๐
๐๐= ๐ผ (
๐2๐
๐๐2+1
๐
๐
๐๐(๐
๐๐
๐๐)) ๐ผ =
๏ฟฝ๏ฟฝ
๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ ;
BC. ๐ = 0 ๐(๐) = ๐๐ ๐ โฅ ๐ โฅ 0
๐ = ๐ฟ +๐๐
๐๐= 0 (long tube approximation)
๐ = 0 ๐๐
๐๐= 0 (symmetric BC)
๐ = ๐ โ ๐๐๐
๐๐= โ๐๐ (๐ ๐2)โ
๐๐ ๐๐๐
๐๐= ๐๐ }
๐ฟ โฅ ๐ง โฅ 0
Let us non-dimensionalize the equation & BC
๐ =๐
To, ๐ง =
๐
Lc ๐คhere Lc = RPe where Pe(radial) =
Umax R
ฮฑ, ฮพ =
r
R
๐๐๐๐ฅ(1 โ ๐2)
Lc
๐๐
โz= ฮฑ(
1
Lc2๐2๐
โz2+1
R2๐2๐
โฮพ2+1
R21
ฮพ
๐๐
โฮพ)
๐
ฮ๐
๐
๐๐ค ๐ ๐2โ
๐ ฮ๐
ฮ๐ ๐๐ค ๐ ๐2โ
๐ฟ
๐ ๐๐
๐ข(๐) = ๐๐๐๐ฅ (1 โ๐2
๐ 2) (๐ ๐ = 200); ๐ , ๐ถ๐, ๐ โก ๐ถ๐๐๐ ๐ก๐๐๐ก
T(r, X) = ?
2
or
(1 โ ๐2)๐๐
โz=
1
๐๐2๐2๐
โz2+๐2๐
โฮพ2+1
ฮพ
๐๐
โฮพ
BCs:
๐ง = 0 ๐ = 1
๐ง = ๐ฟ ๐ฟ๐โ +
๐๐
๐๐ง= 0}1 > ๐ > 0
๐ = 0 ๐๐
๐๐= 0
๐ = 1 ๐๐
๐๐= (
๐๐๐
๐๐๐) = ๐ป(constant) for ๐ฟ ๐ฟ๐
โ > ๐ง > 0
Before solving, let us consider another example on mass transport.
Ex. Consider the fully developed SS flow (๐ ๐ = 200) of an incompressible NF in a long
horizontal tube (๐ฟ, ๐ท). The inlet concentration of the species A in the liquid is ๐ถ๐ด๐ .The species
are catalytically destroyed at the tube walls by the zeroth order chemical reaction
(๐ ๐๐๐๐ ๐ โ ๐3).โ Determine the 2D (๐, ๐)๐๐ concentration profiles in the tube.
Species balance over (2๐๐ฮ๐ฮ๐) ๐ถ, ๐.
๐๐๐๐ถ๐ด๐๐
= ๐ท (๐2๐ถ๐ด๐๐2
+1
๐
๐
๐๐(๐๐๐ถ๐ด๐๐)) moles s โ m3โ
๐๐๐๐ฅ (1 โ๐2
๐ 2)๐๐ถ๐ด๐๐
= ๐ท (๐2๐ถ๐ด๐๐2
+1
๐
๐
๐๐(๐๐๐ถ๐ด๐๐))
= ๐ท (๐2๐ถ๐ด
๐๐2+๐2๐ถ๐ด
๐๐2+1
๐
๐๐ถ๐ด
๐๐)
BCs. ๐ = 0 ๐ถ๐ด = ๐ถ๐ด๐ , ๐ = ๐ฟ ๐๐ถ๐ด
๐๐ฅ= 0 (๐ > ๐ > 0)
๐ = 0 ๐๐ถ๐ด
๐๐= 0 ๐ = ๐ , โ ๐ท
๐๐ถ๐ด
๐๐= ๐ (๐ฟ > ๐ > 0)
Let us non-dimensionalize the equation & BCs:
๐ ๐ถ๐ด๐ ๐ถ(๐, ๐) ๐ = โ๐ ฮ๐
๐
ฮ๐
๐
๐ข(๐) = ๐๐๐๐ฅ (1 โ๐2
๐ 2)
3
๐ =๐ถ๐ด
๐ถ๐ด๐โ , ๐ง =
๐ฅ
๐ฟ๐ , ๐ =
๐
๐ ; ๐ฟ๐ = ๐ ๐๐ , where Pe(radial) =
๐๐๐๐ฅ๐
๐ท
(Note that this โฒ๐๐โฒ is based on mass transport)
(1 โ ๐2)๐๐
๐๐ง=1
๐๐2๐2๐
๐๐ง2+๐2๐
๐๐2+1
๐
๐๐
๐๐
BC. ๐ง = 0, ๐ = 1 ; ๐ง = ๐ฟ๐ฟ๐โ ,
๐๐
๐๐ง= 0
๐ = 0, ๐๐
๐๐= 0 ; ๐ = 1 โ
๐๐
๐๐= (
๐๐
๐ท๐ถ๐ด๐) = ๐โฒ (constant)
โ It is clear that the non-dimensionalized equations and BCs of this (mass transport)
and previous (heat transport) examples are the same. Therefore, you need to solve only one of
the two. The dimensionless solutions will be the same. This situation should remind you of the
recommendation that one should non-dimensionalize the equation before solving it. Several
such analogous heat, mass, and momentum transport scenarios exist in chemical engineering
applications.
โIn most cases, radial Pe(mass or heat) number in laminar flow regime is of the order
of 10 or higher. In such cases, the axial diffusion term can be neglected. In other words,
๐ผ๐2๐
๐๐2<< ๐๐
๐๐
๐๐ ๐๐ ๐ท
๐2๐ถ๐ด
๐๐2<< ๐๐
๐๐ถ๐ด
๐๐ (See BSL book)
If you neglect the axial diffusion term, the 2D elliptic PDE is modified/simplified to 1D
parabolic PDE:
๐๐๐๐
๐๐=
๐ผ
๐
๐
๐๐(๐
๐๐
๐๐) ๐๐ ๐๐
๐๐ถ๐ด
๐๐=
๐ท
๐
๐
๐๐(๐
๐๐ถ๐ด
๐๐)
This simplified PDE can be solved using the Crank-Nicholson technique described in the
preceding lecture. In other words, one can numerically march in โXโ direction and solve in โrโ
direction using Thomas Algorithm for the tridiagonal matrix built from the discretized โrโ
terms. For now, let us revert to the original (full) non-dimensionalized elliptic PDE:
(1 โ ๐2)๐๐
๐๐ง=1
๐๐2๐2๐
๐๐ง2+๐2๐
๐๐2+1
๐
๐๐
๐๐
At ๐ = 0, there is a discontinuity and you are solving an approximation:
(1 โ ๐2)๐๐
๐๐ง=1
๐๐2๐2๐
๐๐ง2+2๐2๐
๐๐2
4
Discretize the main conservation equation:
(1 โ ๐๐2)
๐๐+1,๐ โ๐๐โ1,๐
2ฮ๐ง=
1
๐๐2
๐๐+1,๐โ2๐๐,๐+๐๐โ1,๐
ฮ๐ง2 +๐๐,๐+1โ2๐๐,๐+๐๐,๐โ1
ฮ๐2 +
1
๐๐
๐๐,๐+1โ๐๐,๐โ1
2ฮ๐
or
((1โ๐๐
2)
2ฮ๐ง+
1
๐๐2ฮ๐ง2
)๐๐โ1,๐ โ2๐๐,๐
๐๐2ฮ๐ง2
โ ((1โ๐๐
2)
2ฮ๐งโ
1
๐๐2ฮ๐ง2
)๐๐+1,๐ = (1
2ฮ๐๐๐โ
1
ฮ๐2) ๐๐,๐โ1 +
2๐๐,๐
ฮ๐2โ (
1
2ฮ๐๐๐+
1
ฮ๐2) ๐๐,๐+1
- (1)
Discretize the approximated conservation equation at the line of symmetry:
((1โ๐๐
2)
2ฮ๐ง+
1
๐๐2ฮ๐ง2
)๐๐โ1,0 โ2๐๐,0
๐๐2ฮ๐ง2
โ ((1โ๐๐
2)
2ฮ๐งโ
1
๐๐2ฮ๐ง2
)๐๐+1,0 = โ2๐๐,โ1
ฮ๐2+4๐๐,0
ฮ๐2โ2๐๐,+1
ฮ๐2
Note that RHS terms for all rows contain guess values for all ๐๐,๐to begin with
Discretize BCs:
๐ = 0, ๐ = 0,๐; ๐0,๐ = 1; ๐ = ๐, ๐ = 0,๐; ๐๐+1,๐ = ๐๐โ1,๐
๐ = 0, ๐ = 1,๐; ๐๐,โ1 = ๐๐,1 ; ๐ = ๐, ๐ = 0,๐; ๐๐,๐+1 = ๐๐,๐โ1 โ 2๐โฒฮ๐
๐ = 0
1st row of Tridiagonal matrix,
๐ = 1 โ2๐1,0๐๐2ฮ๐ง2
โ (1 โ ๐0
2
2ฮ๐งโ
1
๐๐2ฮ๐ง2)๐2,0 = โ
4๐1,0ฮ๐2
+4๐1,0ฮ๐2
โ (1 โ ๐0
2
2ฮ๐ง+
1
๐๐2ฮ๐ง2)๐0,0
=1
0 ฮ๐ง2 i โ 1 i + 1 i N ๐ = 1,๐๐ = 1,๐
๐ = 1, ๐๐ = 0 (๐๐๐ก๐ ๐0 = 0)
ฮ๐ง = 1๐โ , ฮ๐ =
๐ฟ ๐ฟ๐โ
๐
i โ 1 i + 1 i N โ 1 N 1 0
5
middle rows,
๐ = 2,๐ โ 1: ((1 โ ๐0
2)
2ฮ๐ง+
1
๐๐2ฮ๐ง2)๐๐โ1,0 โ
2๐๐,0๐๐2ฮ๐ง2
โ ((1 โ ๐0
2)
2ฮ๐งโ
1
๐๐2ฮ๐ง2)๐๐+1,0
= โ4๐๐,1ฮ๐2
+4๐๐,0ฮ๐2
last row, ๐ = ๐: 2
๐๐2ฮ๐ง2
๐๐โ1,0 โ2๐๐,0
๐๐2ฮ๐ง2
= โ4๐๐,1
ฮ๐2+4๐๐,0
ฮ๐2
You have a tridiagonal matrix A in (๐ด๐๐,0๐+1 = ๐๐,0
๐ ) to invert
๐ = 1,๐ โ 1 (Visit the main conservation equation)
1st row,
๐ = 1: โ2๐1,๐
๐๐2ฮ๐ง2โ (
1 โ ๐๐2
2ฮ๐งโ
1
๐๐2ฮ๐ง2)๐2,๐ = โ(
1 โ ๐๐2
2ฮ๐ง+
1
๐๐2ฮ๐ง2)๐0,๐
(1
2ฮ๐๐๐โ
1
ฮ๐2) ๐1,๐โ1 +
2๐1,๐
ฮ๐2โ (
1
2ฮ๐๐๐+
1
ฮ๐2)๐1,๐+1
middle rows:
๐ = 2, ๐ โ 1 : These are middle grids unaffected by BCs.
last row
๐ = ๐ 2
๐๐2ฮ๐ง2๐๐โ1,๐ โ
2๐๐,๐
๐๐2ฮ๐ง2= (
1
2ฮ๐๐๐โ
1
ฮ๐2)๐๐,๐โ1 +
2๐๐,๐
ฮ๐2โ (
1
2ฮ๐๐๐+
1
ฮ๐2)๐๐,๐+1
Again, ๐ด๐๐,๐๐พ+1 = ๐๐,๐
๐พ ; ๐ = 1, ๐
๐ = 1,๐ โ 1
๐ = ๐
1st row,
๐ = 1 โ2๐1,๐๐๐2ฮ๐ง2
โ ((1 โ ๐๐
2)
2ฮ๐งโ
1
๐๐2ฮ๐ง2)๐2,๐ = โ(
(1 โ ๐๐2)
2ฮ๐ง+
1
๐๐2ฮ๐ง2)๐0,๐
โ2
ฮ๐2๐1,๐โ1 +
2๐1,๐
ฮ๐2+ 2๐โฒฮ๐ (
1
2ฮ๐๐๐+
1
ฮ๐2)
middle rows, LHS (same as that of eq1), unaffected by BC =
i = 2, N-1 โ2
ฮ๐2๐๐,๐โ1 +
2๐๐,๐
ฮ๐2+ 2๐โฒฮ๐ (
1
2ฮ๐๐๐+
1
ฮ๐2)
1
1
6
last row,
๐ = ๐ 2๐๐โ1,๐๐๐2ฮ๐ง2
โ2๐๐,๐๐๐2ฮ๐ง2
= โ2
ฮ๐2๐๐,๐โ1 +
2๐๐,๐ฮ๐2
+ 2๐โฒฮ๐ (1
2ฮ๐๐๐+
1
ฮ๐2)
Again, ๐ด๐๐,๐๐+1 = ๐๐,๐
๐
You have called the Thomas Algorithm (M+1) times to invert the tridiagonal A matrix to solve
๐๐,๐ , ๐ = 1, ๐
๐ = 0,๐} using the guess values on the RHS of the tridiagonal matrix .
You must have noted that we did not prepare the tridiagonal matrix, and instead directly
substituted the BCs in the discretized equations! As an exercise, prepare the tridiagonal matrix
by defining individuals elements of rows for every โjโ viz a(i, j), b(i, j)โฏโฏ, substitute BCs and
see if you get the same equations for different โฒ๐๐ โฒ.
Now, this is the time to compare the solved ๐๐,๐ values with the guess values you made at the
beginning of the iterations before starting the iterations.
โ From the programming point of view, you should be able to choose reasonable values of all
variables including, D, Vmax, M and Pe,mass transport, or H and Pe,heat transport .
โ As earlier noted, solving elliptic PDE is computational extensive, requiring guess values,
iterations and convergence. Very often, one artificially inserts a transient term
(๐๐ถ๐ด
๐๐ก or ๐๐ถ๐
๐๐
๐๐ก or ๐
๐๏ฟฝ๏ฟฝ
๐๐ก) and seeks SS solutions, which is the focus of the last two lectures.
1
Lecture #26-27
๐๐๐๐ โ ๐๐๐๐๐๐๐๐๐ก 2๐ท ๐๐๐๐๐๐๐๐๐ ๐๐ท๐ธ: ๐ด๐ท๐ผ ๐๐๐กโ๐๐
We are solving, for examples:
๐๐ถ๐ด
๐๐ก+ ๐. โ๐ถ๐ด = ๐ทโ2๐ถ๐ด + (โ๐๐ด) ; ๐ถ๐ด(๐ก, ๐, ๐ฅ)
or
๐๐ถ๐ (๐๐
๐๐ก+ ๐. โ๐) = ๐โ2๐ + (โ๐๐ด)(ฮ๐ป) ; ๐(๐ก, ๐, ๐ฅ)
Note: SS solution must be the same as that of the converged solution of the analogous
2D elliptic PDE (๐๐ถ๐ด
๐๐ก=
๐๐
๐๐ก= 0) discussed in the previous lectures.
Let us take a general case of the time-dependent 2D PDE:
๐๐
๐๐ก= ๐๐๐ + ๐๐ + ๐๐๐ + ๐๐ ; ๐(๐ก, ๐ฅ, ๐ฆ)
with necessary IC and BCs.
Apply Crank-Nicholson method/scheme to discretize ๐๐๐ , ๐๐๐, ๐๐ , ๐๐๐ ๐๐ terms, in
the similar fashion solved the time-dependent 1D PDE on ๐(๐ก, ๐ฅ):
(๐๐ก+1 โ ๐๐ก
ฮ๐ก)
๐,๐
=1
2[(
๐๐+1,๐ โ 2๐๐,๐ + ๐๐โ1,๐
ฮ๐2 )
๐ก+1
+ (๐๐+1,๐ โ ๐๐โ1,๐
2ฮX )
๐ก+1
+ (๐๐,๐+1 โ 2๐๐,๐ + ๐๐,๐โ1
ฮ๐2 )
๐ก
+ (๐๐,๐+1 โ ๐๐,๐โ1
2ฮY )
๐ก
]
- This way the X-derivatives have been discretized implicitly on time, whereas the Y-
derivatives have been discretized explicitly.
- Alternatively, one can discretize Y-derivatives implicitly on time, whereas X-
derivatives can be discretized explicitly.
- Re-arranging the terms as ๐ดโ ๐ฅ๐ก+1 = โ ๐ฆ
๐ก ๐๐ ๐ดโ ๐ฆ๐ก+1 = โ ๐ฅ
๐ก from either scheme, it
is clear that โAโ will be a tridiagonal matrix, and one can proceed on time-step by
solving ๐ on X-Y plane:
2
(1
2ฮ๐2โ
1
4ฮ๐) ๐๐โ1,๐
๐ก+1 โ (1
ฮ๐ก+
1
ฮ๐2) ๐๐,๐
๐ก+1 + (1
2ฮ๐2+
1
4ฮ๐) ๐๐+1,๐
๐ก+1
= (1
4ฮ๐โ
1
2ฮ๐2) ๐๐,๐โ1
๐ก โ (1
ฮ๐กโ
1
ฮ๐2) ๐๐,๐
๐ก โ (1
4ฮ๐+
1
2ฮ๐2) ๐๐,๐+1
๐ก
- This way you are โmarchingโ in โ๐โ direction and โsweepingโ in โiโ direction.
By the second scheme, if you โmarchโ in โiโ direction and โsweepโ in โ๐โ-direction, you will
get the following equation:
(1
4ฮ๐โ
1
2ฮ๐2) ๐๐,๐โ1๐ก+1 + (
1
ฮ๐ก+
1
ฮ๐2) ๐๐,๐๐ก+1 โ (
1
4ฮ๐+
1
2ฮ๐2) ๐๐,๐+1๐ก+1
= (1
2ฮ๐2โ
1
4ฮ๐) ๐๐โ1,๐
๐ก + (1
ฮ๐กโ
1
ฮ๐2) ๐๐,๐
๐ก + (1
2ฮ๐2+
1
4ฮ๐) ๐๐+1,๐
๐ก
Both schemes will work and the Crank-Nicholson method will produce 2nd order
accuracy.
- Alternate Direct Implicit (ADI) method is an improved method producing 4th
order accuracy without any extra computational cost (for more, refer the book by
Ferziger):
First discretize ๐๐ and ๐๐๐ terms implicitly and ๐๐ and ๐๐๐ terms explicitly to solve ๐
over half step (ฮ๐ก 2โ ) and then discretize ๐๐ and ๐๐๐ terms implicitly and ๐๐ and ๐๐๐ terms
explicitly over the next half step:
Step1:
(๐๐ก+1
2โ โ ๐๐ก
ฮ ๐ก 2โ)
๐,๐
=1
2[(๐๐๐ + ๐๐)๐ก+1
2โ + (๐๐๐ + ๐๐)๐ก]
Step2:
(๐๐ก+1 โ ๐๐ก+1
2โ
ฮ ๐ก 2โ)
๐,๐
=1
2[(๐๐๐ + ๐๐)๐ก+1
2โ + (๐๐๐ + ๐๐)๐ก+1]
or ๐ด๐๐ฅ
๐ก+12โ
= ๐๐ฆ๐ก
and ๐ต๐๐ฆ๐ก+1 = ๐๐ฅ
๐ก+12โ
}
The procedure can also be understood by the following illustration:
๐๐๐๐๐๐๐๐ก ๐๐ฅ๐๐๐๐๐๐ก
๐๐ฅ๐๐๐๐๐๐ก ๐๐๐๐๐๐๐๐ก
3
Ex: Consider 2D diffusion in a rectangular shaped solid porous carbon block. The block is
initially soaked with moisture, say at concentration ๐ถ๐ (๐๐๐๐๐ ๐3)โ . At ๐ก = 0+ all four sides of
the block are exposed to dry air (moisture concentration = ๐ถ๐ โช ๐ถ๐). We are interested in
calculating the unsteady-state concentration profiles of moisture within the block, ie. ๐ถ(๐ก, ๐ฅ, ๐ฆ) =
?. Pore diffusion coefficient for moisture in solid is ๐ท๐๐๐๐.
Ans:
A species balance over โฒฮ๐ฮ๐ฆ. 1โฒ ๐ถ๐ will yield the following conservation equation:
๐๐ถ๐ด
๐๐ก+ ๐. โ๐ถ๐ด = ๐ท๐๐๐๐โ2๐ถ๐ด + (โ๐๐ด)
๐๐ถ๐ด
๐๐ก= ๐ท๐๐๐๐ (
๐2๐ถ๐ด
๐๐2+
๐2๐ถ๐ด
๐๐ฆ2)
๐ก = 0 ๐ถ = ๐ถ๐ ๐๐๐ ๐ฟ โฅ ๐ฅ โฅ 0 ; ๐ค โฅ ๐ฆ โฅ 0
0+ ๐ถ = ๐ถ๐
โ @ ๐ฅ = 0 & ๐ฟ for ๐ค > ๐ฆ > 0
and @ ๐ฆ = 0 & ๐ค for ๐ฟ > ๐ฅ > 0}
(๐ถ๐โ is the solid phase moisture concentration at the surface of the block in equilibrium with
๐ถ๐ in atmoshphere).
๐, ๐ + 1
๐ + 1, ๐ ๐ โ 1, ๐
๐, ๐ โ 1
๐, ๐
๐ก
๐ โ 1, ๐ ๐ + 1, ๐
๐, ๐ + 1
๐, ๐ โ 1
๐, ๐
๐ก + 12โ
๐ก + 12โ
๐ก + 1
๐ โ 1, ๐
๐, ๐ + 1
๐, ๐ โ 1
๐, ๐ ๐ + 1, ๐
๐ก + 12โ
๐ ๐ค๐๐๐ โฒ๐โฒ
๐๐๐๐โ โฒ๐โฒ
๐ ๐ค๐๐๐ โฒ๐โฒ
๐๐๐๐โ โฒ๐โฒ
๐ถ๐ ๐๐๐๐๐ ๐3โ
๐ฟ
๐ฆ
๐ค
ฮ๐
ฮ๐ฆ
X
C(t, x, y) =?
4
Step1: discretize โ๐โ implicitly and โ๐โ explicitly over (๐ก & ๐ก + 12โ )
๐ถ๐,๐
๐ก+12โ
โ ๐ถ๐,๐๐ก
ฮ๐ก2โ
=๐ท๐๐๐๐
2[(
๐ถ๐+1,๐ โ 2๐ถ๐,๐ + ๐ถ๐โ1,๐
ฮ๐2 )
๐ก+12โ
+ (๐ถ๐,๐+1 โ 2๐ถ๐,๐ + ๐ถ๐,๐โ1
ฮ๐ฆ2 )
๐ก
]
(ฮ๐ = L๐โ , ฮ๐ฆ = w
๐โ )
Arrange:
๐ท๐๐๐๐
2ฮ๐2 ๐ถ๐โ1,๐
๐ก+12โ
โ (๐ท๐๐๐๐
ฮ๐2 +2
ฮ๐ก ) ๐ถ
๐,๐
๐ก+12โ
+๐ท๐๐๐๐
2ฮ๐2 ๐ถ๐+1,๐
๐ก+12โ
= โ๐ท๐๐๐๐
2ฮ๐ฆ2 ๐ถ๐,๐โ1๐ก + (
๐ท๐๐๐๐
ฮ๐ฆ2 โ2
ฮ๐ก ) ๐ถ๐,๐
๐ก โ
๐ท๐๐๐๐
2ฮ๐ฆ2 ๐ถ๐,๐+1๐ก
๐ = 1, ๐ โ 1๐ = 1, ๐ โ 1
Step-2:
Discretize BCs: ๐ถ๐,๐ = ๐ถ๐,๐ = ๐ถโ; ๐ = 0, ๐
๐ถ๐,0 = ๐ถ๐,๐ = ๐ถโ; ๐ = 0, ๐
Prepare the tridiagonal matrix:
๐(๐, ๐) = ๐ท๐๐๐๐
2ฮ๐2 ; ๐(๐, ๐) = โ (๐ท๐๐๐๐
ฮ๐2 +2
ฮ๐ก ) ; ๐(๐, ๐) =
๐ท๐๐๐๐
2ฮ๐2 ; ๐(๐, ๐) = โ๐ท๐๐๐๐
2ฮ๐ฆ2 ๐ถ๐,๐โ1๐ก +
(๐ท๐๐๐๐
ฮ๐ฆ2โ
2
ฮ๐ก ) ๐ถ๐,๐
๐ก โ๐ท๐๐๐๐
2ฮ๐ฆ2 ๐ถ๐,๐+1
๐ก
๐ = 1, ๐ โ 1๐ = 1, ๐ โ 1
}
M
M โ 1
(i, j + 1)
0 ๐ โ 1, j 1 (๐, j) ๐ + 1, j ๐ โ 1 ๐
(๐, j โ 1)
โ 1 1
0
5
Substitute BCs and the following coefficients will be modified:
๐(1, ๐) = ๐(1, ๐) โ ๐(1, ๐)๐ถโ
๐(๐ โ 1, ๐) = ๐(๐ โ 1, ๐) โ ๐(๐ โ 1, ๐)๐ถโ} ๐ = 1, ๐ โ 1
Convince yourself that no other coefficients will change. This was actually an easy
problem, when all four boundary conditions were simple, i.e., functional values were prescribed.
Problems are complicated when you have โfluxโ/gradient or mixed boundary conditions; for
example,
โ๐ท๐๐ถ
๐๐= ๐๐(๐ถ โ ๐ถ๐๐ก๐)
๐๐ = Flux (known)
and/or โ๐ท๐๐ถ
๐๐ฆ= ๐๐ถ ๐๐ ๐๐(๐ถ โ ๐ถ๐๐ก๐)
In such cases the other coefficients may also change. Revert to the previous step.
Tridiagonal (๐ โ 1, ๐, ๐, ๐, ๐, ๐ฆ(๐, ๐)) ๐ = 1, ๐ โ 1
You will be calling the subroutine โฒ๐ โ 1โฒ times as you โmarchโ along โฒ๐โฒ direction. Now, you
have the values for ๐ถ๐,๐
๐ก+12โ
, ๐ = 1, ๐ โ 1๐ = 1, ๐ โ 1
Step3:
Now march along โฒ๐โฒ direction and โsweepโ along โฒ๐โฒ direction to solve for
๐ถ๐,๐๐ก+1 from ๐ถ
๐,๐
๐ก+12โ.
๐ถ๐,๐๐ก+1 โ๐ถ
๐,๐
๐ก+12โ
ฮ๐ก2โ
=๐ท๐๐๐๐
2[(
๐ถ๐โ1,๐โ2๐ถ๐,๐+๐ถ๐+1,๐
ฮ๐2 )
๐ก+12โ
+ (๐ถ๐,๐โ1โ2๐ถ๐,๐+๐ถ๐,๐+1
ฮ๐ฆ2 )
๐ก+1
]
Arrange:
๐ท๐๐๐๐
2ฮ๐ฆ2 ๐ถ๐,๐โ1
๐ก+1 โ (๐ท๐๐๐๐
ฮ๐ฆ2+
2
ฮ๐ก ) ๐ถ๐,๐
๐ก+1 +๐ท๐๐๐๐
2ฮ๐ฆ2 ๐ถ๐,๐+1
๐ก+1 = โ๐ท๐๐๐๐
2ฮ๐2 ๐ถ
๐โ1,๐
๐ก+12โ
+ (๐ท๐๐๐๐
ฮ๐2โ
2
ฮ๐ก ) ๐ถ
๐,๐
๐ก+12โ
โ๐ท๐๐๐๐
2ฮ๐2 ๐ถ๐+1,๐
๐ก+12โ ;
๐ = 1, ๐ โ 1๐ = 1, ๐ โ 1
}
๐๐ฅ๐๐๐๐๐๐ก ๐๐๐๐๐๐๐๐ก
6
Step-4:
Discretize the BCs: Same as before.
Prepare the tridiagonal matrix:
๐(๐, ๐) = ๐ท๐๐๐๐
2ฮ๐ฆ2 ; ๐(๐, ๐) = โ (๐ท๐๐๐๐
ฮ๐ฆ2 +2
ฮ๐ก ) ; ๐(๐, ๐) =
๐ท๐๐๐๐
2ฮ๐ฆ2 ; ๐(๐, ๐) = โ๐ท๐๐๐๐
2ฮ๐2 ๐ถ๐โ1,๐
๐ก+12โ
+
(๐ท๐๐๐๐
ฮ๐2 โ2
ฮ๐ก ) ๐ถ
๐,๐
๐ก+12โ
โ๐ท๐๐๐๐
2ฮ๐2 ๐ถ๐+1,๐
๐ก+12โ ;
๐ = 1, ๐ โ 1๐ = 1, ๐ โ 1
}
Substitute the discretized BCs, and only the following coefficients will be modified:
๐(๐, 1) = ๐(๐, 1) โ ๐(๐, 1)๐ถโ
๐(๐, ๐ โ 1) = ๐(๐, ๐ โ 1) โ ๐(๐, ๐ โ 1)๐ถโ} ๐ = 1, ๐ โ 1
Tridiagonal (๐ โ 1, ๐, ๐, ๐, ๐, ๐ฆ(๐, ๐)) ๐ = 1, ๐ โ 1
You will be calling the subroutine โฒ๐ โ 1โฒ times as you โmarchโ along โฒ๐โฒ direction. Thus, you
have solved for ๐ถ๐,๐๐ก+1,
๐ = 1, ๐ โ 1๐ = 1, ๐ โ 1
Recap (solving 2nd order ODE and PDEs at a glance)
BVP: ๐ด๐๐ = ๐ (Direct Method)
1D parabolic: ๐ด๐๐๐ก+1 = ๐๐
๐ก (Crank-Nicholson Method)
2D Elliptic: ๐ด๐๐,๐ = ๐๐,๐๐๐ข๐๐ ๐
or ๐ด๐๐,๐ = ๐๐,๐๐๐ข๐๐ ๐
(Method of Lines)
2D parabolic: (ADI Method)
๐ด๐๐
๐ก+12โ
= ๐๐๐ก
and ๐ต๐๐๐ก+1 = ๐
๐
๐ก+12โ
} or ๐ด๐
๐
๐ก+12โ
= ๐๐๐ก
and ๐ต๐๐๐ก+1 = ๐
๐
๐ก+12โ
}
where, A and B are the Tridiagonal matrices.
1
Lecture #28
Example: Consider the SS flow of a liquid through a long tube. Reynolds number is 180. At
time ๐ก = 0, a tracer is injected into the liquid at inlet to the tube. Diffusion coefficient of tracer
in the liquid is ๐ท ๐๐2 ๐ โ . Determine the time profiles of the tracer concentrations (๐, ๐ฅ) in the
tube, ie. ๐ถ(๐ก, ๐, ๐ฅ) =?
Soln.
A species balance over โฒ2๐๐ฮ๐ฮ๐ฅโฒ ๐ถ๐ yields the following eqn
๐๐ถ
๐๐ก+ ๐. โ๐ถ = ๐ทโ2๐ถ + (โ๐๐ด)
or
๐๐ถ
๐๐ก+ ๐(๐)
๐๐ถ
๐๐= ๐ท (
๐2๐ถ
๐๐2+1
๐
๐
๐๐(๐
๐๐ถ
๐๐))
๐ฟ > ๐ > 0๐ > ๐ > 0
or ๐๐ถ
๐๐ก= (โ๐(๐)
๐๐ถ
๐๐+ ๐ท
๐2๐ถ
๐๐2) + ๐ท (
1
๐
๐๐ถ
๐๐+๐2๐ถ
๐๐2)
๐ก = 0 ๐ถ = 0 ๐ฟ โฅ ๐ฅ โฅ 0 and ๐ โฅ ๐ โฅ 0
0+ ๐ถ = ๐ถ๐ @ ๐ฅ = 0
๐๐ถ
๐๐= 0 @ ๐ = ๐ฟ
} for all ๐ > ๐ > 0
(long tube approximation)
๐๐ถ
๐๐= 0 @๐ = 0 (๐ ๐ฆ๐๐๐๐ก๐๐๐)
= 0 @๐ = ๐ (๐๐๐ โ ๐๐๐๐๐ก๐๐ฃ๐ ๐ค๐๐๐๐ )} ๐๐๐ ๐๐๐ ๐ฟ > ๐ > 0
๐ถ๐ ๐
๐
๐ฟ
ฮ๐ ๐
ฮ๐
๐
๐
ฮ๐ X
C(t,r,x)=?
V(r) = Umax (1 โ๐2
๐ 2)
2
Note: You will encounter discontinuity at ๐ = 0 in the radial diffusion terms while discretizing.
Considering โ๐ถ = 0, you will be solving the approximated equation instead.
๐๐ถ
๐๐ก= (โ๐(๐)
๐๐ถ
๐๐+๐ท
๐2๐ถ
๐๐2) + 2๐ท
๐2๐ถ
๐๐2 ๐๐ก ๐ = 0 ๐๐๐ ๐๐๐ ๐ฟ > ๐ > 0
Discretize the approximated equation:
๐ถ๐,๐
๐ก+1 2โ โ ๐ถ๐,๐๐ก
ฮ๐ก2โ
=1
2[((โ๐๐)
๐ถ๐+1,๐ โ ๐ถ๐โ1,๐
2ฮ๐ + ๐ท
๐ถ๐+1,๐ โ 2๐ถ๐,๐ + ๐ถ๐โ1,๐
ฮ๐2 )
๐ก+1 2โ
+ 2๐ท (๐ถ๐,๐+1 โ 2๐ถ๐,๐ + ๐ถ๐,๐โ1
ฮ๐2 )๐ก
] ; ๐ = 0๐ = 1,๐
}
Arrange;
(๐๐
4ฮ๐+
๐ท
2ฮ๐2) ๐ถ
๐โ1,๐
๐ก+1 2โ โ (2
ฮ๐ก+
๐ท
ฮ๐2) ๐ถ
๐,๐
๐ก+1 2โ โ (๐๐
4ฮ๐โ
๐ท
2ฮ๐2) ๐ถ
๐+1,๐
๐ก+1 2โ
= โ(๐ท
ฮ๐2)๐ถ๐,๐โ1
๐ก โ (2
ฮ๐กโ2๐ท
ฮ๐2)๐ถ๐,๐
๐ก โ (๐ท
ฮ๐2)๐ถ๐,๐+1
๐ก ; ๐ = 0๐ = 1,๐
}
(๐, M)
(๐, M โ 1)
(i, j + 1)
๐ = 0 ๐ โ 1, j 1 (๐, j) ๐ + 1, j ๐ โ 1 ๐
(๐, j โ 1)
โ 1
implicit
0 j =
explicit
1
3
Similarly, discretize the main equation:
๐ถ๐,๐
๐ก+1 2โ โ ๐ถ๐,๐๐ก
ฮ๐ก2โ
=1
2[((โ๐๐)
๐ถ๐+1,๐ โ ๐ถ๐โ1,๐
2ฮ๐ + ๐ท
๐ถ๐+1,๐ โ 2๐ถ๐,๐ + ๐ถ๐โ1,๐
ฮ๐2 )
๐ก+1 2โ
+ ๐ท (1
๐๐
๐ถ๐,๐+1 โ ๐ถ๐,๐โ1
2ฮ๐ +๐ถ๐,๐+1 โ 2๐ถ๐,๐ + ๐ถ๐,๐โ1
ฮ๐2 )
๐ก
] ๐ = 1,๐๐ = 1,๐
}
Arrange,
(๐๐
4ฮ๐+
๐ท
2ฮ๐2) ๐ถ
๐โ1,๐
๐ก+1 2โ โ (2
ฮ๐ก+
๐ท
ฮ๐2) ๐ถ
๐,๐
๐ก+1 2โ โ (๐๐
4ฮ๐โ
๐ท
2ฮ๐2) ๐ถ
๐+1,๐
๐ก+1 2โ
= (๐ท
4๐๐ฮ๐โ
๐ท
2ฮ๐2)๐ถ๐,๐โ1
๐ก โ (2
ฮ๐กโ
๐ท
ฮ๐2)๐ถ๐,๐
๐ก
โ (๐ท
4๐๐ฮ๐+
๐ท
2ฮ๐2)๐ถ๐,๐+1
๐ก ; ๐ = 1,๐๐ = 1,๐
}
Note: ๐๐ = ๐๐๐๐ฅ (1 โ๐๐2
๐ 2) ; ๐๐ = ๐ฮ๐
Discretize BCs & IC
๐ก = 0, ๐ถ(๐, ๐) = 0 ๐r a small number ๐ถ๐๐๐ก โช ๐ถ๐ (๐ โฅ ๐ โฅ 0 ๐๐๐ ๐ โฅ ๐ โฅ 0)
0+ ๐ถ(0, ๐) = ๐ถ๐ ๐ถ(๐+1,๐)โ๐ถ(๐โ1,๐)
ฮ๐= 0
๐๐ ๐ถ(๐ + 1, ๐) = ๐ถ(๐ โ 1, ๐)
} ๐ > ๐ > 0
๐ถ(๐, โ1) = ๐ถ(๐, +1)
๐ถ(๐, ๐ + 1) = ๐ถ(๐,๐ โ 1)}๐ > ๐ > 0
Prepare tridiagonal matrix
๐ = 0: ๐(๐, 0) = (๐0
4ฮ๐+
๐ท
2ฮ๐2) ; ๐(๐, 0) = โ(
2
ฮ๐ก+
๐ท
ฮ๐2) ; ๐(๐, 0) = โ(
๐0
4ฮ๐โ
๐ท
2ฮ๐2) ; ๐(๐, 0) =
โ (๐ท
ฮ๐2)๐ถ๐,โ1
๐ก โ (2
ฮ๐กโ
2๐ท
ฮ๐2)๐ถ๐,0
๐ก โ (๐ท
ฮ๐2)๐ถ๐,+1
๐ก ; ๐ = 1,๐
Substitute BCs,
๐(1,0) = โ(2๐ท
ฮ๐2)๐ถ1,1
๐ก โ (2
ฮ๐กโ2๐ท
ฮ๐2) ๐ถ1,0
๐ก โ ๐(1,0)๐ถ๐
๐(๐, 0) = ๐(๐, 0) + ๐(๐, 0)
implicit
explicit
4
๐(๐, 0) = โ(2๐ท
ฮ๐2)๐ถ๐,1
๐ก โ (2
ฮ๐กโ
2๐ท
ฮ๐2)๐ถ๐,0
๐ก
Tridiagonal (๐, ๐, ๐, ๐, ๐, ๐ฆ๐ก+12โ (๐, 0)) ; ๐ = 1, ๐
Preparation of tridiagonal matrixโฆ continueโฆ.
๐(๐, ๐) = (๐๐
4ฮ๐+
๐ท
2ฮ๐2) ; ๐(๐, ๐) = โ (
2
ฮ๐ก+
๐ท
ฮ๐2) ; ๐(๐, ๐) = โ(
๐๐
4ฮ๐โ
๐ท
2ฮ๐2) ; ๐(๐, ๐)
= (๐ท
4๐๐ฮ๐โ
๐ท
2ฮ๐2)๐ถ๐,๐โ1
๐ก โ (2
ฮ๐กโ
๐ท
ฮ๐2)๐ถ๐,๐
๐ก
โ (๐ท
4๐๐ฮ๐+
๐ท
2ฮ๐2)๐ถ๐,๐+1
๐ก ๐ = 1,๐๐ = 1,๐
}
Sbustitute BC (๐ = 1,๐ โ 1)
๐(1, ๐) = ๐(1, ๐) โ ๐(1, ๐)๐ถ๐
๐(๐, ๐) = ๐(๐, ๐) + ๐(๐, ๐)
Tridiagonal (๐, ๐, ๐, ๐, ๐, ๐ฆ๐ก+12โ (๐, ๐)) ;
๐ = 1, ๐๐ = 1,๐ โ 1
}
You have called the tridiagonal subroutine โฒ๐ โ 1โฒ times for the interior nodes.
Substitute BC @ ๐ = ๐
๐(1,๐) = โ(๐ท
ฮ๐2)๐ถ๐,๐โ1
๐ก โ (2
ฮ๐กโ
๐ท
ฮ๐2)๐ถ๐,๐
๐ก โ a(1, N). Co
๐(๐,๐) = โ(2
ฮ๐2)๐ถ๐,๐โ1
๐ก โ (2
ฮ๐กโ
๐ท
ฮ๐2)๐ถ๐,๐
๐ก
๐(๐,๐) = ๐(๐,๐) + ๐(๐,๐)
๐(๐,๐) = โ(๐ท
ฮ๐2)๐ถ๐,๐โ1
๐ก โ (2
ฮ๐กโ
๐ท
ฮ๐2)๐ถ๐,๐
๐ก
Tridiagonal (๐, ๐, ๐, ๐, ๐, ๐ฆ๐ก+12โ (๐,๐)) ; ๐ = 1,๐
(Therefore, you have called the Thomas Algorithm (๐ + 1) times while sweeping ๐ =
0,๐ rows)
5
For the last time in this course, let us write down complete eqn
๐ด๐ฆ๐ก+12โ = ๐๐ก ๐๐๐ ๐ = 0, ๐ = 1,๐
[ โ (
2
ฮ๐ก+
๐ท
ฮ๐ฅ2) โ (
๐04ฮ๐
+๐ท
2ฮ๐2) โฏ โฏ โฏ
โฏ (๐04ฮ๐
+๐ท
2ฮ๐2) โ(
2
ฮ๐ก+
๐ท
ฮ๐ฅ2) โ(
๐04ฮ๐
โ๐ท
2ฮ๐2) โฏ
โฎ โฎ โฎ โฎ โฎ
โฏ โฏ โฏ (๐ท
ฮ๐ฅ2) โ(
2
ฮ๐ก+
๐ท
ฮ๐ฅ2)]
{
๐๐
}
๐ก+1 2โ
=
{
๐(1,0)โฎ
๐(๐, 0)๐ = 2, ๐ โ 1
โฎโฎ
๐(๐, 0) }
๐ก
Similarly, you can write a set of equations for ๐ = 1,๐ โ 1 and ๐ = ๐ using the coefficient as
above:
๐ = 1,๐ โ 1
[ โ (
2
ฮ๐ก+
4
ฮ๐ฅ2) โ (
๐๐
4ฮ๐+
๐ท
2ฮ๐2) โฏ โฏ โฏ
โฏ (๐๐
4ฮ๐+
๐ท
2ฮ๐2) โ(
2
ฮ๐ก+
๐ท
ฮ๐ฅ2) โ(
๐๐
4ฮ๐โ
๐ท
2ฮ๐2) โฏ
โฎ โฎ โฎ โฎ โฎ
โฏ โฏ โฏ (๐ท
ฮ๐ฅ2) โ(
2
ฮ๐ก+
๐ท
ฮ๐ฅ2)]
{
๐๐
}
๐ก+1 2โ
=
{
๐(๐, ๐)โฎ
๐(๐, ๐)๐ = 2, ๐ โ 1
โฎโฎ
๐(๐, ๐) }
๐ก
6
๐ = ๐
[ โ (
2
ฮ๐ก+
4
ฮ๐ฅ2) โ (
๐๐4ฮ๐
โ๐ท
2ฮ๐2) โฏ โฏ โฏ
โฏ (๐๐4ฮ๐
+๐ท
2ฮ๐2) โ(
2
ฮ๐ก+
๐ท
ฮ๐ฅ2) โ(
๐๐4ฮ๐
โ๐ท
2ฮ๐2) โฏ
โฎ โฎ โฎ โฎ โฎ
โฏ โฏ โฏ (๐ท
ฮ๐ฅ2) โ(
2
ฮ๐ก+
๐ท
ฮ๐ฅ2)]
{
๐๐
}
๐ก+1 2โ
=
{
๐(1,๐)โฎ
๐(๐,๐)๐ = 2, ๐ โ 1
โฎโฎ
๐(๐,๐) }
๐ก
Now, sweep in โฒ๐โฒ direction and march in โฒ๐โฒ direction for (๐ก + 1) based on the ๐ฆ(๐, ๐) values you
determined at (๐ก + 1 2โ ) step (above)
๐ด๐ฆ๐ก+1(๐, ๐) = ๐๐ก+12 โ
๐ = 1,๐๐ = 0,๐
}
Discretize ๐ = 0
๐ถ๐,๐๐ก+1 โ ๐ถ
๐,๐
๐ก+1 2โ
ฮ๐ก2โ
=1
2[((โ๐๐)
๐ถ๐+1,๐ โ ๐ถ๐โ1,๐
2ฮ๐ + ๐ท
๐ถ๐+1,๐ โ 2๐ถ๐,๐ + ๐ถ๐โ1,๐
ฮ๐2 )
๐ก+1 2โ
+ 2๐ท (๐ถ๐,๐+1 โ 2๐ถ๐,๐ + ๐ถ๐,๐โ1
ฮ๐2 )๐ก+1
] (๐ = 1,๐)
๐ = 1,๐
implicit
explicit
7
๐ถ๐,๐๐ก+1 โ ๐ถ
๐,๐
๐ก+1 2โ
ฮ๐ก2โ
=1
2[((โ๐๐)
๐ถ๐+1,๐ โ ๐ถ๐โ1,๐
2ฮ๐ + ๐ท
๐ถ๐+1,๐ โ 2๐ถ๐,๐ + ๐ถ๐โ1,๐
ฮ๐2 )
๐ก+1 2โ
+ ๐ท (1
๐๐
๐ถ๐,๐+1 โ ๐ถ๐,๐โ1
2ฮ๐ +๐ถ๐,๐+1 โ 2๐ถ๐,๐ + ๐ถ๐,๐โ1
ฮ๐2 )
๐ก+1
] (๐ = 1, ๐)
In this last lecture of the course, I leave it here for you to do the remaining part (arranging the
terms and applying BCs for ๐ = 1, (2โฏ๐ โ 1), ๐ rows to invert the matrix) as you sweep in
โฒ๐โฒ direction, as an exercise. The topic on ADI stops here.
Note: (1) The SS solution ๐ฆ(๐ก, ๐ฅ, ๐) ๐๐ ๐ก โ โ of the time-dependent 2D parabolic equation
must be the same as that of the corresponding 2D elliptic PDE you have learnt how to solve in
the preceding lecture, using โMethod of Linesโ, i.e. for
๐๐ถ
๐๐ก+ ๐. โ๐ถ = ๐ทโ2๐ถ + (โ๐๐ด) ;
๐ถ(๐ก, ๐ฅ, ๐) ๐๐ ๐ก โ โ must be the same as that of
๐. โ๐ถ = ๐ทโ2๐ถ + (โ๐๐ด) โ ๐ถ(๐ฅ, ๐)
(2) A question arises. When asked to solve the elliptic (2D) PDE, should not or cannot we
artificially insert the transient term ๐๐ถ
๐๐ก and seek the SS solution to the corresponding time-
dependent 2D parabolic equation? Very often, yes. Recall that, solving elliptic PDE requires
iterations and there is always a convergence issue. How many iterations? On the other hand,
the parabolic equation does not require iterations, and you march on โฒ๐กโฒ axis solving ๐ฆ(๐ฅ, ๐) at
every time step without iterations. Therefore, more than often the ADI method is preferred
over โMethod of Linesโ for solving an elliptic (2D) PDE. Insert the transient term and solve till
you have SS solution.
(3) Before closing this chapter, let us answer how we address non-linearity in the differential
term, for example, V๐๐
๐๐ฅ of the NS equation? The answer is simple. By iterations! Guess velocity
fields (Vg). Discretize the derivative term as before. Solve for velocity fields as before. Iterate
till there is convergence. Alternatively, Taylorโs series can also be used to approximate velocity
fields by linearlization, in which case guesses are required for the velocity gradients.
End โ Semester Exam These lectures are usually covered in approximately 42 one-hour or 28 1hr 15min lectures.
All comments including suggestions and corrections may be sent to [email protected] .