# Lecture Note by S.

M Alay-e-Abbas: Partial Differential Equations

PDEs: If a differential equation is not just a function of single independent variable we get a partial differential equation. There is no one method to solve a partial differential equation. The method we may choose depends upon the type of the equation and on the parameters that appear in the equation. For the time being we’ll focus on PDEs in two dimensions which can have a general form
∂u ∂u ∂ 2u ∂ 2u ∂ 2u + C 2 + f (u , x, y, , ) = 0 A 2 +B ∂x ∂y ∂y∂y ∂y ∂x

And we want to find the solution of this partial differential equation. We can classify this equation into three categories depending upon the value of the discriminant B2-4AC. As follows
B 2 − 4 AC < 0 B 2 − 4 AC = 0 B 2 − 4 AC > 0 Elliptic Parabolic Hyperbolic

Note that there is no general method to solve the above given categories of PDEs and every method depends on the form of equation. An example of the elliptic equation is the Laplace equation given by

∂ 2u ∂ 2u + =0 ∂x 2 ∂y 2
An example of parabolic equation is the heat equation or diffusion equation in one dimension

∂u ∂ 2u =K ∂t ∂x 2
1

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

And that of Hyperbolic equation is the wave equation
2 ∂ 2u 2 ∂ u =v ∂x 2 ∂t 2

These equations can be solved by using the definition of derivatives in their discrete forms (discretization the space). For example in the Laplace equation we can replace the derivatives by the following difference formulas
∂u u ( x + ∆x) − u ( x) Forward difference = ∆x ∂x

and
∂ 2 u u ( x + ∆x) − 2u ( x) + u ( x − ∆x) = Centred difference ∂x 2 ∆x 2

And similarly for the y derivative and then solve these equations to get some solution but this is not a general method.

2

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Laplace Equation for steady state solution of heat flow: Consider that we have a slab in the xy plane with very small thickness ∆z and that we want to find the steady state solution of the heat flow in this slab or the temperature profile of the heat in this slab. We consider the slab being insulated from the z direction and heat can only flow in the x and y directions.

At steady state the heat flowing in from x and y (into the small box) direction must equal the heat flowing out in these directions. So if q(x) represents the heat flowing from the x side and q(y) the heat flowing from the y side then the heat flowing out in the x and y directions should be q(x+∆x) and in the y direction should be q(y+∆y). Since the cross sectional area of the slab in the x direction is ∆y ∆z and in the y direction is ∆x ∆z, therefore the net heat flowing through these cross sectional area per unit time ∆t is given by

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

3

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

q( x + ∆x)∆y∆z∆t + q( y + ∆y )∆x∆z∆t = flow out
And for steady state we get the equality

q ( x ) ∆ y ∆ z ∆ t + q ( y ) ∆ x∆ z ∆ t = q ( x + ∆ x ) ∆ y∆ z ∆ t + q ( y + ∆ y ) ∆ x∆ z ∆ t
Rearranging the terms we can show that

[ q ( x + ∆x ) − q ( x )]∆y + [ q ( y + ∆y ) − q ( y )]∆x = 0
Or we can write

q ( x + ∆x) − q ( x) q( y + ∆y ) − q ( y ) + =0 ∆x ∆y
Note that this is the definition of forward difference which can also be written as

∂q ∂q + =0 ∂x ∂y
This equation gives the heat currents (or heat fluxes) flowing thought the part of slab we have considered. These fluxes are related to the temperature by the Fourier law which states that if u is the temperature then

qi = − kρC

∂u ∂i

Where qi is the heat flux in i direction, p is the density of the material, k(cm2/s) is the coefficient of thermal diffusivity of the material and C is the heat capacity of the material. Substituting these into the above PDE for q we get the Laplace equation

∂ 2u ∂ 2u + 2 =0 2 ∂x ∂y

4

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Which is an elliptic PDE. If there is a source of heat inside the small box we imagined then the Laplace equation becomes the Poisson equation written as

∂ 2u ∂ 2u + 2 = f ( x, y ) 2 ∂y ∂x
The difference equations for the Laplace equation are

∂ 2 u u ( x + ∆x, y ) − 2u ( x, y ) + u ( x − ∆x, y ) = ∆x 2 ∂x 2

∂ 2 u u ( x, y + ∆y ) − 2u ( x, y ) + u ( x, y − ∆y ) = 2 ∂y ∆y 2
Hence the Laplace equation becomes
∂ 2 u ∂ 2 u u ( x + ∆x, y ) − 2u ( x, y ) + u ( x − ∆x, y ) u ( x, y + ∆y ) − 2u ( x, y ) + u ( x, y − ∆y ) + = + =0 ∂x 2 ∂y 2 ∆x 2 ∆y 2

We can use the finite difference scheme to solve these equations. For this reason we can partition the slab into small cells of size ∆x ∆y with the lower left corner as the origin. This gives a grid in xy plane where each grid is identified by a set of indices (i, j). If we take ∆x = ∆y we get a square grid in the pace then above equation reduces to

u i +1, j + u i −1, j + u i , j +1 + u i , j −1 − 4u i , j = 0
This gives n-1 x n-1 equations for n i’s and j’s. i, j = 0 . . . n These can be solved only if the boundary conditions are given. Example 1: Consider a 4 x 4 grid with i and j running from 0 to 4. And consider the lower boundaries at constant temperatures as shown below.

