1 / 26

1-D Finite-Element Methods with Tent Test Functions

1-D Finite-Element Methods with Tent Test Functions. Outline. This topic discusses an introduction to finite-element methods Background Define tent-shaped test functions Perform integration-by-parts to get the linear equation Approximate the solution by a linear solution

magnar
Télécharger la présentation

1-D Finite-Element Methods with Tent Test Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 1-D Finite-Element Methodswith Tent Test Functions

  2. Outline This topic discusses an introduction to finite-element methods • Background • Define tent-shaped test functions • Perform integration-by-parts to get the linear equation • Approximate the solution by a linear solution • Find the system of equations

  3. Outcomes Based Learning Objectives By the end of this laboratory, you will: • Understand the use of test functions in one dimension • Understand how to create a system of linear equations using these test functions in one dimenion

  4. The Target Equation At this point, we have generalized the finite-difference method to allow arbitrarily spaced points in one dimension The ultimate goal is to do this in 2 and 3 dimensions • In order to achieve this, we need one further idea

  5. Test Functions Up to this point, we have used uniform test functions:

  6. Test Functions Two problems: • The impulse function appears in the integrals, and • This will not generalize to two and three dimensions!

  7. Test Functions Solution: • Use a tent function

  8. Test Functions Defining such functions is straight-forward: If x = x2, both , if x = x1, , and if x = x3,

  9. Integration by Parts Now, substitute this test function into the integral: which yields

  10. Integration by Parts The tent function disappears at x1 at x3: thus, this simplifies to: 0

  11. Integration by Parts The tent function disappears at x1 at x3: thus, this simplifies to: 0 A similar property will be used in 2 and 3 dimensions – remember this fact!

  12. Integration by Parts Recall that both the test function f2(x) and are defined on :

  13. Integration by Parts On the intervals, the derivatives are defined:

  14. Integration by Parts Thus:

  15. Integration by Parts In general:

  16. Integration by Parts Substituting this back into our equation, we get: or, expanding the left-hand side:

  17. Integration by Parts In the special case that is a constant, this simplifies further:

  18. The Test Functions The function to find the approximations is straight-forward: function [ v ] = uniform1d( x, uab, rho ) n = length( x ) - 2; idx = 1./diff(x); M = diag( -(idx( 1:end - 1 ) + idx( 2: end )) ) + ... diag( idx( 2:end - 1 ), -1 ) + ... diag( idx( 2:end - 1 ), +1 ); b = zeros ( n, 1 ); for k = 1:n b(k) = int( rho, x(k), x(k + 1), x(k + 2) ); end b(1) = b(1) - idx(1)*uab(1); b(end) = b(end) - idx(end)*uab(end); v = [uab(1); M \ b; uab(2)]; end int( rho, a, b ) approximates

  19. The Test Functions In Matlab, recall that we may evaluate functions at a vector of points: • Let a, b, c be the points x = linspace( a, c, n ); rhox = rho( x ).*((x < b).*(x – a)/(b – a) + (x >= b).*(x – c)/(b – c));

  20. The Test Functions For example, we get the following graph with this Matlab code: >> a = 1; b = 2; c = 5; >> x = linspace( a, c, 100 ); >> tentx = (x < b).*(x - a)/(b - a) + (x >= b).*(x - c)/(b – c); >> cosx = cos(x).*tentx; >> hold on >> plot( x, cosx, 'b' ); >> plot( x, cos(x), 'r' ); >> plot( x, tentx, 'm' );

  21. The Test Functions Using the exact same example fromthe last uniform case: >> x_uneq = [0 0.16 0.25 0.33 0.41 0.5 0.59 0.67 0.75 0.84 1]'; >> u_uniform = uniform1d( x_uneq, [0, 0], @rho ); >> u_tent = tent1d( x_uneq, [0, 0], @rho ); >> plot( x_uneq, u_uniform, 'b+' ); >> hold on >> plot( x_uneq, u_tent, 'rx' );

  22. The Test Functions To demonstrate that this is better than the previous approximation: >> plot( x_uneq, u_uniform - u(x_uneq), 'b+' ); >> plot( x_uneq, u_tent - u(x_uneq), 'rx' ); >> norm( u_uniform - u(x_uneq) ) ans = 0.0012 >> norm( u_tent - u(x_uneq) ) ans = 4.7368e-011 Recall that the function u(x) is the exact solution 8 × 10–4 –1.8 × 10–11

  23. Summary In this topic, we have used tent-shaped test functions as opposed to uniform test functions • The integration-by-parts was simpler • We avoided the end points as they were zero • No impulse functions… • More work is required for the code • Better solution for our example

  24. What’s Next? We will next look at how we can extend this to two dimensions • Use triangles to divide up the region instead of intervals • Tessellations • Approximate the solution using interpolating polynomials Intervals Tessellation

  25. References [1] Glyn James, Advanced Modern Engineering Mathematics, 4th Ed., Prentice Hall, 2011, §§9.2-3.

  26. 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 dwharder@alumni.uwaterloo.ca

More Related