0% found this document useful (0 votes)
6 views

Chapter 8 Numerical Partial Differential Equations (PDEs)-Unlocked

Chapter 8 of BMED-3083 covers Numerical Partial Differential Equations (PDEs), focusing on the definition, classification, and examples of PDEs. It distinguishes between ordinary and partial differential equations, explains the significance of boundary conditions, and introduces numerical methods for solving parabolic PDEs, particularly the heat equation. The chapter emphasizes the importance of classification in relation to engineering problems and provides methods such as the explicit method for solving these equations.

Uploaded by

nigatudebebe3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Chapter 8 Numerical Partial Differential Equations (PDEs)-Unlocked

Chapter 8 of BMED-3083 covers Numerical Partial Differential Equations (PDEs), focusing on the definition, classification, and examples of PDEs. It distinguishes between ordinary and partial differential equations, explains the significance of boundary conditions, and introduces numerical methods for solving parabolic PDEs, particularly the heat equation. The chapter emphasizes the importance of classification in relation to engineering problems and provides methods such as the explicit method for solving these equations.

Uploaded by

nigatudebebe3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 97

BMED-3083: Computational Methods

Chapter 8
Numerical Partial Differential Equations
(PDEs)
Introduction to Partial
Differential Equations
After covering this topic, you should be able to:
1. identify the difference between ordinary and
partial differential equations.
2. identify different types of partial differential
equations.

12/25/2024 http://numericalmethods.eng.usf.edu 2
Partial Differential
Equations

 Partial Differential Equations (PDEs).


 What is a PDE?
 Examples of Important PDEs.
 Classification of PDEs.
What is a Partial Differential
Equation?
◼ Ordinary Differential Equations have only one independent variable

dy
3 + 5 y 2 = 3e − x , y (0) = 5
dx
◼ Partial Differential Equations have more than one independent variable

 2u  2u
3 2 + = x 2
+ y 2

x y 2
subject to certain conditions: where u is the dependent variable, and x and y
are the independent variables.
Partial Differential Equations
A partial differential equation (PDE) is an
equation that involves an unknown function
and its partial derivatives.
Example :
 2 u( x, t )  u ( x, t )
=
x 2
t
PDE involves two or more independen t variable s
(in the example x and t are independen t variable s)
Notation
 2 u ( x, t )
u xx =
x 2
 2 u ( x, t )
u xt =
x t
Order of the PDE = order of the highest order derivative .
Example of an Ordinary
Differential Equation

Spherical
Ball
Hot Water

d
hA( −  a ) = mC
dt
◼ Assumption: Ball is a lumped system.
◼ Number of Independent variables: One (t)
Example of an Partial
Differential Equation

Spherical
Ball
Hot Water

k   2 T  k   T  k  2T T
 r  +  sin   + = C , t  0, T (r , ,  ,0) = Ta
r r  r  r sin   
2 2
  r sin  
2 2 2
t

◼ Assumption: Ball is not a lumped system.


◼ Number of Independent variables: Four (r,θ,φ,t)
Classification of PDEs
Linear Second order PDEs are important sets
of equations that are used to model many
systems in many different fields of science
and engineering.

Classification is important because:


• Each category relates to specific engineering
problems.
• Different approaches are used to solve these
categories.
Linear PDE
Classification
A PDE is linear if it is linear in the unknown
function and its derivatives
Example of linear PDE:
2𝑢𝑥𝑥 + 1𝑢𝑥𝑡 + 3𝑢𝑡𝑡 + 4𝑢𝑥 + cos( 2𝑡) = 0
2𝑢𝑥𝑥 − 3𝑢𝑡 + 4𝑢𝑥 = 0
Examples of Nonlinear PDE
2𝑢𝑥𝑥 + 𝑢𝑥𝑡 2 + 3𝑢𝑡𝑡 = 0
𝑢𝑥𝑥 + 2𝑢𝑥𝑡 + 3𝑢𝑡 = 0
2𝑢𝑥𝑥 + 2𝑢𝑥𝑡 𝑢𝑡 + 3𝑢𝑡 = 0
Classification of Linear Second
Order PDEs
A second order linear PD E (2 - independen t variable s)
A u xx + B u xy + C u yy  2
+ D = 0, or A 2 + B
u  2
u  2
u
+C 2 + D = 0
x xy y
A, B, and C are functions of x and y
D is a function of x, y , u, u x , and u y
is classified based on (B 2 − 4 AC) as follows :
B 2 − 4 AC  0 Elliptic
B 2 − 4 AC = 0 Parabolic
B 2 − 4 AC  0 Hyperbolic
Linear Second Order PDE
Examples (Classification)
 2u ( x , y )  2u ( x , y )
