Project

Steady state vs unsteady analysis

Question:- Compare fastest steady state simulation vs fastest transient simulation and explain your results

Answer :

Steady State Case :-

The Successive Over Relaxation gives fastest simulation for steady state case. Output for the same is as follows.

Program for steady state equation using SOR method :-

clear all 
close all 
clc

% Inputs
L = 1;
nx = 20;
ny = nx;
omega = 1.3;

x = linspace(0,L,nx);
y = linspace(0,L,ny);

dx = x(2) - x(1);
dy = y(2) - y(1);

% BC
T_l = 400;
T_T = 600;
T_R = 800;
T_B = 900;
T = ones(nx,ny);

T(2:ny-1,1) = T_l;
T(2:ny-1,nx) = T_R;
T(1,2:nx-1) = T_T;
T(nx,2:ny-1) = T_B;

T(1,1) = (T_T + T_l)/2;
T(nx,ny) = (T_B + T_R)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_l + T_B)/2;

[X,Y] = meshgrid(x,y);
told = T;
error = 9e9;
tol = 1e-4;

for iterative_solver = 1
    % Successive over relaxation method
   if iterative_solver ==1
      tic;
      successive_over_relaxation = 1;
       while (error > tol)
           for i = 2:nx-1
               for j = 2:ny-1
                   T(i,j) = (1-omega)*told(i,j)+(omega*0.25*(T(i-1,j) + told(i+1,j) + T(i,j-1) + told(i,j+1)));
               end
           end
               error = max(max(abs(told - T)));
               told = T;
               successive_over_relaxation = successive_over_relaxation + 1;
       end
       p = toc;

               figure(1)
               [M,N] = contourf(X,Y,T);
               clabel(M,N);
               colormap(jet);
               colorbar
               title_text = sprintf('No. of iterations(SOR) = %d \t simulation time = %fs', successive_over_relaxation,p);
               xlabel('x axis');
               ylabel('y axis');
               title(title_text);
               set(gca,'ydir','reverse')
   end
end

Output of above method:-

Transient Case :-

The Successive Over Relaxation gives fastest simulations for transient case. Output for the same is as follows.

Program for transient equation using SOR method :-

clear all 
close all 
clc

% Inputs
L = 1;
nx = 20;
ny = nx;
omega = 1.3;
alpha = 1.4;

x = linspace(0,L,nx);
y = linspace(0,L,ny);

dx = x(2) - x(1);
dy = y(2) - y(1);

% BC
T_l = 400;
T_T = 600;
T_R = 800;
T_B = 900;
T = ones(nx,ny);

T(2:ny-1,1) = T_l;
T(2:ny-1,nx) = T_R;
T(1,2:nx-1) = T_T;
T(nx,2:ny-1) = T_B;

T(1,1) = (T_T + T_l)/2;
T(nx,ny) = (T_B + T_R)/2;
T(1,ny) = (T_T + T_R)/2;
T(nx,1) = (T_l + T_B)/2;
dt = 20;


k1 = (alpha*dt)/(dx^2);
k2 = (alpha*dt)/(dy^2);
nt = 1000;
CFL = alpha*((1/dx^2) + (1/dy^2))*(dt);

[X,Y] = meshgrid(x,y);
told = T;
t_prev = told;
tol = 1e-4;
error = 9e9;


for iterative_solver = 1
    % Successive Over Relaxation method
 if iterative_solver ==1
    tic;
    Successive_over_relaxation_iter = 1;
    % Time Loop
     for g = 1:nt
         while (error > tol)
             % Nodal Loop
            for i = 2:nx-1
              for j = 2:ny-1
                  term1 = (1+(2*k1)+(2*k2))^(-1);
                  term2 = k1*term1;
                  term3 = k2*term1;
                  H = (T(i-1,j) + told(i+1,j));
                  V = (T(i,j-1) + told(i,j+1));
                  T(i,j) = ((1-omega)*told(i,j))+omega*((t_prev(i,j)*term1) + (H*term2) + (V*term3));
              end
            end
               error = max(max(abs(told - T)));
               told = T;
               Successive_over_relaxation_iter = Successive_over_relaxation_iter + 1;      
         end
         t_prev = T;
     end
         p = toc;
         figure(1)
         [M,N] = contourf(X,Y,T);
         clabel(M,N);
         colormap(jet);
         colorbar
         title_text = sprintf('No. of iterations(SOR) = %d  simulation time = %fs',Successive_over_relaxation_iter,p);
         xlabel('x axis');
         ylabel('y axis');
         title(title_text);
         set(gca,'ydir','reverse')
 end
end

Output of above method:-

Fastest Method

Iterations

Simulation Time

SOR for Steady State case

260

0.148252 s

SOR for Transient case

259

0.566091 s

Conclusion:-

  • For steady state equation, the Successive Over Relaxation method gives faster covergence rate compared to Gauss Seidal and Jacobi method with the lowest no. of iterations and simulation time.
  • For Transient case , the Successive Over Relaxations method gives the results in less computational time and iterations required to perform the calculations compared to Explicit, and other Implicit methos like Gauss Seidal and Jacobi.
  • When compared to each other, the SOR method for steady state takes less computational time compared to SOR method for Transient case.
  • Whereas steady state's SOR method takes a bit more no. of iterations compared to SOR of Transient case to get stable as shown in above Table.
  • The SOR for steady state case has no numerical difussion as there is no thermal diffusivity in it, so it converges at a very fast rate. Also it is Time independent which makes it faster.
  • In SOR, the relaxation factor ω affects the speed of calculation (i.e if we use higher ω which will cause it to overshoot and make SOR slower causing it high no. of iterations). In this ω plays an important role for making the simulations faster.

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.

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.