CivilStructural Guru
The Very Essence of Civil/Structural Engineering. Civil Structural Engineering Educational Blog. Feel Free to Learn
Thursday, 9 November 2023
Plane Frame Analysis Using Python
Wednesday, 8 November 2023
Friday, 29 September 2023
Truss Analysis Using Python Code Example 2
#Node coordinates
Node=np.array([[0,0],[3,0],[6,0],[4.5,3],[1.5,3]])
#Member connectivity
Conn=np.array([[0,1],[1,2],[0,4],[4,1],[1,3],[3,2],[4,3]])
#Boundary condition
BC=np.array([[0,1,1],[2,1,1]])
#Joint loads
ELD=np.array([[4,0,-50],[3,0,-50]])
E=210000000
A = 0.0001
Input Data
[[ 7000. 0. -7000. -0.]
[ 0. 0. -0. -0.]
[-7000. -0. 7000. 0.]
[ -0. -0. 0. 0.]]
Stiffness Matrix for member 1
[[ 7000. 0. -7000. -0.]
[ 0. 0. -0. -0.]
[-7000. -0. 7000. 0.]
[ -0. -0. 0. 0.]]
Stiffness Matrix for member 2
[[ 1252.1980674 2504.3961348 -1252.1980674 -2504.3961348]
[ 2504.3961348 5008.7922696 -2504.3961348 -5008.7922696]
[-1252.1980674 -2504.3961348 1252.1980674 2504.3961348]
[-2504.3961348 -5008.7922696 2504.3961348 5008.7922696]]
Stiffness Matrix for member 3
[[ 1252.1980674 -2504.3961348 -1252.1980674 2504.3961348]
[-2504.3961348 5008.7922696 2504.3961348 -5008.7922696]
[-1252.1980674 2504.3961348 1252.1980674 -2504.3961348]
[ 2504.3961348 -5008.7922696 -2504.3961348 5008.7922696]]
Stiffness Matrix for member 4
[[ 1252.1980674 2504.3961348 -1252.1980674 -2504.3961348]
[ 2504.3961348 5008.7922696 -2504.3961348 -5008.7922696]
[-1252.1980674 -2504.3961348 1252.1980674 2504.3961348]
[-2504.3961348 -5008.7922696 2504.3961348 5008.7922696]]
Stiffness Matrix for member 5
[[ 1252.1980674 -2504.3961348 -1252.1980674 2504.3961348]
[-2504.3961348 5008.7922696 2504.3961348 -5008.7922696]
[-1252.1980674 2504.3961348 1252.1980674 -2504.3961348]
[ 2504.3961348 -5008.7922696 -2504.3961348 5008.7922696]]
Stiffness Matrix for member 6
[[ 7000. 0. -7000. -0.]
[ 0. 0. -0. -0.]
[-7000. -0. 7000. 0.]
[ -0. -0. 0. 0.]]
Stiffness Matrix for member 7
[[ 8252.1980674 2504.3961348 -7000. 0. 0.
0. 0. 0. -1252.1980674 -2504.3961348]
[ 2504.3961348 5008.7922696 0. 0. 0.
0. 0. 0. -2504.3961348 -5008.7922696]
[-7000. 0. 16504.3961348 0. -7000.
0. -1252.1980674 -2504.3961348 -1252.1980674 2504.3961348]
[ 0. 0. 0. 10017.5845392 0.
0. -2504.3961348 -5008.7922696 2504.3961348 -5008.7922696]
[ 0. 0. -7000. 0. 8252.1980674
-2504.3961348 -1252.1980674 2504.3961348 0. 0. ]
[ 0. 0. 0. 0. -2504.3961348
5008.7922696 2504.3961348 -5008.7922696 0. 0. ]
[ 0. 0. -1252.1980674 -2504.3961348 -1252.1980674
2504.3961348 9504.3961348 0. -7000. 0. ]
[ 0. 0. -2504.3961348 -5008.7922696 2504.3961348
-5008.7922696 0. 10017.5845392 0. 0. ]
[-1252.1980674 -2504.3961348 -1252.1980674 2504.3961348 0.
0. -7000. 0. 9504.3961348 0. ]
[-2504.3961348 -5008.7922696 2504.3961348 -5008.7922696 0.
0. 0. 0. 0. 10017.5845392]]
Global Stiffness Matrix for the Structure
0 -0.0
1 0.0
2 -55.902
3 0.0
4 0.0
5 - 55.902
6 -25.0
Member forces for the Structure
Node No X-react Y-react
======= ======= =======
0 25.0 50.0
2 -25.0 50.0
Support Reactions for the Structure
Original and Deflected Shape of the Structure
Member forces for the Structure
Truss Analysis Using Python Code
Input Data
#Node coordinates
Node=np.array([[0,0],[180,0],[180,240],[0,240]])
#Member connectivity
Conn=np.array([[0,2],[1,2],[3,2]])
#Boundary condition
BC=np.array([[0,1,1],[1,1,1],[3,1,1]])
#Joint loads
ELD=np.array([[2,50,-86.6]])
E=29000
A = 9
[[ 313.2 417.6 -313.2 -417.6]
[ 417.6 556.8 -417.6 -556.8]
[-313.2 -417.6 313.2 417.6]
[-417.6 -556.8 417.6 556.8]]
Stiffness Matrix for Member 1
[[ 0. 0. -0. -0. ]
[ 0. 1087.5 -0. -1087.5]
[ -0. -0. 0. 0. ]
[ -0. -1087.5 0. 1087.5]]
Stiffness Matrix for Member 2
[[ 1450. 0. -1450. -0.]
[ 0. 0. -0. -0.]
[-1450. -0. 1450. 0.]
[ -0. -0. 0. 0.]]
Stiffness Matrix for Member 3
[[ 313.2 417.6 0. 0. -313.2 -417.6 0. 0. ]
[ 417.6 556.8 0. 0. -417.6 -556.8 0. 0. ]
[ 0. 0. 0. 0. 0. 0. 0. 0. ]
[ 0. 0. 0. 1087.5 0. -1087.5 0. 0. ]
[ -313.2 -417.6 0. 0. 1763.2 417.6 -1450. 0. ]
[ -417.6 -556.8 0. -1087.5 417.6 1644.3 0. 0. ]
[ 0. 0. 0. 0. -1450. 0. 1450. 0. ]
[ 0. 0. 0. 0. 0. 0. 0. 0. ]]
Global Stiffness Matrix for the Structure
0 -21.657
1 -69.274
2 62.994
Computed forces for the Members
Node No X-react Y-react
======= ======= =======
Node No X-react Y-react
======= ======= =======
0 12.994 17.326
1 0.0 69.274
3 -62.994 0.0
Computed Reactions at the Nodes
Original and Deflected Truss Shape