Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Simulation of 2-D Unsteady Heat Conduction

Equation Using Explicit Scheme

Prepared by Venu Agarwal & Ms. Shivali

Submitted to Dr. S.P Vanka

1|Page
1. Introduction
The goal of this project was to write a numerical solution to find the two dimensional
temperature distribution in a square plate. The governing equation is the partial differential
equation shown below as equation 1.

𝜕𝑇 𝜕 2𝑇 𝜕 2𝑇
= 𝛼 ( 2 + 2)
𝜕𝑡 𝜕𝑥 𝜕𝑦

A unit square plate was set with an initial temperature value of zero and the boundary
conditions were given as one unit at the top and zero unit at the other three sides. Contour
plots of the temperature distribution as well as plots of the temperature along the vertical
centerline were made at various points in time in order to show the progression until steady
state was reached. Then a graph of the vertical centerline temperature with a time step above
the stability limit was used to show the effect of instability on the temperature distribution.
Finally the calculations were rerun with different grid sizes in order to show the effect of
grid size.

2. Methods
In order to solve the partial differential equation stated above, it was discretized using the
explicit finite difference method. The stencil for the time derivative is first order accurate
and is the following equation.
𝑛+1 𝑛
𝜕𝑇 𝑇𝑖,𝑗 − 𝑇𝑖,𝑗
=
𝜕𝑡 ∆𝑡

The equation for the derivative in x direction is

𝜕 2 𝑇 𝑇𝑖+1,𝑗 − 2𝑇𝑖,𝑗 + 𝑇𝑖−1,𝑗


=
𝜕𝑥 2 ∆𝑥 2

and similarly the equation for the derivative in the y direction is

𝜕 2 𝑇 𝑇𝑖,𝑗+1 − 2𝑇𝑖,𝑗 + 𝑇𝑖,𝑗−1


=
𝜕𝑦 2 ∆𝑦 2

Then combining all three parts together to solve for the temperature the following equation
𝑛+1 𝑛 𝑛 𝑛
is derived 𝑇𝑖,𝑗 = 𝑇𝑖,𝑗 + 𝛼∆𝑡[𝛿𝑥2 𝑇𝑖,𝑗 + 𝛿𝑦2 𝑇𝑖,𝑗 ]

where the two terms inside the brackets represent the partially derivatives in the x and y
directions respectively.

2|Page
To solve the equations, grids of 21x21, 41x41, and 81x81 were used and the code was written
in Fortran and the graphs were plotted using Matplotlib library of Python. In order to ensure
the stability of the solution the time step was determined with the following equation
𝛼∆𝑡 𝛼∆𝑡 1
+ ≤
∆𝑥 2 ∆𝑦 2 2

which required the time step to be less than or equal to 1.5625x10-4 seconds. A time step of
1.5625x10-4 seconds was implemented. Also the thermal diffusivity was taken to be one.
Finally, in order to determine when steady state has been reached, the difference between
the temperature at the current and previous time step was monitored until it was below
1.00x10-16.

3|Page
3. Results
a. Temperature contours at four different time instants for 41X41 grid

The first test of the code was showing the two dimensional contour plot of the temperature
of the square plate. Four contour plots were made; three of them show the progression to
steady state and the fourth is of the plate when it reached steady state. The code took roughly
10000 time steps (with each time step equal to 1.5625x10-4 seconds) to reach steady state
with the above mentioned convergence value of 1.0x10-16.
The first three plots show the progression at 100, 250, and 500 time steps. The four plots can
be seen below as Figures 1 through 4.

4|Page
Figure 2

Figure 3

5|Page
Figure 4

From the above plots one can see the heat flowing from the top of the square down through
the plate and how the temperature distribution changes over time.

6|Page
b. Temperature profile along the vertical centerline at different time instants.

In order to help illustrate the change of temperature profile over time, a plot of the centerline
temperatures at the various numbers of time steps was created and can be seen below in
Figure 5. As the number of time steps increases the temperatures increase and the lines flatten
out and move towards the left.

Figure 5

7|Page
c. Stability Analysis

As stated in the methods, the time step was calculated using stability analysis, in order to
ensure the final solution reached steady state. In order to show the importance of using a
stable time step, a graph was made showing the vertical centerline temperature of both a
stable and an unstable solution. This graph can be seen below in Figure 6. For the unstable
case the time step was set at roughly 1x10-5 seconds above the maximum stable time step.
The graph shows that even with such a time step barely over the maximum the solution blows
up. The temperature goes from a maximum of one to temperatures on the order of 1x1045.

Figure 6: Plot of Stable vs. Unstable Time Steps

8|Page
d. Grid Dependence

The earlier shown temperature contour plots were plotted with a grid of 41x41, but varying
the grid size can change the final solution. So the problem was rerun with two more grid
sizes; 21x21 and 81x81. The plot for 21*21 grid was run for 10000 time steps and a
convergence value of 0.0 was achieved. For 81*81 grid, the simulation was run for 30000
time steps and a convergence value of 1.1*10-14 was achieved.
In order to show the effect of the grid size, contour plots as well as a plot of vertical centerline
temperatures were created.

Figure 7

Figure 8
9|Page
The contour plots, shown above in Figures 7 and 8, do not show much of a difference at first
glance but if the top corners are looked at closely a difference can be seen. The clarity of the
solution at the corner increases with increasing grid size.

The plot of the vertical centerline temperatures shown below (Figure 9) does not show
anything from a distance, but zooming in at any location, the difference between the different
grid sizes as well as the smoother nature of the larger grid number solution can be seen.

Figure 9

10 | P a g e
4. Conclusion
In this project a numerical solution of the unsteady heat conduction equation was developed
and tested. The solution was found by discretizing the equation with the explicit finite
difference method. The solution showed the heat flowing down from the top of the plate and
out the sides and creating a nearly parabolic temperature distribution as seen in figure 4. The
importance of using a stable time step was shown. If an unstable time step is used the solution
quickly blows up as seen in figure 6. Finally the dependence of the solution on grid size was
shown by rerunning the solution with different grid sizes. It showed there is a difference in
the temperatures in the solutions with different grid sizes and that a larger grid size gives a
smoother contour plot. In general the project showed that a numerical method is a quick and
easy way to solve a problem as long as a stable time step as well as an appropriate grid size
is used.

11 | P a g e

You might also like