Attachment
Attachment
Differential Equations
http://numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM Undergraduates
9/15/2011 http://numericalmethods.eng.usf.edu 1
Defining Parabolic PDE’s
The general form for a second order linear PDE with two independent
variables and one dependent variable is
∂ 2u ∂ 2u ∂ 2u
A 2 +B +C 2 + D =0
∂x ∂x∂y ∂y
Recall the criteria for an equation of this type to be considered parabolic
B 2 − 4 AC = 0
For example, examine the heat-conduction equation given by
∂ 2T ∂T
α 2 = , where A = α , B = 0, C = 0, D = −1
∂x ∂t
Then
B 2 − 4 AC = 0 − 4(α )(0)
=0
thus allowing us to classify this equation as parabolic.
Physical Example of an Elliptic
PDE
i −1 i i +1
Schematic diagram showing interior nodes
L
For a rod of length L divided into n + 1 nodes ∆x =
n
The time is similarly broken into time steps of ∆t
i −1 i i +1
L
If we define ∆x = we can then write the finite central divided difference
n
approximation of the left hand side at a general interior node ( i ) as
i −1 i i +1
∂T Ti j +1 − Ti j
≅
∂t i, j ∆t
The Explicit Method
Substituting these approximations into the governing equation yields
∆t
Ti j +1 = Ti j + α
(∆x) 2
T j
i +1(− 2Ti
j
+ T j
i −1 )
choosing,
∆t
λ =α
(∆x) 2
we can write the equation as,
Ti j +1
= Ti + λ T j
( j
i +1 − 2Ti + T
j j
i −1 ) .
The Explicit Method
Ti j +1
= Ti + λ T
j
( j
i +1 − 2Ti + T
j j
i −1 )
•This equation can be solved explicitly because it can be written for each
internal location node of the rod for time node j + 1 in terms of the
temperature at time node j .
•We continue the process by first finding the temperature at all nodes j = 1 ,
and using these to find the temperature at the next time node, j = 2 .This
process continues until we reach the time at which we are interested in
finding the temperature.
Example 1: Explicit Method
Consider a steel rod that is subjected to a temperature of 100°C on the left
end and 25°C on the right end. If the rod is of length 0.05m ,use the explicit
method to find the temperature distribution in the rod from t = 0 and t = 9
seconds. Use ∆x = 0.01m , ∆t = 3s .
W kg J
Given: k = 54 , ρ = 7800 3 , C = 490
m−K m kg − K
i=0 1 2 3 4 5
T =100 ° C T = 25 °C
0.01m
Example 1: Explicit Method
Recall, Number of time steps,
k t final − t initial
α= =
ρC ∆t
9−0
therefore, =
3
54
α= = 3.
7800 × 490
= 1.4129 × 10 −5 m 2 / s. Boundary Conditions
T0 j = 100°C
Then, for all j = 0,1,2,3
∆t T5 = 25°C
j
λ =α
(∆x )2
= 1.4129 × 10 −5
3 All internal nodes are at 20°C
(0.01) 2
for t = 0 sec . This can be
= 0.4239 . represented as,
Ti 0 = 20°C , for all i = 1,2,3,4
Example 1: Explicit Method
Nodal temperatures when t = 0 sec , j = 0 :
T00 = 100°C
T10 = 20°C
T20 = 20°C
Interior nodes
T30 = 20°C
T40 = 20°C
T50 = 25°C
Ti j +1
= Ti + λ Tj
( j
i +1 − 2Ti + T
j j
i −1 )
Example 1: Explicit Method
Nodal temperatures when t = 3 sec (Example Calculations)
i=0 T01 = 100°C − Boundary Condition
setting j=0
i =1 (
T11 = T10 + λ T20 − 2T10 + T00 ) i=2 (
T21 = T20 + λ T30 − 2T20 + T10 )
= 20 + 0.4239(20 − 2(20) + 100 ) = 20 + 0.4239(20 − 2(20) + 20 )
= 20 + 0.4239(80 ) = 20 + 0.4239(0 )
= 20 + 33.912 = 20 + 0
= 53.912°C = 20°C
Nodal temperatures when t = 3 sec , j = 1 :
T01 = 100°C − Boundary Condition
T11 = 53.912°C
T21 = 20°C
Interior nodes
T3 = 20°C
1
T41 = 22.120°C
T51 = 25°C − Boundary Condition
Example 1: Explicit Method
Nodal temperatures when t = 6 sec (Example Calculations)
i=0 T02 = 100°C − Boundary Condition
setting j =1 ,
i =1 (
T12 = T11 + λ T21 − 2T11 + T01 ) i = 2 T22 = T21 + λ (T31 − 2T21 + T11 )
= 53.912 + 0.4239(20 − 2(53.912) + 100 ) = 20 + 0.4239(20 − 2(20) + 53.912 )
= 53.912 + 0.4239(12.176 ) = 20 + 0.4239(33.912 )
= 53.912 + 5.1614 = 20 + 14.375
= 59.073°C = 34.375°C
T42 = 22.442°C
T52 = 25°C − Boundary Condition
Example 1: Explicit Method
Nodal temperatures when t = 9 sec (Example Calculations)
i=0 T03 = 100°C − Boundary Condition
setting j = 2 ,
i =1 i=2
(
T13 = T12 + λ T22 − 2T12 + T02 ) (
T23 = T22 + λ T32 − 2T22 + T12 )
= 59.073 + 0.4239(34.375 − 2(59.073) + 100) = 34.375 + 0.4239(20.899 − 2(34.375) + 59.073)
= 59.073 + 0.4239(16.229) = 34.375 + 0.4239(11.222 )
= 59.073 + 6.8795 = 34.375 + 4.7570
= 65.953°C = 39.132°C
Nodal temperatures when t = 9 sec , j = 3 :
T03 = 100°C − Boundary Condition
T13 = 65.953°C
T23 = 39.132°C
Interior nodes
T3 = 27.266°C
3
T43 = 22.872°C
T53 = 25°C − Boundary Condition
Example 1: Explicit Method
To better visualize the temperature variation at different
locations at different times, the temperature distribution along
the length of the rod at different times is plotted below.
The Implicit Method
WHY:
∂t i , j +1 ∆t
The Implicit Method
∂ T ∂T
2
α =
∂x 2
∂t
Substituting these approximations into the heat conduction
equation yields
The rearranged equation can be written for every node during each time
step. These equations can then be solved as a simultaneous system of
linear equations to find the nodal temperatures at a particular time.
Example 2: Implicit Method
Consider a steel rod that is subjected to a temperature of 100°C on the left
end and 25°C on the right end. If the rod is of length 0.05m ,use the implicit
method to find the temperature distribution in the rod from t = 0 and t = 9
seconds. Use ∆x = 0.01m , ∆t = 3s .
W kg J
Given: k = 54 , ρ = 7800 3 , C = 490
m−K m kg − K
i=0 1 2 3 4 5
T =100 ° C T = 25 °C
0.01m
Example 2: Implicit Method
Recall, Number of time steps,
k t final − t initial
α= =
ρC ∆t
9−0
therefore, =
3
54
α= = 3.
7800 × 490
= 1.4129 × 10 −5 m 2 / s. Boundary Conditions
T0 j = 100°C
Then, for all j = 0,1,2,3
∆t T5 = 25°C
j
λ =α
(∆x )2
= 1.4129 × 10 −5
3 All internal nodes are at 20°C
(0.01) 2
for t = 0 sec . This can be
= 0.4239 . represented as,
Ti 0 = 20°C , for all i = 1,2,3,4
Example 2: Implicit Method
Nodal temperatures when t = 0 sec , j = 0 :
T00 = 100°C
T10 = 20°C
T20 = 20°C
Interior nodes
T30 = 20°C
T40 = 20°C
T50 = 25°C
We can now form our system of equations for the first time step by
writing the approximated heat conduction equation for each node.
− λT j +1
i −1 + (1 + 2λ )Ti j +1
− λT j +1
i +1 = Ti j
Example 2: Implicit Method
Nodal temperatures when t = 3 sec , (Example Calculations)
i=0 T = 100°C − Boundary Condition
0
1
For the interior nodes setting j = 0 and i =1, 2, 3, 4 gives the following,
i =1 − λT01 + (1 + 2λ )T11 − λT21 = T10
(−0.4239 × 100) + (1 + 2 × 0.4239)T11 − (0.4239T21 ) = 20
− 42.39 + 1.8478T11 − 0.4239T21 = 20
1.8478T11 − 0.4239T21 = 62.390
1
0 0 − 0. 4239 1 . 8478 T
4 30 .598
Example 2: Implicit Method
1.8478 − 0.4239 0 0 T11 62.390
− 0.4239 1.8478 − 0.4239 0 1 20
T2 =
0 − 0.4239 1.8478 − 0.4239 T3 20
1
1
0 0 − 0. 4239 1 . 8478 4
T 30 .598
The above coefficient matrix is tri-diagonal. Special algorithms
such as Thomas’ algorithm can be used to solve simultaneous
linear equation with tri-diagonal coefficient matrices.The
solution is given by
T01 100
T11 39.451 1
1 Hence, the nodal T
1 39 . 451
T
= 24 . 792
2
temps at t = 3 sec are T2 24.792
1
T3 21.438
1
1 =
1 3 21. 438
T4 21.477
T
T 1 21.477
41
5
T 25
Example 2: Implicit Method
Nodal temperatures when t = 6 sec , (Example Calculations)
i=0 T = 100°C − Boundary Condition
0
2
For the interior nodes setting j = 1 and i =1, 2, 3, 4 gives the following,
i =1 − λT02 + (1 + 2λ )T12 − λT22 = T11
(−0.4239 × 100) + (1 + 2 × 0.4239)T12 − 0.4239T22 = 39.451
− 42.39 + 1.8478T12 − 0.4239T22 = 39.451
1.8478T12 − 0.4239T22 = 81.841
i=2 − λT12 + (1 + 2λ )T22 − λT32 = T21
− 0.4239T12 + 1.8478T22 − 0.4239T32 = 24.792
For the second time step we can write four such equations with four
unknowns, expressing them in matrix form yields
1.8478 − 0.4239 0 0 T12 81.841
− 0.4239 1.8478 − 0.4239 0 2 24.792
T2 =
0 − 0.4239 1.8478 − 0.4239 T32 21.438
2
0 0 − 0 . 4239 1. 8478 T4 32 . 075
Example 2: Implicit Method
1.8478 − 0.4239 0 0 T12 81.841
− 0.4239 1.8478 − 0.4239 0 2 24.792
T2 =
0 − 0.4239 1.8478 − 0.4239 T3 21.438
2
2
0 0 − 0. 4239 1. 8478 T
4 32 .075
For the interior nodes setting j = 2 and i =1, 2, 3, 4 gives the following,
i =1 − λT03 + (1 + 2λ )T13 − λT23 = T12
( −0.4239 × 100) + (1 + 2 × 0.4239)T13 − (0.4239T23 ) = 51.326
− 42.39 + 1.8478T13 − 0.4239T23 = 51.326
1.8478T13 − 0.4239T23 = 93.716
i=2 − λT13 + (1 + 2λ )T23 − λT33 = T22
− 0.4239T13 + 1.8478T23 − 0.4239T33 = 30.669
For the third time step we can write four such equations with four
unknowns, expressing them in matrix form yields
1.8478 − 0.4239 0 0 T13 93.716
− 0.4239 1.8478 − 0.4239 0 3 30.669
T2 =
0 − 0.4239 1.8478 − 0.4239 T3 23.876
3
3
0 0 − 0 . 4239 1 . 8478 4
T 33 . 434
Example 2: Implicit Method
1.8478 − 0.4239 0 0 T13 93.716
− 0.4239 1.8478 − 0.4239 0 3 30.669
T2 =
0 − 0.4239 1.8478 − 0.4239 T3 23.876
3
3
0 0 − 0 . 4239 1 .8478 T
4 33. 434
T3 26.809
3 3 =
3 3
T 26 . 809
T4 24 . 243 T 24.243
3
43
T5 25
Example 2: Implicit Method
To better visualize the temperature variation at different
locations at different times, the temperature distribution along
the length of the rod at different times is plotted below.
The Crank-Nicolson Method
WHY:
∂ 2T O(∆x) 2
Using the implicit method our approximation of was of
∂x 2
∂T
accuracy, while our approximation of was of O(∆t ) accuracy.
∂t
The Crank-Nicolson Method
The first derivative, on the right hand side of the heat equation, is
approximated using the forward divided difference method at time
level j + 1 ,
j +1
∂T Ti − Ti j
≈
∂t i, j ∆t
The Crank-Nicolson Method
•Substituting these approximations into the governing equation for
heat conductance yields
α Ti +j1 − 2Ti j + Ti −j1 Ti +j1+1 − 2Ti j +1 + Ti −j1+1 Ti j +1 − Ti j
+ =
2 (∆x )2 (∆x )2 ∆t
giving
− λTi −j1+1 + 2(1 + λ )Ti j +1 − λTi +j1+1 = λTi −j1 + 2(1 − λ )Ti j + λTi +j1
where
∆t
λ =α
(∆x )2
•Having rewritten the equation in this form allows us to descritize
the physical problem. We then solve a system of simultaneous linear
equations to find the temperature at every node at any point in
time.
Example 3: Crank-Nicolson
Consider a steel rod that is subjected to a temperature of 100°C on the left
end and 25°C on the right end. If the rod is of length 0.05m ,use the Crank-
Nicolson method to find the temperature distribution in the rod from t = 0
to t = 9 seconds. Use ∆x = 0.01m , ∆t = 3s .
W kg J
Given: k = 54 , ρ = 7800 3 , C = 490
m−K m kg − K
i=0 1 2 3 4 5
T =100 ° C T = 25 °C
0.01m
Example 3: Crank-Nicolson
Recall, Number of time steps,
k t final − t initial
α= =
ρC ∆t
9−0
therefore, =
3
54
α= = 3.
7800 × 490
= 1.4129 × 10 −5 m 2 / s. Boundary Conditions
T0 j = 100°C
Then, for all j = 0,1,2,3
∆t T5 = 25°C
j
λ =α
(∆x )2
= 1.4129 × 10 −5
3 All internal nodes are at 20°C
(0.01) 2
for t = 0 sec . This can be
= 0.4239 . represented as,
Ti 0 = 20°C , for all i = 1,2,3,4
Example 3: Crank-Nicolson
Nodal temperatures when t = 0 sec , j = 0 :
T00 = 100°C
T10 = 20°C
T20 = 20°C
Interior nodes
T30 = 20°C
T40 = 20°C
T50 = 25°C
We can now form our system of equations for the first time step by
writing the approximated heat conduction equation for each node.
− λTi −j1+1 + 2(1 + λ )Ti j +1 − λTi +j1+1 = λTi −j1 + 2(1 − λ )Ti j + λTi +j1
Example 3: Crank-Nicolson
Nodal temperatures when t = 3 sec , (Example Calculations)
i=0 T01 = 100°C − Boundary Condition
For the interior nodes setting j = 0 and i =1, 2, 3, 4 gives the following
i =1
− λT01 + 2(1 + λ )T11 − λT21 = λT00 + 2(1 − λ )T10 + λT20
(−0.4239 × 100) + 2(1 + 0.4239)T11 − 0.4239T21 = (0.4239)100 + 2(1 − 0.4239)20 + (0.4239)20
− 42.39 + 2.8478T11 − 0.4239T21 = 42.39 + 23.044 + 8.478
1
0 0 − 0. 4239 2 . 8478 T4 52 . 718
Example 3: Crank-Nicolson
2.8478 − 0.4239 0 0 T11 116.30
− 0.4239 2.8478 − 0.4239 0 1 40.000
T2 =
0 − 0.4239 2.8478 − 0.4239 T3 40.000
1
1
0 0 − 0 .4239 2 . 8478 T
4 52. 718
1 =
T31 20.797 3
T 20. 797
1 T 1 21.607
T4 21 . 607 41
T5 25
Example 3: Crank-Nicolson
Nodal temperatures when t = 6 sec , (Example Calculations)
i=0 T02 = 100°C − Boundary Condition
For the interior nodes setting j = 1 and i =1, 2, 3, 4 gives the following,
i =1
− λT02 + 2(1 + λ )T12 − λT22 = λT01 + 2(1 − λ )T11 + λT21
(−0.4239 × 100) + 2(1 + 0.4239)T12 − 0.4239T22 =
(0.4239)100 + 2(1 − 0.4239)44.372 + (0.4239)23.746
− 42.39 + 2.8478T12 − 0.4239T22 = 42.39 + 51.125 + 10.066
2
0 0 − 0.4239 2.8478 T4 54.908
Example 3: Crank-Nicolson
2.8478 − 0.4239 0 0 T12 145.971
− 0.4239 2.8478 − 0.4239 0 2 54.985
T2 =
0 − 0.4239 2.8478 − 0.4239 T3 43.187
2
2
0 0 − 0 .4239 2 . 8478 T
4 54 . 908
2 =
T3 23.174
2
T3 23.174
2 T 2 22.730
T4 22 . 730 42
5
T 25
Example 3: Crank-Nicolson
Nodal temperatures when t = 9 sec , (Example Calculations)
i=0 T = 100°C − Boundary Condition
0
3
For the interior nodes setting j = 2 and i =1, 2, 3, 4 gives the following,
i =1
− λT03 + 2(1 + λ )T13 − λT23 = λT02 + 2(1 − λ )T12 + λT22
(−0.4239 × 100) + 2(1 + 0.4239)T23 − 0.4239T23 =
(0.4239)100 + 2(1 − 0.4239)55.883 + (0.4239)31.075
− 42.39 + 2.8478T13 − 0.4239T23 = 42.39 + 64.388 + 13.173
For the third time step we can write four such equations with four
unknowns, expressing them in matrix form yields
2.8478 − 0.4239 0 0 T13 162.34
− 0.4239 2.8478 − 0.4239 0 3 69.318
T2 =
0 − 0.4239 2.8478 − 0.4239 T3 49.509
3
3
0 0 − 0 . 4239 2 .8478 T
4 57 . 210
Example 3: Crank-Nicolson
2.8478 − 0.4239 0 0 T13 162.34
− 0.4239 2.8478 − 0.4239 0 3 69.318
T2 =
0 − 0.4239 2.8478 − 0.4239 T3 49.509
3
3
0 0 − 0 . 4239 2 .8478 4
T 57. 210
Crank-
Node Explicit Implicit Analytical
Nicolson
T13 65.953 59.043 62.604 62.510
T23 39.132 36.292 37.613 37.084
T33 27.266 26.809 26.562 25.844
T43 22.872 24.243 24.042 23.610
THE END