Challenge

Week 5.1 - Mid term project - Solving the steady and unsteady 2D heat conduction problem

Numerical Solution of 2D Heat Conduction Using Iterative Methods

Introduction

Heat conduction is the process of heat transfer inside solid materials caused by temperature differences. Because exact solutions are often difficult for complex problems, numerical methods are used to approximate the temperature distribution. In this work, the two-dimensional heat conduction problem is solved using numerical iterative techniques on a grid.

Three iterative methods are used: Jacobi, Gauss-Seidel, and Successive Over-Relaxation (SOR). These methods help find the temperature distribution inside the domain with given boundary temperatures. Both steady-state (time-independent) and transient (time-dependent) cases are analyzed.

Objective

The goals of this project are to solve the 2D heat conduction problem using the Jacobi, Gauss-Seidel, and SOR methods, implement explicit and implicit time-stepping schemes for transient heat conduction, compare their convergence rates by counting iterations.

Problem Description

The domain is divided into a uniform grid in both x and y directions. The temperature values on the boundaries are fixed: the top boundary at 600 K, the bottom boundary at 900 K, the left boundary at 400 K, and the right boundary at 800 K. The initial temperature inside the domain is set uniformly, and the corner temperatures are set as the average of their adjacent boundary temperatures to improve accuracy.

Solution Procedure

Your explanation is mostly clear and technically sound. However, there are a few grammatical and clarity-related issues that need correction to ensure proper understanding, especially for documentation or academic purposes. Below is the revised and corrected version of your “Solution Procedure” in proper English:


Solution Procedure

This project involves solving the heat conduction equation using numerical methods.

For this purpose, I created three MATLAB files: main_script.m, steady_analysis.m, and unsteady_analysis.m. Below is a detailed explanation of each file.

The file main_script.m is the main driver script. It is the one that should be executed to obtain the results. It repeatedly calls the functions steady_analysis and unsteady_analysis with different input parameters to plot results and count the number of iterations for each case.

Note: The main_script.m file has two modes of operation, controlled by the variable choose:

  • When choose = 1, the script runs each individual case separately with the provided input, plots the results, and outputs the number of iterations.

  • When choose =2, the script runs all schemes and plots them as subplots. It also displays the number of iterations for all cases in the command window, making comparison easier.

The file steady_analysis.m contains the function steady_analysis, which returns the number of iterations required for convergence. Inside this function, there are conditional statements:

  • One for the Jacobi method.

  • Another for Gauss-Seidel and SOR (Successive Over-Relaxation) methods.

Within the SOR section, there is an additional conditional block to distinguish between Gauss-Seidel and SOR. This function takes six input arguments: one of type char (for the method selection) and five of type double. Depending on the selected method, the respective temperature distribution is plotted, and the iteration count is returned as output.

The file unsteady_analysis.m contains the function unsteady_analysis, which also returns the number of iterations based on the selected input parameters. This function takes ten input arguments: two of type char (to choose the scheme and method), and eight of type double.

Inside the function, a conditional block distinguishes between explicit and implicit time-stepping schemes. Within the implicit case, there is another conditional block to choose between Jacobi and Gauss-Seidel/SOR. Further, inside Gauss-Seidel/SOR, there is a final conditional to select either Gauss-Seidel or SOR.

Based on the chosen scheme and method, the corresponding temperature distribution is plotted and the iteration count is returned as output.

Results

For steady-state analysis, the Jacobi method required the highest number of iterations to converge, indicating it is the slowest among the three. The Gauss-Seidel method showed improved performance with fewer iterations, while the SOR method converged the fastest due to the relaxation factor accelerating the iterative updates.

For transient analysis, a large number of iterations is required for conergence and this must also satisfy the convergence criteria (CFL criteria). The implicit scheme was stable for larger time steps and required fewer iterations per time step. Among implicit methods, Gauss-Seidel converged faster than Jacobi, and SOR performed best.

these are the iteration numbers.

steady jacobi

number of iteration is 216

steady gauss

number of iteration is 116

steady sor

number of iteration is 75

unsteady explicit

number of iteration is 3264

unsteady jacobi

number of iteration is 519

unsteady gauss

number of iteration is 409

unstedy sor

number of iteration is 341

Note: Over relaxation number must be chosen wisely or else SOR might take more time to converge.

I have found the optimal value for over over-relaxation factor for unsteady SOR using this code

i=1;
figure
omega=linspace(.8,1.4,50);
iter=zeros(1,length(omega));
for o=omega
iter(i)=unsteady_analysis('implicit','sor',T,alpha,dx,dy,dt,tol,time_end,o);
i=i+1;
end
figure
a=find(iter==min(iter));
b=omega(a);
fprintf('\nthe optimal value for omega is %d\n ',b)
plot(omega,iter)
xlabel('omega')

ylabel('iteration number')

screenshot of this plot is also uploaded along with other files

After running this code the optimal over relaxation factor for unsteady SOR is found to be equal to 1.0693

Discussion

The SOR method gives faster results because it uses a relaxation factor. This helps the solution move more quickly toward the final answer in each step. The explicit method is easy to code and understand, but it can only use small time steps to stay stable. Because of this, it needs many steps, which takes more time to run.

Implicit methods take more effort in each step because they solve equations repeatedly. But they allow larger time steps without becoming unstable. This makes them better for running longer simulations. The convergence tolerance is used to stop the process when the solution is close enough, so we don’t waste time doing extra steps.

To avoid errors at the corners, the corner temperatures are set as the average of the nearby boundary values. This gives a smoother and more accurate result. From the results, we can see that Gauss-Seidel and especially SOR methods are good choices. They give reliable answers and take less time, which is useful in engineering problems.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.