

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Final Project (for grad. students) Date assigned: April 15, 2009 Due date: May 6, 2009
PROBLEMS:
d^2 u dx^2
du dx − 3 u = 0 (1)
u(0) = 2; du dx
(a) Solve IVP (1) analytically using appropriate method. (b) Transform (1) into the system of two first order equations. (c) Solve the resulting system numerically using explicit Euler method for systems. (d) Plot the numerical and analytical solutions for x ∈ [0, 2]. (e) Compute the maximum norm of the difference between numerical and analytical solutions.
∂u ∂t
∂^2 u ∂x^2
= 0, x ∈ [0, 1], t > 0 , (2)
with initial and boundary conditions given by
u(x, 0) =
{ x, if 0 ≤ x ≤ 0. 5 , 1 − x, if 0. 5 < x ≤ 1.
u(0, t) = u(1, t) = 0, t >= 0. (4)
Numerically solve (2)-(4) with the diffusion coefficient D = 1/2.
Use the following difference scheme:
un j +1− unj ∆t
unj+1 − 2 unj + unj− 1 ∆x^2
Take ∆x = 0.1 and compute the numerical solution of (2)-(4) with ∆t = 1/ 50 , 1 / 100 , 1 /200.
Questions.
Exact solution for 1D diffusion equation:
v(x, t) =
∑^ ∞
k=
(kπ)^2 sin( kπ 2 ) sin(kπx)e−D(kπ) (^2) t , (5)
where t is the time, x is the space coordinate and D is the diffusion coefficient.
Matlab code for computing exact solution is given below. In this code the summation has 13 terms (instead of ∞), the time variable is T (so the final time is 1 in this code), xcoord is the space coordinate, J is number of space intervals.
xcoord=linspace(0,1,J+1) vxt=zeros(J+1,1); vxt_sum=zeros(1,J+1); for k=1: vxt=4(1/((kpi).^2))sin(kpi/2)sin(kpixcoord)exp(-D(kpi).^2*T); vxt_sum=vxt_sum+vxt; sol=vxt_sum end