eee 431 computational methods in electrodynamics

31
1 EEE 431 Computational Methods in Electrodynamics Lecture 6 By Dr. Rasime Uyguroglu [email protected] u.tr

Upload: joshua-finley

Post on 30-Dec-2015

29 views

Category:

Documents


0 download

DESCRIPTION

EEE 431 Computational Methods in Electrodynamics. Lecture 6 By Dr. Rasime Uyguroglu [email protected]. FINITE DIFFERENCE METHODS (cont). FINITE DIFFERENCE METHODS (cont). Finite Differencing of Hyperbolic PDE’s Consider the wave equation:. FINITE DIFFERENCE METHODS (cont). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: EEE 431 Computational Methods in Electrodynamics

1

EEE 431Computational Methods in

Electrodynamics

Lecture 6By

Dr. Rasime [email protected]

Page 2: EEE 431 Computational Methods in Electrodynamics

2

FINITE DIFFERENCE METHODS (cont).

Page 3: EEE 431 Computational Methods in Electrodynamics

3

FINITE DIFFERENCE METHODS (cont). Finite Differencing of Hyperbolic PDE’s Consider the wave equation:

2 2

22 2

ux t

Page 4: EEE 431 Computational Methods in Electrodynamics

4

FINITE DIFFERENCE METHODS (cont).

Using central difference formula the wave equation may be approximated as:

2

2

2 2

2 2

( 1, ) 2 ( , ) ( 1, )

( )

( , 1) 2 ( , ) ( , 1)

( )

i j i j i j

x x

i j i j i j

t t

Page 5: EEE 431 Computational Methods in Electrodynamics

5

FINITE DIFFERENCE METHODS (cont).

Substituting

Let

22 2

( 1, ) 2 ( , ) ( 1) ( , 1) 2 ( , ) ( , 1)

( ) ( )

i j i j i i j i j i ju

x t

22 2

2

( )u t u tr

xx

( 1, ) 2 ( , ) ( 1, ) ( , 1) 2 ( , ) ( , 1)

( , 1) 2(1 ) ( , ) ( 1, ) ( 1, ) ( , 1)

r i j i j i j i j i j i j

i j r i j r i j i j i j

Page 6: EEE 431 Computational Methods in Electrodynamics

6

FINITE DIFFERENCE METHODS (cont).

Example: Solve the wave equation

Subject to the boundary conditions,

And the initial conditions:

0 1, 0tt xx x t

(0, ) 0 (1, ) 0t t t

( ,0) sin , 0 1,

( ,0) 0, 0 1t

x x x

x x

Page 7: EEE 431 Computational Methods in Electrodynamics

7

Finite Difference Method

Take r=1,

For j=0,

( , 1) 2(1 ) ( , ) ( 1, ) ( 1, ) ( , 1)

( , 1) ( 1, ) ( 1, ) ( , 1), 1

i j r i j r i j i j i j

i j i j i j i j j

( ,0) ( ,1) ( , 1)0

2( ,1) ( , 1)

t

x i i

t ti i

Page 8: EEE 431 Computational Methods in Electrodynamics

8

Finite Difference Method

Substitute to get the starting formula:

( ,1) ( 1,0) ( 1,0) ( , 1)

( ,1) ( 1,0) ( 1,0) ( ,1)

1( ,1) ( 1,0) ( 1,0)

2

i i i i

i i i i

i i i

Page 9: EEE 431 Computational Methods in Electrodynamics

9

Finite Difference Method

Since u=1, r=1, chose,

Solve the problem for since it is symmetric. See the C code.

,

0.1

x t

x t

0 0.5x

Page 10: EEE 431 Computational Methods in Electrodynamics

10

Finite Difference Method

Finite Differencing of Elliptic PDE’s. Consider the two dimensional Poisson’s Equation:

2 2

2 2( , )g x y

x y

Page 11: EEE 431 Computational Methods in Electrodynamics

11

Finite Difference Method

Central difference approximation for the partial derivatives:

2

2

22 2

22 2

( 1, ) 2 ( , ) ( 1, )( )

( )

( , 1) 2 ( , ) ( , 1)( )

( )

i j i j i jO x

x x

i j i j i jO y

y y

Page 12: EEE 431 Computational Methods in Electrodynamics

12

Finite Difference Method

Where,

Assume:

FD approximation of the Poisson’s equation after simplification:

, , 0,1,2,3...x i x y j y and i j

x y h

Page 13: EEE 431 Computational Methods in Electrodynamics

13

Finite Difference Method

Gives:

Or

2( 1, ) ( 1, ) ( , 1) ( , 1) 4 ( , ) ( , )i j i j i j i j i j h g i j

21( , ) ( 1, ) ( 1, ) ( , 1) ( , 1) ( , )

4i j i j i j i j i j h g i j

Page 14: EEE 431 Computational Methods in Electrodynamics

14

Finite Difference Method

When the source term vanishes, the Poisson’s equation leads to the Laplace’s equation. Thus for the same mesh size h:

1( , ) ( 1, ) ( 1, ) ( , 1) ( , 1)

4i j i j i j i j i j

Page 15: EEE 431 Computational Methods in Electrodynamics

15

Finite Difference Method

The application of the finite difference method to elliptic PDEs often leads to a large system of algebraic equations to be solved.

Solution of such equations is a major problem. Band matrix and iterative methods are commonly used to solve the system of equations.

Page 16: EEE 431 Computational Methods in Electrodynamics

16

Finite Difference Method

Band Matrix Method Notice that only nearest neighboring

nodes affect the value of at each node.

Application of the FD equations results in a set of equation such that:

A X B

Page 17: EEE 431 Computational Methods in Electrodynamics

17

Finite Difference Method

Where is a sparse matrix (it has many zeros) , is the column matrix consisting of the unknown values, and

is the column matrix containing the known values of . So:

A X

B

1X A B

Page 18: EEE 431 Computational Methods in Electrodynamics

18

Accuracy and Stability FD Solutions

Accuracy is the closeness of the approximate solution to the exact solutions.

Stability is the requirement that the scheme does not increase the magnitude of the solution with increase in time.

Page 19: EEE 431 Computational Methods in Electrodynamics

19

Accuracy and Stability FD Solutions

Unavoidable errors in numerical solution of physical problems:

modeling errors, truncation (or discretization) errors, round-off errors

Page 20: EEE 431 Computational Methods in Electrodynamics

20

Accuracy and Stability FD Solutions

Modeling errors: Several assumptions are made for obtaining the mathematical model. i.e. nonlinear system may be represented by a liner PDE.

Page 21: EEE 431 Computational Methods in Electrodynamics

21

Accuracy and Stability FD Solutions

Truncation errors, arise from the fact that in numerical analysis we can deal only with finite number of terms of a series.

Page 22: EEE 431 Computational Methods in Electrodynamics

22

Accuracy and Stability FD Solutions

Truncation errors may be reduced: By using finer meshes. i.e. smaller time

and space step sizes and more number of points.

By using a large number of terms in the series expansion of derivatives.

Page 23: EEE 431 Computational Methods in Electrodynamics

23

Accuracy and Stability FD Solutions Round-off Errors, are due to finite

precision of computers. May be reduced by using double

precision.

Page 24: EEE 431 Computational Methods in Electrodynamics

24

Accuracy and Stability FD SolutionsError as a function of a mesh size

Page 25: EEE 431 Computational Methods in Electrodynamics

25

Accuracy and Stability FD Solutions

To determine whether the FD scheme is stable, define an error, , which occurs at time step n, assuming a single independent variable. Define the amplification of this error at time step n+1 as:

Where is known as amplification factor.

n

1n ng g

Page 26: EEE 431 Computational Methods in Electrodynamics

26

Accuracy and Stability FD Solutions

For the stability of the difference scheme it is required that the above equation satisfies:

or

1n n

1g

Page 27: EEE 431 Computational Methods in Electrodynamics

27

2D Potential Distribution in a Discrete Inhomogeneous Dielectric

The relevant equation is:

( ) ( ) 0x x y y

Page 28: EEE 431 Computational Methods in Electrodynamics

28

2D Potential Distribution in a Discrete Inhomogeneous Dielectric

Divide the domain into a grid.

( 1, ) ( 1, )

2

i j i j

x x

1/ 2, 1/ 2,( ) i j i jx x

x x x

Page 29: EEE 431 Computational Methods in Electrodynamics

29

2D Potential Distribution in a Disceat Inhomogeneous Dielectric

And:

1, ,

1/ 2

, 1,

1/ 2

i j i j

i

i j i j

i

x x

x x

Page 30: EEE 431 Computational Methods in Electrodynamics

30

2D Potential Distribution in a Discrete Inhomogeneous Dielectric

So,

1/ 2, 1, , 1/ 2, , 1,

2

1/ 2, 1, 1/ 2, 1/ 2, , 1/ 2, 1,

2

( ) ( )( )

( )

( )

( )

i j i j i j i j i j i j

i j i j i j i j i j i j i j

x x x

x

Page 31: EEE 431 Computational Methods in Electrodynamics

31

2D Potential Distribution in a Discreat Inhomogeneous Dielectric

Similarly:

, 1/ 2 , 1 , , 1/ 2 , , 1

2

, 1/ 2 , 1 , 1/ 2 , 1/ 2 , , 1/ 2 , 1

2

( ) ( )( )

( )

( )

( )

i j i j i j i j i j i j

i j i j i j i j i j i j i j

y y x

x