Skip to content

Commit

Permalink
Moved unready test and example
Browse files Browse the repository at this point in the history
  • Loading branch information
JWock82 committed Nov 6, 2023
1 parent 08d938c commit 25f737a
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Examples/Plastic Beam.py → PyNite/Plastic Beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
# 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()
65 changes: 65 additions & 0 deletions Testing/x_test_nonlinear.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 25f737a

Please sign in to comment.