18.085 Fall 2011

Announcements

Ch1Q19FiniteDiffs.m
output1.pdf
output2.pdf
output3.pdf
Ch1Q19FiniteDiffsConvergence.m
This is a code for Problem 1.2.19: Finite differences for the linear advection-diffusion equation
- D * u_xx + v * u_x = 1 in Homework 1 [1.2.19]
You could test this code with different parameters D, v, h as suggested below.
The code solves and then plots the solutions. It compares the true analytic solution with the solution from finite differences,
using (1) centered differences and (2) upwind differences. See sample outputs. It is easy to
* see the matrices K (diffusion) and Del0 or Del_+ (centered/forward) for small N
* see the boundary conditions u(0) = 0 and u(1) = 0
* see whether centered or upwind is more accurate
* make h smaller and see the approximations converge (increase the number of mesh points, N, to make h smaller)
What is the order of convergence (try the second code for this)?
* try different values of the parameters D, v
(i) v=D=1
(ii) v << D (and see the numerical approximation is good, even with large h)
(iii) v >> D (and see a boundary layer because diffusion is so weak)

Class Stuff

Course Topics

Additional Information

Class Resources

o Movie of elimination   moe.m   (also need realmmd.m )

o Code to create K,T,B,C as sparse matrices

o MATLAB's backslash command to solve Ax = b   (ps, pdf)

o Getting started with Matlab: http://ocw.mit.edu/OcwWeb/Mathematics/18-06Spring-2005/RelatedResources/