Homework 11: Numerical Solution to the Diffusion Equation

advertisement
Homework 11: Numerical Solution to the Diffusion Equation
[Extra Credit] Consider the diffusion equation
ut = Duxx .
Set D = 1. In additional to the analytical techniques discussed during lecture, it is also possible
to solve this equation numerically (given initial and boundary conditions) using MATLAB. See
pde num sol.m for code.
(a) The default code solves the diffusion equation on the interval [0,1], from t = 0 to t = 0.1 with
the following conditions:
1
[cos(13x) + 1]
2
BC: u(0, t) = 1, u(1, t) = 0.
IC: u(x, 0) =
• Describe the output of the plot and the movie.
• Find the steady state solution analytically. Does the numerical solution converge to this
solution as t → ∞? Provide a plot to support this answer.
(b) Examine the code. Note that the boundary points are updated separately from the points on
the interior. Why is this done?
(c) Adjust the code to consider a Gaussian initial condition with µ = 0.5 and σ = 0.05, as well as
no flux boundary conditions:
1
(x − µ)2
IC: u(x, 0) = √
exp −
2σ 2
2πσ 2
BC: ux (0, t) = 0, ux (1, t) = 0.
No need to write additional code. Simply comment/uncomment the provided code accordingly.
• Describe the output of the plot and the movie.
• Change µ and σ. Does this significantly change the output of the plots? Does the solution
appear to be converging to the same solution?
1
Download