1D heat conduction equation with FTCS method

28 views (last 30 days)
Mücahid
Mücahid on 19 Dec 2022
Commented: Torsten on 25 Dec 2022
I have a homework about this subject. The entire question is ;
A semi-infinite plate is L = 1 m thick and T(x, t=0) =cos[pi(x-0.5)] is a function of initial temperature. Since both surfaces of the plate are suddenly brought to 0C and kept at this temperature, obtain the 1-D heat conduction equation expressing the problem numerically for 0<x<1 [m] and t>0. DT/Dt = (1/pi2)*(D2T/Dx2)
For N=50 points and a suitable time step, plot the temperature contours at different times, namely T(x,t=0;0.1;0.2;0.3;0.4;4;20;40 seconds) using the FTCS method and solve the problem. Compare with the analytical solution.
Analytical Solution:
T(x,t) = e'-t *(cos[pi(x-0.5)])
What should I do, how can I write a code to solve this equation?

Answers (1)

William Rose
William Rose on 25 Dec 2022
Since this is a homework problem, I will give some suggestions.
The article here has a good description of the FTCS method. It includes equations which you can turn into Matlab code.
I recommend that you create a 2D array, T, with 50 or 51 columns and 501 rows. Different columns correspond to different spatial locations, and different rows correspond to different times. I recommend 50 or 51 columns because the problem says "50 points". The bar length L=1. If you have 50 points, including the ends, them deltaX=1/49. If you have 51 points, including the ends, then deltaX=1/50=0.02. I recommend 501 rows, because the problem statement says the analytical solution is
.
Therefore delta t = 0.01 is 1% of the time constant for the analytical solution, which should be small enough. If you solve for 5 time consants, in other words if you go out to t=5 seconds, or 501 rows, then you will be very close to the final solution. If delta t is too large, the solution is likely to display increasing oscillations between large positive and negative values, when you use the FTCS method. If you see such oscillations in your numerical solution, reduce delta t.
Fill in row 1 of the array T with the initial temperature distribution. Then use the FTCS method to fill in the remaining rows. Remember to apply the boundary conditions at the edges.
Good luck witth your studies!

Categories

Find more on Thermal Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!