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

Numerical Methods PDE

Uploaded by

wandile
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)
35 views

Numerical Methods PDE

Uploaded by

wandile
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/ 13

Numerical Methods: Partial Differential Equations

K. Naveesh Reddy


c Copyright CNEP

May 6, 2011

General form of linear,Second-order PDEs for two independent variables:

2 2 2
A ∂∂ 2 ux + B ∂x∂y
∂ u
+ C ∂∂ 2uy + D ∂u
∂x
+ E ∂u
∂y
+ F = 0.

where A,B,C,D,E and F are functions of x and y or constants.Based on the val-


ues of the coefficients of the second-derivative terms-A,B,C above equation can be
classified into one of the three categories.

1.B 2 − 4AC < 0, Elliptic


Ex:-Laplace Equation(steady state with two spatial dimensions)
∂2T 2
∂2x
+ ∂∂ 2Ty = 0

2.B 2 − 4AC = 0 , Parabolic


Ex:-Heat Conduction Equation(time variable with one spatial dimension)
∂T 2
∂t
= k ∂∂ 2Tx

3.B 2 − 4AC > 0 , Hyperbolic


Ex:-Wave Equation(time variable with one spatial dimension)
∂2y 2

∂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)

Figure 1: A thin rectangular heated plate

q(x)∆y ∆z ∆t + q(y)∆x ∆z ∆t = q(x + ∆x) ∆y ∆z ∆t + q(y + ∆y) ∆x ∆z ∆t

rearranging, divide by ∆x ∆y ∆z ∆t and taking the limit results in a PDE rep-


resenting the conservation of energy for the plate.
∂q ∂q
∂x
+ ∂y
=0

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.

substituting it in above equation we get Laplace’s Equation(steady state with two


spatial dimensions)
∂2T ∂2T
∂2x
+ ∂2y
=0

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:

Laplacian Difference Equation:

• Treating the plate as a grid of discrete points.(see fig2)

• Replace derivatives by centered finite-divided-difference formulas.

Figure 2: A grid used for the finite difference solution of Laplacian equation

∂2T Ti+1,j −2Ti,j +Ti−1,j


∂2x
= ∆x2

∂2T Ti,j+1 −2Ti,j +Ti,j−1


∂2y
= ∆y 2

substituting in laplace equation,we get


Ti+1,j −2Ti,j +Ti−1,j Ti,j+1 −2Ti,j +Ti,j−1
∆x2
+ ∆y 2
=0

for ∆ x = ∆ y

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

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

Figure 3: A heated plate with Dirichlet Boundary conditions

and corresponding difference equations are:-

T2,1 − 4T1,1 + T2 + T1,2 + T0 = 0

T3 − 4T2,1 + T1,1 + T2,2 + T0 = 0

T2,2 − 4T1,2 + T2 + T1 + T1,1 = 0

T3 − 4T2,2 + T1,2 + T1 + T2,1 = 0


4 equations and 4 unknowns can be easily solved

The Liebmann Method


• n-by-n grid involves n2 linear algebraic equations.

• For larger sized grids,a significant number of terms will be zero.

• To such sparse systems,full matrix eliminations methods waste great amounts of


computer memory storing these zeros.

• the most commonly employed approach is gauss-seidel,which when applied to PDEs


is also referred to as Liebmann’s Method.

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.

T new i,j = λT new i,j + (1 − λ)T old i,j , 1 < λ < 2

the percent relative errors(a )i,j


is given as:-
T new −T old i,j
(a )i,j = Ti,j new
i,j
< s

where s is stopping criterion.

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

θ = arctan( qqxy ), qx > 0


θ = arctan( qqxy ) + π, qx < 0

Derivative Boundary Conditions

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)

Figure 4: A Boundary node (0, j) on the left edge of heated plate

T1,j − 4T0,j + T−1,j + T0,j+1 + T0,j−1 = 0

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

T−1,j = T1,j − 2∆x ∂T


