Example #1
0
# cProfile.run('myWall.analyze()', sort='cumtime')
myWall.analyze()

# +-----------------------+
# | Discussion of Results |
# +-----------------------+

# MITC4 elements are very accurate, but there are some nuances to be aware of. They are described
# below.

# Render the wall. The default load combination 'Combo 1' will be displayed since we're not
# specifying otherwise. The quad mesh will be set to show 'Mx' results. It will be noted that the
# results are `unsmoothed` making the contour plot look "striped" like a step function. This will
# be discussed below in more detail.
import Visualization
Visualization.RenderModel(myWall.fem, text_height=meshsize/6, deformed_shape=False, combo_name='Combo 1', color_map='dz', render_loads=True)

# The `RectWall` class has a smoothing algorithm built into it. Let's plot a smoothed contour for
# Mx for comparison.
myWall.plot_forces('Mx')

# Essentially, smoothing averages the corner stresses from every quad framing into each node. This
# leads to a much more accurate solution. The unsmoothed plot is essentially showing quad center
# stresses at the quad element corners.

# Here are the expected results from Timoshenko's "Theory of Plates and Shells" Table 35, p. 202.
# Note that the deflection values for the PyNite solution are slightly larger, due to transverse
# shear deformations being accounted for.
D = E*t**3/(12*(1-nu**2))
print('Solution from Timoshenko Table 35 for b/a = 2.0:')
print('Expected displacement: ', 0.00254*load*width**4/D)
A = 10

frame.AddMember('M1', 'N2', 'N1', E, G, Iy, Iz, J, A)
frame.AddMember('M2', 'N3', 'N1', E, G, Iy, Iz, J, A)
frame.AddMember('M3', 'N4', 'N1', E, G, Iy, Iz, J, A)

# Add nodal loads
frame.AddNodeLoad('N1', 'FY', -50)
frame.AddNodeLoad('N1', 'MX', -1000)

# Analyze the model
frame.Analyze(check_statics=False)

# Render the deformed shape
Visualization.RenderModel(frame,
                          text_height=5,
                          deformed_shape=True,
                          deformed_scale=100,
                          render_loads=True)

# Print the node 1 displacements
print('Node 1 deformations:')
print('Calculated values: ',
      frame.GetNode('N1').DX,
      frame.GetNode('N1').DY,
      frame.GetNode('N1').DZ,
      frame.GetNode('N1').RX,
      frame.GetNode('N1').RY,
      frame.GetNode('N1').RZ)
print('Expected values: ', 7.098e-5, -0.014, -2.352e-3, -3.996e-3, 1.78e-5,
      -1.033e-4)
                         False)  # Not constrained for torsion at 'N2'

# Add a downward point load of 5 kips at the midspan of the beam
SimpleBeam.AddMemberPtLoad('M1', 'Fy', -5, 7 * 12, 'D')  # 5 kips Dead load
SimpleBeam.AddMemberPtLoad('M1', 'Fy', -8, 7 * 12, 'L')  # 8 kips Live load

# Add load combinations
SimpleBeam.AddLoadCombo('1.4D', {'D': 1.4})
SimpleBeam.AddLoadCombo('1.2D+1.6L', {'D': 1.2, 'L': 1.6})

# Analyze the beam and perform a statics check
SimpleBeam.Analyze(check_statics=True)

Visualization.RenderModel(SimpleBeam,
                          text_height=10,
                          deformed_shape=True,
                          deformed_scale=30,
                          render_loads=True,
                          combo_name='1.2D+1.6L')

# Print the shear, moment, and deflection diagrams
SimpleBeam.GetMember('M1').PlotShear('Fy', '1.2D+1.6L')
SimpleBeam.GetMember('M1').PlotMoment('Mz', '1.2D+1.6L')
SimpleBeam.GetMember('M1').PlotDeflection('dy', '1.2D+1.6L')

# Print reactions at each end of the beam
print('Left Support Reaction:',
      SimpleBeam.GetNode('N1').RxnFY['1.2D+1.6L'], 'kip')
print('Right Support Reacton:',
      SimpleBeam.GetNode('N2').RxnFY['1.2D+1.6L'], 'kip')

# Print the max/min shears and moments in the beam
                           False, False, False, False, True, True)
truss.DefineReleases('BE', False, False, False, False, True, True, \
                           False, False, False, False, True, True)

# Add nodal loads
truss.AddNodeLoad('A', 'FX', 10)
truss.AddNodeLoad('A', 'FY', 60)
truss.AddNodeLoad('A', 'FZ', 20)

# Analyze the model
truss.Analyze()

# Print results
print('Member BC calculated axial force: ' +
      str(truss.GetMember('BC').MaxAxial()))
print('Member BC expected axial force: 32.7 Tension')
print('Member BD calculated axial force: ' +
      str(truss.GetMember('BD').MaxAxial()))
print('Member BD expected axial force: 45.2 Tension')
print('Member BE calculated axial force: ' +
      str(truss.GetMember('BE').MaxAxial()))
print('Member BE expected axial force: 112.1 Compression')

# Render the model for viewing. The text height will be set to 50 mm.
# Because the members in this example are nearly rigid, there will be virtually no deformation. The deformed shape won't be rendered.
# The program has created a default load case 'Case 1' and a default load combo 'Combo 1' since we didn't specify any. We'll display 'Case 1'.
Visualization.RenderModel(truss,
                          text_height=0.05,
                          render_loads=True,
                          case='Case 1')