import openseespy.opensees as ops import opsvis as opsv import matplotlib.pyplot as plt ops.wipe() ops.model('basic', '-ndm', 2, '-ndf', 2) # truss 2D a = 6.0 h = 4.0 na = 4 E = 200.e6 A = 0.01 P = 60.0 mat_tag=1 # identyfikator materiału # zdefiniowanie materiału sprężystego ops.uniaxialMaterial('Elastic', mat_tag, E) # węzły ops.node(1, 0.0, 0.0) ops.node(2, 1*a, 0.0) ops.node(3, 2*a, 0.0) ops.node(4, 3*a, 0.0) ops.node(5, 4*a, 0.0) ops.node(6, 0.0, h) ops.node(7, 1*a, h) ops.node(8, 2*a, h) ops.node(9, 3*a, h) ops.node(10, 4*a, h) # podpory ops.fix(1, 1, 1) ops.fix(5, 0, 1) # pas dolny i górny ops.element('truss', 1, 1, 2, A, mat_tag) ops.element('truss', 2, 2, 3, A, mat_tag) ops.element('truss', 3, 3, 4, A, mat_tag) ops.element('truss', 4, 4, 5, A, mat_tag) ops.element('truss', 5, 6, 7, A, mat_tag) ops.element('truss', 6, 7, 8, A, mat_tag) ops.element('truss', 7, 8, 9, A, mat_tag) ops.element('truss', 8, 9, 10, A, mat_tag) # słupki ops.element('truss', 9, 1, 6, A, mat_tag) ops.element('truss', 10, 2, 7, A, mat_tag) ops.element('truss', 11, 3, 8, A, mat_tag) ops.element('truss', 12, 4, 9, A, mat_tag) ops.element('truss', 13, 5, 10, A, mat_tag) # krzyżulce ops.element('truss', 14, 1, 7, A, mat_tag) ops.element('truss', 15, 2, 8, A, mat_tag) ops.element('truss', 16, 8, 4, A, mat_tag) ops.element('truss', 17, 9, 5, A, mat_tag) patTag = 1 tsTag = 1 ops.timeSeries('Constant', tsTag) ops.pattern('Plain', patTag, tsTag) ops.load(6, 3*P, -P) ops.load(2, 0.0, -2*P) ops.load(3, 0.0, -2*P) ops.load(4, 0.0, -2*P) ops.load(10, 0.0, -P) ops.analysis('Static') ops.analyze(1) ops.reactions() ops.printModel() opsv.plot_model() plt.axis('equal') plt.figure() opsv.plot_supports_and_loads_2d() plt.axis('equal') plt.figure() # zfac = 5.0 # opsv.plot_defo(zfac) opsv.plot_defo() sfacN = 3.e-3 plt.figure() minVal, maxVal = opsv.section_force_diagram_2d('N', sfacN) # plt.title(f'Axial forces, max = {maxVal:.2f}, min = {minVal:.2f}') plt.title(f'Axial forces') # plt.savefig('kurs_krata_axial_force_dia.png') Ux_max = 0. Uy_max = 0. Ux_nd = 0 Uy_nd = 0 print(f'\n-- przemieszczenia węzłów:') for node_tag in ops.getNodeTags(): Uxy = ops.nodeDisp(node_tag) print(f'przemieszczenia w węźle {node_tag}: {Uxy}') if abs(Uxy[0]) > Ux_max: Ux_max = abs(Uxy[0]) Ux_nd = node_tag if abs(Uxy[1]) > Uy_max: Uy_max = abs(Uxy[1]) Uy_nd = node_tag print('') print(f'Ux_max: {Ux_max} w węźle {Ux_nd}') print(f'Uy_max: {Uy_max} w węźle {Uy_nd}') print(f'\n-- siły w prętach kratownicy:') for ele_tag in ops.getEleTags(): ele_defo = ops.eleResponse(ele_tag, 'deformation')[0] sila_osiowa = ops.eleResponse(ele_tag, 'axialForce')[0] print(f'ele_tag: {ele_tag} - sila_osiowa: {sila_osiowa}') print(f'ele_tag: {ele_tag} - ele_defo: {ele_defo}') # plt.show()