MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.

Slides:



Advertisements
Similar presentations
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Advertisements

ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Laplace Transform Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2008 by Douglas Wilhelm Harder.
Copyright © Cengage Learning. All rights reserved.
Some Ideas Behind Finite Element Analysis
Differentiation and Richardson Extrapolation
Topics in Applied Mathematics Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
The Black-Scholes Equation in Finance Nathan Fiedler Joel Kulenkamp Steven Koch Ryan Watkins Brian Sikora.
Ch 5.2: Series Solutions Near an Ordinary Point, Part I
Ch 7.9: Nonhomogeneous Linear Systems
17 VECTOR CALCULUS.
Ch 2.1: Linear Equations; Method of Integrating Factors
Boundary-value Problems and Finite-difference Equations Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University.
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
Laplace’s Equation in 2 and 3 Dimensions Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Finite element method 1 Finite Elements  Basic formulation  Basis functions  Stiffness matrix  Poisson‘s equation  Regular grid  Boundary conditions.
The Wave Equation Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Louisiana Tech University Ruston, LA Slide 1 Krogh Cylinder Steven A. Jones BIEN 501 Wednesday, May 7, 2008.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
The Shooting Method for Boundary-value Problems
Lecture 4: Boundary Value Problems
Fixed-Point Iteration Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Section 2: Finite Element Analysis Theory
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Welcome to ECE 204 Numerical Methods for Computer Engineers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo.
Proof by Induction.
The Crank-Nicolson Method and Insulated Boundaries
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Finite Element Method.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Binary Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
16 VECTOR CALCULUS.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Chapter 8 Integration Techniques. 8.1 Integration by Parts.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 31.
Problems with Floating-Point Representations Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright.
Decimal Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007 by Douglas Wilhelm Harder.
HEAT TRANSFER FINITE ELEMENT FORMULATION
Double-Precision Floating-Point Numbers Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2007.
The Wave Equation Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Interpolation Search Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
Interpolating Solutions to IVPs Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
In Chapters 6 and 8, we will see how to use the integral to solve problems concerning:  Volumes  Lengths of curves  Population predictions  Cardiac.
MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011.
Boyce/DiPrima 9 th ed, Ch 11.3: Non- Homogeneous Boundary Value Problems Elementary Differential Equations and Boundary Value Problems, 9 th edition, by.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 N -ary trees This topic quickly looks at a generalization of a binary tree, where each node has up to N children –Definition –Perfect N -ary trees –Complete.
Announcements Topics: -sections 7.3 (definite integrals), 7.4 (FTC), and 7.5 (additional techniques of integration) * Read these sections and study solved.
1 Complete binary trees Outline Introducing complete binary trees –Background –Definitions –Examples –Logarithmic height –Array storage.
Boyce/DiPrima 10th ed, Ch 7.9: Nonhomogeneous Linear Systems Elementary Differential Equations and Boundary Value Problems, 10th edition, by William E.
Open Addressing: Quadratic Probing
Outline Introducing perfect binary trees Definitions and examples
Finite Elements Basic formulation Basis functions Stiffness matrix
Boundary-value problems and Finite-difference equations
Laplace’s Equation in 2 and 3 Dimensions
Presentation transcript:

MATH 212 NE 217 Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada Copyright © 2011 by Douglas Wilhelm Harder. All rights reserved. Advanced Calculus 2 for Electrical Engineering Advanced Calculus 2 for Nanotechnology Engineering Finite-Element Methods in Two Dimensions

Finite-element Methods in Two Dimensions 2 Outline This topic discusses an introduction to finite-element methods in two dimensions –What we did in one dimension –Dividing up a 2-D region –Defining planar test functions on those regions –Converting the test functions to systems of linear equations –Solving the system –Examples

Finite-element Methods in Two Dimensions 3 Outcomes Based Learning Objectives By the end of this laboratory, you will: –You will understand dividing regions into triangular sub-regions (tessellations) –Understand the mathematical theory for performing finite-element methods in two dimensions

Finite-element Methods in Two Dimensions 4 Integration-by-Parts in Higher Dimensions Before we start, we need a higher-dimensional version of integration by parts: –Using the properties of the gradient: –Now use a corollary of Stokes’ theorem: Ref:

Finite-element Methods in Two Dimensions 5 Integration-by-Parts in Higher Dimensions This variation has the product of two scalar-valued functions replaced with a product of scalar- and vector-valued functions –Using the properties of the gradient: –Now use a corollary of Stokes’ theorem:

Finite-element Methods in Two Dimensions 6 Poisson’s Equation in Two Dimensions At this point, we have generalized the finite-difference method to allow arbitrarily spaced points in one dimension to solve systems such as Poisson’s equation: The ultimate goal is to do this in 2 and 3 dimensions –In order to achieve this, we need one further idea

Finite-element Methods in Two Dimensions 7 Extending Test Functions In the previous –Use triangles to divide up the region instead of intervals Tessellations –Approximate the solution using interpolating polynomials Intervals Tessellation

Finite-element Methods in Two Dimensions 8 Partitioning a Region Given a region R, a partial differential equation defines conditions on the boundary ∂R and we attempt to find an approximation of the solution in the region

Finite-element Methods in Two Dimensions 9 Partitioning a Region We have seen how using finite differences, we: –Create a uniform grid –Assign points to either the boundary or the interior of the region

Finite-element Methods in Two Dimensions 10 Partitioning a Region Unfortunately, uniform grids make a poor approximation of most real-world situations

Finite-element Methods in Two Dimensions 11 Partitioning a Region It would be much more desirable to allow the user to select the placement of points where appropriate: –Non-linear boundaries can be fitted –Points can be concentrated at regions of interest Let N be the number interior points – in this case, 22

Finite-element Methods in Two Dimensions 12 Partitioning a Region In one dimension, the regions between points were intervals –Similarly, we must divide the region into a number of sub-regions

Finite-element Methods in Two Dimensions 13 Partitioning a Region Our goal will be to find approximations of the solution on the interior of the region R

Finite-element Methods in Two Dimensions 14 Partitioning a Region We will divide the region into triangular elements: –This forms a connected graph –The collection of all triangles is a tessellation –Tessella is the Latin word for a small piece of a mosaic

Finite-element Methods in Two Dimensions 15 Partitioning a Region From wikipedia: a tessellation of a 2D magnetostatic configuration User: Zureks

Finite-element Methods in Two Dimensions 16 Defining Test Functions In one dimension, for each interior point, x k, we used the two adjacent intervals upon which we defined the test functions –The support of the test function  6 (x) is the interval [x 5, x 7 ] 6(x)6(x) 7(x)7(x)

Finite-element Methods in Two Dimensions 17 Defining Test Functions In two dimensions, given the point x k, we will define a test function on the region comprised of triangles adjacent to x k –Call that region R k

Finite-element Methods in Two Dimensions 18 Defining Test Functions For ease of reference, given a point x k, we will number the adjacent points, in this case: x k,1 x k,2 x k,3 x k,4 x k,5 x k,6

Finite-element Methods in Two Dimensions 19 Defining Test Functions Similarly, we will label each triangles with R k, in this case: R k,1 R k,2 R k,3 R k,4 R k,5 R k,6

Finite-element Methods in Two Dimensions 20 Defining Test Functions On each region R k, we will define a piecewise planar test function –The test function is  k (x, y) –It is defined to be zero outside R k –It is also useful to have it zero on the boundary ∂R k

Finite-element Methods in Two Dimensions 21 Defining Test Functions The formula for each plane  k, ℓ (x, y) defined on R k, ℓ is a plane of the form  x +  y +  –To find it, we use linear algebra

Finite-element Methods in Two Dimensions 22 Finding Interpolating Planes Given three points in the plane (x 1, y 1 ), (x 2, y 2 ), (x 3, y 3 ) if we want to find the interpolating plane  x +  y +  that passes through these points z 1, z 2, and z 3, respectively, we must solve the system of linear equations

Finite-element Methods in Two Dimensions 23 Finding Interpolating Planes Rewritten using matrices and vectors, we must solve:

Finite-element Methods in Two Dimensions 24 Finding Interpolating Planes Example, given the points in the plane (1.3, 5.4), (2.9, 7.0) and (6.5, 4.9)

Finite-element Methods in Two Dimensions 25 Finding Interpolating Planes Example, given the points in the plane (1.3, 5.4), (2.9, 7.0) and (6.5, 4.9) we want to find the polynomial  x +  y +  that passes through the points 2.8, 1.6 and 3.9, respectively

Finite-element Methods in Two Dimensions 26 Finding Interpolating Planes Example, given the points in the plane (1.3, 5.4), (2.9, 7.0) and (6.5, 4.9) we want to find the polynomial  x +  y +  that passes through the points 2.8, 1.6 and 3.9, respectively We must therefore solve >> [ ; ; ] \ [ ]' ans =

