0% found this document useful (0 votes)
29 views6 pages

Displacement of The Each Member in The Given Truss Solved by SOR Method

The document describes solving for the displacement of each member in a given truss using the successive over-relaxation (SOR) method. It provides the 10x10 matrix representing the truss, applies the SOR method using a relaxation factor of 1.1, and iterates until the residual error is less than 10^-5. The displacements of each member are then provided as the solution.

Uploaded by

Jake Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views6 pages

Displacement of The Each Member in The Given Truss Solved by SOR Method

The document describes solving for the displacement of each member in a given truss using the successive over-relaxation (SOR) method. It provides the 10x10 matrix representing the truss, applies the SOR method using a relaxation factor of 1.1, and iterates until the residual error is less than 10^-5. The displacements of each member are then provided as the solution.

Uploaded by

Jake Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Carlos Joaquin C.

Santos 1st Trimester SY 2021-2022

MECp 1- Computer Application for ME Due Date: October 20, 2021

Final Examination- Part 3

Problem Title

Displacement of the Each Member in the Given Truss Solved by SOR Method

1. Problem Statement

By SOR method, the displacement or the deformation of each bar will be solved using the given 10 x10
matrix with tolerable error of 1 x 10-5.

2. Results and Discussion

Same step with part 1and part 2 of final examination, the first step is to analyze the truss and then
substitute all given to the 10 x 10 matrix. The difference of SOR from Gauss-Seidel is that, in SOR there is a
relaxation factor (𝜔). If 𝜔 is equal to one, the result will be the same as Gauss-Seidel. In this problem I used
𝜔=1.1, to have successive over relaxation.

The matrix after substitution and the equations of X1 to X10 as said in Final Examination Part 1

8 0 −4 0 0 0 −2 2√3 0 0
0
0 12 0 0 0 0 2√3 −6 0 0 −4𝑥10−3
−4 0 12 0 −4 0 −2 −2√3 −2 2√3 0
0 0 0 12 0 0 −2√3 −6 2√3 −6 −4𝑥10−3
0 0 −4 0 8 0 0 0 −2 −2√3 0
−3
0 0 0 0 0 12 0 0 −2√3 −6 −4𝑥10
−2 2√3 −2 −2√3 0 0 12 0 −4 0 0
−4𝑥10−3
2√3 −6 −2√3 −6 0 0 0 12 0 0
0
0 0 −2 2√3 −2 −2√3 −4 0 12 0 [−4𝑥10−3 ]
[ 0 0 2√3 −2√3 −2√3 −6 0 0 0 12 ]

Formula for SOR in general is : 𝑥𝑛𝑒𝑤 = 𝜔(𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛 𝑓𝑟𝑜𝑚 𝑔𝑎𝑢𝑠𝑠 − 𝑠𝑒𝑖𝑑𝑒𝑙 ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )

Formula will be used in this problem are:

4𝑋3 + 2𝑋7 − 2√3𝑋8


𝑥1 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
8

−2√3𝑋7 + 6𝑋8 − 4𝑥10−3


𝑥2 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12
4𝑋1 + 4𝑋5 + 2𝑋7 + 2√3𝑋8 + 2𝑋9 − 2√3𝑋10
𝑥3 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

2√3𝑋7 + 6𝑋8 − 2√3𝑋9 + 6𝑋10 − 4𝑥10−3


𝑥4 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

2√3𝑋7 + 6𝑋8 − 2√3𝑋9 + 6𝑋10 − 4𝑥10−3


𝑥4 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

4𝑋3 + 2𝑋9 + 2√3𝑋10


𝑥5 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
8

2√3𝑋9 + 6𝑋10 − 4𝑥10−3


𝑥6 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

2𝑋1 − 2√3𝑋2 + 2𝑋3 + 2√3𝑋4 + 4𝑋9


𝑥7 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

−2√3𝑋1 + 6𝑋2 + 2√3𝑋3 + 6𝑋4 − 4𝑥10−3


𝑥8 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

2𝑋3 − 2√3𝑋4 + 2𝑋5 + 2√3𝑋6 + 4𝑋7


𝑥9 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12

−2√3𝑋3 + 2√3𝑋4 + 2√3𝑋5 + 6𝑋6 − 4𝑥10−3


𝑥10 = 𝜔 ( ) + (1 − 𝜔)(𝑥𝑜𝑙𝑑 )
12
Substitute the initial guess. In this problem the initial guess is X1-10 = 0 and 𝜔 = 1.1. Just like Gauss-
Seidel method, same process will be done by using the equations of X1-10 . The table below shows the result of
iteration at residual error of 1 x10-5 is met. The blue color represents the first three iterations and orange
represents the last three iterations.

Iteration x1 x2 x3 x4 x5 x6 x7 x8 x9 x10
0 0 0 0 0 0 0 0 0 0 0
1 0.8 -1.20037 -1.2 -1.20037 -0.8 -1.20037 -1.2 -1.20037 1.2 -1.20037
2 1.21825 -1.47 -2.22667 -2.24174 -2.36175 -2.24162 -2.0067 -1.88 2.0067 -2.1147
3 1.30E-03 -1.92E-03 -1.37E-04 -3.05E-03 -8.67E-04 -1.25E-03 -1.86E-05 -3.22E-03 3.40E-04 -2.04E-03
21 1.05E-03 -1.62E-03 -1.36E-04 -2.58E-03 -7.66E-04 -1.15E-03 -5.46E-05 -2.69E-03 2.32E-04 -1.80E-03
22 1.20E-03 -1.80E-03 -1.39E-04 -2.87E-03 -8.36E-04 -1.22E-03 -3.62E-05 -3.02E-03 2.95E-04 -1.95E-03
23 1.40E-03 -2.03E-03 -1.30E-04 -3.19E-03 -8.82E-04 -1.28E-03 4.13E-06 -3.38E-03 3.85E-04 -2.11E-03
The results are:

𝑋1 = 1.40025725 𝑥 10−3 𝑖𝑛
𝑋2 = −2.02501510 𝑥 10−3 𝑖𝑛
𝑋3 = −1.29609943 𝑥 10−4 𝑖𝑛
𝑋4 = −3.18818583 𝑥 10−3 𝑖𝑛
𝑋5 = −8.81979696 𝑥 10−4 𝑖𝑛 Almost the same value in part 2 of exam
𝑋6 = −1.27692279 𝑥 10−3 𝑖𝑛
𝑋7 = 4.12810386 𝑥 10−6 𝑖𝑛
𝑋8 = −3.38163254 𝑥 10−3 𝑖𝑛
𝑋9 = 3.84525257 𝑥 10−4 𝑖𝑛
−3
𝑋10 = −2.10936116 𝑥 10 𝑖𝑛
3. Problems Encountered

Before trying to code in Pycharm IDE, I tried it first in excel, but the value goes bigger and bigger, and
it is impossible to have a bigger deformation in each member of a truss like it. So I tried the code of Gauss-
Seidel and make it as reference. I only add the formula of SOR method and set the relaxation factor to 1.1.

4. Reference

-The Math Guy. (2017, November 27). Numerical Methods for Linear Systems - SOR [Video].

5. Appendix

The same code is located in notepad named “Part3_code”

print("-----Displacement of the Each Member in the Given Truss Solved by SOR Method-----")

print("#NOTE: In the problem, the given are:")

print("-----A(1-5)= 1 in^2; A(6-11)= 2 in^2")

print("-----P(odd)= 0lb; P(even)= -1000lb")

print("-----E= 30psi; l= 30in")

import numpy as np

import math

print("----------------------------Input Value--------------------------------")

a = float(input("Enter Value of A(1-5) in square inch: "))

b =float(input("Enter Value of A(6-11)in square inch: "))

P1 = P3 = P5 = P7 = P9 =float(input("Enter Value of P(odd) in lb: "))

P2 = P4 = P6 = P8 = P10 = float(input("Enter Value of P(even) in lb: "))

E = float(input("Enter Value of Modulus of Elasticity (x10^6) in psi: "))

E = E*10**6

l = float(input("Enter length of the member (l) in inches: "))


def sor_solver(A, b, omega, initial_guess, convergence_criteria):

step = 0

Φ = initial_guess[:]

residual = np.linalg.norm(np.matmul(A, Φ) - b)

while residual > convergence_criteria:

for i in range(A.shape[0]):

sigma = 0

for j in range(A.shape[1]):

if j != i:

sigma += A[i, j] * Φ[j]

Φ[i] = (1 - omega) * Φ[i] + (omega / A[i, i]) * (b[i] - sigma)

residual = np.linalg.norm(np.matmul(A, Φ) - b)

step += 1

print("Step {} Residual: {:10.6g}".format(step, residual))

return Φ

# An example case that mirrors the one in the Wikipedia article

residual_convergence = 1e-5

omega = 1.1 # Relaxation factor

print("Values of a matrix")

A = np.array([[((4*a)+(b)+(b)), 0, ((-4)*(a)), 0, 0, 0, (-b),((math.sqrt(3))*(b)), 0, 0 ],

[0, ((3)*(b+b)), 0, 0, 0, 0, ((math.sqrt(3))*(b)),((-3)*(b)), 0, 0 ],

[((-4)*(a)), 0, (((4)*(a))+ (((4)*(a)))+(b)+(b)),0, ((-4)*(a)), 0, ((-b)), (-(math.sqrt(3))*(b)), ((-b)),


((math.sqrt(3))*(b))],
[0, 0, 0, ((3)*(b+b)), 0, 0, (-(math.sqrt(3))*(b)), ((-3)*(b)), ((math.sqrt(3))*(b)),((-3)*(b))],

[0, 0, ((-4)*(a)), 0, ((4*a)+(b)+(b)), 0, 0, 0, ((-b)), (-(math.sqrt(3))*(b))],

[0, 0, 0, 0, 0,((3)*(b+b)), 0, 0, (-(math.sqrt(3))*(b)), ((-3)*(b))],

[((-b)), ((math.sqrt(3))*(b)), ((-b)),(-(math.sqrt(3))*(b)), 0, 0, (((4)*(a))+ (((4)*(a)))+(b)+(b)), 0, ((-


4)*(a)),0],

[((math.sqrt(3))*(b)), ((-3)*(b)),(-(math.sqrt(3))*(b)), ((-3)*(b)), 0, 0, 0, ((3)*(b+b)), 0, 0],

[0, 0, ((-b)), ((math.sqrt(3))*(b)), ((-b)), (-(math.sqrt(3))*(b)), ((-4)*(a)), 0, ((4)*(a))+ (((4)*(a)))+(b)+(b),


0],

[0, 0, ((math.sqrt(3))*(b)), (-(math.sqrt(3))*(b)), (-(math.sqrt(3))*(b)), ((-3)*(b)), 0, 0, 0, ((3)*(b+b))]])

b = np.array([((4*l)/E)*P1, ((4*l)/E)*P2, ((4*l)/E)*P3, ((4*l)/E)*P4, ((4*l)/E)*P5, ((4*l)/E)*P6, ((4*l)/E)*P7,


((4*l)/E)*P8, ((4*l)/E)*P9, ((4*l)/E)*P10])

initial_guess = np.zeros(10)

Φ = sor_solver(A, b, omega, initial_guess, residual_convergence)

print(Φ)

You might also like