EEE 431 Computational Methods in Electrodynamics Lecture 4

  • Slides: 33
Download presentation
EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu Rasime. uyguroglu@emu.

EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu Rasime. uyguroglu@emu. edu. tr 1

FINITE DIFFERENCE METHODS 2

FINITE DIFFERENCE METHODS 2

Introduction l l l In general real life EM problems cannot be solved by

Introduction l l l In general real life EM problems cannot be solved by using the analytical methods, because: The PDE is not linear, The solution region is complex, The boundary conditions are of mixed types, The boundary conditions are time dependent, The medium is inhomogeneous or anisotropic. 3

Introduction l l l For such complicated problems numerical methods must be employed. Finite

Introduction l l l For such complicated problems numerical methods must be employed. Finite Difference Method (FDM) is one of the available numerical methods which can easily be applied to solve PDE’s with such complexity. FDM, is easy to understand apply. 4

Introduction l l FD techniques are based upon approximations of differential equations by finite

Introduction l l FD techniques are based upon approximations of differential equations by finite difference equations. Finite difference approximations: have algebraic forms, Relate the value of the dependent variable at a point in the solution region to the values at some neighboring points. 5

Introduction l l Steps of finite difference solution: Divide the solution region into a

Introduction l l Steps of finite difference solution: Divide the solution region into a grid of nodes, Approximate the given differential equation by finite difference equivalent, Solve the differential equations subject to the boundary conditions and/or initial conditions. 6

Introduction l Rectangular Grid Pattern 7

Introduction l Rectangular Grid Pattern 7

Finite Difference Schemes l The derivative of a given function f(x) can be approximated

Finite Difference Schemes l The derivative of a given function f(x) can be approximated as: 8

Finite Difference Schemes f(x) P B A x 9

Finite Difference Schemes f(x) P B A x 9

Finite Difference Schemes l Estimate of second derivative of f(x) at P: 10

Finite Difference Schemes l Estimate of second derivative of f(x) at P: 10

Finite Difference Schemes l Or, by using Taylor Series: 11

Finite Difference Schemes l Or, by using Taylor Series: 11

Finite Difference Schemes l Adding these equations: l Assuming that higher order terms are

Finite Difference Schemes l Adding these equations: l Assuming that higher order terms are neglected: 12

Finite Difference Schemes l l is the error introduced by truncating the series. It

Finite Difference Schemes l l is the error introduced by truncating the series. It represents the terms that are not greater than. 13

Finite Difference Schemes l Subtracting Eq. 6 from Eq. 5 and neglecting terms of

Finite Difference Schemes l Subtracting Eq. 6 from Eq. 5 and neglecting terms of the order l Error is second order. Eq. 3 - Eq. 4 are second order, Eq. 1 and Eq. 2 are first order. l 14

Finite Difference Schemes l As long as the derivatives of f are well behaved

Finite Difference Schemes l As long as the derivatives of f are well behaved and the step size is not too large, the central difference should be the most accurate of the other two. i. e. Backward and forward difference approximations. 15

Finite Difference Schemes l l The error in central difference decreases quadratically as the

Finite Difference Schemes l l The error in central difference decreases quadratically as the step size decreases, whereas the decrease is only linear for the other two formula. In general, CDF is to be preferred. Situations where the data is not available on both sides of the point where the numerical derivative is to be calculated are exceptions. 16

Finite Difference Schemes l To apply the difference method to find the solution of

Finite Difference Schemes l To apply the difference method to find the solution of a function the solution region is divided into rectangles: 17

Finite Difference Schemes l Let the coordinates (x, t) of a typical grid point

Finite Difference Schemes l Let the coordinates (x, t) of a typical grid point or a node be: l The value of at a point: 18

Finite Difference Schemes l Using this notation, the central difference approximations of at (i,

Finite Difference Schemes l Using this notation, the central difference approximations of at (i, j) are: First derivative: 19

Finite Difference Schemes l Second derivative: 20

Finite Difference Schemes l Second derivative: 20

Finite Difference Schemes l One dimensional example: Solve l Subject to the boundary conditions:

Finite Difference Schemes l One dimensional example: Solve l Subject to the boundary conditions: l Assume l 21

Finite Difference Schemes l Solution: Discretization of the equation: 22

Finite Difference Schemes l Solution: Discretization of the equation: 22

Finite Difference Schemes l Since there is one unknown, one equation is enough to

Finite Difference Schemes l Since there is one unknown, one equation is enough to find this unknown. 23

Finite Difference Schemes l If 24

Finite Difference Schemes l If 24

Finite Difference Schemes l f(1), f(2) and f(3) are unknowns. Therefore, three equations are

Finite Difference Schemes l f(1), f(2) and f(3) are unknowns. Therefore, three equations are written to find three unknowns. 25

Finite Difference Schemes l For we have (N-1) unknowns and we need (N-1) equations

Finite Difference Schemes l For we have (N-1) unknowns and we need (N-1) equations to solve. l The equation of the i th node is: 26

Finite Differencing of Parabolic PDE’s l Consider the diffusion equation: l Where k is

Finite Differencing of Parabolic PDE’s l Consider the diffusion equation: l Where k is a constant. Discretized equation: 27

Finite Difference Schemes l Where l Forward difference for t and central difference for

Finite Difference Schemes l Where l Forward difference for t and central difference for x is used. Let: l 28

Finite Difference Schemes l We can write: l This equation can be calculated in

Finite Difference Schemes l We can write: l This equation can be calculated in terms of boundary and initial conditions. This explicit formula can be used to find explicitly in terms of. l l 29

Stability l l l Stability is important for the numerical solutions. A stable solution

Stability l l l Stability is important for the numerical solutions. A stable solution is only possible when (1 -2 r) is nonnegative. Or: Choose r=1/2. Then our equation becomes: 30

Stability l Stability increases by applying an implicit formula. The formula is simple to

Stability l Stability increases by applying an implicit formula. The formula is simple to apply but it is computationally slow. Crank and Nicholson’s formula: 31

Example (Cont. ) l Rewrite: l Three known values on the left hand side

Example (Cont. ) l Rewrite: l Three known values on the left hand side and three unknown values on the right hand side. 32

Example (cont. ) l The formula is valid for all finite values of r,

Example (cont. ) l The formula is valid for all finite values of r, chose r=1: 33