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

Lecture11

The document discusses the numerical solution of heat conduction problems using the Finite Difference Method (FDM) in both 1D and 2D contexts, focusing on boundary conditions and steady-state scenarios. It outlines the process of deriving algebraic equations from the governing differential equations and introduces iterative solvers like the Gauss-Seidel method and the Alternating Direction Implicit (ADI) method for solving the resulting linear systems. The document emphasizes the importance of convergence criteria and the computational challenges associated with direct solvers.

Uploaded by

ackshaya1311
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)
2 views

Lecture11

The document discusses the numerical solution of heat conduction problems using the Finite Difference Method (FDM) in both 1D and 2D contexts, focusing on boundary conditions and steady-state scenarios. It outlines the process of deriving algebraic equations from the governing differential equations and introduces iterative solvers like the Gauss-Seidel method and the Alternating Direction Implicit (ADI) method for solving the resulting linear systems. The document emphasizes the importance of convergence criteria and the computational challenges associated with direct solvers.

Uploaded by

ackshaya1311
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/ 24

Copyright © Sandip Mazumder

Lecture 10: What we learnt The Ohio State University

Numerical Solution of Heat Conduction Problems


o Finite Difference Method in 1D
o Application of Boundary Conditions

1
Copyright © Sandip Mazumder
Lecture 11: What we will learn The Ohio State University

 Numerical Solution of Heat Conduction Problems


o Finite Difference Method in 2D
o Unsteady (transient) problems

2
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Consider a 2D Steady State Heat Conduction Problem


y The objective is to find the
distribution of Τ within the
slab
L
∂ 2T ∂ 2T q g′′′
H GE 2
+ 2 =− = ST
∂x ∂y k
x
The boundary conditions could be any of the three types discussed in
the previous lecture.

Note that in this case, the fact that the GE is non-homogeneous and/or
the BCs may be non-homogeneous has no bearing on the method of
solution.
All possible variations can be addressed easily by the FDM.

3
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University
1,M N,M FD nodes are at the
intersections of the vertical
and horizontal lines
For uniform grid spacing
L H
H ∆x
= ;=
∆y
N −1 M −1

Governing Equation:
j ∂ 2T ∂ 2T
2
+ 2 =ST
∂x ∂y
1,1 N,1
L
i
Our objective is to derive a set of algebraic equations for the
unknowns. In this case, we have NxM unknowns.
Let K = NxM
To set up matrix, each unknown (node) must have a unique number
instead of a double index. 4
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University
NxM

If the numbering pattern as


k+N shown on the left is followed,
then the unique number of
k-1 k k+1 the cell, k, can be written as
H k = (j-1)*N + i
k-N

j
N+1 N+2

1 2 3 4 N
L
i
Next task is to develop the FD approximations for a generic node, k.

5
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Using Taylor Series Expansions


k+N independently in both X and Y
directions, we get
N
∂ 2T Ti +1, j − 2Ti , j + Ti −1, j
k 2
≈ 2
+ ε ( ∆x 2
)
W O E ∂x (∆x)
k-1 k+1
∂ 2T Ti , j +1 − 2Ti , j + Ti , j −1
2
≈ 2
+ ε ( ∆ y 2
)
S ∂y (∆y )
k-N
Ti +1, j − 2Ti , j + Ti −1, j Ti , j +1 − 2Ti , j + Ti , j −1
Plug in to the governing equation: + ST ,i , j
=
(∆x) 2 (∆y ) 2
In terms of global node Tk +1 − 2Tk + Tk −1 Tk + N − 2Tk + Tk − N
+ ST , k
=
numbers (k indices): (∆x) 2
(∆y ) 2

1 1 1 1  2 2 
Re-write as Tk +1 + Tk −1 + Tk − N + Tk + N −  + T =
2  k
ST , k
(∆x) 2 (∆x) 2 (∆y ) 2 (∆y ) 2  ( ∆x ) 2
( ∆y ) 

Re-write as A(k , k + 1)Tk +1 + A(k , k − 1)Tk −1 + A(k , k − N )Tk − N + A(k , k + N )Tk + N − A(k , k )Tk =
ST , k
6
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Boundary conditions are applied in exactly the


same way as in 1D.
k+N
N Consider, for example, a right boundary with a
heat flux boundary condition.
The y derivative can be ∂ T ≈ Tk + N − 2Tk + Tk − N
2

W k O 2
approximated as before: ∂y k (∆y ) 2
k-1
For the x derivative, use one/two backward TSEs:
S ∂ 2T 8Tk −1 − Tk − 2 − 7Tk + 6∆x ⋅ C
k-N = Lecture 10, Slide 18
∂x 2 k
2(∆x) 2

