sewkokot / opsvis

OpenSeesPy postprocessing and plotting module
GNU General Public License v3.0
35 stars 21 forks source link

Axial force of truss elements shown on M, V diagrams of 2D frame models #43

Closed mhscott closed 1 year ago

mhscott commented 1 year ago

The axial force of a truss element shows up as M and V with section_force_diagram_2d

Bending moment diagram. The diagonal brace is a truss element.

FrameMomentopsvis

Shear force diagram. The diagonal brace is a truss element.

FrameShearopsvis

Axial force diagram. The diagonal brace is a truss element.

FrameAxialopsvis

sewkokot commented 1 year ago

@mhscott, thank you for reporting this bug. It should be fixed in https://github.com/sewkokot/opsvis/commit/24fa0a82aed3e3e5a0a8076d0ef8fd7f36abcc19 and the pip opsvis package has been updated. Let me know if it works.

mhscott commented 1 year ago

Works perfect now. Thanks!

mhscott commented 1 year ago

Sorry, I was still using elastic beams for the braces. When attempting to draw shear and moment for the truss, a new error appears

image

mhscott commented 1 year ago

Small working example

import openseespy.opensees as ops
import opsvis as opsv
import matplotlib.pyplot as plt

%matplotlib notebook

ops.wipe()
ops.model('basic','-ndm',2,'-ndf',3)

kip = 1.0
feet = 1.0
inch = feet/12
ksi = kip/inch**2

ops.node(1,0.0,0.0); ops.fix(1,1,1,0)
ops.node(2,0.0,12.0*feet)
ops.node(3,9.0*feet,12.0*feet)
ops.node(4,18.0*feet,12.0*feet)
ops.node(5,18.0*feet,0.0); ops.fix(5,1,1,0)

E = 29000.0*ksi # Elastic modulus of steel (ksi)

ops.geomTransf('Linear',1) # small displacement analysis

# W14x68
A = 20*inch**2; I = 723*inch**4
ops.uniaxialMaterial('Elastic',4,E)
ops.element('truss',1,1,3,A,4)
ops.element('truss',6,3,5,A,4)
#ops.element('elasticBeamColumn',1,1,3,A,E,I,1)
#ops.element('elasticBeamColumn',6,3,5,A,E,I,1)

# W14x120
A = 35.3*inch**2; I = 1380*inch**4
ops.element('elasticBeamColumn',3,5,4,A,E,I,1)
ops.element('elasticBeamColumn',5,1,2,A,E,I,1)

# W18x106
A = 31.1*inch**2; I = 1910*inch**4
ops.element('elasticBeamColumn',2,2,3,A,E,I,1)
ops.element('elasticBeamColumn',4,3,4,A,E,I,1)

opsv.plot_model()
#plt.title('Model Definition')

ops.timeSeries('Constant',23)
ops.pattern('Plain',5,23)
ops.load(2,20.0*kip,0.0,0.0)
#ops.sp(1,2,-0.02*feet)
ops.eleLoad('-ele',2,'-type','-beamUniform',-0.4*kip/feet)
ops.eleLoad('-ele',4,'-type','-beamUniform',-0.4*kip/feet)

ops.constraints('Transformation')
ops.system('UmfPack')
ops.algorithm('Newton')

ops.analysis('Static','-noWarnings')
ops.analyze(1)

ops.reactions()

# Nodal displacements
for nd in ops.getNodeTags():
    print(f'Node {nd}:',ops.nodeDisp(nd))

print()

# Nodal reactions
for nd in ops.getNodeTags():
    print(f'Node {nd}:',ops.nodeReaction(nd))

opsv.plot_defo()
plt.title('Deflected Shape')

opsv.section_force_diagram_2d('V')
plt.title('Shear Force Diagram')

opsv.section_force_diagram_2d('M')
plt.title('Shear Force Diagram')

opsv.section_force_diagram_2d('N')
plt.title('Axial Force Diagram')
sewkokot commented 1 year ago

@mhscott Thanks again. Hopefully, now I have fixed this bug in https://github.com/sewkokot/opsvis/commit/bceb25190a9b94ae21a85b420db59cc69839067a Please test it, and let me know.

mhscott commented 1 year ago

Looks good now! Thanks!