# | o o o | | -- cover # --------------------- -- -- # |-------- B --------| # # RC section: coverY = HCol / 2.0 # The distance from the section z-axis to the edge of the cover concrete -- outer edge of cover concrete coverZ = BCol / 2.0 # The distance from the section y-axis to the edge of the cover concrete -- outer edge of cover concrete coreY = coverY - coverCol coreZ = coverZ - coverCol nfY = 16 # number of fibers for concrete in y-direction nfZ = 4 # number of fibers for concrete in z-direction op.section('Fiber', ColSecTag) op.patch('quad', IDconcU, nfZ, nfY, -coverY, coverZ, -coverY, -coverZ, coverY, -coverZ, coverY, coverZ) # Define the concrete patch op.layer('straight', IDreinf, numBarsCol, barAreaCol, -coreY, coreZ, -coreY, -coreZ) op.layer('straight', IDreinf, numBarsCol, barAreaCol, coreY, coreZ, coreY, -coreZ) # BEAM section: op.section('Elastic', BeamSecTag, Ec, ABeam, IzBeam) # elastic beam section) ColTransfTag = 1 BeamTransfTag = 2 op.geomTransf('Linear', ColTransfTag) op.geomTransf('Linear', BeamTransfTag) numIntgrPts = 5 op.element('nonlinearBeamColumn', 1, 1, 3, numIntgrPts, ColSecTag, ColTransfTag)
def main(): """ Create a Cantilever Problem """ ops.wipe() ops.model('basic', '-ndm', 2, '-ndf', 3) height = 5.0 nElem = 20 ElemLength = height / nElem nodeID = [] Ycoord = 0 for i in range(nElem + 1): nodeID.append(i) ops.node(i, 0.0, Ycoord) Ycoord += ElemLength IDctrlNode = i ops.fix(0, 1, 1, 1) ops.geomTransf('Linear', 1) concrete = 'Concrete04' steel = 'Steel02' matTAGConc = 319 matTAGSteel = 312 fcc = -20000 ec2c = -0.002 ecu2c = -0.0035 Ec = 30000000 fct = 2200 et = 0.001 fy = 500000 E0 = 200000000 b = 0.01 ops.uniaxialMaterial(concrete, matTAGConc, fcc, ec2c, ecu2c, Ec, fct, et) ops.uniaxialMaterial(steel, matTAGSteel, fy, E0, b, 20, 0.925, 0.15, 0, 1, 0, 1, 0) # Core Fibers ops.section('Fiber', 105) ops.patch('rect', 319, 11, 11, -0.20, -0.20, 0.20, 0.20) # Cover Fibers ops.patch('rect', 319, 15, 2, 0.250000, 0.200000, -0.250000, 0.250000) ops.patch('rect', 319, 15, 2, 0.250000, -0.250000, -0.250000, -0.200000) ops.patch('rect', 319, 2, 11, -0.250000, -0.200000, -0.200000, 0.200000) ops.patch('rect', 319, 2, 11, 0.200000, -0.200000, 0.250000, 0.200000) # create corner bars ops.layer('straight', 312, 4, 0.00025450, 0.200000, 0.200000, -0.200000, 0.200000) ops.layer('straight', 312, 4, 0.00025450, 0.200000, -0.200000, -0.200000, -0.200000) ops.beamIntegration('Lobatto', 100, 105, 3) for i in range(len(nodeID) - 1): ops.element('forceBeamColumn', i, nodeID[i], nodeID[i + 1], 1, 100, '-iter', 10, 1e-6) # Add Vertical Load at Top ops.timeSeries('Linear', 101) ops.pattern('Plain', 100, 101) ops.load(IDctrlNode, 0, -500, 0) # Solve Gravity First ops.system('UmfPack') ops.numberer('Plain') ops.constraints('Transformation') ops.integrator('LoadControl', 0.1) ops.test('RelativeTotalNormDispIncr', 0.001, 100, 2) ops.algorithm('Newton') ops.analysis('Static') LoadControlSubStep(10, 0.1, True) # Displacement Control Analysis(Pushover) ops.pattern('Plain', 200, 101) ops.load(IDctrlNode, 1, 0, 0) ops.system('UmfPack') ops.numberer('Plain') ops.constraints('Transformation') ops.test('RelativeTotalNormDispIncr', 1e-2, 500, 2) ops.algorithm('Newton') ops.analysis('Static') DispControlSubStep(100, IDctrlNode, 1, 1.0)
def section_creator(sectag, matcore, matcover, matsteel, d, b, cc, fi, bartop, nsuby, nsubz, fibot=0, barbot=0, fiside = 0, barside = 0, angle = 0, print_section = False): """ Introduction ------------ This function generate a fiber section for openseespy framework. It is implemented for RC section, with the possibility to Plot the section, and to rotate the RcSection by a given angle. As output the function will generate the give section on openseespy model. Information ----------- Author: Gaetano Camarda, Ph.D. Student in Structural Engineer Affiliation: University of Palermo e-mail: [email protected] V1.0 2020 Package needed -------------- - Openseespy - Openseespy.postprocessing - matplotlib - numpy Input: ------ sectag, the sectiontag in the model matcore, material for confined core concrete matcover, material for concrete cover matsteel, material for reinforcement d, section depth b, section base length cc, cover length fi, top bar diameter bartop, number of top bar; if barbot is not specidied, bartop will be used nsuby, fiber subdivision along y axis nsubz, fiber subdivision along z axis Optional input: --------------- fibot, diameter of bottom reinforcement if different from top barbot, number of bottom reinforcement if different from top fiside, diameter of side bar barside, number of side bar (How to use: if for example you need 4 bars, you have to input barside = 2, because the other 2 bars are inserted in bartop and bottom) angle, angle if you need to rotate section, for example angle = 90 print_section, plot the section defined """ if fibot == 0: fibot = fi if barbot == 0: barbot = bartop import openseespy.opensees as ops import openseespy.postprocessing.ops_vis as opsv import matplotlib.pyplot as plt from numpy import power from numpy import pi ymax = b / 2 zmax = d / 2 ymin = ymax - cc zmin = zmax - cc Abar = pi * power(fi/2,2) Abarbot = pi * power(fibot/2,2) Abarside = pi * power(fiside/2,2) lside = d - (2*cc) bside = lside / (barside + 2) + (lside / (barside + 2))/(barside+2) # TODO: VERIFICARE COME SI COMPORTANO LE BARRE LATERAL angle = (angle * pi) /180 pc = { 'a' : rotate_point(-ymin, -zmin, angle), 'b' : rotate_point(ymin, -zmin, angle), 'c' : rotate_point(ymin, zmin, angle), 'd' : rotate_point(-ymin, zmin, angle), 'e' : rotate_point(-ymax, -zmax, angle), 'f' : rotate_point(ymax, -zmax, angle), 'g' : rotate_point(ymax, zmax, angle), 'h' : rotate_point(-ymax, zmax, angle), 'b1': rotate_point(ymax, -zmin, angle), 'a1': rotate_point(-ymax, -zmin, angle), 'd1': rotate_point(-ymax, zmin, angle), 'c1': rotate_point(ymax, zmin, angle) } fib_sec = [['section', 'Fiber', sectag], ['patch','quad',matcore,nsuby, nsubz, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1], pc['c'][0], pc['c'][1], pc['d'][0], pc['d'][1]], # core 1 ['patch','quad',matcover,nsuby, int(nsubz/2), pc['e'][0], pc['e'][1], pc['f'][0], pc['f'][1], pc['b1'][0], pc['b1'][1], pc['a1'][0], pc['a1'][1]], # cover 2 ['patch','quad',matcover,nsuby, int(nsubz/2), pc['d1'][0], pc['d1'][1], pc['c1'][0], pc['c1'][1], pc['g'][0], pc['g'][1], pc['h'][0], pc['h'][1]], # cover 3 ['patch','quad',matcover,int(nsubz/2), nsuby, pc['a1'][0], pc['a1'][1], pc['a'][0], pc['a'][1], pc['d'][0], pc['d'][1], pc['d1'][0], pc['d1'][1]], # cover 4 ['patch','quad',matcover,int(nsubz/2), nsuby, pc['b'][0], pc['b'][1], pc['b1'][0], pc['b1'][1], pc['c1'][0], pc['c1'][1], pc['c'][0], pc['c'][1]] # cover 5 ] ops.section('Fiber', sectag) ops.patch('quad',matcore,nsuby, nsubz, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1], pc['c'][0], pc['c'][1], pc['d'][0], pc['d'][1]) ops.patch('quad',matcover,nsuby, int(nsubz/2), pc['e'][0], pc['e'][1], pc['f'][0], pc['f'][1], pc['b1'][0], pc['b1'][1], pc['a1'][0], pc['a1'][1]) ops.patch('quad',matcover,nsuby, int(nsubz/2), pc['d1'][0], pc['d1'][1], pc['c1'][0], pc['c1'][1], pc['g'][0], pc['g'][1], pc['h'][0], pc['h'][1]) ops.patch('quad',matcover,int(nsubz/2), nsuby, pc['a1'][0], pc['a1'][1], pc['a'][0], pc['a'][1], pc['d'][0], pc['d'][1], pc['d1'][0], pc['d1'][1]) ops.patch('quad',matcover,int(nsubz/2), nsuby, pc['b'][0], pc['b'][1], pc['b1'][0], pc['b1'][1], pc['c1'][0], pc['c1'][1], pc['c'][0], pc['c'][1]) if barbot == bartop: fib_sec.append(['layer', 'straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]]) fib_sec.append(['layer', 'straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1]]) ops.layer('straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]), ops.layer('straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1]) elif bartop != barbot: fib_sec.append(['layer', 'straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]]) fib_sec.append( ['layer', 'straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1]]) ops.layer('straight', matsteel, bartop, Abar, pc['d'][0], pc['d'][1], pc['c'][0], pc['c'][1]), ops.layer('straight', matsteel, barbot, Abarbot, pc['a'][0], pc['a'][1], pc['b'][0], pc['b'][1]) if barside != 0: p1 = rotate_point(-ymin, -zmin + bside, angle) p2 = rotate_point(-ymin, zmin - bside, angle) fib_sec.append(['layer', 'straight', matsteel, barside, Abarside, p1[0], p1[1], p2[0], p2[1]]) p3 = rotate_point(ymin, -zmin + bside, angle) p4 = rotate_point(ymin, zmin - bside, angle) fib_sec.append(['layer', 'straight', matsteel, barside, Abarside, p3[0], p3[1], p4[0], p4[1]]) ops.layer('straight', matsteel, barside, Abarside, p1[0], p1[1], p2[0], p2[1]) ops.layer('straight', matsteel, barside, Abarside, p3[0], p3[1], p4[0], p4[1]) if print_section == True: # plt.style.use('classic') matcolor = ['r', 'darkgrey', 'lightgrey', 'w', 'w', 'w'] opsv.plot_fiber_section(fib_sec, matcolor=matcolor) plt.axis('equal') del fib_sec #### DISMISSED FOR NOW ##### # def PlotFrame(nodematrix,elementmatrix,displacement = None,scale = 1): # import matplotlib.pyplot as plt # plt.style.use('classic') # plt.figure() # if displacement is None: # plt.figure() # for i in range(len(elementmatrix[0])): # nodoi = elementmatrix[0][i] # nodoj = elementmatrix[1][i] # xx = (nodematrix[nodoi][0],nodematrix[nodoj][0]) # yy = (nodematrix[nodoi][1],nodematrix[nodoj][1]) # plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi) # plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj) # plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i, bbox=dict(facecolor='green', alpha=0.2)) # plt.plot(xx, yy,'-k'); # elif displacement is not None: # nodematrix_update = [] # plt.figure() # for i in range(len(elementmatrix[0])): # nodoi = elementmatrix[0][i] # nodoj = elementmatrix[1][i] # xx = (nodematrix[nodoi][0],nodematrix[nodoj][0]) # yy = (nodematrix[nodoi][1],nodematrix[nodoj][1]) # plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi) # plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj) # plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i,bbox=dict(facecolor='green', alpha=0.2)) # plt.plot(xx, yy,'-k'); # txt = ('Node Displacement (Scale_factor: ' + str(scale) + ')') # plt.title(txt) # for i in range(len(nodematrix)): # nodematrix_update.append([nodematrix[i][0]+displacement[i][0]*scale,nodematrix[i][1]+displacement[i][1]*scale]) # for i in range(len(elementmatrix[0])): # nodoi = elementmatrix[0][i] # nodoj = elementmatrix[1][i] # xx = (nodematrix_update[nodoi][0],nodematrix_update[nodoj][0]) # yy = (nodematrix_update[nodoi][1],nodematrix_update[nodoj][1]) # plt.plot(xx, yy,'-r'); # def PlotFrame_move(nodematrix,elementmatrix,displacement = None,scale = 1): # import matplotlib.pyplot as plt # plt.style.use('classic') # if displacement is None: # plt.figure() # for i in range(len(elementmatrix[0])): # nodoi = elementmatrix[0][i] # nodoj = elementmatrix[1][i] # xx = (nodematrix[nodoi][0],nodematrix[nodoj][0]) # yy = (nodematrix[nodoi][1],nodematrix[nodoj][1]) # plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi) # plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj) # plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i, bbox=dict(facecolor='green', alpha=0.2)) # plt.plot(xx, yy,'-k'); # elif displacement is not None: # nodematrix_update = [] # plt.figure() # for i in range(len(elementmatrix[0])): # nodoi = elementmatrix[0][i] # nodoj = elementmatrix[1][i] # xx = (nodematrix[nodoi][0],nodematrix[nodoj][0]) # yy = (nodematrix[nodoi][1],nodematrix[nodoj][1]) # plt.text(nodematrix[nodoi][0], nodematrix[nodoi][1], nodoi) # plt.text(nodematrix[nodoj][0], nodematrix[nodoj][1], nodoj) # plt.text((nodematrix[nodoi][0]+nodematrix[nodoj][0])/2, (nodematrix[nodoi][1]+nodematrix[nodoj][1])/2, i,bbox=dict(facecolor='green', alpha=0.2)) # plt.plot(xx, yy,'-k'); # txt = ('Node Displacement (Scale_factor: ' + str(scale) + ')') # plt.title(txt) # for i in range(len(nodematrix)): nodematrix_update.append([nodematrix[i][0]+displacement[i][0]*scale,nodematrix[i][1]+displacement[i][1]*scale]) for i in range(len(elementmatrix[0])): nodoi = elementmatrix[0][i] nodoj = elementmatrix[1][i] xx = (nodematrix_update[nodoi][0],nodematrix_update[nodoj][0]) yy = (nodematrix_update[nodoi][1],nodematrix_update[nodoj][1]) plt.plot(xx, yy,'-r');
def test_MomentCurvature(): ops.wipe() # Define model builder # -------------------- ops.model('basic', '-ndm', 2, '-ndf', 3) # Define materials for nonlinear columns # ------------------------------------------ # CONCRETE tag f'c ec0 f'cu ecu # Core concrete (confined) ops.uniaxialMaterial('Concrete01', 1, -6.0, -0.004, -5.0, -0.014) # Cover concrete (unconfined) ops.uniaxialMaterial('Concrete01', 2, -5.0, -0.002, 0.0, -0.006) # STEEL # Reinforcing steel fy = 60.0 # Yield stress E = 30000.0 # Young's modulus # tag fy E0 b ops.uniaxialMaterial('Steel01', 3, fy, E, 0.01) # Define cross-section for nonlinear columns # ------------------------------------------ # set some paramaters colWidth = 15 colDepth = 24 cover = 1.5 As = 0.60 # area of no. 7 bars # some variables derived from the parameters y1 = colDepth / 2.0 z1 = colWidth / 2.0 ops.section('Fiber', 1) # Create the concrete core fibers ops.patch('rect', 1, 10, 1, cover - y1, cover - z1, y1 - cover, z1 - cover) # Create the concrete cover fibers (top, bottom, left, right) ops.patch('rect', 2, 10, 1, -y1, z1 - cover, y1, z1) ops.patch('rect', 2, 10, 1, -y1, -z1, y1, cover - z1) ops.patch('rect', 2, 2, 1, -y1, cover - z1, cover - y1, z1 - cover) ops.patch('rect', 2, 2, 1, y1 - cover, cover - z1, y1, z1 - cover) # Create the reinforcing fibers (left, middle, right) ops.layer('straight', 3, 3, As, y1 - cover, z1 - cover, y1 - cover, cover - z1) ops.layer('straight', 3, 2, As, 0.0, z1 - cover, 0.0, cover - z1) ops.layer('straight', 3, 3, As, cover - y1, z1 - cover, cover - y1, cover - z1) # Estimate yield curvature # (Assuming no axial load and only top and bottom steel) # d -- from cover to rebar d = colDepth - cover # steel yield strain epsy = fy / E Ky = epsy / (0.7 * d) # Print estimate to standard output print("Estimated yield curvature: ", Ky) # Set axial load P = -180.0 # Target ductility for analysis mu = 15.0 # Number of analysis increments numIncr = 100 # Call the section analysis procedure MomentCurvature(1, P, Ky * mu, numIncr) u = ops.nodeDisp(2, 3) assert abs(u - 0.00190476190476190541) < 1e-12