You are on page 1of 30

Solution of Partial Differential Equation

Partial Differential Equation(PDE): Where the independent variables in differential


equation are more than one is called PDE .

PDE occurs in many braches of applied mathematics, e.g. in hydrodynamics, elasticity,


heat conduction, quantum mechanics etc. The analytical solution of these equations is
a rather involved process and requires application of advanced mathematical methods.
On the other hand, it is generally easier to produce sufficiently approximate solution by
simple and efficient numerical methods.

Several numerical methods have been proposed for the solution of PDE, such as
i) Finite difference method (ii) Finite volume method and (iii) Finite
Element method.

The general second order linier partial differential equation is of the form
 2u  2u  2u u u
A 2 B C 2  D E  Fu  G
x xy y x y
Where, A, B, ........... G are all functions of x and y.

These equations are classified depending on the value of discreminant, Δ


  B 2  4 AC
0 the eqn. is Elliptic
  0 the eqn. is Parabolic
  0 the eqn. is Hyperbolic

Uxx + Uyy = 0 (Laplace eqn.) ……… Elliptic

Uxx  1 ………….. Hyperbolic


Utt  0 (Wave eqn.)
c2

Uxx – Ut =0 (Conduction eqn.) …….. Parabolic

Finite Difference Method:

Steps in FD Method:

1. Grid generation
2. Discretization of PDE to FDE
3. Set of Boundary Conditions
4. Initialization
5. Solution by direct method or method of iteration
Finite Difference Quotients/Approximations to the Derivatives
u x 2  2u x 3  3u
x.    ..............
By Taylor’s series(FD) ui+1 =ui+ x 2! x 2 3! x 3
……..(1)
In Backward Difference,
u x 2  2 u x 3  3u
ui-1=ui- x. x  2!   ..............
x 2 3! x 3
…………(2)

xi  ix i  0, 1, 2, 3............
y j  jy j  0, 1, 2, 3..................

u ui 1, j  ui , j
 ux   0(x) Forward Diff.
x x 0( x )
mathematically means
The neglected terms
ui , j  ui 1, j
=ux   0(x) Backward Diff. containing Δx and higher
x order of x.

ux= ui 1, j  ui 1, j  0(x 2 ) Central Diff..


2x
x.
These are the FDE of derivatives at i,j and all are first order accurate as second
and higher order terms are neglected.

i, j+2

i, j+1

i - 2, j i - 1, j ij i + 1, j i + 2, j

i, j-1

i, j-2

Adding eqns. (1) and (2) we get

 2 u u i 1, j  2u i , j  u i 1, j

x 2
x 2
This is FDE of second order derivatives at i,j and is second order accurate.

It is interesting to note that central difference approximation of the second order


derivative given by the above equation can be interpreted as a forward
difference of the lst order derivatives, with backward differences in terms of
dependent variables for the first order derivatives. This is because
  2u     u   1  u   u 
 2        {    }
 x  i j  x  x  i j  x  x  i 1, j  x  i , j
u u
| 1  |
x i  2 , j x 1  ui 1, j  ui , j ui , j  ui 1, j 
1
i , j
 2
   
x x  x x 

1  u i 1, j  u i , j u i , j  u i 1, j 
   
x  x x 
u i 1, j  2u i , j  u i 1, j

1
x 2

u i 1, j  2u i , j  u i 1, j  
x 2
So the same approach can be used to find the value of mixed derivative at i, j.
 2u   u 
  
xy x  y 

In above equation, if we write the x-derivative as a central difference of the y-


derivatives and further make use of central difference to find out y-derivatives, we
obtain
 u   u 
    
 2u   u   y i  l, j  y i  l, j
  
xy x  y  2x

1  u i 1, j 1  u i 1, j 1 u i 1, j 1  u i 1, j 1 


   
2x  2y 2y 

1
4xy

u i l , j 1  u i 1, j 1  u i 1, j 1  u i 1, j 1 
Laplace Equation, uxx+uyy = 0

U13 U23 U33 U43

