2
2
import math
3
3
# import matplotlib, matplotlib.pyplot as plt
4
4
5
- def create_model ():
6
-
5
+ def create_3_support_model ():
7
6
continuous_beam = FEModel3D ()
8
7
9
8
continuous_beam .add_node ('N1' , 0 , 0 , 0 )
@@ -26,30 +25,57 @@ def create_model():
26
25
27
26
return continuous_beam
28
27
29
- def test_continuous_beam_moments ():
30
- model = create_model ()
28
+ def test_3_support_beam_moments ():
29
+ model = create_3_support_model ()
31
30
member = model .members ['M1' ]
32
31
assert math .isclose (member .max_moment ('Mz' , '1.0D' ), 18000.0 ), 'Incorrect max moment during continuous beam test'
33
32
assert math .isclose (max (member .moment_array ('Mz' , 11 , '1.0D' )[1 ]), 18000.00 ), 'Incorrect max moment in moment array during continuous beam test.'
34
33
35
- # def test_plots():
36
-
37
- # model = create_model()
38
-
39
- # assert isinstance(model.members['M1'].plot_shear('Fy', '1.0D', 100), matplotlib.figure.Figure)
40
- # plt.close()
41
34
42
- # assert isinstance(model.members['M1'].plot_moment('Mz', '1.0D', 100), matplotlib.figure.Figure)
43
- # plt.close ()
35
+ def create_2_support_model ():
36
+ model = FEModel3D ()
44
37
45
- # assert isinstance( model.members['M1'].plot_torque('1.0D', 100), matplotlib.figure.Figure )
46
- # plt.close( )
38
+ model .add_material ( "default" , 1 , 1 , 1 , 1 , 1 )
39
+ model . add_section ( "default" , 1 , 1 , 1 , 1 )
47
40
48
- # assert isinstance(model.members['M1'].plot_axial('1.0D', 100), matplotlib.figure.Figure)
49
- # plt.close()
41
+ model .add_node ("0" , 0 , 0 , 0 )
42
+ model .add_node ("1" , 10 , 0 , 0 )
43
+ model .add_node ("2" , 13 , 0 , 0 )
44
+
45
+ model .def_support ("0" , 1 , 1 , 1 , 1 , 1 , 0 )
46
+ model .def_support ("1" , 0 , 1 , 0 , 0 , 0 , 0 )
47
+
48
+ model .add_member ("M0" , "0" , "2" , "default" , "default" )
49
+ model .add_member_dist_load ("M0" , "Fy" , - 10 , - 10 , 0 , 13 , case = 'load' )
50
+ model .add_load_combo ("combo" , {"load" : 1.0 })
51
+
52
+ model .analyze (check_statics = True )
53
+
54
+ return model
55
+
56
+ def test_2_support_beam_moments ():
57
+ # The following test passes on Pynite==1.1.2 but fails with Pynite==1.2.0, Pynite==1.3.0
58
+
59
+ model = create_2_support_model ()
60
+ member = model .members ['M0' ]
61
+ fe_max_moment = member .max_moment ("Mz" , "combo" )
62
+ fe_min_moment = member .min_moment ("Mz" , "combo" )
63
+ member .plot_moment ("Mz" , "combo" , 2000 )
64
+
65
+ # Analytic solution
66
+ w = - 10
67
+ l = 10
68
+ a = 3
69
+
70
+ # Beam formula source: Handbook of Steel Construction, CISC, 11th Ed. Pg. 5-138 diag. 24
71
+ analytic_min_moment = (w * (l + a )** 2 * (l - a )** 2 )/ (8 * l ** 2 )
72
+ analytic_max_moment = - w * a ** 2 / 2
50
73
51
- # assert isinstance(model.members['M1'].plot_deflection('dy', '1.0D', 100), matplotlib.figure.Figure)
52
- # plt.close()
74
+ try :
75
+ assert math .isclose (fe_max_moment , analytic_max_moment )
76
+ except AssertionError :
77
+ print (fe_max_moment , analytic_max_moment )
78
+ assert math .isclose (fe_min_moment , analytic_min_moment )
53
79
54
80
if __name__ == '__main__' :
55
81
pass
0 commit comments