Numerical Methods PDE
Numerical Methods PDE
K. Naveesh Reddy
c Copyright CNEP
May 6, 2011
2 2 2
A ∂∂ 2 ux + B ∂x∂y
∂ u
+ C ∂∂ 2uy + D ∂u
∂x
+ E ∂u
∂y
+ F = 0.
∂2x
= c12 ∂∂ 2yt
1
Finite Difference:Elliptic Equations:
Laplace Equations:
• The Laplace Equation can be used to model a variety of problems involving the
potential of an unknown variable.
• Steady state, boundary value problem.
• Ex:-A thin rectangular heated plate.
Consider a thin rectangular plate of thickness ∆z.At steady state, the flow of heat
into the element over a unit time period ∆t must equal to the flow out.(see fig1)
since temperature boundary conditions are known. the above expression must be
reformulated in terms of temperature using ”Fourier’s law of heat conduction”,which
can be represented as
qi = -kρC ∂T ∂i
(1)
where
qi is heat flux in the direction of the i dimension.
ρ is density of the material.
C is heat capacity of the material.
k 0 = kρC is the coefficient of thermal conductivity.
2
Note that for the case where there are sources or sinks of heat which is given by
a function f(x,y)then the corresponding equation is referred to as the poisson’s equa-
tion.
∂2T ∂2T
∂2x
+ ∂2y
= f (x, y)
Solution Technique:
Figure 2: A grid used for the finite difference solution of Laplacian equation
for ∆ x = ∆ y
this relation holds good for all interior points on the plate,is referred to as the Lapla-
cian difference equation.
Boundary conditions:
3
• The temperature at the boundary is set to a fixed value-Dirichlet Boundary condi-
tion.
• Derivative boundary condition(derivative is given)-Neumann Boundary condition.
for ex:-(see fig3)
Dirichlet Boundary conditions are:- Ti,0 = T0 ,Ti,3 = T1 ,T0,j = T2 ,T3,j = T3
4
Ti+1,j +Ti−1,j +Ti,j+1 +Ti,j−1
Ti,j = 4
solve iteratively for j=1 to n and for i = 1 to m. since system is diagonally dominant,it
will converge on a stable solution.
Overrelaxation:-
Overrelaxation is sometimes employed to accelerate the rate of convergence by ap-
plying the following formula after each iteration.
Secondary Variable
For the heated plate
• a primary variable is Temperature(T).
• a secondary variable is the rate of heat flux across the plate’s surface(qi ).
qi = −kρC ∂T
∂i
Ti+1,j −Ti−1,j
qx = −k 0 2∆x
Ti+1,j −Ti−1,j
qy =−k 0 2∆y
the resultant heat flux can be computed from these two quantities by
p
qn = qx2 + qy2
where the direction of qn is given by
5
Derivative Boundary Conditions,in which derivative is specified-Neumann Boundary
condition.
for ex:-
For the heated plate,where the edge is insulated i.e heat flux is zero.
fig depicts a node(-1,j) lying outside the plate.(see fig4)
Imaginary point (-1,j) lying outside the plate is required for this equation.it serves as
the vehicle for incorporating the derivative boundary condition into the problem.
∂T ∼
=
T1,j −T−1,j
∂x 2∆x
Irregular Boundaries
6
Figure 5: A grid of heated plate with an irregular shaped Boundary
( ∂T ) ∼ T1,j −Ti−1,j
∂x i−1,j = α∆x
( ∂T ) ∼ T1,j −Ti,j−1
∂y i,j−1 = β∆y
• it is used for the system having unequal grid spacing,made of different materi-
als and mixed boundary conditions.(see fig6)
• For orthogonal grid,the volume is formed by the perpendicular lines through the
midpoint of each line joining adjacent nodes.
7
Figure 6: A heated plate with unequal grid spacing,two materials,and mixed boundary conditions
Figure 7: A control volume for node A with arrows indicating heat transfer through the boundaries
q1 h2 t − q4 h2 t + q2 h2 t + q3 h4 t − qh h4 t = 0
where
q1 = −k10 ∂T
∂x
, q2 = −k20 ∂T
∂y
, q3 = −k20 ∂T
∂y
, q4 = −k20 ∂T
∂x
, qh = hc (TA − T∞ )
q1 = −k10 TA −T
h
B
, q2 = −k10 TA −T
h
D
, q3 = −k20 TA −T
h
D
, q4 = −k20 TF(−T
h
)
A
,
4
k20 TF −T
h
A −TB
− k10 TA2h −TD
− k10 TA2h −TD
− k20 TA4h − hc TA −T
4
∞
=0
8
Finite Difference:Parabolic Equations
The amount of heat stored in the element over a unit time period ∆t.
− ∂x
∂q
=ρC ∂T
∂t
Substituting Fourier’s law of heat conduction in above equation, results in Heat Con-
duction Equation
2
k ∂∂ 2Tx = ∂T
∂t
Explicit Method
l −2T l +T l
Ti+1
∂2T i i−1
∂2x
= ∆x2
∂T Til+1 −Til
∂t
= ∆t
l −2T l +T l
Ti+1 i i−1 Til+1 −Til
k ∆x2
= ∆t
9
Til+1 = Til + λ(Ti+1
l
− 2Til + Ti−1
l
)
∆t
where λ = k ∆x 2
Boundary conditions:
T (t = 0)∀i
Ti=0 ∀t; Ti=N ∀t;
qi=0,n = −k 0 ( ∂T )
∂x i=0,n
where
T0 −T−1
( ∂T ) =
∂x i=0 ∆x
Tn+1 −Tn
( ∂T )
∂x i=n
= ∆x
where T0 andTn+1 are fictitious temperature that can be determined once q is known.
• Stability means that errors at any stage of the computation are not amplified but
are attenuated as the computation progresses.
∆t
λ = k ∆x2
10
•λ≤ 1
2
- errors don’t grow,but oscillate.
•λ≤ 1
4
- ensures that solution will not oscillate.
•λ≤ 1
6
- tends to minimize truncation error.
l+1
∂2T Ti+1 −2Til+1 +Ti−1
l+1
∂2x
= ∆x 2
∂T T l+1 −T l
∂t
= i ∆t i
Til = −λTi+1
l+1
+ (1 + 2λ)Til+1 − λTi−1
l+1
∆t
where λ = k ∆x 2
this equation applies to all but for the first and last nodes,which must be modi-
fied to reflect the boundry condition.
• The sysytem obtained is tridiagonal,we can utilize the extremely efficient solu-
tion algorithms that are available for tridiagonal systems.
• It can be also used to obtain steady state solutions for elliptic equations.
11
The Crank-Nicolson Method:
l+1
∂2T Ti+1 −2Til+1 +Ti−1
l+1 l −2T l +T l
Ti+1
∂2x
= 12 [ ∆x 2 + i
∆x2
i−1
]
∂T T l+1 −T l
∂t
= i ∆t i
−λTi+1
l+1
+ 2(1 + λ)Til+1 − λTi−1
l+1 l
= λTi+1 + 2(1 − λ)Til + λTi−1
l
∆t
where λ = k ∆x 2
∂T 2 ∂2T
∂t
= k( ∂∂ 2Tx + ∂2y
)
• It is used for solving Parabolic equations in two spatial dimensions using tridi-
agonal matrices.
12
• In this method each time increment is executed in two steps.
for the first step,the spatial derivative x is at time level l , the spatial derivative
y is at time level l+ 12 and the time derivative from l to l+ 21 .
l+ 1 l+ 1 l+ 1 l+ 1
Ti,j 2 −Ti,j
l Tl −2T l +T l 2 −2T
Ti,j+1 2 2
i,j +Ti,j−1
∆t = k[ i+1,j ∆xi,j2 i−1,j + ∆y 2 ]
2
l+ 1 l+ 1 l+ 1
l
λTi+1,j + 2(1 − λ)Ti,j
l l
+ λTi−1,j = −λTi,j+1
2
+ 2(1 + λ)Ti,j 2 − λTi,j−1
2
∆t
where λ = k 2∆x 2
for the second step,the spatial derivative x is at time level l+1 , the spatial derivative
y is at time level l+ 12 and the time derivative from l+ 21 to l+1.
l+1 l+ 1 l+ 1 l+ 1 l+ 1
Ti,j −Ti,j 2 T l+1 −2Ti,j
l+1 l+1
+Ti−1,j 2 −2T
Ti,j+1 2 2
i,j +Ti,j−1
∆t = k[ i+1,j ∆x 2 + ∆y 2 ]
2
l+ 1 l+ 1 l+ 1
−λTi+1,j
l+1 l+1
+ 2(1 + λ)Ti,j − λTi−1,j
l+1
= λTi,j+1
2
+ 2(1 − λ)Ti,j 2 + λTi,j−1
2
∆t
where λ = k 2∆x 2
• The ADI method results in tridiagonal system if it is applied along the dimen-
sion that is implicit.thus on the first step, it is applied along the y dimension and on
the second step, it is applied along the x dimension.
13