of Unsteady Gauss-Seidel Iterations(IMPLICIT) = %d', Gauss_Seidel_iteration)) pause(0. %Calculation of 2D steady heat conduction EQUATION by Gauss-seidel methodįor k = 1:nt error = 9e9 while(error > tolerance) for i = 2:nx - 1 for j = 2:ny - 1 T(i,j)= T_intial(i,j).*(1-4*A) + A *(T(i-1,j)+ T_old(i+1,j)+T(i,j+1)+T_old(i,j-1)) end end error = max(max(abs(T_old - T))) T_old = T Gauss_Seidel_iteration = Gauss_Seidel_iteration + 1 end T_intial = T %Plotting figure(1) contourf(x,y,T) clabel(contourf(x,y,T)) colorbar colormap(jet) set(gca, 'ydir', 'reverse') xlabel('X-Axis') ylabel('Y-Axis') title(sprintf('No. %Calculating Average temperature at corners I don't think there is anything wrong with your code, and the final result looks beautiful. In order for the lower triangular matrix D L to be invertible it is necessary and sufficient for aii 0. %Solving the Unsteady state 2D heat conduction by Gauss Seidel Method(IMPLICIT SCHEME) I have checked your code carefully and I know you have used the 5-point Gauss-Seidel difference method to obtain the solution of 2d unsteady state in heat transfer modelling. We will leave, as an exercise for the student, the derivation, but the matrix equation for the Gauss-Seidel iteration method is as follows: xk (D L) 1Uxk 1 + (D L) 1b. I Wrote the code for 2d unsteady state using jacobi method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |