MATH Partial Differential Equations in Engineering

Assignment

Your code should include comments using the % symbol explaining what each part of your code is doing.

__Heat propagation in a brick. __

Consider a 1 m in length brick that has been heated in such a way that its temperature distribution at t = 0 is given by;

T(x,0) = 30x+30 for all x where 0 £x £1

Assuming that a = k = 1, two different cases are to be considered:

- In this first case, the brick is allowed to cool down by having one end (x = 0) lose heat at constant rate of
^{-1}which starts instantaneously. The other end (x = 1) is held at a constant temperature of 30 C. - In the second case, the brick is put into contact with two thermal sources and their boundaries become instantaneously held at 60 C (x=0) and 60 C (x = 1).

Calculate the following:

- (a) (6 marks) Write MATLAB code which uses the Crank/Nicolson Method to approximate the solution for case 1. Your code should define hx (or n) and ht near the beginning and the rest of the process should depend on these values. Your code should also include a check to ensure that the method will converge, should check that the approximation converges to the steady state, and should graph numerous time steps using the pause (0.002) command inside the time step loop.
- (b) (6 marks) Write MATLAB code which uses the Implicit Method to approximate the solution for case 2. Your code should define hx (or n) and ht near the beginning, should include a check to ensure that the method will converge, should check that the approximation converges to the steady state, and should graph numerous time steps using the pause (0.002) command inside the time step loop.
- (c) (3 marks) Compute the average error of your approximate solution with 21 nodes in part (b) at time t = 0.25, 0.5, 0.75, 1 with the first few terms of the analytic solution found in part (c) of Assignment 1 (include all terms up to and including the n = 10 term). Include the MATLAB code that you used to compute these errors.

In part (c), try to solve as you can and tell me what other data you need and I will provide it for you because I could not understand it.