Starting from:
$35

$29

ESC103F Engineering Mathematics and Computation: Lab #3 Solution

Pre-Lab

A mathematical model of the temperature distribution for a long, thin rod (length L) positioned between two constant temperature walls has been developed. The rod’s cross-sectional dimensions are small enough so that radial temperature gradients are minimal and consequently temperature is a function exclusively of the axial direction . Heat is transferred along the rod by conduction and between the rod and surrounding air by convection. The mathematical model is given by the following differential equation:
2  (  )
+ ℎ'(   −   (  )) = 0



2



where h' is a constant related to the conduction and convection properties of the rod and surrounding air, and T is the temperature of the surrounding air (assumed to be

constant). This equation can be used to compute the temperature along the rod’s axial dimension assuming that the temperatures of the rod at each end are held constant and are known.

Assume the rod is 10 m long (L=10) with h' = 0.05 m −2 and T = 200 K . The boundary conditions are T (0) = 300 K and T (10) = 400 K .

1.    Calculus can be used to solve the model equation analytically, giving the solution:

  (  ) = 200 + 20.4671  √.05    + 79.5329  −√.05    (K)

Show that this solution satisfies both the differential equation model and the boundary conditions.

    2. Using a finite difference approach, the second derivative in the differential equation model can be approximated as:
2

  (   + Δ  ) − 2  (  ) +   (   − Δ  )
2

(Δ  )2

where the rod length L has been discretized into n evenly spaced subintervals and the length of one subinterval is given by x . Using this approximation, convert the differential equation model into a difference equation model and collect all like terms.
3.    Using 5 subintervals (    = 5), corresponding to Δ  = (10 − 0)/5 = 2, set up the

system of linear equations    ⃗⃗ with corresponding numerical values that     ⃗ =

needs to be solved to determine a numerical solution to this problem. Hint: with this choice of , you are solving for   ⃗ = [  (2)   (4)   (6)   (8)] and matrix A should be 4x4. In the command line mode, find the solution using MATLAB’s matrix division operator (see ‘mldivide’ for more information).
Exercise

Write a function that takes in a user-defined value of n and the two boundary conditions and solves for the temperature of the rod at the interior grid points. Use your function to solve this BVP for a range of n values. Hint: in writing your function, you are encouraged to take advantage of the tridiagonal structure of the A matrix and it is suggested you consider using the ‘diag’ function in MATLAB.

Your final result should be a figure that shows the different numerical solutions including the boundary conditions plotted using different line types for different n values, along with appropriate axis labels and a legend. In the same figure, using again a different line type, plot the exact, analytical solution. For plotting this line you will want to define a grid for x that is very fine so that your plot of the exact solution is smooth.

Based on your results, recommend an appropriate choice for n that balances computational load with accuracy of the numerical solution.

More products