All Courses
All Courses
Aim: To understand the stability of the linear system using iterative techniques Abstract In the above case, eigenvalues of [3 x 3] matrix are calculated by using iterative methods. The inbuilt command will not be used in this case. Governing equation: Let us consider a general [] 3 X 3 matrix which is of the form…
Faizan Akhtar
updated on 25 Feb 2021
Aim: To understand the stability of the linear system using iterative techniques
Abstract
In the above case, eigenvalues of [3 x 3] matrix are calculated by using iterative methods. The inbuilt command will not be used in this case.
Governing equation:
Let us consider a general [] 3 X 3 matrix which is of the form
The coefficient matrix is decomposed into diagonal matrix "D", lower triangular matrix "L", upper triangular matrix "U".
Therefore,
D=[a11000a22000a33]
L=[000a2100a31a320]
U=[0a12a1300a23000]
So, coefficient matrix, A=L+U+D
The general system of linear equation is AX=B
Iterative methods
It uses the old value of the iteration and update the new value after iteration after it has transferred the entire array. So when AX=Bis solved for the Jacobi method the result yields
[a11a12a13a21a22a23a31a32a33]∗[x1x2x3]=[b1b2b3]
a11∗x1=b1-a12∗x2-a13∗x3(Initially x1=0;x2=0;x3=0)
Rewriting the above equation as
a11∗x1new=b1-a12∗x2old-a13∗x3old
Similarly the other equation is written as
a22∗x2new=b2-a21∗x1old-a23∗x3old
a33∗x3new=b3-a31∗x1old-a32∗x2old
Writing in matrix form
D∗Xnew=B-(U+L)∗Xold
Multiplying by D-1
D-1D∗Xnew=D-1B-D-1(U+L)∗Xold
The Jacobi method is rewritten in the general iterative equation of the form
Xnew=T∗Xold+C
Xnew = Current iteration value
Xold = Previous iteration value
T = Iteration matrix
C = Constant matrix
Thus the final equation for the Jacobi method is
Xnew=D-1B-D-1(U+L)∗Xold
Comparing final equation for Jacobi method to general iterative equation
T=-D-1(U+L)
C=D-1B
Gauss-Seidel method readily uses the updated value after it has been computed and thus it is much faster.
[a11a12a13a21a22a23a31a32a33]∗[x1x2x3]=[b1b2b3]
a11∗x1new=b1-a12∗x2old-a13∗x3old
a22∗x2new=b2-a21∗x1new-a23∗x3old
a22∗x2new+a21∗x1new=b2-a23∗x3old
a33∗x3new+a31∗x1new+a32∗x2new=b3
Writing in matrix form
(L+D)∗Xnew=B-U∗Xold
Multiplying by (L+D)-1
Xnew=B∗(L+D)-1-U∗(L+D)-1∗Xold
Comparing the final equation for the Gauss-Seidel method to the general iterative equation
T=-U∗(L+D)-1
C=B∗(L+D)-1
It is faster than the above two iterative methods because it uses a relaxation factor called ω
The general iterative equation for the successive over-relaxation method is
Xnew=(L+1ω∗D)-1[(1ω∗D-D-U)∗Xold+B]
T=(L+1ω∗D)-1(1ω∗D-D-U)
Please note that the primary concern is the iteration matrix in all the three iterative method
The characteristics equation for finding the eigenvalues of a 3 X 3 matrix is
λ3-(traceA)∗λ2+(sum of minor of all the diagonal elements)∗λ-det(T)=0
Eigenvalue, λ=max(abs(roots(poly(T))))
T can be Tjac, Tgs, Tsor
Spectral radius can be calculated by using the formula as under
ρ=max(|λ1|,|λ2|,|λ3|,|λ4|...)
Calculating eigenvalue and spectral radius for diagonal modification DM=0.5
Diagonally dominant matrix
The matrix is said to be diagonally dominant if the magnitude of the diagonal entry in a row is larger than or equal to the sum of the magnitudes of all the other (non-diagonal) entries in that row.
Let us consider the square matrix A
A=[a11a12a13a21a22a23a31a32a33]
|a11|≥(a12+a13)
|a22|≥(a21+a23)
|a33|≥(a31+a32)
Diagonal dominance plays an important role in the "CFD" solution. Thus when a matrix is diagonally dominant the solution will converge faster. The diagonal dominance and the spectral radius will tell us whether the solution will converge or not thus an important criterion determining the stability analysis of the linear system.
Matlab coding procedures
Matlab code
clear
close all
clc
% coefficient matrix
A=[5 1 2;-3 9 4;1 2 -7];
% lower triangular matrix
L=[0 0 0;-3 0 0;1 2 0];
% upper triangular matrix
U=[0 1 2;0 0 4;0 0 0];
% diagonal matrix
D1=[5 0 0;0 9 0;0 0 -7];
% right hand side
B=[10;-14;33];
% identity matrix
I=[1 0 0; 0 1 0;0 0 1];
% omega
omega=1.25;
% diagonal modification
DM=(1:1:10);
for i=1:length(DM)
D=D1*DM(i);
% iteration matrix for jacobi
Tjac=inv(D)*(-L-U);
eigen_value_Tjac=roots(poly(Tjac));
spectral_radius_Tjac(i)=max(abs(real(eigen_value_Tjac)));
% calling jacobian function
[jac_iter(i),X]=jacobi(L,D,U,B);
% iteration matrix for gauss-seidel method
Tgs=-U*inv(L+D);
eigen_value_Tgs=roots(poly(Tgs));
spectral_radius_Tgs(i)=max(abs(real(eigen_value_Tgs)));
% calling gauss-seidel function
[GS_iter(i),X]=GS(L,D,U,B);
% iteration matrix for successive over relaxation method
Tsor=inv(D+(omega*L))*(((1-omega)*D)-(U*omega));
eigen_value_Tsor=roots(poly(Tsor));
spectral_radius_Tsor(i)=max(abs(real(eigen_value_Tsor)));
% calling SOR method
[SOR_iter(i),X]=SOR(L,D,U,B);
end
% plotting
figure(1)
subplot(2,1,1)
plot(DM,spectral_radius_Tjac)
grid on
xlabel('diagonal modification')
ylabel('spectral radius Tjac')
title('Jacobi Method')
subplot(2,1,2)
plot(spectral_radius_Tjac,jac_iter)
grid on
xlabel('spectral radius')
ylabel('Number of jacobi iteration')
figure(2)
subplot(2,1,1)
plot(DM,spectral_radius_Tgs)
grid on
xlabel('diagonal modification')
ylabel('spectral radius Tgs')
title('GS Method')
subplot(2,1,2)
plot(spectral_radius_Tgs,GS_iter)
grid on
xlabel('spectral radius')
ylabel('Number of GS iteration')
figure(3)
subplot(2,1,1)
plot(DM,spectral_radius_Tsor)
grid on
xlabel('diagonal modification')
ylabel('spectral radius Tsor')
title('SOR Method')
subplot(2,1,2)
plot(spectral_radius_Tsor,SOR_iter)
grid on
xlabel('spectral radius')
ylabel('Number of SOR iteration')
function [jac_iter,X]=jacobi(L,D,U,B)
error=9e9;
tol=1e-4;
jac_iter=1;
Xold=[0;0;0];
% jacobi iteration
while(error>tol)
X=inv(D)*B+(inv(D)*(-L-U)*Xold);
error=max(abs(Xold-X));
Xold=X;
jac_iter=jac_iter+1;
end
end
function [GS_iter,X]=GS(L,D,U,B)
error=9e9;
tol=1e-4;
GS_iter=1;
Xold=[0;0;0];
% GS
while(error>tol)
X=inv(L+D)*B+(inv(L+D)*(-U)*Xold);
error=max(abs(Xold-X));
Xold=X;
GS_iter=GS_iter+1;
end
end
function [SOR_iter,X]=SOR(L,D,U,B,omega)
error=9e9;
tol=1e-4;
SOR_iter=1;
Xold=[0;0;0];
I=[1 0 0; 0 1 0;0 0 1];
% SOR
while(error>tol)
X=((1-omega)*Xold+(omega*((inv(D+L)*B)+inv(D+L)*(-U)*Xold)));
error=max(abs(Xold-X));
Xold=X;
SOR_iter=SOR_iter+1;
end
end
Conclusion
It can be concluded from the graphs and the table that
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week-4 : Basic Calibration of Single cylinder CI-Engine
Aim: Basic Calibration of Single cylinder CI-Engine Objective : Explore Tutorial No 1- CI final 1.Compare SI vs CI and list down differences (assignment no 2-SI) 2. Comments on the following parameters BSFC Exhaust Temperature A/F ratios 3.Change MFB 50 and observe impact on performance Introduction Difference…
11 Nov 2021 05:26 AM IST
Week 2 : Basic Calibration of Single cylinder SI-Engine
Aim: Basic Calibration of Single-cylinder SI-Engine Objective: 1. Run the case at 1800 rpm and list down important parameters (20 Marks) air flow rate BMEP BSFC In-cylinder pressure 2. Increase the power output at 3600 rpm by 10% (30 Marks) Introduction A spark-ignition engine (SI engine) is…
22 Oct 2021 07:11 AM IST
Week 1 : Exploring the GUI of GT-POWER
Aim: Exploring the GUI of GT-suite GT-suite can be used in a wide range of applications. There are several industries that are using GT-suite for various applications On-highway and off-highway vehicle Marine and rail Industrial machinery Aerospace Power generation Multiphysics platform GT-Suite has a versatile multiphysics…
12 Oct 2021 02:52 PM IST
Week 8: Literature review - RANS derivation and analysis
Aim: Literature review - RANS derivation and analysis Objective: Apply Reynolds decomposition to the NS equations and come up with the expression for Reynolds stress. Explain your understanding of the terms Reynolds stress What is turbulent viscosity? How is it different from molecular viscosity? Introduction…
01 Sep 2021 07:52 AM IST
Related Courses