Plug both expressions into 8Tk −1 − Tk − 2 − 7Tk + 6∆x ⋅ C Tk + N − 2Tk + Tk − N


+ ST , k
=
the GE: 2(∆x) 2
(∆y ) 2

Re-write as A(k , k − 1)Tk −1 + A(k , k − 2)Tk − 2 + A(k , k − N )Tk − N + A(k , k + N )Tk + N − A(k , k )Tk =
Bk

Note: Highlighted term will be missing if a first-order scheme is used for the
boundary node.
7
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

The last equation on Slides 6 and 7, when written in matrix form results
in a five-banded (for first-order BC) coefficient matrix, as follows:

0
0
=
0
0
[A] [Τ] = [B]
The three central bands are clustered, while the two outer bands (North
and South contributions) are removed from the center diagonal by N
elements.
Note that the size of the coefficient matrix is K x K (Note: K = N x M) 8
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Solution of a linear system of algebraic equations is usually performed


using a method called Gaussian Elimination or Gauss-Jordan
Elimination.
Such a solver is known as a Direct Solver.
A direct solver yields the exact solution to the system of equations,
barring very small numerical precision (round-off) errors.
However, such a procedure is prohibitive for two reasons:
Memory Requirement: Entire K x K matrix must be allocated and stored.
This is because even though the matrix is sparse to begin with, during
the solution process, it becomes full, i.e., the zeroes become non-
zeroes. Consider a scenario where we want to solve a 2D problem on a
100 x 100 mesh. The number of unknowns, K = N x M = 100 x 100 = 104.
Therefore, 108 real numbers must be stored. In double precision, each
real number requires 8 bytes, which implies 800 MB of memory. For
larger 2D or 3D calculations, memory requirements become absurd.
CPU time Requirement: The number of long floating point operations
(i.e., multiplication and division) scales as ~ K3 9
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Because of the aforementioned two challenges, Iterative Solvers are


used instead.
In 6510, we will study two easy-to-use iterative solvers.
In an iterative solver, the central idea is to update the solution of a single
or a small sub-set of the nodes rather than all the nodes (as in a direct
solver).
The solution to the other nodes (unknowns) are assumed during the
update process. Hence, iterations are necessary.
The nodes where the solution is guessed are referred to as explicit,
while the node(s) where the solution is being updated are referred to as
implicit.

If the nodes are scanned one at a time, we have what is called a


pointwise iterative scheme.

10
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

The Gauss-Seidel Method is a pointwise iteration method.


Step 1
 Start with a guess for values of Τ at all nodes. Let this be Τ*i,j
 If any of the boundary nodes have isothermal boundary conditions, use
the boundary value as the guess.
Step 2
 Select a sweeping pattern, e.g., Bottom => Top, Left => Right
 Update Τ at all nodes using
 1 * 1 1 1 *   2 2 
Ti , j =  T
2 i +1, j
+ T
2 i −1, j
+ T
2 i , j −1
+ T
2 i , j +1
− S /
i, j   2
+ 2 
 ( ∆x ) ( ∆x ) ( ∆y ) ( ∆y )   ( ∆x ) ( ∆y ) 

Or other appropriate nodal equation for boundaries.


 Skip nodes on isothermal boundaries
Note: In this case, since we are doing B => T and L => R sweeps, by
the time we get to node (i,j), the (i-1,j) and the (i,j-1) nodes already
have current iteration values.
11
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Step 3
 Calculate Residual, R2
 Check for convergence
Step 4
 Repeat steps 1-3 until convergence

Residual and Convergence


Recall, that for each node, we have a FD equation. For example, for
interior nodes, we have
Ti +1, j − 2Ti , j + Ti −1, j Ti , j +1 − 2Ti , j + Ti , j −1
2
+ 2
ST ,i , j
=
(∆x) (∆y )
When we solve the system of equations iteratively, the final objective is
to satisfy the FD equation at each node. To ensure that, we define a
residual at each node, as follows:
Ti +1, j − 2Ti , j + Ti −1, j Ti , j +1 − 2Ti , j + Ti , j −1
Ri , j = 2
+ 2
− ST ,i , j
(∆x) (∆y ) 12
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

If the residual goes to zero at each node, then the nodal equation has
been satisfied at each node, and we should then have the correct
solution.
Computationally, performing an IF check on the residual for each node is
computationally expensive. To avoid that, we calculate a norm instead:

L2Norm R 2 = ∑ i, j
R 2

i, j

Convergence is said to have been attained, when the R2 goes below a