U12 U22 U32 U42

U11 U21 U31 U41


First we have to write finite difference equation
u i 1, j  2u ij  u i 1, j u i, j l  2u ij  u i, j l
 0
x 2 y 2

If x  y then

ui, j 
1
4

u i 1, j  u i 1, j  u i , j 1  u i , j 1 

Which is called standard five point formula.

Instead of above formula we can also write


1
ui, j 
4

u i 1, j 1  u i 1, j 1  u i 1, j 1  u i 1, j 1 
Which is called diagonal five point formula.

Expanding the RHS of standard formula we have

 1

u i 1, j  u i 1, j  u i , j 1  u i , j 1  4u ij  x 2 u xx  u yy  h 4 u xxyy  oh 6
6
Similarly, expanding the RHS of diagonal formula we have
1
  h 4 u xxyy  Oh 6
6
2 4
u i 1, j 1  u i l , j 1  u i 1, j 1  u i 1, j 1  4u ij  h u xxyy  Oh 6
3
From above two expressions we can conclude that the error in the diagonal formula is
four times than the standard formula. So we preferto use standard formula whenever
possible.
Solution of Elliptic Equation

Laplace equation, uxx + u yy = 0

First we have to divide the domain in i, j directions, considering (for simplification).


We get from standard five point formula,

u i , j  u i 1, j  u i 1, j  u i , j 1  u i , j 1 ...........................(1)


1
4

C6
C5

C4
C3
C2
C1
C7 C8 C9 C10 C11 C12
The very first grid point, are at the boundary. So those values can be obtained
from Boundary conditions.

Boundary Condition:

There are two types-

Dirichlet B.C. : u or T = Const.


u T
Neumann B. C.   Const.
x x
First, we can calculate the value of at different grid points using the above eqn.
(1) or also diagonal formula if required assuming the initial values. Then we
implement the following method to improve their accuracy

(i) Jacobi Method


n 1 1  n n n n 
 u u u u for the interior grid points
i  l , j  1 i, j  1 i, j  1
u
i, j 4  i  1, j
(ii) Gauss-Seidel Method
Here,

u in, j 1 
4

1 n 1
u i l , j  u inl , j  u in, j 1l  u in, j l 
This method converges twice as fast as the Jacobi method.

(iii) Successive Over Relaxation Method


We can write,
u in, j 1  u in, j 
1
Do   uin, j
4
 u ij
n

1
4

Do  4u ij
n

1
 u ij
n
 Rij
4
1
Where 4 Rij is the change in the value of ui,j for are Gauss-Seidel iteration.
In the SOR method, a larger change than this is given to ui,j and the
iteration formula is

Where, ω has got the value between 1 and 2. This converges the solution
faster. But it is tricky to select the value of ω which converges faster.
Solution of Parabolic Equation

1. One Dimensional Steady state Conduction Problem with Heat generation


 T 1
2
where g = Energy generating rate W/m3
 g ( x)  0
x k 2

in 0  x  L k = thermal conductivity

i-1/2 i i+1/2
L

Let the L distance is subdivided into M divisions, so there will be (M+1) number of
nodes.

xi = i  x i = 0, 1, 2, 3, ..........M
Then the FD equations can be written as
Ti 1  2Ti  Ti 1 1
 g ( x)  0
x 2
k
x 2
 Ti 1  2Ti  2Ti 1  g ( x)  0
k

Like this we can write the equations for other nodes but we get at best (M-1)
equations. But for (M+1) unknowns we need M+1 number of equations. The other
two equations come from two boundary conditions.
BoundaryConditions :

For Prescribed temperature:


T ( x) | x 0  fo
T ( x) | x  L  f M
i. e. At i = 0, To = fo
andat i = M, TM = fM
Two equations will come from above two relations
Prescribed Heat Flux:
To develop the FD form of these B.C.,we need to write energy balance equations for
x
the differential volume element 2
at node i = 0 and i = M.

The energy balance equation for the differential volume can be statedas