5

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Now the equation at the point (2, 2) will be

u 3, 2 + u1, 2 + u 2 ,3 + u 2 ,1 − 4u 2, 2 = 0
And at (2,0) it will be simply

u 2, 0 = 75
Hence we only have to solve for the points inside the boundaries, which total to 9 equations. For (1,1)

u 2,1 + u 0,1 + u1, 2 + u1, 0 − 4u1,1 = 0
For (2,1)

u 3,1 + u1,1 + u 2, 2 + u 2, 0 − 4u 2 ,1 = 0
And so on we get simultaneous equations that can be solved using the method for simultaneous equations using matrix methods. But the best way of doing this is to do an iterative scheme by writing the equations as

ui, j =

1 (u i +1, j + u i −1, j + u i , j +1 + u i , j −1 ) 4
6

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Heat Equation for heat conduction: The Laplace equation deals with the steady state case of heat conduction. The time dependent equation that lets us know how to calculate the temperature at any point as a function of time is called the heat equation written as.

∂ 2 u ∂u k 2 = ∂t ∂x
Consider heat conduction across thin rod along whose cross section the temperature is uniform and imagine that its insulated all over its length. The heat can flow in and out only in the x direction as shown below

Only the boundaries are exposed to the temperature. Let q(x) be the heat flux coming in and q(x+∆x) be the heat flowing out of the element dx. Using this and same steps as already used and letting the local heat change as a function of time we can get the heat equation.

∂ 2 u ∂u k 2 = ∂t ∂x
Which equates the heat lost in the section dx per unit length with the heat retained in that section per unit time. There are two methods that we will discuss for solving this equation.

7

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Explicit and Implicit Methods: For the Heat Equation

∂ 2 u ∂u k 2 = ∂t ∂x
Writing the special difference equations at t as
∂ 2 u u ( x + ∆x, t ) − 2u ( x, t ) + u ( x − ∆x, t ) = ∂x 2 ∆x 2

And time difference equation at t + ∆t as

∂u u ( x, t + ∆t ) − u ( x, t ) = ∂t ∆t
Gives us the Explicit (clear) method. Whereas writing the difference equations at t + ∆t as
∂ 2 u u ( x + ∆x, t + ∆t ) − 2u ( x, t + ∆t ) + u ( x − ∆x, t + ∆t ) = ∂x 2 ∆x 2

And time difference equation at t + ∆t as

∂u u ( x, t + ∆t ) − u ( x, t ) = ∆t ∂t
Gives us the Implicit (Implied) method. For the Explicit method we get the situation very similar to the steady state case. Using finite difference formulae we get

∂ 2 u u lt+1 − 2u lt + u lt−1 = 2 ∂x ∆x 2
ult +1 = ult + k

and

∂u u lt +1 − u lt +1 = ∂t ∆t

Substituting into the heat equation and solving we get

∆t t (ul −1 − ult + ult−1 ) 2 ∆x
8

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Which gives the temperature at time t+1 on a discretized line along the x direction. This can be solved using an iterative methods (because this gives us a sparse matrix). The constant parameter
λ=k
∆t ∆x 2

appearing in the equation tells us that the heat equation is sensitive to both space and time discretization. Since both i.e. ∆x and ∆t can have different values. Hence if we take λ too large then this method will not give good results whereas small value will. It should typically be < 0.5 to get a good result. Here again we require the boundary conditions. For example we can take left boundary conditions as 1000 and right as 00. But the main problem with the Explicit method is with the choice of λ . In the Implicit method we take the special equation at the time t + ∆t. Hence For the Implicit method we get
+1 +1 ∂ 2 u u lt+1 − 2u lt +1 + u lt−1 = ∆x 2 ∂x 2

and

∂u u lt +1 − u lt +1 = ∂t ∆t

Substituting into the heat equation and solving we get
+1 +1 − λu lt−1 + (1 + 2λ )u lt +1 − λu lt+1 = u lt

This equation can only be written in form of system of linear equation. That can be solved using Matrix methods for a tridiagonal matrix. These can only be solved if we have the knowledge of the end points or boundry conditions.

9

Lecture Note by S.M Alay-e-Abbas: Partial Differential Equations

Crank-Nicolson Implicit Method: This is one class of methods called the implicit methods. The basic difference between the simple implicit method and this method is that the special discretization is taken both at the time t and t + ∆t and mean of both is used to solve the PDE. For example in the Crank Nicolson method for heat equation we can write the space derivative to be the average as
+1 +1 ∂ 2 u 1  u lt+1 − 2u lt + u lt−1 u lt+1 − 2u lt +1 + u lt−1   =  + 2 2 2   2 ∂x ∆x ∆x 

And

∂u u lt +1 − u lt +1 = ∂t ∆t
This gives the Heat equation as
+1 +1 u lt +1 − u lt +1 1  u lt+1 − 2u lt + u lt−1 u lt+1 − 2u lt +1 + u lt−1   + =k   2 ∆t ∆x 2 ∆x 2  

From this the equation we get is of the form
+1 +1 − λu lt−1 + 2(1 + λ )u lt +1 − λu lt+1 = λu lt−1 − 2(1 − λ )u lt + λu lt+1

This can be solved again using matrix inversion methods.

There is more to PDEs!!!!

10