0% found this document useful (0 votes)
38 views

Week 3 Programming Assignment 2: Expected Learning Outcomes From This Assignment

The document describes a programming assignment to solve the 1D heat equation for a metal rod using the Finite Difference Time Domain (FTDC) method in MATLAB. The rod is divided into 5 grid points and the student must use the FTDC method to find the temperature at each point over time for time steps of 0.001 and 0.1 seconds at total times of 1, 2, and 10 seconds. The expected learning outcomes are to use MATLAB modules, study matrix handling and operations, use loops to solve equations, and write a MATLAB code to solve the given problem. The algorithm outlined discretizes the 1D heat equation and solves it iteratively using a for loop over time to calculate the temperature values at each node.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Week 3 Programming Assignment 2: Expected Learning Outcomes From This Assignment

The document describes a programming assignment to solve the 1D heat equation for a metal rod using the Finite Difference Time Domain (FTDC) method in MATLAB. The rod is divided into 5 grid points and the student must use the FTDC method to find the temperature at each point over time for time steps of 0.001 and 0.1 seconds at total times of 1, 2, and 10 seconds. The expected learning outcomes are to use MATLAB modules, study matrix handling and operations, use loops to solve equations, and write a MATLAB code to solve the given problem. The algorithm outlined discretizes the 1D heat equation and solves it iteratively using a for loop over time to calculate the temperature values at each node.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Week 3 Programming assignment 2

1) Solve the 1D heat equation for a 1D rod using FTCS method. The length of the rod is
0.5 m. The 1D metal rod with a thermal conductivity of 0.05 W/mK is at an initial
temperature 300 K. The left side of the rod is set to a temperature of 400 K and the
right end of the rod is set to a temperature of 300K. Divide the rod into 5 grid points
(as shown in Figure below). Using the results from the MATLAB program answer the
following questions.
a) Find the temperature at all 5 nodal points for a total time of 1 second and with a
time step of 0.001 and 0.1 seconds.
b) Find the temperature at all 5 nodal point for a total time of 2 seconds and with a
time step of 0.001 and 0.1 seconds.
c) Find the temperature at all 5 nodal point for a total time of 10 seconds and with a
time step of 0.001 and 0.1 seconds.

1 2 3 4 5
Total time Time step Temperature at
(s) (s) Node 1 Node 2 Node 3 Node 4 Node 5

1 0.001

0.1

2 0.001

0.1

10 0.001

0.1

Expected learning outcomes from this assignment:


1. To use the MATLAB online module.
2. To study matrix handling and operations.
3. To study the usage of loops in solving equations.
4. To write basic .m file to solve the assignment problem.
Code Algorithm:

1. Obtain input from the user for the value of initial and working temperature of the
rod.
2. Obtain input from the user for the value of thermal conductivity of the rod, the
length of the rod and number of grid points required for the discretization of the
domain.
3. Set the total time and time step for the problem.
4. Calculate grid spacing from length of the rod and number of grid points.
5. Define temperature matrix for storing initial values (Boundary conditions are
given at the corner nodes and other nodes are populated with initial values),
temporary values (values from previous iteration), and final value.
6. The discretised 1D conduction equation for FTCS is
𝑇𝑛+1
𝑖 = 𝑇𝑛𝑖 +𝛾(𝑇𝑛𝑖+1 ― 2𝑇𝑛𝑖 + 𝑇𝑛𝑖―1), where 𝛾 = 𝑘(𝛥𝑡) (𝛥𝑥)2
7. Solve the discretised equation using a for loop starting at time t=0s till the desired
time.
8. Display Final temperature at each nodal point.
9. Run the code for different total time and time step.
10. The above algorithm is just a guideline and the candidate is encouraged to write
the MATLAB code as per his/ her interest. In fact, such different attempts are
welcomed as the candidates can share their code with their peers for discussion
once the assignment is closed. This will help everyone in learning better.
11. The candidate can also compare the impact of the various discretization schemes,
number of discretisation points and the time step on the accuracy of the solution
obtained.

You might also like