Rate of heat
supply through Rate of heat Rate of hat
theentry boundary + generation = going out by
surface conduction
qo
0 1 2 M-1 M qM

x x
2 2
x0 xL

x k To  T1
At x = 0 qo  go  where, qo is heat flux at 0
2 x
k (T1  T0 ) x
qo   g  0...............................................(1)
x 2 o

At x = L
x T  TM
g M  k M 1  q M
2 x
(T  TM ) x
or , q M  k M 1  g M  0....................................(2)
x 2

x 2 2x
2T1  2T0  g0  qo  0 for i  0
k k

x 2 2x
2T1  2TM  gM  qM  0 for i  M
and k k
•For Adiabatic or insulated or symmetry boundary conditions, Hence the
equations become,

x 2
2T1  2T0  go  0 for i  0
k
x 2

And 2T M 1  2T M g  0 for i  M
M
k
•Again for adiabatic and without heat generation, the equations become
T1  T0  0 for i = 0

TM 1  TM  0

TM 1  TM  0 for i = M
T
This is nothing but x
0 for such case (Insulated boundary)
Ti 1  Ti
 0
x
 Ti 1  Ti  0

For Convection Boundary with heat generation(with h = convective heat


transfer coefficient)

T T
The equations become
(T1  T0 ) x
h (T  T0 )  k  g0  0 at i=0
x 2
(TM 1  TM ) x
and h (T  TM )  k  gM  0 at i = M
x 2

By simplification the above equations can be written as

 2xh  x 2 2xh ..................... at i = 0


2T1   2   To  g0  T  0
 k  k k

 2xh  x 2 2xh
& 2 TM 1   2  TM  gM  T  0 ................................. at i = M
 k  k k

Prob : Consider the steady state heat conduction in a slab of thickness 0.1m in
which the energy is generated at 7.5x10 W m The boundary surface at x = 0 is
7 s

maintained at T0  80 0 C, while the other boundary dissipates heat by convection


with heat transfer coefficient, h = 220 W m C into an ambient at T  150 C, Assume
2 o o

thermal conductivity of material, k = 20 W m C. Find the temperature distribution


O

with the slab dividing it into 5 regions.


Sol : Here the eqns. are
 2T 1
 g0 in 0<x<L
x 2 k

T ( x)  f o  80 0 C at x = 0
T x
k  h (T  T)  0 at x=L
x 2g

There are 5 intervals, so there will be 6 nodes. Out of these 6 nodes temperature of
lst node is known, therefore temp. are unknown at 5 nodes.

For the 4 interior nodes the FD eqns. Become


x 2
Ti 1  2Ti  Ti 1  g0 for i = 1 to 4
k

2xh  2
x 2xh

and 2T4   2   T5  g T  0 for i=5
 k  k k

x 2 0.022
 7.5 107 
Now, k
g
20
(a1)

2xh 2  0.02  220


2  2  (b1)
k 20
2xh
T  (c1)
k
To  80 0 C
Therefore the eqns. Become
 2T1  T2  a l  T0  a l  80
T1  2T2  T3  a1
T2  2T3  T4  a1

T3  2T4  T5  a1
2T4  b1T5  a1  c1

Now solve it by TDM or by iteration Method (By Gauss Seidel Method)

2. 1-Dimensional Unsteady state Heat conduction problem:

We consider the heat conduction equation


T  2

t x 2
where is thermal diffusivity of the material
Now, Finite difference approximation by FTCS (Forward Time Central space)

T Ti n 1  Ti n

t t
 T
2
Ti 1  2Ti n  Ti n1
n
Ti n1  2Ti n  Ti n l If we dont consider t as a dimension.
 
x 2 x 2 x 2
 FDE of PDE
Ti n 1  Ti n n
Ti 1  2Ti
n
 Ti 
n
  1

t x 2
 Ti n 1  Ti n 
t
x 2

Ti n
1  2Ti
n
 Ti 
n
1 
t
 Ti n  r Do  where r  
x 2

1
It can be shown that the above formula is valid or works for 0r 
2
. Which
requires very small value of Δt.