∂x
substitute it we get

2T1,j − 4T0,j − 2∆x ∂T


∂x
+ T0,j+1 + T0,j−1 = 0

Irregular Boundaries

• many systems have irregular boundaries.(see fig5)

• we use weight functions α, β.

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

• simple but important.

• Becomes difficult to handle when imposing Neumann’s condition on irregular bound-


aries.

Control volume Approach


• also called as volume integral approach.

• it is used for the system having unequal grid spacing,made of different materi-
als and mixed boundary conditions.(see fig6)

• rather than approximating the PDE at a point,the approximation is applied to


a volume surrounding the point.

• 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

A steady-state heat balance for the volume(Energy conservation)(see fig7).

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

• Parabolic equations are employed to characterize time-variable problems.

• Ex:-A long,thin insulated rod-one dimensional case.

The amount of heat stored in the element over a unit time period ∆t.

Input - output = Accumulation

q(x)∆y ∆z ∆t - q(x + ∆x) ∆y ∆z ∆t = ρC ∆x ∆y ∆z ∆t

rearranging, divide by ∆x ∆y ∆z ∆t and taking the limit results in a PDE rep-


resenting the conservation of energy for the thin insulated rod.

− ∂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

• we approximate the spatial derivative at time level l.

• centered finite-divided-difference formulas.

l −2T l +T l
Ti+1
∂2T i i−1
∂2x
= ∆x2

∂T Til+1 −Til
∂t
= ∆t

l represent the time step.

substituting in Heat Conduction Equation,we get

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:

• The temperature at the boundary is set to a fixed value-Dirichlet Boundary condi-


tion.

T (t = 0)∀i
Ti=0 ∀t; Ti=N ∀t;

• Derivative boundary condition(derivative is given)-Neumann Boundary condition.

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.

Convergence and stability:

• Convergence means that as ∆x and ∆t approach zero.The results of the finite-


difference technique approach the true solution.

• Stability means that errors at any stage of the computation are not amplified but
are attenuated as the computation progresses.
∆t
λ = k ∆x2

k is given,∆x and ∆t are chosen.

the Explicit method is convergent and stable if λ ≤ 12 .

10
•λ≤ 1
2
- errors don’t grow,but oscillate.

•λ≤ 1
4
- ensures that solution will not oscillate.

•λ≤ 1
6
- tends to minimize truncation error.

A simple Implicit Method:

Implicit method overcome the two difficulties of explicit method such as

• Problems related to stability,computational burden may be large to attain accept-


able accuracy.

• they exclude information that has a bearing on the solution.

• In explicit method,we approximate the spatial derivative at time level l.

• In implicit method,we approximate the spatial derivative at time level l+1.

l+1
∂2T Ti+1 −2Til+1 +Ti−1
l+1

∂2x
= ∆x 2

∂T T l+1 −T l
∂t
= i ∆t i

substituting in Heat Conduction Equation,it can be expressed as

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.

• The implicit method described is stable and convergent.

• It can be also used to obtain steady state solutions for elliptic equations.

11
The Crank-Nicolson Method:

• it is an alternative implicit scheme that is second order accurate in both space


and time.

• difference approximations are developed at the midpoint of the time increment


i.e l+ 12 .

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

substituting in Heat Conduction Equation and rearranging,it can be expressed as

−λ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

• It is often used for one spatial dimensions.

• It can be also used for unequally spaced meshes.

Parabolic equations in two spatial dimensions:

• Heat Conduction Equation in two spatial dimensions is of the form.

∂T 2 ∂2T
∂t
= k( ∂∂ 2Tx + ∂2y
)

The ADI scheme:

• ADI-Alternating Direction Implicit.

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

• Square grid(∆x = ∆y).

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

substituting in two spatial dimension Heat Conduction Equation and rearranging,it


can be expressed as

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

substituting in two spatial dimension Heat Conduction Equation and rearranging,it


can be expressed as

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

You might also like