certain tolerance (small value).
The exact value of the tolerance to be used depends on the problem
being solved (temperature range) and also the units being used.
To avoid problem-dependent tolerance, it is common practice to use a
normalized residual for monitoring convergence: R2* = R2/R2(1st iteration)

Note: the often-used practice of detecting change in temperature to monitor


convergence is not scientifically correct and should never be used!
13
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

The Gauss-Seidel method, being a pointwise method, often results in


slow convergence.
A more efficient option is to use a Line-by-Line Method.
In a structured mesh, we have constant i and constant j lines.
Therefore, it is conceivable that we sweep through the domain one line
at a time.

Keep moving up
Repeat for each line

Solve for these nodes


simultaneously 14
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Step 1
 Start with a guess for values of Τ at all nodes. Let this be Τ*i,j
 If any of the boundary nodes have isothermal boundary conditions, use
the boundary value as the guess.
Step 2
 Set up tri-diagonal solver for each line (e.g., row-wise sweep B => T)
 2 2  1 1 1 1
 2
+ T
2  i, j
− T
2 i +1, j
− T
2 i −1, j
= T
2 i , j −1
+ T * − ST ,i , j
2 i , j +1
 (∆x) (∆y )  (∆x) (∆x) (∆y ) (∆y )

or other appropriate nodal equation for boundaries.

Step 3
 Calculate R2 (exact same equation as before)
 Check for convergence

Step 4
 Repeat steps 1-3 until convergence
15
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

In many heat transfer calculations, depending on the geometry and


mesh, it is not easy to predict a priori whether a row-wise sweep or a
column-wise sweep would be more efficient.
To avoid such decision-making, the Alternating Direction Implicit (ADI)
method was proposed and developed.
In this method, a row-wise sweep through the whole domain is followed
by a column-wise sweep, followed by a row-wise sweep etc.
Step 2a (Row-wise sweep)
 Set up tri-diagonal solver for each row (e.g., B => T)
 2 2  1 1 1 1 *
 2
+ T
2  i, j
− T
2 i +1, j
− T
2 i −1, j
= T
2 i , j −1
+ T
2 i , j +1
− ST ,i , j
 ( ∆x ) ( ∆y )  ( ∆x ) ( ∆x ) ( ∆y ) ( ∆y )

Step 2b (Column-wise sweep)


 Set up tri-diagonal solver for each column (e.g., L => R)
 2 2  1 1 1 1
 2
+ T
2  i, j
− T
2 i , j +1
− T
2 i , j −1
= T
2 i −1, j
+ T * − ST ,i , j
2 i +1, j
 (∆x) (∆y )  (∆y ) (∆y ) (∆x) (∆x)
16
Copyright © Sandip Mazumder
Finite Difference Method for 2D Heat Conduction
The Ohio State University

Let us now consider an example:


y ∂ 2φ ∂ 2φ
GE: 2 + 2 = Sφ = 50000 ⋅ exp[ −50{(1 − x ) 2 + y 2 }] ⋅ [100{(1 − x ) 2 + y 2 } − 2]
∂x ∂y

φ (1, y ) = 100(1 − y ) + 500 exp( −50 y 2 )


L
BC: φ (0, y ) = 500 exp( −50{1 + y 2 })
φ ( x,0) = 100 x + 500 exp( −50(1 − x ) 2 )
φ ( x,1) = 500 exp( −50{(1 − x ) 2 + 1})
x
Temperature
distribution

Convergence
41 x 41 mesh

17
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University

Next we will consider transient (unsteady) problems.


∂T  ∂ 2T ∂ 2T  q ′′′g
GE = α 2 + 2 +
∂t  ∂x ∂y  ρc
We already know how to discretize the space derivatives. The only task
is to discretize the time derivative.

For that, we again use Taylor series expansions, but now in time.
n n
n +1 ∂T (∆t ) ∂ T 2 2
where a time index, n, has been
T = T + ∆t
i, j
n
i, j + 2
+ ... introduced such that t = n∆t
∂t 2! ∂t
n n
Ti ,nj+1 − Ti ,nj 2
Re-arranging, we get ∂T = −
∆t ∂ T
+ ...
2
∂t ∆t 2 ∂t
Neglecting the higher order derivative terms, we get
n n +1 n n Thus, the error introduced by
∂T Ti , j − Ti , j 2
∆t ∂ T discretization of the time
≈ , ε=
− + ...
∂t ∆t 2 ∂t 2 derivative is first order. 18
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University
Recall that we are trying to discretize the following governing equation
∂T  ∂ 2T ∂ 2T  q ′′′g
= α 2 + 2 +
∂t  ∂x ∂y  ρc
Since the left hand side of the above equation was evaluated at time
index n, the right hand side must also be evaluated at the same time
index. This yields (after using central difference for spatial derivatives)
Ti ,nj+1 − Ti ,nj  Ti +n1, j + Ti −n1, j − 2Ti ,nj Ti ,nj +1 + Ti ,nj −1 − 2Ti ,nj  q ′′′g
≈α  +  +

 ρc