Explicit and Implicit Formula/Scheme:


From this formula, we can calculate Tin+1 because all Tn are known in the previous
time level, hence this is called explicit formula or scheme. If RHS contains any
temperature of (n+1) time level then it is called implicit formula or scheme.
Crank -Nicolson Implicit Scheme:  2T
Crank and Nicolson proposed a method in 1947, according to which x 2 in
the previous formula is replaced by the average of its finite differences on the nth
and (n+1)th time level. Thus

FDE becomes
 2T 1  Ti nl  2Ti n  Ti n l Ti n11  2Ti n 1  Ti n11 
   
x 2 2 x 2 x 2 

or, Tin 1  Tin 


t
2x 2
Tin1  2Tin  Tin1  Tin11  2Tin 1  Tin11 
 Tin11  2  2r  Tin 1  rTin11  rTin1  2  2r  Tin  rTin1.......................(1)
r
or,

Here, Tin+1 can not be calculated so easily because it contains other two terms at
(n+1)th time level. This is called Crank-Nicolson Implicit scheme. The implicit scheme
is unconditionally stable. So for any value of ‘r’ we can get solution. To solve the
problem, we have to write FDE for all internal grid points. The RHS will be a known
quantity but left hand side will have three unknown terms. These linear equations
could be solved by matrices
A X  B
where, A is a TDM.
** This can also be solved by the methods of iteration.

From eqn. (1),


2(1 + r) Tin+1 = rTi-1n + 2(1 - r)Tin + rTi+1n + rTi-1n+1 + rTi+1n+1

(1 + r) Tin+1 = r/2Ti-1n + (1 - r)Tin + r/2Ti+1n + r/2(Ti-1n+1 + Ti+1n+1)

= Tin + r/2( Ti-1n + 2Tin + Ti+1n ) + r/2(Ti-1n+1 + Ti+1n+1)

Let Ci = Tin + r/2( Ti-1n + 2Tin + Ti+1n )

Therefore, Tin+1 = r/2(1+r)( Ti-1n+1 + Ti+1n+1 ) + Ci/(1+r)

3. 2-D Steady state Heat Conduction without Heat Generation

 2T  2T
 0
x 2 y 2
dT
0 ( Insulated )
dy
h = Const
T=Const
T=T 

q = Const

FD equations are as follows


Ti n1, j  2Ti ,nj  Ti n1, j Ti ,nj 1  2Ti ,nj  Ti ,nj l
 0
x 2 y 2

Δy2(…………….) +Δx2 (……………….) = 0

or, β2(………….) + (………………) = 0 where, β = Δy/Δx

or, 2(1 + β2) Ti,j = β2 Ti-1,j + β2 Ti+1,j + Ti,j-1 + Ti,j+1

If   1,
And all other equations come from Boundary Conditions. Then
solution will come from Matrices or iteration methods.

Ti , j  Ti 1, j  Ti 1, j  Ti , j 1  Ti , j 1
4. 2-D Unsteady state heat conduction
T   2T  2T 
   
t  x 2 y 2 
 

Discretization and solution as before.

Consistency of Numerical Solution:


We know
n 1  U n U in1  2U in  U in1
u  2u Ul i
  
t x 2 t x 2

  2 n n
  4 u  x 2 
  
 ...........
 u  t  
  
  2  2  4  
  t  i  x  i
12


But we neglect the last term in the Bracket of RHS for numerical solutions.
 The truncation error, TE for this representation Is 0 t, x  . This truncation
2

error will be zero when


t  0, x  0
Under such circumstances, the finite difference representation of the partial
differential equation is said to be consistent.

Lim (PDE - FDE) = Lim (TE) = 0


mesh → 0 t , x  0

i.e. Lim (PDE - FDE) = Lim (TE) = 0


t , x  0 t , x  0

Errors and Stability of Numerical Solution:

Discretization Error:

The difference between the exact analytical solution of PDE and the exact (round
off free) solution of corresponding FDE is called the discretization error or
truncation error plus the error due to implementation of B.C.

