1 / 26

MA2213 Lecture 11

MA2213 Lecture 11. PDE. Topics. Introduction p. 451-452. Poisson equation p. 453-466. Boundary conditions p. 453. Finite difference grid p. 454-456. MATLAB Program p. 456-458. Visualization of numerical results p. 459-466. One-dimensional heat equation p. 466-481. Introduction.

connie
Télécharger la présentation

MA2213 Lecture 11

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. MA2213 Lecture 11 PDE

  2. Topics Introduction p. 451-452 Poisson equation p. 453-466 Boundary conditions p. 453 Finite difference grid p. 454-456 MATLAB Program p. 456-458 Visualization of numerical results p. 459-466 One-dimensional heat equation p. 466-481

  3. Introduction “Many phenomena in sciences and engineering depend on more than one variable. For example, an unknown function of a real-world problem usually depends on both time t and the location of the point (x,y,z).” p. 451 Physical laws, including the conservation of energy, momentum and mass, the laws of electricity and magnetism, thermodynamics, and chemical kinetics, require that the partial derivatives of these functions satisfy certain (partial differential) equations.

  4. Introduction Increasingly, PDE’s are used to model biological and social phenomena. The models include the “law of supply and demand” in economics that determines equilibrium prices of goods and services, the Black-Sholes equation for options prices in arbitrage-free financial markets, and laws that describe the evolution of population densities that are used in epidemiology, ecology, and population genetics. http://www.imbs.uci.edu/index.html

  5. Introduction Examples Poisson equation Heat equation Wave equation

  6. Poisson Equation Boundary Conditions Let be a planar domain, and denote its boundary by The boundary value problem is called a Dirichlet problem because the value of u is specified on the boundary. For simplicity we will assume that and therefore

  7. Finite Difference Grid For the square domain we choose a grid of points example boundary points interior points

  8. Finite Difference Approximation We approximate the PDE by where at interior points For boundary points

  9. Finite Difference Approximation We approximate by the solutions of Where, at every boundary point, we define

  10. Finite Difference Equations We now choose to obtain equations for and equations for

  11. Solution Using Gauss-Seidel for k = 1,…,maxit for i = 2,…,n for j = 2,…,n end % j loop end % i loop end % k loop Compare this with the Jacobi method that you used for problems in slides 37,41 of Lecture 7.

  12. MATLAB Program n = 10; maxit = 60;h = 1/n; [X,Y] = meshgrid(0:h:1,0:h:1); u = zeros(n+1); f = -2*pi^2*sin(pi*X).*sin(pi*Y); figure(1); surf(X,Y,f); title([‘f = -source distribution’]) for k = 1:maxit for i = 2:n for j = 2:n u(i,j) = 0.25*(u(i-1,j)+u(i+1,j)+u(i,j+1)+u(i,j-1)-h^2*f(i,j)); end end end figure(2); surf(X,Y,u); title([‘computed solution’]) utrue = sin(pi*X).*sin(pi*Y); figure(3); surf(X,Y,utrue-u); title([‘error with ’ num2str(maxit) ‘ iterations’])

  13. Source Distribution

  14. Computed Solution with 60 iter Gauss-Seidel

  15. Error Due Primarily to Discretization

  16. One Dimensional Heat Equation We consider the initial value problem for a function The heat equation arises in the modeling of a number of phenomena and is often used in financial mathematics in the modeling of options. The famous Black-Scholes option pricing model's differential equation can be transformed into the heat equation allowing relatively easy solutions.

  17. One Dimensional Heat Equation The domain of the function boundary value boundary value initial value

  18. Discretization We divide the interval [0,L] into equal parts to obtain a grid with size and (space) grid points and divide We also choose maximum time the interval [0,T] into equal parts to obtain a grid with size and (time) grid points This provides a two-dimensional grid with points

  19. Discretization We define and will compute approximations We first use approximations

  20. Discretization and combine them with the Heat PDE to obtain approximate equations We replace by

  21. Discretization to obtain linear equations that can be solved directly by

  22. Matrix Representation Define sequences Then where and the matrix in slide 38, L7 has eig.val. the eigenvalues satisfy

  23. Stability The numerical roundoff error sequence satisfies therefore the algorithm is stable if and only if the iteration matrix has spectral radius < 1 Since this occurs for large when

  24. MATLAB CODE L = 1; nx = 20; hx = L/nx; a = 1; ht = hx^2/3; % for stable % ht = hx^2; for unstable niter = 500; F = zeros(nx-1,1); F(nx-1) = ht/(hx^2); u(:,1) = zeros(nx-1,1); A = -diag(2*ones(nx-1,1)) + diag(ones(nx-2,1),1) + diag(ones(nx-2,1),-1); I = eye(nx-1); c = a*ht/(hx^2); M = I + c*A; for k = 1:niter u(:,k+1) = M*u(:,k) + F; end

  25. Stable Solution of Heat Equation

  26. Unstable Solution of Heat Equation

More Related