Laplace Equation + =0
x 2
y 2

A = 1, B = 0, C = 1  B 2 − 4 AC  0
 Laplace Equation is Elliptic
One possible solution : u( x, y ) = e x sin y
u x = e x sin y , uxx = e x sin y
u y = e x cos y , u yy = −e x sin y
u xx + u yy = 0
Linear Second Order PDE
Examples (Classification)
 2u ( x, t )  u ( x , t )
Heat Equation  − =0
x 2
t
A =  , B = 0, C = 0  B 2 − 4 AC = 0
 Heat Equation is Parabolic
__________ __________ __________ ________
 2
u ( x , t )  2
u ( x, t )
Wave Equation c 2
− =0
x 2
t 2

A = c 2  0, B = 0, C = −1  B 2 − 4 AC  0
 Wave Equation is Hyperbolic
Heat Equation

 u ( x, y , z , t )   2u  2u  2u 
=   2 + 2 + 2 

t  x y z 

The function u(x,y,z,t) is used to represent


the temperature at time t in a physical body
at a point with coordinates (x,y,z)
 is the thermal diffusivity. It is sufficient, but
not always, to consider the case  = 1.
Simpler Heat Equation

 T ( x, t )  T ( x, t )
2
= x
t x 2

T(x,t) is used to represent the temperature


at time t at the point x of the thin rod.
Boundary Conditions for PDEs
◼ To uniquely specify a solution to the PDE,
a set of boundary conditions are needed.
◼ Both regular and irregular boundaries are
possible. t
 2u( x, t ) u( x, t )
Heat Equation :  − =0
x 2
t region of
interest
u(0, t ) = 0
u(1, t ) = 0
x
u( x,0) = sin( x ) 1
Parabolic Partial Differential
Equations
After covering this topic, you should be able to:
❑ Use numerical methods to solve parabolic partial

differential equations by explicit, implicit, and


Crank-Nicolson methods.

17
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 − 4 AC = 0
2

◼ For example, examine the heat-conduction equation given by


 2T T , where A =  , B = 0, C = 0, D = −1
 2 =
x t
Then
B 2 − 4 AC = 0 − 4( )(0)
=0
thus allowing us to classify this equation as parabolic.
Physical Example of an
Parabolic PDE

The internal temperature of a metal rod, exposed to two different


temperatures at each end, can be found using the heat conduction
equation.

 T T2
 2 =
x t
Parabolic Problems
 T ( x, t )  2 T ( x, t )
Heat Equation : =
t x 2
T (0, t ) = T (1, t ) = 0
T ( x,0) = sin( x ) ice ice

* Parabolic problem ( B 2 − 4 AC = 0)
* Boundary conditions are needed to uniquely specify a solution.
Discretizing the Parabolic PDE
x
x x

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

Hence Ti j corresponds to the temperature at node i , that is,

x = (i )(x ) and time t = ( j )(t )


The Explicit Method
x
x x

i −1 i i +1
L
If we define  x =
n we can then write the finite central divided
difference approximation of the left hand side at a general interior
node ( i ) as

 2T Ti +j1 − 2Ti j + Ti −j1



x 2 i, j
(x )2
where ( j ) is the node number along the time.
The Explicit Method
x
x x

i −1 i i +1

The time derivative on the right hand side is approximated by the forward
divided difference method as,

j +1
T Ti − Ti j

t i, j t
The Explicit Method
Substituting these approximations into the governing equation yields

Ti +j1 − 2Ti j + Ti −j1 Ti j +1 − Ti j


 =
(x )2 t
Solving for the temp at the time node j + 1 gives
t
Ti j +1
= Ti + 
j

(x) 2
(T j
i +1 − 2Ti
j
+ Ti −1 )
j

choosing,
t
 =
(x) 2
we can write the equation as,

