diff --git a/Examples/Plastic Beam.py b/PyNite/Plastic Beam.py similarity index 68% rename from Examples/Plastic Beam.py rename to PyNite/Plastic Beam.py index e0a1d74e..b798971e 100644 --- a/Examples/Plastic Beam.py +++ b/PyNite/Plastic Beam.py @@ -32,25 +32,26 @@ # Add a load plastic_beam.add_node_load('N3', 'FY', -0.0001, 'D') -plastic_beam.add_node_load('N2', 'FY', -0.3, 'Push') -plastic_beam.add_node_load('N3', 'FX', -1, 'Push') +plastic_beam.add_node_load('N2', 'FY', -0.3*259.3, 'Push') +plastic_beam.add_node_load('N3', 'FX', -1*259.3, 'Push') # Add a load combination plastic_beam.add_load_combo('1.4D', {'D':1.4}) -plastic_beam.add_load_combo('Pushover', {'Push':0.1}) +plastic_beam.add_load_combo('Pushover', {'Push':0.05}) # Analyze the model plastic_beam.analyze_pushover(log=True, check_stability=False, push_combo='Pushover', max_iter=30, tol=0.01, sparse=True, combo_tags=None) # Plot the moment diagram -plastic_beam.Members['M1'].plot_shear('Fy', '1.4D') -plastic_beam.Members['M1'].plot_moment('Mz', '1.4D') -plastic_beam.Members['M1'].plot_deflection('dy', '1.4D') +# plastic_beam.Members['M1'].plot_shear('Fy', '1.4D') +# plastic_beam.Members['M1'].plot_moment('Mz', '1.4D') +# plastic_beam.Members['M1'].plot_deflection('dy', '1.4D') # Render the model -from PyNite.Visualization import Renderer -rndr = Renderer(plastic_beam) -rndr.combo_name = '1.4D' -rndr.render_loads = True -rndr.deformed_shape = True -rndr.render_model() \ No newline at end of file +# from PyNite.Visualization import Renderer +# rndr = Renderer(plastic_beam) +# rndr.combo_name = '1.4D' +# rndr.render_loads = True +# rndr.deformed_shape = True +# rndr.deformed_scale = 100 +# rndr.render_model() \ No newline at end of file diff --git a/Testing/x_test_nonlinear.py b/Testing/x_test_nonlinear.py new file mode 100644 index 00000000..a27e51a5 --- /dev/null +++ b/Testing/x_test_nonlinear.py @@ -0,0 +1,65 @@ +import unittest +from PyNite import FEModel3D +from PyNite.Section import SteelSection +import math +import sys +from io import StringIO + +class Test_End_Release(unittest.TestCase): + """Nonlinear material tests + """ + + def setUp(self): + # Suppress printed output temporarily + sys.stdout = StringIO() + + def tearDown(self): + # Reset the print function to normal + sys.stdout = sys.__stdout__ + + def test_plastic_beam(self): + """Matrix Structural Analysis, 2nd Edition - Example 8.6 + """ + + # Create the model + plastic_beam = FEModel3D() + + # Define a material + E = 29000 # ksi + G = 11200 # ksi + nu = 0.3 + rho = 0.490/12**3 # kci + fy = 50 # ksi + plastic_beam.add_material('Stl_A992', E, G, nu, rho, fy) + + # Define a cross-section + W12 = SteelSection('W12x65', 19.1, 20, 533, 1, 15, 96.8, 'Stl_A992') + plastic_beam.add_section('W12x65', W12) + + # Add nodes + plastic_beam.add_node('N1', 0, 0, 0) + plastic_beam.add_node('N2', 8*12, 0, 0) + plastic_beam.add_node('N3', 24*12, 0, 0) + + # Add supports + plastic_beam.def_support('N1', True, True, True, True, True, True) + plastic_beam.def_support('N2', False, True, True, False, False, False) + + # Add a member + plastic_beam.add_member('M1', 'N1', 'N2', 'A992', section='W12x65') + + # Add a load + plastic_beam.add_node_load('N2', 'FY', 0.3, 'Push') + plastic_beam.add_node_load('N3', 'FX', -1, 'Push') + + # Add a load combination + plastic_beam.add_load_combo('Pushover', {'Push':1}) + + # Analysis the model + plastic_beam.analyze_pushover(True, True, True, 'Pushover', 1.02, 20, 30, True) + + # Get the resulting moments + # calculated_moment = myModel.Members['M1'].min_moment('Mz') + # expected_moment = -0.5*(10*12)**2/8 + + # self.assertAlmostEqual(calculated_moment, expected_moment) \ No newline at end of file