Finite-element Methods in Two Dimensions 27 Finding Interpolating Planes From >> [ ; ; ] \ [ ]' ans = we have that the interpolating plane is x – y

Finite-element Methods in Two Dimensions 28 Using the Test Function Now, going back to the problem: –We have the test function  k (x, y) and we have a function V(x, y) that is known to satisfy the formula V(x, y) = 0 As we did in one dimension, it must therefore be true that

Finite-element Methods in Two Dimensions 29 Using the Test Function Again, let’s consider Poisson’s equation: We defined and thus our integral is

Finite-element Methods in Two Dimensions 30 Using the Test Function Expanding the integral, we get where the right-hand side is reasonably easy to calculate The left-hand side, however, requires further calculus

Finite-element Methods in Two Dimensions 31 Using the Test Function Using the 2-dimensional equivalent of integration-by-parts, we get:

Finite-element Methods in Two Dimensions 32 Using the Test Function Using the 2-dimensional equivalent of the fundamental theorem of calculus: However, recall that we specifically chose a test function that is zero on the boundary ∂R k –Therefore, the first term disappears! 0

Finite-element Methods in Two Dimensions 33 Using the Test Function Therefore, we have the easier integral: and therefore we have

Finite-element Methods in Two Dimensions 34 Using the Test Function We can calculate the right-hand side: both are known The left-hand side has the unknown function u(x, y) …

Finite-element Methods in Two Dimensions 35 Using the Test Function We can calculate the right-hand side: both are known First, rewrite the left-hand side as integrals over each sub-region Let n k be the number of triangles touching x k – in this case, 6

Finite-element Methods in Two Dimensions 36 Finding the Test Function Gradient The test function defined on each sub-region is planar, that is thus we can easily calculate:

Finite-element Methods in Two Dimensions 37 Finding the Test Function Gradient To find the gradient of this plane, we must find the vector

Finite-element Methods in Two Dimensions 38 Finding the Test Function Gradient Solving for  is as follows:

Finite-element Methods in Two Dimensions 39 Finding the Test Function Gradient Solving for  is as follows:

Finite-element Methods in Two Dimensions 40 Approximating the Solution Gradient The next step is to approximate the unknown

Finite-element Methods in Two Dimensions 41 Approximating the Solution Gradient The actual unknown function u(x, y) an unknown and likely non- linear function –You don’t get paid $ /a to find a linear function…

Finite-element Methods in Two Dimensions 42 Approximating the Solution Gradient Recall from 1-D finite element methods: –We approximated the solution with an unknown piecewise linear function

Finite-element Methods in Two Dimensions 43 Approximating the Solution Gradient We are attempting to approximate u(x, y) at a number of interior points where the solution is defined on the border

Finite-element Methods in Two Dimensions 44 Approximating the Solution Gradient We can do the same as we did in one dimension: –Approximate the solution by a piecewise planer approximation

Finite-element Methods in Two Dimensions 45 Approximating the Solution Gradient As before, we can find the interpolating polynomial:

Finite-element Methods in Two Dimensions 46 Approximating the Solution Gradient To find the gradient of this triangle, we must find the vector

Finite-element Methods in Two Dimensions 47 Approximating the Solution Gradient Solving for a is as follows:

Finite-element Methods in Two Dimensions 48 Approximating the Solution Gradient Solving for b is as follows:

Finite-element Methods in Two Dimensions 49 Approximating the Double Integral Thus, we can find both gradients: If you look back, all values are either known –The positions of the points x k, x k,1 and x k,2 : x 1, x 2, x 3, y 1, y 2, y 3 or unknown constants u k, u k,1 and u k,2 : –Take them out of the integral

Finite-element Methods in Two Dimensions 50 Approximating the Double Integral Finally, we note that the right-hand integral is just the area of the region R k,1, call it A k,1 :

Finite-element Methods in Two Dimensions 51 Approximating the Double Integral Thus, for each interior point x k, we must calculate: For each x k, there are n k adjacent triangles R k,ℓ, and each of these is associated given three points, call them x 1 = (x 1, y 1 ), x 2 = (x 2, y 2 ), x 3 = (x 3, y 3 ) and the unknowns associated with, call them u 1, u 2 and u 3 : –Each interior point ends up with n k linear equations that are summed together forming a single linear equation

Finite-element Methods in Two Dimensions 52 Approximating the Double Integral If the ratio is a constant, the right-hand integral can be simplified further: where A k is the area of the region R k

