Skip to content

Commit 5c53a28

Browse files
Add shape factor tests
1 parent a441044 commit 5c53a28

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

tests/analysis/test_yield_moment.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ def test_rectangle():
7070
assert check_yield_index(stress, "sig_zz_m11") == pytest.approx(1.0)
7171
assert check_yield_index(stress, "sig_zz_m22") == pytest.approx(1.0)
7272

73+
# check shape factors
74+
sec.calculate_plastic_properties()
75+
sf_xx, _, sf_yy, _ = sec.get_sf()
76+
sf_11, _, sf_22, _ = sec.get_sf_p()
77+
assert sf_xx == pytest.approx(1.5)
78+
assert sf_yy == pytest.approx(1.5)
79+
assert sf_11 == pytest.approx(1.5)
80+
assert sf_22 == pytest.approx(1.5)
81+
7382

7483
def test_rectangle_rotated():
7584
"""Test the yield moment of a simple rotated rectangle."""
@@ -92,6 +101,12 @@ def test_rectangle_rotated():
92101
assert check_yield_index(stress, "sig_zz_m11") == pytest.approx(1.0)
93102
assert check_yield_index(stress, "sig_zz_m22") == pytest.approx(1.0)
94103

104+
# check shape factors
105+
sec.calculate_plastic_properties()
106+
sf_11, _, sf_22, _ = sec.get_sf_p()
107+
assert sf_11 == pytest.approx(1.5)
108+
assert sf_22 == pytest.approx(1.5)
109+
95110

96111
def test_isection():
97112
"""Test the yield moment of an isection."""
@@ -119,6 +134,22 @@ def test_isection():
119134
assert check_yield_index(stress, "sig_zz_m11") == pytest.approx(1.0)
120135
assert check_yield_index(stress, "sig_zz_m22") == pytest.approx(1.0)
121136

137+
# check that shape factors with a geometric-only analysis match the composite
138+
sec.calculate_plastic_properties()
139+
sf_xx_c, _, sf_yy_c, _ = sec.get_sf()
140+
141+
geom = i_section(d=200, b=100, t_f=10, t_w=5, r=12, n_r=8)
142+
geom.create_mesh(mesh_sizes=0, coarse=True)
143+
sec = Section(geometry=geom)
144+
sec.calculate_geometric_properties()
145+
sec.calculate_plastic_properties()
146+
147+
sf_xx_plus, sf_xx_minus, sf_yy_plus, sf_yy_minus = sec.get_sf()
148+
assert sf_xx_c == pytest.approx(sf_xx_plus)
149+
assert sf_xx_c == pytest.approx(sf_xx_minus)
150+
assert sf_yy_c == pytest.approx(sf_yy_plus)
151+
assert sf_yy_c == pytest.approx(sf_yy_minus)
152+
122153

123154
def test_rectangle_composite():
124155
"""Test the yield moment of a composite rectangular section."""

tests/post/test_get_results.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,19 +798,13 @@ def test_get_plastic(sec_no_mat_and_mat):
798798
assert sf_yy_plus == pytest.approx(1.5)
799799
assert sf_yy_minus == pytest.approx(1.5)
800800

801-
with pytest.raises(RuntimeError):
802-
rect_mat.get_sf()
803-
804801
# check sf_p
805802
sf_11_plus, sf_11_minus, sf_22_plus, sf_22_minus = rect_no_mat.get_sf_p()
806803
assert sf_11_plus == pytest.approx(1.5)
807804
assert sf_11_minus == pytest.approx(1.5)
808805
assert sf_22_plus == pytest.approx(1.5)
809806
assert sf_22_minus == pytest.approx(1.5)
810807

811-
with pytest.raises(RuntimeError):
812-
rect_mat.get_sf_p()
813-
814808

815809
def test_get_effective_material():
816810
"""Tests effective material properties."""

0 commit comments

Comments
 (0)