def get_disp(GRS): ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) for i in range(GRS.nbnBns): if GRS.LoadType == 0 \ or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= 0) \ or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= 0) \ or (GRS.GeomType in {4} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= GRS.span / 2) \ or (GRS.GeomType in {4} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= GRS.span / 2): ops.load(int(100 + GRS.nbn[i]), 0., 0., -1., 0., 0., 0.) ops.algorithm("Linear") ops.integrator("LoadControl", 1) ops.analysis('Static') ops.analyze(1) NDisp = np.zeros([GRS.nbNsAll, 3]) for j in range(GRS.nbNsAll): NDisp[j, 0] = ops.nodeDisp(int(j + 100), 1) NDisp[j, 1] = ops.nodeDisp(int(j + 100), 2) NDisp[j, 2] = ops.nodeDisp(int(j + 100), 3) return NDisp
def RunIterations2(GRS, Fz, printOn): ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) for i in range(GRS.nbnBns): ops.load(int(100 + GRS.nbn[i]), 0., 0., Fz * un.kN, 0., 0., 0.) GRS.GetTopNode() # ops.load(int(100+GRS.maxNsID), 0., 0., Fz * kN, 0., 0., 0.) # mid-point # create SOE ops.system('UmfPack') # create DOF number ops.numberer('RCM') # create constraint handler ops.constraints('Transformation') # create integrator ops.integrator("LoadControl", 1.0 / GRS.Steps) # create algorithm ops.algorithm("Newton") # create test ops.test('EnergyIncr', 1.e-10, 100) ops.analysis('Static') NDisp = np.zeros([GRS.Steps + 1, GRS.nbNsAll, 3]) # EDisp = np.zeros([GRS.Steps + 1, GRS.nbElAll, 6]) EForce = np.zeros([GRS.Steps + 1, GRS.nbElAll, 12]) reI = 0 reI = 0 lefutott = 1 for i in range(1, GRS.Steps + 1): hiba = ops.analyze(1) if hiba == 0: if i == 1: if printOn: print('analysis step 1 completed successfully') for j in range(GRS.nbNsAll): NDisp[i, j, 0] = -ops.nodeDisp(int(j + 100), 1) / un.mm # mm displacement NDisp[i, j, 1] = -ops.nodeDisp(int(j + 100), 2) / un.mm # mm displacement NDisp[i, j, 2] = -ops.nodeDisp(int(j + 100), 3) / un.mm # mm displacement for j in range(GRS.nbElAll): EForce[i, j] = ops.eleResponse(int(j + 1000), 'localForce') # EDisp[i, j] = ops.eleResponse(int(j + 1000), 'basicDeformation') else: lefutott = 0 reI = i if reI == 1: if printOn: print('analysis failed to converge in step ', i) break return lefutott, NDisp, EForce, reI
def get_normal_force(GRS): ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) for i in range(GRS.nbnBns): if GRS.LoadType == 0 \ or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= 0) \ or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= 0) \ or (GRS.GeomType in {4} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= GRS.span / 2) \ or (GRS.GeomType in {4} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= GRS.span / 2): ops.load(int(100 + GRS.nbn[i]), 0., 0., -1., 0., 0., 0.) ops.algorithm("Linear") ops.integrator("LoadControl", 1) ops.analysis('Static') ops.analyze(1) EForce = np.zeros([GRS.nbElAll]) for j in range(GRS.nbElAll): EForce[j] = ops.eleResponse(int(j + 1000), 'localForce')[0] return EForce
sys.path.insert(0, '../SRC/interpreter/') # sys.path.insert(0, '../build/lib/') import opensees as ops ops.model('basic', '-ndm', 1, '-ndf', 1) ops.uniaxialMaterial('Elastic', 1, 3000.0) ops.node(1, 0.0) ops.node(2, 72.0) ops.fix(1, 1) ops.element('Truss', 1, 1, 2, 10.0, 1) ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) ops.load(2, 100.0) ops.constraints('Transformation') ops.numberer('ParallelPlain') ops.test('NormDispIncr', 1e-6, 6, 2) ops.system('ProfileSPD') ops.integrator('Newmark', 0.5, 0.25) # ops.analysis('Transient') ops.algorithm('Linear') ops.analysis('VariableTransient') ops.analyze(5, 0.0001, 0.00001, 0.001, 10) time = ops.getTime() print(f'time: ', ops.getTime()) approx_vtime = 0.0001 + 0.001 # One step at target, then one step at maximum assert 0.99 < time / approx_vtime < 1.01, (time, approx_vtime)
ops.element("forceBeamColumn", leftColTag, 1, 2, transfTag, cbiTag) girderTag = 2 ops.element("forceBeamColumn", girderTag, 2, 3, transfTag, gbiTag) rightColTag = 3 ops.element("forceBeamColumn", rightColTag, 3, 4, transfTag, cbiTag) P = 25.0 w = 1.0e-1 tsTag = 1 ops.timeSeries("Constant", tsTag) patternTag = 1 ops.pattern("Plain", patternTag, tsTag) ops.load(2, P, 0, 0) ops.eleLoad("-ele", girderTag, "-type", "beamUniform", -w) ops.analysis("Static") ops.randomVariable(62, 'lognormal', '-mean', E, '-stdv', 0.1 * E) ops.randomVariable(32, 'normal', '-mean', P, '-stdv', 0.2 * P) ops.randomVariable(89, 'normal', '-mean', 0, '-stdv', 1) ops.randomVariable(41, 'normal', '-mean', -w, '-stdv', abs(0.2 * w)) ops.parameter(12, 'randomVariable', 62, "element", leftColTag, "E") ops.addToParameter(12, 'element', rightColTag, "E") ops.parameter(25, 'randomVariable', 32, "loadPattern", patternTag, "loadAtNode", 2, 1) ops.parameter(3, 'randomVariable', 89, "node", 1, "coord", 1) ops.parameter(45, 'randomVariable', 41, "loadPattern", patternTag,
i = m * (bx * bx + by * by) / 12.0 # Set mass at the master nodes # tag MX MY MZ RX RY RZ ops.mass(9, m, m, 0.0, 0.0, 0.0, i) ops.mass(14, m, m, 0.0, 0.0, 0.0, i) ops.mass(19, m, m, 0.0, 0.0, 0.0, i) # Define gravity loads # create a Constant TimeSeries ops.timeSeries("Constant", 1) # create a Plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) for i in [5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18]: ops.load(i, 0.0, 0.0, -p, 0.0, 0.0, 0.0) # set rayleigh damping factors ops.rayleigh(0.0, 0.0, 0.0, 0.0018) # Define earthquake excitation # ---------------------------- dt = 0.02 # Set up the acceleration records for Tabas fault normal and fault parallel ops.timeSeries("Path", 2, "-filePath", "tabasFN.txt", "-dt", dt, "-factor", g) ops.timeSeries("Path", 3, "-filePath", "tabasFP.txt", "-dt", dt, "-factor", g) # Define the excitation using the Tabas ground motion records # tag dir accel series args ops.pattern("UniformExcitation", 2, 1, "-accel", 2) ops.pattern("UniformExcitation", 3, 2, "-accel", 3)
ops.element('quad', 16, 19, 24, 25, 20, 1, 'PlaneStress', 1) ops.fix(1, 1, 1) ops.fix(6, 1, 1) ops.fix(11, 1, 1) ops.fix(16, 1, 1) ops.fix(21, 1, 1) ops.equalDOF(2, 22, 1, 2) ops.equalDOF(3, 23, 1, 2) ops.equalDOF(4, 24, 1, 2) ops.equalDOF(5, 25, 1, 2) ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) ops.load(15, 0., -1.) ops.analysis('Static') ops.analyze(1) # - plot model opsv.plot_model() plt.axis('equal') # - plot deformation plt.figure() opsv.plot_defo() plt.axis('equal') # get values at OpenSees nodes sig_out = opsv.sig_out_per_node()
op.recorder('Element', '-file', 'Pile_Forces_Liq.txt', '-time', '-ele', 3, 4, 'force') op.recorder('Node', '-file', 'Pile_Disp_Liq.txt', '-time', '-node', 1, 2, 3, '-dof', 2, 'disp') # create time series seriesTag = seriesTag + 1 op.timeSeries("Linear", seriesTag) # create a plain load pattern patternTag = 1 op.pattern("Plain", patternTag, seriesTag) # add load at the pile head load loadValues = [0, P, 0.0] op.load(3, *loadValues) # ------------------------------ # Start of analysis generation # ------------------------------ # create SOE op.system('UmfPack') # create DOF number op.numberer('RCM') # create constraint handler op.constraints('Transformation') # create integrator op.integrator('LoadControl', timeStep, NumSteps) # create algorithm op.algorithm('Newton') # create test
# Define elements # --------------- # Create truss elements - command: element truss trussID node1 node2 A matID ops.element("truss", 1, 1, 4, 10.0, 1) ops.element("truss", 2, 2, 4, 5.0, 1) ops.element("truss", 3, 3, 4, 5.0, 1) # Define loads # ------------ # create a Linear TimeSeries (load factor varies linearly with time) - command: timeSeries Linear $tag ops.timeSeries("Linear", 1) # create a Plain load pattern - command: pattern Plain $tag $timeSeriesTag { $loads } ops.pattern("Plain", 1, 1, "-fact", 1.0) # create the nodal load - command: load nodeID xForce yForce ops.load(4, 100.0, -50.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example1.1.json") # ------------------------------ # End of model generation # ------------------------------ # ------------------------------ # Start of analysis generation # ------------------------------ # create the system of equation, a SPD using a band storage scheme
op.model('basic', '-ndm', 2, '-ndf', 3) # define constant scaling factor for applied velocity cFactor = colArea * dashpotCoeff # define velocity time history file velocityFile = 'velocityHistory' data_gm = np.loadtxt('velocityHistory.txt') #motionSteps=len(data_gm) #print('Number of point for GM:',motionSteps) # timeseries object for force history op.timeSeries('Path', 2, '-dt', motionDT, '-filePath', velocityFile + '.txt', '-factor', cFactor) op.pattern('Plain', 10, 2) op.load(1, 1.0, 0.0, 0.0) print("Dynamic loading created...") op.constraints('Penalty', 1.0E16, 1.0E16) op.test('NormDispIncr', 1e-3, 35, 1) op.algorithm('KrylovNewton') op.numberer('RCM') op.system('ProfileSPD') op.integrator('Newmark', gamma, beta) op.rayleigh(a0, a1, 0.0, 0.0) op.analysis('Transient') # perform analysis with timestep reduction loop ok = op.analyze(nSteps, dT)
ops.fix(3, 1, 1) # define materials ops.uniaxialMaterial("Elastic", 1, 3000) # define elements ops.element("Truss", 1, 1, 4, 10.0, 1) ops.element("Truss", 2, 2, 4, 5.0, 1) ops.element("Truss", 3, 3, 4, 5.0, 1) # create TimeSeries ops.timeSeries("Linear", 1) # create a plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) ops.load(4, 100, -50) # print model #ops.Print() # create SOE ops.system("BandSPD") # create DOF number ops.numberer("RCM") # create constraint handler ops.constraints("Plain") # create algorithm ops.algorithm("Linear")
def test_recorder_time_step_is_stable(): opy.model('basic', '-ndm', 2, '-ndf', 2) opy.loadConst('-time', 1e+13) opy.node(1, 0.0, 0.0) opy.node(2, 0.5, 0.0) opy.node(3, 0.0, -0.5) opy.node(4, 0.5, -0.5) opy.equalDOF(3, 4, 1, 2) opy.node(5, 0.0, -1.0) opy.node(6, 0.5, -1.0) opy.equalDOF(5, 6, 1, 2) opy.node(7, 0.0, -1.5) opy.node(8, 0.5, -1.5) opy.equalDOF(7, 8, 1, 2) opy.node(9, 0.0, -2.0) opy.node(10, 0.5, -2.0) opy.equalDOF(9, 10, 1, 2) opy.node(11, 0.0, -2.5) opy.node(12, 0.5, -2.5) opy.equalDOF(11, 12, 1, 2) opy.node(13, 0.0, -3.0) opy.node(14, 0.5, -3.0) opy.equalDOF(13, 14, 1, 2) opy.fix(13, 0, 1) opy.fix(14, 0, 1) opy.node(15, 0.0, -3.0) opy.node(16, 0.0, -3.0) opy.fix(15, 1, 1) opy.fix(16, 0, 1) opy.equalDOF(13, 14, 1) opy.equalDOF(13, 16, 1) opy.nDMaterial('ElasticIsotropic', 1, 212500.0, 0.0, 1.7) opy.element('SSPquad', 1, 3, 4, 2, 1, 1, 'PlaneStrain', 1.0, 0.0, 16.677) opy.element('SSPquad', 2, 5, 6, 4, 3, 1, 'PlaneStrain', 1.0, 0.0, 16.677) opy.element('SSPquad', 3, 7, 8, 6, 5, 1, 'PlaneStrain', 1.0, 0.0, 16.677) opy.element('SSPquad', 4, 9, 10, 8, 7, 1, 'PlaneStrain', 1.0, 0.0, 16.677) opy.element('SSPquad', 5, 11, 12, 10, 9, 1, 'PlaneStrain', 1.0, 0.0, 16.677) opy.element('SSPquad', 6, 13, 14, 12, 11, 1, 'PlaneStrain', 1.0, 0.0, 16.677) opy.uniaxialMaterial('Viscous', 2, 212.5, 1.0) opy.element('zeroLength', 7, 15, 16, '-mat', 2, '-dir', 1) opy.constraints('Transformation') opy.test('NormDispIncr', 0.0001, 30, 0, 2) opy.algorithm('Newton', False, False, False) opy.numberer('RCM') opy.system('ProfileSPD') opy.integrator('Newmark', 0.5, 0.25) opy.analysis('Transient') opy.analyze(40, 1.0) opy.analyze(50, 0.5) opy.setTime(1.0e3) opy.wipeAnalysis() opy.recorder('Node', '-file', 'time_0_01.txt', '-precision', 16, '-dT', 0.01, '-rTolDt', 0.00001, '-time', '-node', 1, '-dof', 1, 'accel') opy.recorder('Element', '-file', 'etime_0_01.txt', '-precision', 16, '-dT', 0.01, '-rTolDt', 0.00001, '-time', '-ele', 1, 2, 'stress') opy.recorder('EnvelopeNode', '-file', 'entime_0_01.txt', '-precision', 16, '-dT', 0.01, '-time', '-node', 1, '-dof', 1, 'accel') # opy.recorder('Drift', '-file', 'dtime_0_01.txt', '-precision', 16, '-dT', 0.01, '-time', # '-iNode', 1, '-jNode', 2, '-dof', 1, '-perpDirn', 2) opy.timeSeries('Path', 1, '-dt', 0.01, '-values', -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -0.0, -7.51325e-05) opy.pattern('Plain', 1, 1) opy.load(13, 1.0, 0.0) opy.algorithm('Newton', False, False, False) opy.system('SparseGeneral') opy.numberer('RCM') opy.constraints('Transformation') opy.integrator('Newmark', 0.5, 0.25) opy.rayleigh(0.17952, 0.000909457, 0.0, 0.0) opy.analysis('Transient') opy.test('EnergyIncr', 1e-07, 10, 0, 2) opy.record() opy.analyze(1, 0.001) for i in range(1100): print(i) opy.analyze(1, 0.001) cur_time = opy.getTime() opy.wipe() a = open('time_0_01.txt').read().splitlines() for i in range(len(a) - 1): dt = float(a[i + 1].split()[0]) - float(a[i].split()[0]) assert abs(dt - 0.01) < 0.0001, (i, dt)
# generate the nodes and elements # numX numY startNode startEle eleType eleArgs? coords? ops.block2D(nx, ny, 1, 1, "ShellMITC4", 1, 1, -20.0, 0.0, 0.0, 2, -20.0, 0.0, 40.0, 3, 20.0, 0.0, 40.0, 4, 20.0, 0.0, 0.0, 5, -10.0, 10.0, 20.0, 7, 10.0, 10.0, 20.0, 9, 0.0, 10.0, 20.0) # define the boundary conditions # rotation free about x-axis (remember right-hand-rule) ops.fixZ(0.0, 1, 1, 1, 0, 1, 1) ops.fixZ(40.0, 1, 1, 1, 0, 1, 1) # create a Linear time series ops.timeSeries("Linear", 1) # add some loads ops.pattern("Plain", 1, 1, "-fact", 1.0) ops.load(mid, 0.0, -0.50, 0.0, 0.0, 0.0, 0.0) ops.load(side1, 0.0, -0.25, 0.0, 0.0, 0.0, 0.0) ops.load(side2, 0.0, -0.25, 0.0, 0.0, 0.0, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example7.1.json") # ----------------------- # End of model generation # ----------------------- # ------------------------ # Start of static analysis # ------------------------
ops.fix(3, 1, 1) # define materials ops.uniaxialMaterial("Elastic", 1, 3000) # define elements ops.element("Truss",1,1,4,10.0,1) ops.element("Truss",2,2,4,5.0,1) ops.element("Truss",3,3,4,5.0,1) # create TimeSeries ops.timeSeries("Linear", 1) # create a plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) ops.load(4, 100, -50) # print model #ops.Print() # create SOE ops.system("BandSPD") # create DOF number ops.numberer("RCM") # create constraint handler ops.constraints("Plain") # create algorithm ops.algorithm("Linear")
4, -1.0, 1.0, 0.0, 5, -1.0, -1.0, 10.0, 6, 1.0, -1.0, 10.0, 7, 1.0, 1.0, 10.0, 8, -1.0, 1.0, 10.0) # boundary conditions ops.fixZ(0.0, 1, 1, 1) # Define point load # create a Linear time series ops.timeSeries("Linear", 1) # create a Plain load pattern load = 0.10 ops.pattern("Plain", 1, 1, "-fact", 1.0) ops.load(nn, load, load, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example8.1.json") # ----------------------- # End of model generation # ----------------------- # ------------------------ # Start of static analysis # ------------------------ # Load control with variable load steps
P = -192.0 # create a Linear TimeSeries ops.timeSeries("Linear", 1) # create a Plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) # Create nodal loads at nodes for i in range(numBay+1): # set some parameters node1 = i*3 + 2 node2 = node1 + 1 if (i == 0): ops.load(node1, 0.0, P, 0.0) ops.load(node2, 0.0, P/2.0, 0.0) elif (i == numBay): ops.load(node1, 0.0, P, 0.0) ops.load(node2, 0.0, P/2.0, 0.0) else: ops.load(node1, 0.0, 2.0*P, 0.0) ops.load(node2, 0.0, P, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example4.1.json") # ------------------------------ # End of model generation # ------------------------------
3, 20.0, 0.0, 40.0, 4, 20.0, 0.0, 0.0, 5, -10.0, 10.0, 20.0, 7, 10.0, 10.0, 20.0, 9, 0.0, 10.0, 20.0) # define the boundary conditions # rotation free about x-axis (remember right-hand-rule) ops.fixZ( 0.0, 1, 1, 1, 0, 1, 1) ops.fixZ(40.0, 1, 1, 1, 0, 1, 1) # create a Linear time series ops.timeSeries("Linear", 1) # add some loads ops.pattern("Plain", 1, 1, "-fact", 1.0) ops.load(mid , 0.0, -0.50, 0.0, 0.0, 0.0, 0.0) ops.load(side1, 0.0, -0.25, 0.0, 0.0, 0.0, 0.0) ops.load(side2, 0.0, -0.25, 0.0, 0.0, 0.0, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example7.1.json") # ----------------------- # End of model generation # ----------------------- # ------------------------ # Start of static analysis # ------------------------
ops.geomTransf(coordTransf, gTTagx, 0., -1., 0.) ops.geomTransf(coordTransf, gTTagy, 1., 0., 0.) ops.element('elasticBeamColumn', 1, 1, 2, A, E, G, J, Iy, Iz, gTTagz) ops.element('elasticBeamColumn', 2, 2, 3, A, E, G, J, Iy, Iz, gTTagx) ops.element('elasticBeamColumn', 3, 3, 4, A, E, G, J, Iy, Iz, gTTagy) Ew = {} Px = -4.e1 Py = -2.5e1 Pz = -3.e1 ops.timeSeries('Constant', 1) ops.pattern('Plain', 1, 1) ops.load(4, Px, Py, Pz, 0., 0., 0.) ops.constraints('Transformation') ops.numberer('RCM') ops.system('BandGeneral') ops.test('NormDispIncr', 1.0e-6, 6, 2) ops.algorithm('Linear') ops.integrator('LoadControl', 1) ops.analysis('Static') ops.analyze(1) opsv.plot_model() sfac = 2.0e0 # fig_wi_he = 22., 14.
i = m*(bx*bx + by*by)/12.0 # Set mass at the master nodes # tag MX MY MZ RX RY RZ ops.mass( 9, m, m, 0.0, 0.0, 0.0, i) ops.mass(14, m, m, 0.0, 0.0, 0.0, i) ops.mass(19, m, m, 0.0, 0.0, 0.0, i) # Define gravity loads # create a Constant TimeSeries ops.timeSeries("Constant", 1) # create a Plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) for i in [5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18]: ops.load(i, 0.0, 0.0, -p, 0.0, 0.0, 0.0) # set rayleigh damping factors ops.rayleigh(0.0, 0.0, 0.0, 0.0018) # Define earthquake excitation # ---------------------------- dt = 0.02 # Set up the acceleration records for Tabas fault normal and fault parallel ops.timeSeries("Path", 2, "-filePath", "tabasFN.txt", "-dt", dt, "-factor", g) ops.timeSeries("Path", 3, "-filePath", "tabasFP.txt", "-dt", dt, "-factor", g) # Define the excitation using the Tabas ground motion records # tag dir accel series args ops.pattern("UniformExcitation", 2, 1, "-accel", 2) ops.pattern("UniformExcitation", 3, 2, "-accel", 3)
P = -192.0 # create a Linear TimeSeries ops.timeSeries("Linear", 1) # create a Plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) # Create nodal loads at nodes for i in range(numBay + 1): # set some parameters node1 = i * 3 + 2 node2 = node1 + 1 if (i == 0): ops.load(node1, 0.0, P, 0.0) ops.load(node2, 0.0, P / 2.0, 0.0) elif (i == numBay): ops.load(node1, 0.0, P, 0.0) ops.load(node2, 0.0, P / 2.0, 0.0) else: ops.load(node1, 0.0, 2.0 * P, 0.0) ops.load(node2, 0.0, P, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example4.1.json") # ------------------------------ # End of model generation # ------------------------------
elif (Quad == "bbarQuad"): # numX numY startNode startEle eleType eleArgs? coords? ops.block2D(nx, ny, 1, 1, Quad, thick, 1, 1, 0.0, 0.0, 2, 40.0, 0.0, 3, 40.0, 10.0, 4, 0.0, 10.0) # Single point constraints # node u1 u2 ops.fix(1, 1, 1) ops.fix(bn, 0, 1) # Define gravity loads # create a Linear time series ops.timeSeries("Linear", 1) # create a Plain load pattern ops.pattern("Plain", 1, 1, "-fact", 1.0) ops.load(l1, 0.0, -1.0) ops.load(l2, 0.0, -1.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example6.1.json") # ----------------------- # End of model generation # ----------------------- # -------------------------------------------------------------------- # Start of static analysis (creation of the analysis & analysis itself) # -------------------------------------------------------------------- # create the system of equation
def RunIterations(GRS, Fz, printOn): ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) loadA = np.linspace(0, -Fz, GRS.Steps + 1) # kN for i in range(GRS.nbnBns): if GRS.LoadType == 0 \ or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= 0) \ or (GRS.GeomType in {0, 1, 2} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= 0) \ or (GRS.GeomType in {4} and GRS.LoadType == 1 and GRS.nsAll.x[GRS.nbn[i]] <= GRS.span / 2) \ or (GRS.GeomType in {4} and GRS.LoadType == 2 and GRS.nsAll.y[GRS.nbn[i]] <= GRS.span / 2): ops.load(int(100 + GRS.nbn[i]), 0., 0., Fz * un.kN, 0., 0., 0.) GRS.GetTopNode() # ops.load(int(100+GRS.maxNsID), 0., 0., Fz * kN, 0., 0., 0.) # mid-point # create SOE ops.system('UmfPack') # create DOF number ops.numberer('RCM') # create constraint handler ops.constraints('Transformation') # create test ops.test('EnergyIncr', 1.e-12, 10) # create algorithm ops.algorithm("Newton") NDisp = np.zeros([GRS.Steps + 1, GRS.nbNsAll, 3]) # EDisp = np.zeros([GRS.Steps + 1, GRS.nbElAll, 6]) EForce = np.zeros([GRS.Steps + 1, GRS.nbElAll, 12]) reI=0 reI = 0 lefutott = 1 i=0 load = 0 stepSize = 1.0 / GRS.Steps ops.integrator("LoadControl", stepSize) ops.analysis('Static') while ((-stepSize*Fz > GRS.MinStepSize) and (i<GRS.Steps)): hiba = ops.analyze(1) if hiba == 0: load += -stepSize * Fz i += 1 loadA[i] = load if i == 1: if printOn: print('analysis step 1 completed successfully') for j in range(GRS.nbNsAll): NDisp[i, j, 0] = - ops.nodeDisp(int(j + 100), 1) / un.mm # mm displacement NDisp[i, j, 1] = - ops.nodeDisp(int(j + 100), 2) / un.mm # mm displacement NDisp[i, j, 2] = - ops.nodeDisp(int(j + 100), 3) / un.mm # mm displacement for j in range(GRS.nbElAll): EForce[i, j] = ops.eleResponse(int(j+1000), 'localForce') # EDisp[i, j] = ops.eleResponse(int(j + 1000), 'basicDeformation') else: stepSize = stepSize/2 if printOn: print('analysis failed to converge in step ', i) ops.integrator("LoadControl", stepSize) lefutott = 0 reI = i if i == GRS.Steps: if reI == 1: if printOn: print('analysis failed to converge') return lefutott, NDisp, EForce, loadA, reI
ops.element("elasticBeamColumn", 3, 3, 4, 360.0, 4030.0, 8640.0, 2) # Define gravity loads # -------------------- # Set a parameter for the axial load P = 180.0 # 10% of axial capacity of columns # create a Linear TimeSeries (load factor varies linearly with time) - command: timeSeries Linear $tag ops.timeSeries("Linear", 1) # create a Plain load pattern - command: pattern Plain $tag $timeSeriesTag { $loads } ops.pattern("Plain", 1, 1, "-fact", 1.0) # create the nodal load - command: load nodeID xForce yForce zMoment ops.load(3, 0.0, -P, 0.0) ops.load(4, 0.0, -P, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example3.1.json") # ------------------------------ # End of model generation # ------------------------------ # ------------------------------ # Start of analysis generation # ------------------------------ # create the system of equation
exit() ops.model('basic', '-ndm', 2, '-ndf', 2) ops.uniaxialMaterial('Elastic', 1, 3000.0) if pid == 0: ops.node(1, 0.0, 0.0) ops.node(4, 72.0, 96.0) ops.fix(1, 1, 1) ops.mass(4, 100.0, 100.0) ops.element('Truss', 1, 1, 4, 10.0, 1) ops.timeSeries('Linear', 1) ops.pattern('Plain', 1, 1) ops.load(4, 100.0, -50.0) else: ops.node(2, 144.0, 0.0) ops.node(3, 168.0, 0.0) ops.node(4, 72.0, 96.0) ops.fix(2, 1, 1) ops.fix(3, 1, 1) ops.mass(4, 100.0, 100.0) ops.element('Truss', 2, 2, 4, 5.0, 1) ops.element('Truss', 3, 3, 4, 5.0, 1) ops.constraints('Transformation') ops.numberer('ParallelPlain')
# tag ndI ndJ A E Iz transfTag ops.element("elasticBeamColumn", 3, 3, 4, 360.0, 4030.0, 8640.0, 2) # Define gravity loads # -------------------- # Set a parameter for the axial load P = 180.0; # 10% of axial capacity of columns # create a Linear TimeSeries (load factor varies linearly with time) - command: timeSeries Linear $tag ops.timeSeries("Linear", 1) # create a Plain load pattern - command: pattern Plain $tag $timeSeriesTag { $loads } ops.pattern("Plain", 1, 1, "-fact", 1.0) # create the nodal load - command: load nodeID xForce yForce zMoment ops.load(3, 0.0, -P, 0.0) ops.load(4, 0.0, -P, 0.0) # print model #ops.printModel() ops.printModel("-JSON", "-file", "Example3.1.json") # ------------------------------ # End of model generation # ------------------------------ # ------------------------------ # Start of analysis generation # ------------------------------
#---------------------------------------------------------- # create the loading #---------------------------------------------------------- op.setTime(10.0) # apply point load at the uppermost pile node in the x-direction values = [0.0, 0.0, 1.0, 1.0] time = [0.0, 10.0, 20.0, 10000.0] nodeTag = 200+nNodePile loadValues = [3500.0, 0.0, 0.0, 0.0, 0.0, 0.0] op.timeSeries('Path', 1, '-values', *values, '-time', *time, '-factor', 1.0) op.pattern('Plain', 10, 1) op.load(nodeTag, *loadValues) print("Finished creating loading object...") #---------------------------------------------------------- # create the analysis #---------------------------------------------------------- op.integrator('LoadControl', 0.05) op.numberer('RCM') op.system('SparseGeneral') op.constraints('Transformation') op.test('NormDispIncr', 1e-5, 20, 1) op.algorithm('Newton') op.analysis('Static') print("Starting Load Application...")