Finite Difference Method

Similar documents
Lecture 2 Solution of Nonlinear Equations ( Root Finding Problems )

: Numerical Analysis Topic 2: Solution of Nonlinear Equations Lectures 5-11:

CISE301: Numerical Methods Topic 2: Solution of Nonlinear Equations

Single Variable Optimization

OPTIMISATION. Introduction Single Variable Unconstrained Optimisation Multivariable Unconstrained Optimisation Linear Programming

Numerical Methods. ME Mechanical Lab I. Mechanical Engineering ME Lab I

ORDINARY DIFFERENTIAL EQUATIONS EULER S METHOD

36.1 Why is it important to be able to find roots to systems of equations? Up to this point, we have discussed how to find the solution to

Chapter 3 Differentiation and Integration

Grid Generation around a Cylinder by Complex Potential Functions

Numerical Methods Solution of Nonlinear Equations

Chapter 12. Ordinary Differential Equation Boundary Value (BV) Problems

CS 331 DESIGN AND ANALYSIS OF ALGORITHMS DYNAMIC PROGRAMMING. Dr. Daisy Tang

( ) [ ( k) ( k) ( x) ( ) ( ) ( ) [ ] ξ [ ] [ ] [ ] ( )( ) i ( ) ( )( ) 2! ( ) = ( ) 3 Interpolation. Polynomial Approximation.

PART 8. Partial Differential Equations PDEs

Lecture 21: Numerical methods for pricing American type derivatives

Numerical Heat and Mass Transfer

APPENDIX A Some Linear Algebra

Lecture 3. Ax x i a i. i i

Solution of Linear System of Equations and Matrix Inversion Gauss Seidel Iteration Method

Errors for Linear Systems

Summary with Examples for Root finding Methods -Bisection -Newton Raphson -Secant

Lectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix

Chapter 7: Conservation of Energy

Physics 2A Chapter 3 HW Solutions

CHAPTER 4d. ROOTS OF EQUATIONS

Lecture 26 Finite Differences and Boundary Value Problems

ME 501A Seminar in Engineering Analysis Page 1

DEMO #8 - GAUSSIAN ELIMINATION USING MATHEMATICA. 1. Matrices in Mathematica

Instituto Tecnológico de Aeronáutica FINITE ELEMENTS I. Class notes AE-245

Chapter 10. Numerical Solution Methods for Engineering Analysis

Lecture 2: Numerical Methods for Differentiations and Integrations

Numerical Differentiation

Rigid body simulation

Propagation of error for multivariable function

EE 330 Lecture 24. Small Signal Analysis Small Signal Analysis of BJT Amplifier

The Fundamental Theorem of Algebra. Objective To use the Fundamental Theorem of Algebra to solve polynomial equations with complex solutions

P A = (P P + P )A = P (I P T (P P ))A = P (A P T (P P )A) Hence if we let E = P T (P P A), We have that

Nice plotting of proteins II

New Method for Solving Poisson Equation. on Irregular Domains

Complex Variables. Chapter 18 Integration in the Complex Plane. March 12, 2013 Lecturer: Shih-Yuan Chen

Module 2. Random Processes. Version 2 ECE IIT, Kharagpur

PLATE BENDING ELEMENTS

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 16

Numerical Simulation of Wave Propagation Using the Shallow Water Equations

Week 2. This week, we covered operations on sets and cardinality.

Mathematical Economics MEMF e ME. Filomena Garcia. Topic 2 Calculus

2 Finite difference basics

Physics for Scientists & Engineers 2

Section 8.3 Polar Form of Complex Numbers

Transfer Functions. Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: ( ) system

1 GSW Iterative Techniques for y = Ax

Lecture Note 3. Eshelby s Inclusion II

Shuai Dong. Isaac Newton. Gottfried Leibniz

SCALARS AND VECTORS All physical quantities in engineering mechanics are measured using either scalars or vectors.

Chapter 5 Function-based Monte Carlo

Lecture 13 APPROXIMATION OF SECOMD ORDER DERIVATIVES

Advanced Circuits Topics - Part 1 by Dr. Colton (Fall 2017)

Lecture 12: Discrete Laplacian

The Karush-Kuhn-Tucker. Nuno Vasconcelos ECE Department, UCSD

Week 5: Neural Networks

x yi In chapter 14, we want to perform inference (i.e. calculate confidence intervals and perform tests of significance) in this setting.

Inner Product. Euclidean Space. Orthonormal Basis. Orthogonal

Structure and Drive Paul A. Jensen Copyright July 20, 2003

Scattering Matrices for Semi Analytical Methods

Solutions to Homework 7, Mathematics 1. 1 x. (arccos x) (arccos x) 1

1 Matrix representations of canonical matrices

Appendix B. The Finite Difference Scheme

Measurement and Uncertainties

PES 1120 Spring 2014, Spendier Lecture 6/Page 1

Lecture 22: Potential Energy

Spring Force and Power

PHYS 705: Classical Mechanics. Newtonian Mechanics

University of Washington Department of Chemistry Chemistry 452/456 Summer Quarter 2014

Modeling motion with VPython Every program that models the motion of physical objects has two main parts:

CHAPTER-5 INFORMATION MEASURE OF FUZZY MATRIX AND FUZZY BINARY RELATION

Module 3: Element Properties Lecture 1: Natural Coordinates

One Dimensional Axial Deformations

A Simple Research of Divisor Graphs

Statistics and Probability Theory in Civil, Surveying and Environmental Engineering

4DVAR, according to the name, is a four-dimensional variational method.

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 13

Digital Signal Processing

Mathematics Intersection of Lines

Application to Plane (rigid) frame structure

Chapter 5. Solution of System of Linear Equations. Module No. 6. Solution of Inconsistent and Ill Conditioned Systems

Using T.O.M to Estimate Parameter of distributions that have not Single Exponential Family

Least squares cubic splines without B-splines S.K. Lucas

CHAPTER 4. Vector Spaces

C PLANE ELASTICITY PROBLEM FORMULATIONS

SIMPLE LINEAR REGRESSION

Modelli Clamfim Equazione del Calore Lezione ottobre 2014

Plate Theories for Classical and Laminated plates Weak Formulation and Element Calculations

5.76 Lecture #21 2/28/94 Page 1. Lecture #21: Rotation of Polyatomic Molecules I

MEM 255 Introduction to Control Systems Review: Basics of Linear Algebra

General Tips on How to Do Well in Physics Exams. 1. Establish a good habit in keeping track of your steps. For example, when you use the equation

Numerical Solution of Ordinary Differential Equations

Formulas for the Determinant

What is LP? LP is an optimization technique that allocates limited resources among competing activities in the best possible manner.

Math1110 (Spring 2009) Prelim 3 - Solutions

Transcription:

7/0/07 Instructor r. Ramond Rump (9) 747 698 rcrump@utep.edu EE 337 Computatonal Electromagnetcs (CEM) Lecture #0 Fnte erence Method Lecture 0 These notes ma contan coprghted materal obtaned under ar use rules. strbuton o these materals s strctl prohbted Slde Outlne Fnte erence Appromatons Fnte erence Method Numercal Boundar Condtons Matr Operators Lecture 0 Slde

7/0/07 Fnte erence Appromatons Lecture 0 Slde 3 The Basc Fnte erence Appromaton d d. second order accurate rst order dervatve d d Ths s the onl nte derence appromaton we wll use n ths course! Lecture 0 Slde 4

7/0/07 Tpes o Fnte erence Appromatons Backward Fnte erence d d Central Fnte erence d d. Forward Fnte erence d d Lecture 0 Slde The Generalzed Fnte erence n d d n a In act, an lnear operaton on the uncton can be appromated as a lnear sum o known ponts o that uncton. L a The dervatve o an order o a uncton at an poston can be appromated as a lnear sum o known ponts o that uncton. Lecture 0 Slde 6 3

7/0/07 Fnte erence Atoms An nte derence appromaton can be summarzed graphcall as an atom. d d d d, j 4, j, j, j, j, j, j, j, j, j, j Lecture 0 Slde 7 Fnte erence Method Lecture 0 Slde 8 4

7/0/07 Overvew o Our FM. Ident and wrte the governng equaton(s). a b c g. Wrte the matr orm o ths equaton gong term b term. a b c g A B C g 3. Put matr equaton n the standard orm o [L][] = [g]. L g L A B C 4. Solve [L][] = [g]. L g where L = A*X + *B*X + C; Lecture 0 Slde 9 What s the Catch? LA B C How do we construct these matrces? What do the mean? A B C Lecture 0 Slde 0

7/0/07 Functons Vs. Operatons ( o ) a b g c Operatons Everthng else n a derental equaton s somethng that operates on a uncton. a, b, c pont-b-pont multplcaton on, calculates dervatves o scales entre Functons The onl tme unctons appear n a derental equaton s as the unknown or as the ectaton. g unknown ectaton Lecture 0 Slde Functons Vs. Operatons ( o ) A B C g Operatons Operatons are alwas stored n square matrces. An lnear operaton can be put nto matr orm. L l l l l l l l l l M M M M MM Functons Functons are stored as column vectors. g g g g M M Lecture 0 Slde 6

7/0/07 Interpretaton o Matrces aa a3 z b aa a3z b a3a3 a33z b3 EQUATION FOR a a a3 b a a a b 3 a3 a3 a 33 z b 3 RELATION TO Equaton or Equaton or Equaton or z a a a a a a a a a 3 3 3 3 33 a a a a a a a a a 3 3 3 3 33 From a purel mathematcal perspectve, ths nterpretaton does not make sense. Ths nterpretaton wll be hghl useul and nsghtul because o how we derve the equatons. Lecture 0 Slde 3 Representng Functons on a Grd Eample phscal (contnuous) uncton A grd s constructed b dvdng space nto dscrete cells Functon s known onl at dscrete ponts Representaton o what s actuall stored n memor Lecture 0 Slde 4 7

7/0/07 Grd Cells Whole Grd A Sngle Grd Cell A uncton value s assgned to a specc pont wthn the grd cell., grd resoluton parameters Lecture 0 Slde Functons are Put Into Column Vectors Sstems 4 3 3 4 Sstems 9 3 6 0 4 3 7 4 8 6 3 4 6 7 8 9 0 3 4 6 Lecture 0 Slde 6 8

7/0/07 Puttng Functons nto Column Vectors 9 3 6 0 4 3 7 4 8 6 MATLAB reshape command = F(:); F = reshape(,n,n); 3 4 6 7 8 9 0 3 4 6 3 4 6 7 8 9 0 3 4 6 Lecture 0 Slde 7 Locatng Nodes n Column Vectors Grds Node located at n m = n Grds Node located at n,n m = (n )*N + n 3 Grds Node located at n,n,nz m = (nz )*N*N + (n )*N + n Lecture 0 Slde 8 9

7/0/07 The Fnte erence Method Conventonal FM k Tedous, but not dcult. erental Equaton to Solve d a g d k a k k g k Ver dcult and tedous. L g Eas. L g Most tme consumng step. Almost eortless. a g Eas. Ver eas and clean L g L a Improved FM Lecture 0 Slde 9 Conventonal FM ( o 3) Step We start wth a derental equaton that we wsh to solve. d d a b c d d Step We appromate the dervatves wth nte derences. k k k k k a k b k k c k IMPORTANT RULE: Ever term n a nte derence equaton must est at the same pont. Step 3 The equaton s epanded and we collect common terms Lecture 0 Slde 0 a k a k k k k k k b k k c k a k a k k bk k k c k 0

7/0/07 Conventonal FM ( o 3) Step 4 The nal equaton s used to populate a matr equaton. k a a k k bk k k k c Fllng n the matr lke ths can be a ver dcult and tedous task or more complcated derental equatons or or sstems o derental equatons. c c 3 c 3 4 c 4 c N cn N cn Lecture 0 Slde Conventonal FM (3 o 3) Step The matr equaton s solved or the unknown uncton () L c L c L c L c Lecture 0 Slde

7/0/07 Improved FM We want a ver eas wa to mmedatel wrte derental equatons n matr orm. Startng wth the same derental equaton a b c We wll develop a procedure b whch ths wll be drectl wrtten n matr orm wthout havng to eplctl handle an nte derences. a b c, A,, and B are square matrces that perorm lnear operatons on the vector. A B =c Lecture 0 Slde 3 A B =c LL L c Locatng Nodes n Matrces m or n = n m or n = (n )*N + n 3 m or n = (nz )*N*N + (n )*N + n Column n Relaton to node (n,n,nz) Row m Equaton or node (n,n,nz) Lecture 0 Slde 4

7/0/07 Numercal Boundar Condtons Lecture 0 Slde The Problem at the Boundares Suppose t s desred to solve the ollowng derental equaton on a 33 grd.,, g,, j, j, j, j, j, j g, j 0, 0, 0,3,0,0 3,0,4,4 3,4 The terms n red est outsde o the grd. How ths s handled s called a boundar condton. 4, 4, 4,3 3,,,,, 4, 3,, 3, 3,,,,, 0,,0,0 3,0,, 0,,3,, 4, 0,3,4,4 4,3 3,4 3,,,,3,, 3,, 3,3 3, 3,,3,3,3, 3,3,3,3,3, 3,3,3 3,3 3, g, g g g, 3,, g g g, 3,,3 g g,3 3,3 Lecture 0 Slde 6 3

7/0/07 rchlet Boundar Condtons ( o ) The smplest boundar condton s to assume that all values o (,) outsde o the grd are zero. 0, 0, 0,3,0,0 3,0,4,4 3,4 4, 4, 4,3,, 0,, 0 g 3,,,,, 0 g 03,, 3, 3, 0 g 0,,,3,, 0 3,,,,3,, 3,, 3,3 3, 3, g 3, 0 0 0 0 0,3,3,3, 3,3,3,3,3, 3,3,3 3,3 3,, g, 3,, g g,,3 g g,3 3,3 Lecture 0 Slde 7 rchlet Boundar Condtons ( o ) rchlet boundar condtons assume uncton values rom outsde o the grd are zero.,, 0 N, 0 N,,, 0, N 0, N,,, 0 N, 0 N, N,,,, 0, N 0,, N N Lecture 0 Slde 8 4

7/0/07 Perodc Boundar Condtons ( o ) I the uncton (,) s perodc, then the values rom outsde o the grd can be mapped to a value rom nsde the grd at the other sde.,,, and 0, j 3, j 4, j, j,0,3,4, 0, 0, 0,3,0,0 3,0,4,4 3,4 4, 4, 4,3 3,,,,,, 3,, 3, 3,,,,, 3,,3,3 3,3,, 3,,3,,, 3,3,,,3 3, 3,,,,3,, 3,, 3,3 3, 3,,3,3,3, 3,3,3,3,3, 3,3,3 3,3 3, g, g g g, 3,, g g g, 3,,3 g g,3 3,3 Lecture 0 Slde 9 Perodc Boundar Condtons ( o ) Perodc boundar condtons assume uncton values rom outsde o the grd can be taken rom the opposte sde o the grd.,, N, N,,, N,,, N, N,, N,,, N, N,,,, N N,,,, N, N,,, N N Lecture 0 Slde 30

7/0/07 Neumann Boundar Condtons We use Neumann boundar condtons or non perodc unctons or unctons that are not zero at the boundar. Here the uncton contnues lnearl outsde o the grd. Spatall varant gratng that s not perodc and not zero at the boundares. Here s a uncton wth Neumann boundares Lecture 0 Slde 3 Neumann BC s or Functon The nte derence appromaton or a uncton s d d At =, we have a problem d d 0 Ths term doesn t est! d d At =N, we have another problem d N N d N Ths term doesn t est! N N Lecture 0 Slde 3 d d N 6

7/0/07 What About the nd Order ervatves or the Neumann Boundar Condton? In order or the uncton to contnue n a straght lne, the second order dervate should be set to zero at the boundar. IMPORTANT: Ths s NOT rchlet boundar condtons. A rchlet BC sets the uncton tsel to zero outsde o the grd, not the dervatve. Here, the nd order dervatve s set to zero. d d d 0 0 d d d N N N 0 N d N d Lecture 0 Slde 33 Neumann Boundar Condtons or Functons Neumann boundar condtons are used when a uncton should be contnuous at the boundar. That s, the rst order dervatve s contnuous and the second order dervatve s zero.,,, N, N, N,,,,, N,, N N, N,,, N 0 0 0 0 Lecture 0 Slde 34 7

7/0/07 Matr Operators Lecture 0 Slde 3 Orgn o Matr Operators We start wth a governng equaton. We appromate the governng equaton wth nte derences and then wrte the ntederence equaton at each pont the grd. d d, g,,, 0 g, 3,, g 0 3, g,,, 0 g, 3,, g 0 3, g,,3,3 0 g,3 3,3,3 g 0 3,3 g,3,, 3,,, 3,,3,3 3,3 We collect the large set o equatons nto a sngle matr equaton. 0 0 0 0 0 0 0, g, 0 0 0 0 0 0, g, 0 0 0 0 0 0 0 3, g 3, 0 0 0 0 0 0 0, g, 0 0 0 0 0 0, g, 0 0 0 0 0 0 0 3, g3, 0 0 0 0 0 0 0,3 g,3 0 0 0 0 0 0,3 g,3 0 0 0 0 0 0 0 3,3 g 3,3 We construct a grd to store the unctons. Ths matr calculates the dervatve o (,) and puts the answer n g(,). Ths s a matr operator. Lecture 0 Slde 36 8

7/0/07 Other Matr Operators A square matr can alwas be constructed to perorm an lnear operaton on a uncton that s stored n a column vector.? 3 d d N FFT F d Lecture 0 Slde 37 g G h H Pont b Pont Multplcaton ( o ) b b b b 3 4 b b6 Snce we are storng our unctons n vector orm, how do we perorm a pont b pont multplcaton usng a square matr? 6 3 4 b B 3 4 6 b 0 0 0 0 0 b 0 b 0 0 0 0 b? 0 0 b3 0 0 0 3 b3 3 0 0 0 b4 0 04 b4 4 0 0 0 0 b 0 b 0 0 0 0 0 b6 6 b6 6 B B Lecture 0 Slde 38 9

7/0/07 Pont b Pont Multplcaton ( o ) b b b b 3 4 b b6 Snce we are storng our unctons n vector orm, how do we perorm a pont b pont multplcaton usng a square matr? 6 3 4 b B 3 4 6 b 0 0 0 0 0 b 0 b 0 0 0 0 b 0 0 b3 0 0 0 3 b3 3 0 0 0 b4 0 04 b4 4 0 0 0 0 b 0 b 0 0 0 0 0 b6 6 b6 6 B B Lecture 0 Slde 39 Frst Order Partal ervatve ( o ) How do we construct a square matr so that when t premultples a vector, we get a vector contanng the rst order partal dervatve? 6 3 4 3 4 6 0 0 0 0 0 0 0 0 0 0 3? 0 0 0 0 3 4 0 0 0 0 4 3 0 0 0 0 6 4 0 0 0 0 0 6 7 Lecture 0 Slde 40 0

7/0/07 Frst Order Partal ervatve ( o ) How do we construct a square matr so that when t premultples a vector, we get a vector contanng the rst order partal dervatve? 6 3 4 3 4 6 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 3 4 0 0 0 0 4 3 0 0 0 0 6 4 0 0 0 0 0 6 7 Lecture 0 Slde 4 Second Order Partal ervatve ( o ) How do we construct a square matr so that when t premultples a vector, we get a vector contanng the second order partal dervatve? 6 3 4 3 4 6 0 0 0 0 0 0 0 0 3? 0 0 0 3 4 3 0 0 0 4 4 3 0 0 0 6 4 0 0 0 0 6 7 6 Lecture 0 Slde 4

7/0/07 Second Order Partal ervatve ( o ) How do we construct a square matr so that when t premultples a vector, we get a vector contanng the second order partal dervatve? 6 3 4 3 4 6 0 0 0 0 0 0 0 0 3 0 0 0 3 4 3 0 0 0 4 4 3 0 0 0 6 4 0 0 0 0 6 7 6 Lecture 0 Slde 43 What About Grds ( o )? Two dmensonal grds are a lttle more dcult, Lecture 0 Slde 44 3 4 6 7 8 9??? 3 0 3??? 3 0 4 4??? 6 4 0 6??? 6 0 7 8 7??? 8 9 8 7 9??? 9 8

7/0/07 What About Grds ( o )? Two dmensonal grds are a lttle more dcult, 3 4 6 7 8 9 0 0 4??? 0 0 0??? 0 0 0 0 3 6 3??? 0 0 0 0 4 7 4 0 0 0 0 8 0 0 0 0 6 9 6 3 0 0 0 0 7??? 7 4 0 0 0 8??? 8 0 0 9??? 9 6 Lecture 0 Slde 4 ervatve Operators wth rchlet Boundar Condtons 0 0 0 0 0 0 0 Both o these matrces onl have 0 0 0 0 0 0 numbers along three o ther dagonals. 0 0 0 0 0 0 0 Ths s called trdagonal. 0 0 0 0 0 0 0 Ths suggests a ast wa to construct 0 0 0 0 0 0 these matrces. 0 0 0 0 0 0 0 () has some correctons shown n 0 0 0 0 0 0 0 blue along two o ts dagonals. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 These matrces contan mostl zeros. 0 0 0 0 0 0 0 0 0 0 0 0 0 These are called a sparse matrces. 0 0 0 0 0 0 0 0 0 0 0 0 See MATLAB sparse() command. 0 0 0 0 0 0 0 Also see MATLAB spdags() command. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Lecture 0 Slde 46 3

7/0/07 Wh o We Need Separate Matr Operators or Frst and Second Order ervatves? We know that, Can we just calculate () rom ()??? Yes, but ths does not make ecent use o the grd. For a pont, grd, we have 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Ths s not as accurate because t calculates the dervatve wth poorer grd resoluton than s avalable. Ths matr operator makes optmal use o the avalable grd resoluton. Lecture 0 Slde 47 ervatve Operators or Grds When N= and N> When N> and N= Z zero matr s standard or grd s standard or grd Z zero matr 0 0 0 0 0 0 0 0 0 0 Lecture 0 Slde 48 4

7/0/07 USE SPARSE MATRICES!!!!!!! The dervatve operators wll be EXTREMELY large matrces. For a small grd that s just 0000 ponts: Total Number o Ponts: 0,000 Sze o ervate Operators: 0,000 0,000 Total Elements n Matrces: 400,000,000 Memor to Store One Full Matr: 6 Gb Memor to Store One Sparse Matr: Mb NEVER AT ANY POINT should ou use FULL MATRICES n the nte derence method. Not even or ntermedate steps. NEVER! Lecture 0 Slde 49