Let, A = Exact analytical solution of PDE


D = Exact solution of FDE
N = Numerical solution of FDE
Discretization error = A-D = TE + error due to implantation of B.C.
Round of Error:

This is the numerical error introduced for a repeatitive number of calculations in


which the computer is constantly rounding off the numbers upto some decimal
points.
Round off error, = N-D
N=D+
where, is the round off error, which henceforth will be called 'error.'

The numerical solution, N must satisfy the FDE. Hence the previous conduction
equation can be written as,
Din 1   in 1  Din   in  Din1  2 Din  Din1   in1  2 in   in1 
   ...........(1)
t  x 2 
By definition, D is the exact solution of the FDE, hence it exactly satisfies

Din 1  Din  Din1  2 Din  Din1 


  ............................................................(2)
t  x 2 

Subtracting (2) from (1), we have


 in 1   in   inl  2 in   inl 
 .......................(3)
t  x 2 
From (3) we can see that the error also satisfies FDE

If errors εi are already present at some stages of the solution of this equation, then
the solution will be stable if the εi’s shrink or at least stay the same, as the solution
progresses in the marching direction i.e. from step n to n+1. If the εi’s grow larger
during the progress of solution from step n to n+1 then the solution is called
unstable.

For stable solution, the mandatory condition is

 in 1
 1........................( 4)
 in

Now let us examine under what circumstances eqn.(4) holds good for FDE.

Von Neumann stability Analysis:

Assume that the distribution of errors along the x-axis is given by a Fourier series in
x, and the time wise distribution is exponential in 't', i.e.
Where i  unit complex number
 ( x, t )  e at  e ik x .......................(5)
m
k  wave number
m  1, 2, ...m
m

Since the FDE, eqn.(3) is liner, when eqn.(5) is substituted into eqn.(3) the
behavior of each term of the series is the same as the series itself. Hence, let us
deal with just one term of the series, and write

 m  x, t   e at e ik mx
....................................(6)

Putting the value of (6) to (3) we have

e a (t  t ) e ikm x  e at e ikm x  e at e ikm ( xx )  2e at e ikm x  e at e ikm ( x x ) 


 .....................(7)
t  x 2

Dividing both sides of eqn. (7) by e at e ikm x we have


e at  1  e  ikm x  2  e ikm x 
  
t  x 2 

t ikmx
Or, e  1  2 e
at
 2  eikmx .........................8)
x
e ikm x  e ikm x
But we know cos k m x  =
2

eqn. (8) can be written as,


 2t 
e at  1  2 cos k m x   2
x 2
 2t 
 1 cos k m x   1
x 2
 1
2t  cos 2 k x / 2  sin 2 k x / 2  sin 2 k x / 2  cos 2 k x / 2
 
x 2
m m m m

 1
4t  sin 2 k x / 2 ......................(9)
x 2
m

But from eqn. (6)


 in 1 e a (  t ) e ik x m

  e at
i e e at ik x
m

 in1 4t 2
 e at  1  sin k m x / 2  1.................................(10)
i n
x 2

Eqn. (10) must be satisfied for stable solution. So the condition of stability can be
determined from this.
Evaluating the inequality in eqn.(10), the two possible situations which must hold
simultaneously are
4t
(i) 1 sin 2 k m x / 2  1
x 2

t
 4 sin 2
k m x / 2  0
x 2

t
Since x 2 is always + ve, this condition always holds.

(ii) Since sin k 2


m x / 2 lies between 0 and 1, So

t
 1  1  4r   1 then the solution is stable r
x 2
 2  4r  0

 2  4r  0

1
 r  0
 2
1
i.e. r lies between 0 to 2 for stable solution, this is the condition of stability for
explicit scheme.
Alternatively,
(ii) 1 + 4r sin k x / 2  1
2
m

Thus 4r sin 2 k m x / 2  1  1
sin2 k m x / 2lies between 0 and 1
 4r  2
1
or, r
2

You might also like