2 2
∆t  ( ∆ x ) ( ∆ y )
Re-arrange equation with knowns on one side (RHS) and unknowns on
the other side (LHS)
 T n
i +1, j + T n
i −1, j − 2φ n
i, j T n
i , j +1 + T n
i , j −1 − 2T n
i, j
 q ′′′g
Ti ,nj+1 = Ti ,nj + α ∆t  +  + ∆t

 ρc
2 2
 ( ∆ x ) ( ∆ y )

Note that in the above equation, all quantities on the RHS represent old
time-index values, i.e., initial conditions for current time index (n+1).
Therefore, these are known. 19
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University
Such a scheme is best represented pictorially as follows

Ti ,nj+1
Time index n+1 Unknown

Ti ,nj +1
Ti ,nj
Ti −n1, j φin+1, j
Time index n Knowns
Ti ,nj −1

Since, the determination of the nodal value of φ at the time index n+1
(new time step) requires only an explicit calculation, i.e., no solution of a
set of simultaneous equations, such a scheme is referred to as an
EXPLICIT or Forward Euler time-marching scheme.
20
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University

Algorithm for the Explicit Method:


Step 1: Set up initial condition for all nodes, i.e., set up Τi,jn for all (i,j) for
n = 0.
Step 2: Calculate all nodal values at next time step, i.e., compute Τi,jn+1
for all (i,j) for n = 1 using the explicit update formula.
Step 3: Reset initial condition: Τi,jn = Τi,jn+1
Step 4: Proceed to next time step and Repeat Steps 2 and 3

The Explicit time-marching scheme has the following advantages:


 It does not require any matrix inversion (solution) => low
computational cost and memory
 Very easy to set up and use
However, the time step size (∆t) one can use in this method has certain
restrictions.
  A time-step larger than
(∆x) 2 1  1  the maximum
1D ∆tmax ≤ 2D max 2α 1
∆ t ≤ 
1 

allowable will cause

2α +
 (∆x) (∆y ) 
2 2 21
the solution to blow up.
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University

Example of 1D Transient Heat Conduction:


∂T ∂ 2T IC: T (0, x) = T0
GE: = 2
∂t ∂x
q′′ = 0 h, T∞
∂T ∂T
BCs: 0, − k
= h [T (t , L) − T∞ ]
=
L ∂x ( t ,0) ∂x (t , L )

x
T − T∞ * x * α t
=
Non-dimensionalize using variables used before: θ =,x = ,t
T0 − T∞ L L2

∂θ ∂ 2θ IC: θ (0, x ) = 1
*
GE: *
= *2
∂t ∂x

∂θ ∂T hL
BCs: = 0, = − Bi θ (t * ,1) where Bi =
∂x* ( t * ,0) ∂x* ( t * ,1) k
22
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University

Using the explicit method, we get


∆t * * 1
θi ,n +1 =θi ,n + * 2 [θi +1,n − 2θi ,n + θi −1,n ] for i =2,3,..., N − 1 where ∆x =
(∆x ) N −1

Left boundary node (i = 1):


∂θ (∆x* ) 2 ∂ 2θ (∆x* )3 ∂ 3θ ∂ 2θ 2
θ 2= θ1 + ∆x * +*
+ + ... *2
≈ * 2
[θ 2 − θ1 ]
∂x 1 2 ∂x 1 *2
6 ∂x 1 *3
∂x 1 (∆x )

2∆t *
Substitute into GE and rearrange: θ1,n +1 =
θ1,n + * 2
[θ 2,n − θ1,n ]
(∆x )
∂θ (∆x* ) 2 ∂ 2θ (∆x* )3 ∂ 3θ
Right boundary node (i = N): θ N −=
1 θ N − ∆x *
+ − + ...
∂x* N 2 ∂x*2 N
6 ∂x*3 N

∂ 2θ 2
Substitute right BC: ≈ [θ N −1 − (1 + Bi ∆x* )θ N ]
∂x*2 N
* 2
(∆x )

2∆t *
Substitute into GE and rearrange: θ N ,n +1= θ N ,n + * 2
[θ N −1,n − (1 + Bi ∆x)θ N ,n ]
(∆x ) 23
Copyright © Sandip Mazumder
FDM for Unsteady Heat Conduction: Explicit
The Ohio State University

Solution for Bi = 1, and ∆t = ∆tmax/2, N = 26

x* 24

You might also like