Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics...

13
Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation

Transcript of Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics...

Page 1: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Numerical Methodson

Partial Differential Equation

Md. Mashiur Rahman

Department of Physics

University of Chittagong

Laplace Equation

Page 2: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 02/10

Expansion of a function f(x) about a point x = a in an infinite series of terms involving derivatives of the function f(x) evaluated at that point.

Taylor Series:

ƒ (n)(a) denotes the nth derivative of ƒ evaluated at the point x=a.

English Mathematician(1685 – 1731)

Rn(x) denotes the Remainder after n terms:

[ ]: closed interval( ): open interval

If a = 0, then Taylor series is called Maclaurin series.

Page 3: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 03/10

Expansion of a function f(x+h) about a point x :

Taylor Series:

O(h) denotes the terms involving

h and its higher degree.

By rearranging,

Forward Finite Difference approximation

O(h) is known as Local Truncation Error.

Local truncation error is proportional to the step-size (h).

Page 4: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 04/10

Expansion of a function f(x – h ) about a point x :

Taylor Series:

By rearranging,

backward Finite Difference approximation

O(h) is known as Local Truncation Error.

Local truncation error is proportional to the step-size (h).

Page 5: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 05/10

Subtracting f(x + h ) from f(x – h ) :

Taylor Series:

By rearranging,

central Finite Difference approximation

For central approximation, Local Truncation Error is of the

order of h2 . For both the forward and backward approximation,

it is O(h). So, central approximation gives better approximation

for the 1st order derivative.

Page 6: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 06/10

Geometrical interpretation:

So, there is a huge difference between derivative and finite

difference.

x

f(x)

f(x)

f(x+h)

f(x-h)

f’(x)

Forward:

Backward:

Central:

Derivative: f(x) = slope

Smaller the step-size, Better the approximation.

x x+h

x–h

h h

Page 7: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 07/10

Adding f(x + h ) from f(x – h ) :

Double derivative:

By rearranging,

Double Derivative of FD

approximation

Local Truncation Error is of the order of h2 .

Page 8: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Finite Difference Method

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 08/10

FDM transforms derivatives into Finite Difference.

Derivatives apply for continuous function.

Finite Difference requires functional values at different points.

So, non-continuous space is enough for FD.

This is done dividing the space into number of equal sections.

x

y

h

k

Discretization

Mesh/Grid

Mesh-point/Grid-point

Mesh-lines/Grid-lines

Page 9: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Laplace Equation

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 09/10

This is a 2D problem and so, xy-plane is enough.

xy-plane has to be divided into some grids.

For simplicity, let grid-sizes in both directions are equal h = k.

Elliptic:

Time independent problem

Solution: u(x, y) = ?

x

y

h

h

Solutions u(x, y) have to be determined at grid points.

x = ih, i = 0, 1, 2, 3, …..

y = jh, j = 0, 1, 2, 3, …..Grid points: (i, j)

Page 10: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Laplace Equation

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 010/10

In the Grid representation:

x

y

h

h

x = ih, i = 0, 1, 2, 3, …..

y = jh, j = 0, 1, 2, 3, …..

Solutions at grid-point (i, j):

Double derivatives:

Page 11: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Laplace Equation

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 011/10

x = ih, i = 0, 1, 2, 3, …..

y = jh, j = 0, 1, 2, 3, …..

Laplace equation becomes:

In the Grid representation:

x

yStandard Five-Point Formula

(Five-point stencil) Value of u at any grid point is the average of its values at four neighbouring points to left, right, up & down.

Page 12: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Laplace Equation

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 012/10

Laplace equation remains invariant under rotation of 45.

Diagonal Five-Point Formula:

x

y

Value of u at any grid point is the average of its values at four diagonal points.

Error in Diagonal formula is FOUR TIMES than that in Standard formula.

Standard Five-point Formula should be preferred , if possible.

Page 13: Numerical Methods on Partial Differential Equation Md. Mashiur Rahman Department of Physics University of Chittagong Laplace Equation.

Numerical Methods for PDE

Md. Mashiur Rahman Tuesday, June 09, 2015Department of Physics, CU. Slide: 013/10

What we have learnt:

Finite Difference Method

Transformation of Laplace Equation in FDM

Next class:

Solution of Laplace equation