Ti j +1
= Ti +  T − 2Ti + T
j
( j
i +1
j j
i −1 )
The Explicit Method
Ti j +1
(
= Ti +  T − 2Ti + T
j j
i +1
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 .

•In other words, if we know the temperature at node j = 0 , and the boundary
temperatures, we can find the temperature at the next time step.

•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

The initial temperature of the rod is 20C .

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 m2 / 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
T3 = 20C 
0

T40 = 20C 
T50 = 25C

We can now calculate the temperature at each node explicitly using the
equation formulated earlier,

Ti j +1
(
= Ti +  T − 2Ti + T
j j
i +1
j j
i −1 )
Example 1: Explicit Method
Nodal temperatures when t = 3sec (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 = 3sec , 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

Nodal temperatures when t = 6 sec , j = 2 :


T02 = 100C − Boundary Condition
T12 = 59.073C 

T22 = 34.375C 
 Interior nodes
T3 = 20.889C 
2

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 − BoundaryCondition
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:

•Using the explicit method, we were able to find the temperature at


each node, one equation at a time.

•However, the temperature at a specific node was only dependent on


the temperature of the neighboring nodes from the previous time step.
This is contrary to what we expect from the physical problem.

•The implicit method allows us to solve this and other problems


by developing a system of simultaneous linear equations for the
temperature at all interior nodes at a particular time.
The Implicit Method
 T T 2
 2 =
x t
The second derivative on the left hand side of the equation is
approximated by the CDD scheme at time level j + 1 at node ( i ) as

 2T Ti +j1+1 − 2Ti j +1 + Ti −j1+1



x 2
i , j +1
(x ) 2
The Implicit Method
 T T 2
 2 =
x t
The first derivative on the right hand side of the equation is
approximated by the BDD scheme at time level j + 1 at node ( i ) as

j +1
T Ti − Ti j

t i , j +1 t
The Implicit Method
 T T 2
 2 =
x t
Substituting these approximations into the heat conduction equation
yields

j +1 j +1 j +1 j +1
T − 2Ti +T Ti − Ti j
 i +1 i −1
=
(x ) 2
t
The Implicit Method
From the previous slide,
Ti +j1+1 − 2Ti j +1 + Ti −j1+1 Ti j +1 − Ti j
 =
(x )2 t
Rearranging yields

− Ti −j1+1 + (1 + 2 )Ti j +1 − Ti +j1+1 = Ti j


given that,
t
 =
(x ) 2

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

The initial temperature of the rod is 20C .

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 m2 / 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 = 3sec , (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

i=2 − T11 + (1 + 2 )T21 − T31 = T20


− 0.4239T11 + 1.8478T21 − 0.4239T31 = 20
For the first time step we can write four such equations with four
unknowns, expressing them in matrix form yields
 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 
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. The solution is given


by

T01   100 
T11   39.451   1  
 1   Hence, the nodal temps T
 1  39 . 451 
T
 = 24 . 792 
2
at t = 3sec 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  T3  21.438
2

  2   
 0 0 − 0.4239 1.8478   4  
T 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 

The above coefficient matrix is tri-diagonal. The solution is given


by

T02   100 
T12  51.326   2  
 2   Hence, the nodal temps T1  51.326 
T
 2 = 30 .669  at t = 6 sec are T22  30.669 
T3  23.876 
2
 2 = 
 2   
T4  22.836  T3   23 . 876 
T 2  22.836 
 42   
T5   25 
Example 2: Implicit Method
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 + (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 T 
 4   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 

The above coefficient matrix is tri-diagonal. The solution is given


by

T03   100 
T13  59.043  Hence, the nodal temps
 3  
 3  T
   59 . 043 
 1
T
 2= 36 . 292  at t = 9 sec are T2  36.292 
3

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
Using the implicit method our approximation of was of O(x) 2
x 2
T
accuracy, while our approximation of was of O(t ) accuracy.
t
The Crank-Nicolson Method
One can achieve similar orders of accuracy by approximating the second
derivative, on the left hand side of the heat equation, at the midpoint of the
time step. Doing so yields

 2T   Ti +j1 − 2Ti j + Ti −j1 Ti +j1+1 − 2Ti j +1 + Ti −j1+1 


  + 
x 2 i, j
2 (x )2 (x ) 2

The Crank-Nicolson Method
The first derivative, on the right hand side of the heat equation, is
approximated using the forward divided difference method.

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
discretize 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 .

J
Given: k = 54 W ,  = 7800 kg3 , C = 490
m−K m kg − K

The initial temperature of the rod is 20C .

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 m2 / 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
T3 = 20C 
0

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 = 3sec , (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

2.8478T11 − 0.4239T21 = 116.30


For the first time step we can write four such equations with
four unknowns, expressing them in matrix form yields
 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  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   4  
T 52 .718 

The above coefficient matrix is tri-diagonal. The solution is given


by

T01   100 
T11   44.372  Hence, the nodal temps  1  
T
   44 . 372 
 1   1
T
 = 23 . 746  at t = 3sec are T2   23.746 
1

 1 = 
2

T31  20.797   3 
T 20 . 797 
 1   T 1  21.607 
T4  21.607   41   

 5  
T 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.8478T12 − 0.4239T22 = 145.971


For the second time step we can write four such equations with
four unknowns, expressing them in matrix form yields
 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  T32   43.187 
  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   4  
T 54 .908 

The above coefficient matrix is tri-diagonal. The solution is given


by

T02   100 
T12  55.883  Hence, the nodal temps  2  
T
 1   55 . 883 
 2   at t = 6 sec are T22  31.075 
T
 = 31 .075 
2
 2 =  
T3  23.174 
2
 3 
T 23 . 174 
 2   T  22.730 
2
T4  22.730   42   

 5  
T 25 
Example 3: Crank-Nicolson
Nodal temperatures when t = 9 sec , (Example Calculations)
i=0 T03 = 100C − Boundary Condition
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

2.8478 T13 − 0.4239 T23 = 162.34

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   4  
T 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 T 
 4   57 .210 

The above coefficient matrix is tri-diagonal. The solution is given


by

T03   100 
T13  62.604  Hence, the nodal temps  3 
T 62 . 604 
 3   at t = 9 sec are   
1 
T
 2= 37 .613  T2  37.613 
3

T3  26.562 
3  3 =  
 3 
T 26 . 562 
 3   T 3  24.042 
T4  24.042   43   

 5  
T 25 
Example 3: Crank-Nicolson
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.
Internal Temperatures at 9 sec.
The table below allows you to compare the results from all three
methods discussed in juxtaposition with the analytical solution.

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
Elliptic Partial Differential
Equations
After covering this topic, you should be able to:
❑ use numerical methods to solve elliptic partial

differential equations by direct method ,Gauss-


Seidel method, and Gauss-Seidel method with
over relaxation.

63
Defining Elliptic PDE’s
◼ The general form for a second order linear PDE with two
independent variables ( x, y ) and one dependent variable ( u ) 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
elliptic
B 2 − 4 AC  0
◼ For example, examine the Laplace equation given by:
 2T  2T
+ 2 = 0 , where A = 1 , B = 0 , C =1
x 2
y
then
B 2 − 4 AC = 0 − 4(1)(1)
= −4  0
thus allowing us to classify this equation as elliptic.
Laplace Equation
Laplace equation appears in several engineering problems
such as:
• Studying the steady state distribution of heat in a body.

• Studying the steady state distribution of electrical charge

in a body.

 2 T ( x, y )  2 T ( x, y )
+ = f ( x, y )
x 2
y 2

T : steady state temperatu re at point (x, y)


f ( x, y ) : heat source (or heat sink)

65
Laplace Equation
 2 T ( x, y )  2 T ( x, y )
+ = f ( x, y )
x 2
y 2

A = 1, B = 0, C = 1
B 2 − 4 AC = −4  0 Elliptic

◼ Temperature is a function of the position (x and y)

◼ When no heat source is available →f(x,y)=0

66
Physical Example of an Elliptic PDE
y

Tt

W Tl Tr

x
Tb
L

Schematic diagram of a plate with specified temperature boundary conditions

The Laplace equation governs the temperature:  2T  2T


+ 2 =0
x y
2
Discretizing the Elliptic PDE
L
y x =
Tt m
(0, n) W
x y = (i, j + 1)
n y x
y Tr
Tl (i, j ) (i − 1, j ) (i, j ) (i + 1, j )

x (i, j − 1)
(0,0)
Tb (m,0)

T
2
T ( x + x, y ) − 2T ( x, y ) + T ( x − x, y )
( x, y ) 
x 2
(x ) 2

 2T T ( x, y + y ) − 2T ( x, y ) + T ( x, y − y )
( x, y ) 
y 2
(y ) 2
Discretizing the Elliptic PDE
y
Tt
(0, n)
x (i, j + 1)
y x
y Tr
Tl (i, j ) (i − 1, j ) (i, j ) (i + 1, j )

x (i, j − 1)
(0,0)
Tb (m,0)

 2T T ( x + x, y ) − 2T ( x, y ) + T ( x − x, y )  2T Ti +1, j − 2Ti , j + Ti −1, j


( x , y )  
x 2 (x )2 x 2 i, j (x )2
Discretizing the Elliptic PDE
y
Tt
(0, n)
x (i, j + 1)
y x
y Tr
Tl (i, j ) (i − 1, j ) (i, j ) (i + 1, j )

x (i, j − 1)
(0,0)
Tb (m,0)

 2T T ( x + x, y ) − 2T ( x, y ) + T ( x − x, y )  2T Ti +1, j − 2Ti , j + Ti −1, j


( x , y )  
x 2 (x )2 x 2 i, j (x )2

 2T T ( x, y + y ) − 2T ( x, y ) + T ( x, y − y )  2T Ti , j +1 − 2Ti , j + Ti , j −1
( x , y )  
y 2 (y )2 y 2 i, j (y )2
Discretizing the Elliptic PDE
 2T  2T
+ =0
x 2
y 2

Substituting these approximations into the Laplace equation yields:

Ti +1, j − 2Ti , j + Ti −1, j Ti , j +1 − 2Ti , j + Ti , j −1


+ =0
(x ) 2
(y ) 2

if,

x = y
the Laplace equation can be rewritten as

Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1 − 4Ti , j = 0


Discretizing the Elliptic PDE

Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1 − 4Ti , j = 0

Once the governing equation has been discretized we will


use Direct method that can be used to solve the problem.
Example 1: Direct Method
Consider a plate 2.4 m  3.0 m that is subjected to the boundary conditions
shown below. Find the temperature at the interior nodes using a square
grid with a length of 0.6 m by using the direct method.
y
300 C

75 C
3 .0 m 100 C

x
50 C

2 .4 m
Example 1: Direct Method
We can discretize the plate by taking,

x = y = 0.6m
Example 1: Direct Method
The nodal temperatures at the boundary nodes are given by:

y 300 C

T 0, 5 T1,5 T2,5 T3,5 T4,5

T0, 4
T0, j = 75, j = 1,2,3,4
T1, 4 T2, 4 T3, 4 T4, 4

75 C T0,3 100 C T4, j = 100, j = 1,2,3,4


T1,3 T2,3 T3,3 T4,3
T0, 2 Ti ,0 = 50, i = 1,2,3
T1, 2 T2, 2 T3, 2 T4, 2

T0,1 T1,1 T2,1 T3,1 T4,1


Ti ,5 = 300, i = 1,2,3
x
T0, 0 T1,0 T2, 0 T3, 0 T4, 0

50 C
Example 1: Direct Method
y

T 0, 5 T1,5 T2,5 T3,5 T4,5

T0, 4
T1, 4 T2, 4 T3, 4 T4, 4
T0,3
T1,3 T2,3 T3,3 T4,3
T0, 2
T1, 2 T2, 2 T3, 2 T4, 2

T0,1 T1,1 T2,1 T3,1 T4,1


x
T0, 0 T1,0 T2, 0 T3, 0 T4, 0

Here we develop the equation for the temperature at the node (2,3)
i=2 and j=3 Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1 − 4Ti , j = 0
T3,3 + T1,3 + T2, 4 + T2, 2 − 4T2,3 = 0
T1,3 + T2, 2 − 4T2,3 + T2, 4 + T3,3 = 0
Example 1: Direct Method
We can develop similar equations for every interior node leaving us with an
equal number of equations and unknowns.

Question: How many equations would this generate?


Example 1: Direct Method
We can develop similar equations for every interior node leaving us with an
equal number of equations and unknowns.

Question: How many equations would this generate? Answer: 12


y
 T1,1  73.8924 
T    300
  
1, 2 93 . 0252 
300 300
 T1,3  119 .907 
   
T1, 4  173 .355  75 100
T2,1  77.5443  173 199 182
   
Solving yields:  2, 2  = 
T 103 . 302  C 75 120 138 131
100
T  138 .248 
 2,3   
 2, 4  
T 198 . 512  75
93 103 104
100
 T  82.9833 
 3,1   
T3, 2  104 .389  75
74 78 83 100
   
T
 3, 3   131 . 271  x
T3, 4  182 .446  50 50 50
The Gauss-Seidel Method
◼ Recall the discretized equation

Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1 − 4Ti , j = 0


◼ This can be rewritten as
Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1
Ti , j =
4
◼ For the Gauss-Seidel Method, this equation is
solved iteratively for all interior nodes until a pre-
specified tolerance is met.
Example 2: Gauss-Seidel Method
Consider a plate 2.4 m  3.0 m that is subjected to the boundary conditions
shown below. Find the temperature at the interior nodes using a square grid
with a length of 0.6 m using the Gauss-Siedel method. Assume the initial
temperature at all interior nodes to be 0 C .
y
300 C

75 C
3 .0 m 100 C

x
50 C

2 .4 m
Example 2: Gauss-Seidel Method
We can discretize the plate by taking
x = y = 0.6m
Example 2: Gauss-Seidel Method
The nodal temperatures at the boundary nodes are given by:

y 300 C

T 0, 5 T1,5 T2,5 T3,5 T4,5

T0, 4
T0, j = 75, j = 1,2,3,4
T1, 4 T2, 4 T3, 4 T4, 4

75 C T0,3 100 C T4, j = 100, j = 1,2,3,4


T1,3 T2,3 T3,3 T4,3
T0, 2 Ti ,0 = 50, i = 1,2,3
T1, 2 T2, 2 T3, 2 T4, 2

T0,1 T1,1 T2,1 T3,1 T4,1


Ti ,5 = 300, i = 1,2,3
x
T0, 0 T1,0 T2, 0 T3, 0 T4, 0

50 C
Example 2: Gauss-Seidel Method
•Now we can begin to solve for the temperature at each interior node using

Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1
Ti , j =
4
•Assume all internal nodes to have an initial temperature of zero.
Iteration #1
T +T +T +T
i=1 and j=1 T1,1 = 2,1 0,1 1, 2 1,0
4
0 + 75 + 0 + 50
=
4
= 31.2500 C
T2, 2 + T0, 2 + T1,3 + T1,1
i=1 and j=2 T1, 2 =
4
0 + 75 + 0 + 31.2500
=
4

= 26.5625C
Example 2: Gauss-Seidel Method
After the first iteration, the temperatures are as follows. These will now be
used as the nodal temperatures for the second iteration.
y

300 C

100 102 135

75 C 25 9.3 37 100 C

27 12 39

31 20 43
x
50 C
Example 2: Gauss-Seidel Method
Iteration #2
i=1 and j=1

T2,1 + T0,1 + T1, 2 + T1,0 T1,present − T previous

T1,1 =  a 1,1 = 1 present1,1 100


4 T1,1
20.3125 + 75 + 26.5625 + 50 42.9688 − 31.2500
= = 100
4 42.9688
= 42.9688 C = 27.27%
Example 2: Gauss-Seidel Method
The figures below show the temperature distribution and absolute relative error
distribution in the plate after two iterations:

Absolute Relative
Approximate
Temperature Distribution Error Distribution
y y
300 300 300

75
133 156 161 100 25% 34% 16%
75
56 56 87 100 54% 83% 58%
75
39 29 56 100 31% 62% 32%
75
43 37 56 100 27% 45% 24%
x x
50 50 50
Example 2: Gauss-Seidel Method
Node Temperature Distribution in the Plate (°C)

Number of Iterations
1 2 10
T1,1
31.2500 42.9688 73.0239
T1, 2
26.5625 38.7695 91.9585
T1,3
25.3906 55.7861 119.0976
T1, 4
100.0977 133.2825 172.9755
T2,1
20.3125 36.8164 76.6127
T2, 2 11.7188 30.8594 102.1577
T2,3
9.2773 56.4880 137.3802
T2, 4
102.3438 156.1493 198.1055
T3,1 42.5781 56.3477 82.4837
T3, 2 38.5742 56.0425 103.7757
T3,3 36.9629 86.8393 130.8056
T3, 4 134.8267 160.7471 182.2278
The Lieberman Method
◼ Recall the equation used in the Gauss-Siedel Method,

Ti +1, j + Ti −1, j + Ti , j +1 + Ti , j −1
Ti , j =
4

◼ Because the Guass-Siedel Method is guaranteed to


converge in the previous example, we can accelerate
the process by using over- relaxation. In this case,

Ti ,relaxed
j = T new
i, j + (1 −  )T old
i, j
Example 3: Lieberman Method
Consider a plate 2.4 m  3.0 m that is subjected to the boundary conditions
shown below. Find the temperature at the interior nodes using a square grid
with a length of 0.6 m . Use a weighting factor of 1.4 in the Lieberman
method. Assume the initial temperature at all interior nodes to be 0 C .
y
300 C

75 C
3 .0 m 100 C

x
50 C

2 .4 m
Example 3: Lieberman Method
We can discretize the plate by taking
x = y = 0.6m
Example 3: Lieberman Method
We can also develop equations for the boundary conditions to define the
temperature of the exterior nodes.

y 300 C

T 0, 5 T1,5 T2,5 T3,5 T4,5

T0, 4
T0, j = 75, j = 1,2,3,4
T1, 4 T2, 4 T3, 4 T4, 4

75 C T0,3 100 C T4, j = 100, j = 1,2,3,4


T1,3 T2,3 T3,3 T4,3
T0, 2 Ti ,0 = 50, i = 1,2,3
T1, 2 T2, 2 T3, 2 T4, 2

T0,1 T1,1 T2,1 T3,1 T4,1


Ti ,5 = 300, i = 1,2,3
x
T0, 0 T1,0 T2, 0 T3, 0 T4, 0

50 C
Example 3: Lieberman Method
•Now we can begin to solve for the temperature at each interior node using
the rewritten Laplace equation from the Gauss-Siedel method.

•Once we have the temperature value for each node we will apply the over
relaxation equation of the Lieberman method

•Assume all internal nodes to have an initial temperature of zero.


Iteration #1 Iteration #1
T2,1 + T0,1 + T1, 2 + T1,0 T2, 2 + T0, 2 + T1,3 + T1,1
i=1 and j=1 T1,1 = i=1 and j=2 T1, 2 =
4 4
0 + 75 + 0 + 50 0 + 75 + 0 + 43.75
= =
4 4
= 31.2500 C = 29.6875 C
𝑟𝑒𝑙𝑎𝑥𝑒𝑑 𝑛𝑒𝑤 𝑜𝑙𝑑
T relaxed
1,1 = T new
1,1 + (1 −  )T old
1,1
𝑇1,2 = 𝜆𝑇1,2 + (1 − 𝜆)𝑇1,2

= 1.4(31.2500) + (1 − 1.4)0 = 1.4(29.6875) + (1 − 1.4)0


= 43.7500C = 41.5625C
Example 3: Lieberman Method
After the first iteration the temperatures are as follows. These will be used as
the initial nodal temperatures during the second iteration.
y

300 C

146 164 221

75 C 41 23 66 100 C

42 26 67

44 33 64
x
50 C
Example 3: Lieberman Method
Iteration #2
i=1 and j=1

T2,1 + T0,1 + T1, 2 + T1,0 T1,present − T previous

T1,1 =  a 1,1 = 1 1,1


present
100
T
4 1,1

32.8125 + 75 + 41.5625 + 50 52.2813 − 43.7500


= = 100
4 52.2813
= 49.8438C = 16.32%

T1,1relaxed = T1,1new + (1 −  )T1,1old

= 1.4(49.8438) + (1 − 1.4)43.75
= 52.2813 C
Example 3: Lieberman Method
The figures below show the temperature distribution and absolute relative error
distribution in the plate after two iterations:

Absolute Relative
Temperature Distribution Approximate
y y Error Distribution
300 300 300

75
161 216 181 100 9.6% 24% 22%
75
87 122 155 100 53% 81% 57%
75
51 58 76 100 19% 55% 13%
75
52 54 69 100 16% 39% 7.5%
x x
50 50 50
Example 3: Lieberman Method
Node Temperature Distribution in the Plate (°C)

Number of Iterations
1 2 9
T1,1
43.7500 52.2813 73.7832
T1, 2
41.5625 51.3133 92.9758
T1,3
40.7969 87.0125 119.9378
T1, 4
145.5289 160.9353 173.3937
T2,1
32.8125 54.1789 77.5449
T2, 2 26.0313 57.9731 103.3285
T2,3
23.3898 122.0937 138.3236
T2, 4
164.1216 215.6582 198.5498
T3,1 63.9844 69.1458 82.9805
T3, 2 66.5055 76.1516 104.3815
T3,3 66.4634 155.0472 131.2525
T3, 4 220.7047 181.4650 182.4230
THE END

You might also like