66Matrix Structural Analysis: Second Edition 2nd Edition
77by William McGuire, Richard H. Gallagher, Ronald D. Ziemian
88"""
9- from context import pystran
10- from pystran import model
11- from pystran import property
12- from pystran import geometry
13- from pystran import plots
9+ from math import sqrt
1410from numpy import array , dot
1511from numpy import linalg
1612from numpy .linalg import cross
17- from math import sqrt
13+ from context import pystran
14+ from pystran import model
15+ from pystran import section
1816
1917h = 8.0
2018E = 2.0e6
2119G = E / (2 * (1 + 0.3 ))
2220H = 0.13
2321B = 0.5
2422A = H * B
25- Iy = H * B ** 3 / 12
26- Iz = H ** 3 * B / 12
23+ Iy = H * B ** 3 / 12
24+ Iz = H ** 3 * B / 12
2725Ix = Iy + Iz
2826J = Ix
29-
27+
28+
3029def test (e_x , e_y , e_z , F , refdefl , refslope ):
3130 m = model .create (3 )
3231 model .add_joint (m , 1 , [0.0 , 0.0 , 0.0 ])
33- model .add_joint (m , 2 , h * e_x )
34- clamped = m [' joints' ][1 ]
35- freeend = m [' joints' ][2 ]
36-
32+ model .add_joint (m , 2 , h * e_x )
33+ clamped = m [" joints" ][1 ]
34+ freeend = m [" joints" ][2 ]
35+
3736 model .add_support (clamped , model .U1 )
3837 model .add_support (clamped , model .U2 )
3938 model .add_support (clamped , model .U3 )
4039 model .add_support (clamped , model .UR1 )
4140 model .add_support (clamped , model .UR2 )
4241 model .add_support (clamped , model .UR3 )
43-
44-
45- p1 = property .beam_property ('property_1' , E , G , A , Ix , Iy , Iz , J , e_z )
42+
43+ p1 = section .beam_3d_section ("property_1" , E , G , A , Ix , Iy , Iz , J , e_z )
4644 model .add_beam_member (m , 1 , [1 , 2 ], p1 )
47-
45+
4846 model .add_load (freeend , model .U1 , F [0 ])
4947 model .add_load (freeend , model .U2 , F [1 ])
5048 model .add_load (freeend , model .U3 , F [2 ])
@@ -63,47 +61,48 @@ def test(e_x, e_y, e_z, F, refdefl, refslope):
6361 # print(m['K'][0:m['nfreedof'], 0:m['nfreedof']])
6462
6563 # print(m['U'][0:m['nfreedof']])
66-
64+
6765 rot = cross (e_x , F )
68- defl = dot (F , freeend [' displacements' ][0 :3 ])
69- slope = dot (rot , freeend [' displacements' ][3 :6 ])
66+ defl = dot (F , freeend [" displacements" ][0 :3 ])
67+ slope = dot (rot , freeend [" displacements" ][3 :6 ])
7068
71- print ('Reference deflection: ' , refdefl , ' Computed deflection: ' , defl )
72- print ('Reference slope: ' , refslope , ' Computed slope: ' , slope )
73-
74- if abs (defl - refdefl ) > 1.e-3 * abs (refdefl ):
75- raise ValueError ('Displacement calculation error' )
69+ print ("Reference deflection: " , refdefl , " Computed deflection: " , defl )
70+ print ("Reference slope: " , refslope , " Computed slope: " , slope )
7671
77- if abs (slope - refslope ) > 1.e-3 * abs (refslope ):
78- raise ValueError ('Slope calculation error' )
72+ if abs (defl - refdefl ) > 1.0e-3 * abs (refdefl ):
73+ raise ValueError ("Displacement calculation error" )
74+
75+ if abs (slope - refslope ) > 1.0e-3 * abs (refslope ):
76+ raise ValueError ("Slope calculation error" )
7977
8078 # plots.plot_setup(m)
8179 # plots.plot_members(m)
8280 # plots.plot_deformations(m, 10.0)
8381 # # ax = plots.plot_shear_forces(m, scale=0.50e-3)
8482 # # ax.set_title('Shear forces')
8583 # plots.show(m)
86-
84+
85+
8786e_x , e_y , e_z = array ([1 , 0 , 0 ]), array ([0 , 1 , 0 ]), array ([0 , 0 , 1 ])
8887F = array ([0 , 1 , 0 ])
89- refdefl = 1 * h ** 3 / ( 3 * E * Iz )
90- refslope = 1 * h ** 2 / ( 2 * E * Iz )
88+ refdefl = 1 * h ** 3 / ( 3 * E * Iz )
89+ refslope = 1 * h ** 2 / ( 2 * E * Iz )
9190test (e_x , e_y , e_z , F , refdefl , refslope )
9291
9392e_x , e_y , e_z = array ([1 , 0 , 0 ]), array ([0 , 1 , 0 ]), array ([0 , 0 , 1 ])
9493F = array ([0 , 0 , 1 ])
95- refdefl = 1 * h ** 3 / ( 3 * E * Iy )
96- refslope = 1 * h ** 2 / ( 2 * E * Iy )
94+ refdefl = 1 * h ** 3 / ( 3 * E * Iy )
95+ refslope = 1 * h ** 2 / ( 2 * E * Iy )
9796test (e_x , e_y , e_z , F , refdefl , refslope )
9897
9998e_x , e_y , e_z = array ([0 , 1 , 0 ]), array ([0 , 0 , 1 ]), array ([1 , 0 , 0 ])
10099F = array ([0 , 0 , 1 ])
101- refdefl = 1 * h ** 3 / ( 3 * E * Iz )
102- refslope = 1 * h ** 2 / ( 2 * E * Iz )
100+ refdefl = 1 * h ** 3 / ( 3 * E * Iz )
101+ refslope = 1 * h ** 2 / ( 2 * E * Iz )
103102test (e_x , e_y , e_z , F , refdefl , refslope )
104103
105104e_x , e_y , e_z = array ([0 , 1 , 0 ]), array ([0 , 0 , 1 ]), array ([1 , 0 , 0 ])
106105F = array ([0 , 0 , - 1 ])
107- refdefl = 1 * h ** 3 / ( 3 * E * Iz )
108- refslope = 1 * h ** 2 / ( 2 * E * Iz )
106+ refdefl = 1 * h ** 3 / ( 3 * E * Iz )
107+ refslope = 1 * h ** 2 / ( 2 * E * Iz )
109108test (e_x , e_y , e_z , F , refdefl , refslope )
0 commit comments