270 likes | 295 Vues
Programming assignment #2 Solving a parabolic PDE using finite differences Numerical Methods for PDEs Spring 2007. Jim E. Jones. The Problem. Reference: Burden and Faires, Numerical Analysis, Ch12. The Problem. PDE. Boundary conditions. Initial conditions.
E N D
Programming assignment #2Solving a parabolic PDE using finite differences Numerical Methods for PDEs Spring 2007 Jim E. Jones
The Problem Reference: Burden and Faires, Numerical Analysis, Ch12
The Problem PDE Boundary conditions Initial conditions Reference: Burden and Faires, Numerical Analysis, Ch12
Last lecture we will looked at three methods • Forward Difference method (explicit) • Backward difference method (implicit) • Crank-Nicolson method (implicit)
Forward Difference method Let Time stepping formula j k h i
Backward Difference Method Let Time stepping formula j k h i
Crank-Nicolson Method Time stepping formula j k h i
All Methods Time stepping formula Time stepping corresponds to matrix multiplication Approximations are generated by repeated application of T
Stability Approximations are generated by repeated application of T If the initial conditions are perturbed, the perturbed approximation is And their difference is
Stability Following the material from ODEs we will say that a numerical method is stable if perturbations in the initial conditions give rise to perturbations in the computed solution that do not grow without bound. We want dk to be bounded for all k.
Stability Following the material from ODEs we will say that a numerical method is stable if perturbations in the initial conditions give rise to perturbations in the computed solution that do not grow without bound. We want dk to be bounded for all k. What properties of the matrix T do we need to guarantee dk doesn’t grow without bound?
Stability Following the material from ODEs we will say that a numerical method is stable if perturbations in the initial conditions give rise to perturbations in the computed solution that do not grow without bound. We want dk to be bounded for all k. We need the right analogue of absolute value which is what we had for the scalar case in the ODE slides.
Review: Vector Norms A vector norm is a function ||x|| from Rn to R with the following properties:
Review: Matrix Norms A matrix norm is a function ||A|| from the set of n x n matrices to R with the following properties:
Review: Natural Matrix Norms Any vector norm ||x|| defines a corresponding matrix norm via: And for this natural, matrix norm and its corresponding vector norm we have the following inequality
Review: Common Natural Matrix Norms The infinity norm of a matrix is the maximum row sum of the absolute values of its entries. The one norm of a matrix is the maximum column sum of the absolute values of its entries.
Review: Spectral Radius and Two Norm The spectral radius r(A) of a matrix is the largest eigenvalue in absolute value The two norm of a matrix is related to the spectral radius and if A is symmetric
Stability Following the material from ODEs we will say that a numerical method is stable if perturbations in the initial conditions give rise to perturbations in the computed solution that do not grow without bound. We need conditions to guarantee
Stability of Forward Differences using infinity norm. • If r > ½ • Unstable • Else • Stable
Stability requires spectral radius bounded by one • If r > ½ • Unstable • Else • Stable Same result as infinity norm
Assignment #2 • Forward Difference method (explicit) • Backward difference method (implicit) • Crank-Nicolson method (implicit) Assignment #2 will is due Wednesday Feb 21. You will code up these three methods for a particular problem and look at accuracy and stability issues.
Assignment #2 PDE solution is: The Burden and Faires text contains results for this example
Assignment #2 • Your job is to experiment with different values of h and k. Do your best to investigate numerically some of the issues we’ve talked about in the lecture. • Stability: Run at least two problems with forward differences. One that satisfies the stability condition and one that does not. Comment on your observations. We’ve not seen it yet, but the other two methods are unconditionally stable. • Convergence: Backward and Forward differencing has truncation error O(k+h2). Crank-Nicolson is O(k2+h2). Calculate the errors you see and comment on how they agree, or not, with these truncation error results. • Comparison: Comment on the relative strengths and weaknesses of the three methods.