Programming assignment # 3 Numerical Methods for PDEs Spring 2007

Slides:



Advertisements
Similar presentations
Numerical Solution of Linear Equations
Advertisements

Partial Differential Equations
Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 9 Instructor: Tim Warburton.
Linear System Remark: Remark: Remark: Example: Solve:
Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion
Scientific Computing QR Factorization Part 2 – Algorithm to Find Eigenvalues.
MATH 685/ CSI 700/ OR 682 Lecture Notes
Rayan Alsemmeri Amseena Mansoor. LINEAR SYSTEMS Jacobi method is used to solve linear systems of the form Ax=b, where A is the square and invertible.
Steepest Decent and Conjugate Gradients (CG). Solving of the linear equation system.
Modern iterative methods For basic iterative methods, converge linearly Modern iterative methods, converge faster –Krylov subspace method Steepest descent.
Cojugate Gradient Method Zhengru Zhang ( 张争茹 ) Office: Math. Building 413(West) 2010 年教学实践周
Total Recall Math, Part 2 Ordinary diff. equations First order ODE, one boundary/initial condition: Second order ODE.
Shawn Sickel A Comparison of some Iterative Methods in Scientific Computing.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 20 Solution of Linear System of Equations - Iterative Methods.
Sparse Matrix Methods Day 1: Overview Day 2: Direct methods
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 19 Solution of Linear System of Equations - Iterative Methods.
The Landscape of Ax=b Solvers Direct A = LU Iterative y’ = Ay Non- symmetric Symmetric positive definite More RobustLess Storage (if sparse) More Robust.
ENGG 1801 Engineering Computing MATLAB Lecture 7: Tutorial Weeks Solution of nonlinear algebraic equations (II)
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Ordinary Differential Equations (ODEs)
Systems of Linear Equations Iterative Methods
Solving Scalar Linear Systems Iterative approach Lecture 15 MA/CS 471 Fall 2003.
Scientific Computing Partial Differential Equations Implicit Solution of Heat Equation.
Programming assignment #2 Solving a parabolic PDE using finite differences Numerical Methods for PDEs Spring 2007 Jim E. Jones.
1 Incorporating Iterative Refinement with Sparse Cholesky April 2007 Doron Pearl.
Solving an elliptic PDE using finite differences Numerical Methods for PDEs Spring 2007 Jim E. Jones.
On implicit-factorization block preconditioners Sue Dollar 1,2, Nick Gould 3, Wil Schilders 2,4 and Andy Wathen 1 1 Oxford University Computing Laboratory,
Case Study in Computational Science & Engineering - Lecture 5 1 Iterative Solution of Linear Systems Jacobi Method while not converged do { }
Final Project Topics Numerical Methods for PDEs Spring 2007 Jim E. Jones.
CS 290H Administrivia: May 14, 2008 Course project progress reports due next Wed 21 May. Reading in Saad (second edition): Sections
1 Spring 2003 Prof. Tim Warburton MA557/MA578/CS557 Lecture 34.
Consider Preconditioning – Basic Principles Basic Idea: is to use Krylov subspace method (CG, GMRES, MINRES …) on a modified system such as The matrix.
Linear Systems Numerical Methods. 2 Jacobi Iterative Method Choose an initial guess (i.e. all zeros) and Iterate until the equality is satisfied. No guarantee.
Linear System expensive p=[0,0.2,0.4,0.45,0.5,0.55,0.6,0.8,1]; t=[1:8; 2:9]; e=[1,9]; n = length(p); % number of nodes m = size(t,2); % number of elements.
1 Spring 2003 Prof. Tim Warburton MA557/MA578/CS557 Lecture 32.
Programming assignment # 3 Numerical Methods for PDEs Spring 2007 Jim E. Jones.
Conjugate gradient iteration One matrix-vector multiplication per iteration Two vector dot products per iteration Four n-vectors of working storage x 0.
Fast 3D Least-squares Migration with a Deblurring Filter Wei Dai.
Example application – Finite Volume Discretization Numerical Methods for PDEs Spring 2007 Jim E. Jones.
The Landscape of Sparse Ax=b Solvers Direct A = LU Iterative y’ = Ay Non- symmetric Symmetric positive definite More RobustLess Storage More Robust More.
Iterative Solution Methods
Programming assignment #1. Solutions and Discussion
Solving Systems of Linear Equations: Iterative Methods
بسم الله الرحمن الرحيم.
Iterative Methods Good for sparse matrices Jacobi Iteration
Lecture 19 MA471 Fall 2003.
CSE 245: Computer Aided Circuit Simulation and Verification
A Comparison of some Iterative Methods in Scientific Computing
CSE 245: Computer Aided Circuit Simulation and Verification
ENGG 1801 Engineering Computing
MATLAB EXAMPLES Matrix Solution Methods
Variations on Backpropagation.
CSE 245: Computer Aided Circuit Simulation and Verification
Matrix Methods Summary
Scientific Computing Partial Differential Equations Implicit Solution of Heat Equation.
CS5321 Numerical Optimization
Introduction to Scientific Computing II
MATH-321 In One Slide MATH-321 & MATLAB Command.
Numerical Linear Algebra
Introduction to Scientific Computing II
MAT 2401 Linear Algebra 7.2 Diagonalization
Numerical Methods on Partial Differential Equation
Administrivia: November 9, 2009
Variations on Backpropagation.
Performance Optimization
Programming assignment #1 Solving an elliptic PDE using finite differences Numerical Methods for PDEs Spring 2007 Jim E. Jones.
Linear Algebra Lecture 16.
Numerical Modeling Ramaz Botchorishvili
Home assignment #3 (1) (Total 3 problems) Due: 12 November 2018
Solving Systems of Linear Equations by Elimination
Presentation transcript:

Programming assignment # 3 Numerical Methods for PDEs Spring 2007 Jim E. Jones

Programming Assignment #3 Problem 1 Problem 2 K=.01 K=1 K=100 K=1

Programming Assignment #3 Use your code to investigate these issues How does the variable K effect the computed solution. This is best seen by comparing plots of the solution to the two problems. How does the number of conjugate gradient iterations required compare to the number of Gauss-Seidel iterations required for the same tolerance.

Programming Assignment #3 On web page are three matlab codes: hw3gs: Gauss-Seidel hw3cg: Conjugate Gradient hw3pcg: Preconditioned Conjugate Gradient

Plots showing the effect of variable K on the solution Constant K Variable K

Results: Iterations needed for tol=1e10-6 K=1 n=10 n=20 n=40 n=80 GS 132 474 1673 5790 CG 23 48 95 185 variable K n=10 n=20 n=40 n=80 GS 179 662 2424 8786 CG 227 1032 3106 7676

Conjugate gradient algorithm To solve Au=f, starting from initial guess u0 r0=f-Au0 for k=1,2,3,… rk-1= (rk-1Trk-1) if k=1 p1= r0 else bk-1=rk-1/rk-2 pk=rk-1+bk-1pk-1 end if qk=Apk ak= rk-1/(pkTqk) xk=xk-1+akpk rk=rk-1-akqk Check convergence end for

Preconditioning The convergence of conjugate gradients for solving Ax=b depends on the eigenvalues of A (see Shewchuck). Sometimes it pays to modify the system by multiplying by a matrix, M-1Ax=M-1b. Now the convergence depends on eigenvalues of M-1A.

Preconditioned conjugate gradient algorithm To solve Au=f, starting from initial guess u0 r0=f-Au0 for k=1,2,3,… sk-1= M-1rk-1 rk-1= (rk-1Tsk-1) if k=1 p1= s0 else bk-1=rk-1/rk-2 pk=sk-1+bk-1pk-1 end if qk=Apk ak= rk-1/(pkTqk) xk=xk-1+akpk rk=rk-1-akqk Check convergence end for

Preconditioning The preconditioner M should be “close” to A. The preconditioner should be easy to invert. Simple preconditioner, M=D, the diagonal of A.

Results: Iterations needed for tol=1e10-6 K=1 n=10 n=20 n=40 n=80 GS 132 474 1673 5790 CG 23 48 95 185 PCG variable K n=10 n=20 n=40 n=80 GS 179 662 2424 8786 CG 227 1032 3106 7676 PCG 32 68 133 255

Upcoming Schedule March M W 12 14 19 21 26 28 April M W 2 4 9 11 16 18 12 14 19 21 26 28 April M W 2 4 9 11 16 18 23 25 Upcoming Schedule Take home portion of exam handed out March 28 Take home due and in class exam April 2 Programming assignment #4 due April 9 Final Project presentations April 23 & 25

Upcoming Schedule March M W 12 14 19 21 26 28 April M W 2 4 9 11 16 18 12 14 19 21 26 28 April M W 2 4 9 11 16 18 23 25 Upcoming Schedule Take home portion of exam handed out March 28 Take home due and in class exam April 2 Programming assignment #4 due April 9 Final Project presentations April 23 & 25 Optional: Will drop lowest programming assignment 13

Optional Programming assignment #4 Implement the finite difference method we talked about last time for the hyperbolic PDE: Exact solution

Optional Programming assignment #4 Investigate stability and accuracy issues What relationship between h and k must hold for stability? Do your results agree with the CFL condition? How does the error behave: O(h+k)? O(h2 + k)? O(h2 + k2)? ???