Finite-element Methods in Two Dimensions 53 Finding the points This will produce N linear equations and unknowns –We can solve this system of linear equations for the unknown values u 1, u 2, u 3, …, u N

Finite-element Methods in Two Dimensions 54 Code For 2-D Finite Elements A set of functions are available on the web site that set a finite element system and solve for the interior values –It assumes the right-hand side of Poisson’s equation is constant fe_system( rho, pts ) Create a data structure for the above equation by passing in a set of points (interior and boundary) with values for the boundary points and -Inf for the interior points fe_update( obj, pt, alist ) Indicate the tessellation around an interior point by passing a list of neighbouring points fe_solve( obj ) Having called fe_update for each interior point, now solve the system of equations returning the initial argument pts with all values -Inf replaced with values fe_coeffs( x1, x2, x3 ) A helper function

Finite-element Methods in Two Dimensions 55 Example 1 Consider the following region and we are trying to approximate Laplace’s equation (  = 0 ) with the following region and boundary values:

Finite-element Methods in Two Dimensions 56 Example 1 We can define the system as follows: pts1 = [ % % Inf % % % Inf % ]'; % 7 obj1 = fe_system( 0, pts1 );

Finite-element Methods in Two Dimensions 57 Example 1 We define the tessellation around the point 3 by listing the adjacent points in order (counter-clockwise): obj1 = fe_update( obj1, 3, [ ] ); Note, Matlab does not have proper objects, thus we simulate object-oriented programming by replacing obj1.fe_update( 3, [4, 6, 2, 1] ) with obj1 = fe_update( obj1, 3, [4, 6, 2, 1] )

Finite-element Methods in Two Dimensions 58 Example 1 Similarly, we define the tessellation around the point 6 by listing the adjacent points in order (counter-clockwise): obj1 = fe_update( obj1, 6, [ ] );

Finite-element Methods in Two Dimensions 59 Example 1 Having defined the system, we solve the system and plot the result: u1 = fe_solve( obj1 ) u1 = plot3( u1(1,: ), u1(2,:), u1(3,:), 'ko' ) The plot was augmented in CorelDRAW!

Finite-element Methods in Two Dimensions 60 Example 2 Consider the following region and we are trying to approximate Poisson’s equation with  = 4, the following region and boundary values:

Finite-element Methods in Two Dimensions 61 Example 2 We can define the system as follows: pts2 = [ % % % Inf % % Inf % Inf % % –Inf % % % Inf % ]'; % 13 obj2 = fe_system( 4, pts2 );

Finite-element Methods in Two Dimensions 62 Example 2 We then define the various tessellations: obj2 = fe_update( obj2, 4, [ ] ); obj2 = fe_update( obj2, 6, [ ] ); obj2 = fe_update( obj2, 7, [ ] ); obj2 = fe_update( obj2, 9, [ ] ); obj2 = fe_update( obj2, 12, [ ] );

Finite-element Methods in Two Dimensions 63 Example 2 Finally, we solve the system: u2 = fe_solve( obj2 ) u = Columns 1 through Columns 9 through plot3( u2(1,:), u2(2,:), u2(3,:), 'o' )

Finite-element Methods in Two Dimensions 64 Example 2 Here we see the boundary points and the actual solution (light blue) and the approximations (in red)

Finite-element Methods in Two Dimensions 65 Summary This topic discusses an introduction to finite-element methods in two dimensions –We generalized the test functions in one dimension –Created a tessellation of the region R –Defined planar test functions Found the gradient of the planes making the test functions –Approximated the solution with piecewise planar sections –Created a linear equation This is done for each interior point –The resulting system of linear equations may be solved –Two examples…

Finite-element Methods in Two Dimensions 66 What’s Next? The next step is to go to three dimensions –Divide the region into tetrahedral regions –3-dimensional tessellations Tessellation User: Tom Ruen Robert Webb's Great Stella software

Finite-element Methods in Two Dimensions 67 References [1]Glyn James, Advanced Modern Engineering Mathematics, 4 th Ed., Prentice Hall, 2011, §§9.2-3.

Finite-element Methods in Two Dimensions 68 Usage Notes These slides are made publicly available on the web for anyone to use If you choose to use them, or a part thereof, for a course at another institution, I ask only three things: –that you inform me that you are using the slides, –that you acknowledge my work, and –that you alert me of any mistakes which I made or changes which you make, and allow me the option of incorporating such changes (with an acknowledgment) in my set of slides Sincerely, Douglas Wilhelm Harder, MMath