Skip to content

Commit a034135

Browse files
committed
Create test_w_shear.py
1 parent 2f5d4b1 commit a034135

1 file changed

Lines changed: 121 additions & 0 deletions

File tree

tests/test_w_shear.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import pytest
2+
from xsection.library import WideFlange, from_aisc
3+
from xsection.analysis import SaintVenantSectionAnalysis
4+
import numpy as np
5+
6+
point_poisson = [#-0.9, -0.5,
7+
0, 0.3, 0.499]
8+
9+
def wide_flange_cowper(shape: WideFlange, nu=0.3):
10+
b = shape.bf
11+
tf = shape.tf
12+
tw = shape.tw
13+
d = shape.d
14+
15+
m = 2*b*tf/(d*tw)
16+
n = b/d
17+
18+
D = ((12 + 72*m + 150*m**2 + 90*m**3) + nu*(11+66*m + 135*m**2 + 90*m**3) + 30*n**2*(m + m**2) + 5*nu*n**2*(8*m+9*m**2))
19+
return (10*(1+nu)*(1+3*m)**2)/D
20+
21+
22+
def single_flange_cowper(shape: WideFlange, nu):
23+
r"""
24+
$\frac{10(1+\nu)(1+4 m)^2}{\left(12+96 m+276 m^2+192 m^3\right)+\nu\left(11+88 m+248 m^2+216 m^3\right)+30 n^2\left(m+m^2\right)+10 \nu n^2\left(4 m+5 m^2+m^3\right)}$
25+
"""
26+
b = shape.bf
27+
tf = shape.tf
28+
tw = shape.tw
29+
d = shape.d
30+
31+
m = b*tf/(d*tw)
32+
n = b/d
33+
D = (12 + 96*m + 276*m**2 + 192*m**3) + nu*(11 + 88*m + 248*m**2 + 216*m**3) + 30*n**2*(m+m**2) + 10*nu*n**2*(4*m+5*m**2+m**3)
34+
return (10*(1+nu)*(1+4*m)**2)/D
35+
36+
37+
def wide_flange_timoshenko(shape: WideFlange, nu=0.3):
38+
b = shape.bf
39+
tf = shape.tf
40+
tw = shape.tw
41+
d = shape.d
42+
A = shape.area
43+
I = shape.elastic.Iy
44+
return float(8*tw*I/(A*(b*d**2 - (b - tw)*(d - 2*tf)**2)))
45+
46+
47+
def wide_flange_newlin(shape: WideFlange, nu=0.3):
48+
b = shape.bf
49+
tf = shape.tf
50+
tw = shape.tw
51+
d = shape.d
52+
A = shape.area
53+
I = shape.elastic.Iy
54+
d1 = d - 2*tf
55+
aw = A*b/(64*I**2)*(d1**5*(8*tw/(15*b)+b/tw-4/3)-d1**3*d**2*(2*b/tw-4/3)+d1*d**4*(b/tw))
56+
af = A*b/(64*I**2)*(-d1**5/5 + 2/3*d1**3*d**2 - d1*d**4 + 8/15*d**5)
57+
return float(1/(aw + af))
58+
59+
60+
61+
62+
def test_poisson():
63+
for name in [ "W14x48"]: # "W18x40",
64+
shape = from_aisc(name, mesh_scale=1/10, fillet=False, mesher="gmsh", mesh_type="T6")
65+
for nu in [0, 0.3]:
66+
sv = SaintVenantSectionAnalysis(shape, nu=nu)
67+
cowper = sv.create_trace(form="geometric").sce()
68+
assert cowper[0] > 0
69+
assert cowper[1] == pytest.approx(wide_flange_cowper(shape, nu=nu), rel=1e-2)
70+
71+
72+
73+
def test_single_flange():
74+
for name in ["WT18x115.5"]:
75+
shape = from_aisc(name, mesh_scale=1/10, fillet=False, mesher="gmsh", mesh_type="T6")
76+
shape = shape.translate(-shape.centroid)
77+
for nu in [0, 0.3]:
78+
sv = SaintVenantSectionAnalysis(shape, nu=nu)
79+
cowper = sv.create_trace(form="geometric").sce()
80+
assert cowper[0] > 0
81+
assert cowper[1] == pytest.approx(single_flange_cowper(shape, nu=nu), rel=5e-2)
82+
83+
84+
85+
86+
# def test_material():
87+
# for name in ["W18x40"]:
88+
# shape = from_aisc(name, mesh_scale=1/10, fillet=False, mesher="gmsh", mesh_type="T6")
89+
# for nu in [0, 0.3]:
90+
# sv = SaintVenantSectionAnalysis(shape, nu=nu)
91+
# cowper = sv.create_trace(form="geometric").sce()
92+
# assert cowper[0] > 0
93+
# assert cowper[1] == pytest.approx(wide_flange_cowper(shape, nu=nu), rel=1e-2)
94+
95+
96+
97+
if __name__ == "__main__":
98+
import sys
99+
# "W14x48"
100+
if len(sys.argv) > 1:
101+
name = sys.argv[1]
102+
else:
103+
name = "W18x40"
104+
105+
print("Section:", name)
106+
107+
shape = from_aisc(name, mesh_scale=1/10, fillet=False, mesher="gmsh")
108+
109+
print("A/(d*tw)", shape.depth*shape.tw/shape.elastic.A)
110+
for nu in 0.3, 0:
111+
print(f"nu = {nu}")
112+
print(" Cowper\t\t", wide_flange_cowper(shape, nu=nu))
113+
print(" Timoshenko\t", wide_flange_timoshenko(shape, nu=nu))
114+
print(" Newlin\t\t", wide_flange_newlin(shape, nu=nu))
115+
116+
shear_model = shape._analysis.shear_model(nu=nu)
117+
Xr = shape._analysis.shear_factor_romano(nu=0.0)[0][1]
118+
print(" Romano\t\t", Xr)
119+
print(" Cowper\t\t", shear_model.correction(form="average"))
120+
print("-"*10, "\n")
121+

0 commit comments

Comments
 (0)