def test_recorder_time_step_can_handle_fp_precision(): import tempfile opy.model('basic', '-ndm', 2, '-ndf', 3) opy.node(1, 0.0, 0.0) opy.node(2, 0.0, 5.0) opy.fix(2, 0, 1, 0) opy.fix(1, 1, 1, 1) opy.equalDOF(2, 1, 2) opy.mass(2, 1.0, 0.0, 0.0) opy.geomTransf('Linear', 1, '-jntOffset') opy.element('elasticBeamColumn', 1, 1, 2, 1.0, 1e+06, 0.00164493, 1) opy.timeSeries('Path', 1, '-dt', 0.1, '-values', 0.0, -0.001, 0.001, -0.015, 0.033, 0.105, 0.18) opy.pattern('UniformExcitation', 1, 1, '-accel', 1) opy.rayleigh(0.0, 0.0159155, 0.0, 0.0) opy.wipeAnalysis() opy.algorithm('Newton') opy.system('SparseSYM') opy.numberer('RCM') opy.constraints('Transformation') opy.integrator('Newmark', 0.5, 0.25) opy.analysis('Transient') opy.test('EnergyIncr', 1e-07, 10, 0, 2) node_rec_ffp = tempfile.NamedTemporaryFile(delete=False).name ele_rec_ffp = tempfile.NamedTemporaryFile(delete=False).name rdt = 0.01 adt = 0.001 opy.recorder('Node', '-file', node_rec_ffp, '-precision', 16, '-dT', rdt, '-rTolDt', 0.00001, '-time', '-node', 1, '-dof', 1, 'accel') opy.recorder('Element', '-file', ele_rec_ffp, '-precision', 16, '-dT', rdt, '-rTolDt', 0.00001, '-time', '-ele', 1, 'force') opy.record() for i in range(1100): opy.analyze(1, adt) opy.getTime() opy.wipe() a = open(node_rec_ffp).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) < adt * 0.1, (i, dt) a = open(ele_rec_ffp).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) < adt * 0.1, (i, dt)
# Geometric transformation ops.geomTransf("Linear", 1) beamID = 1 eleType = "forceBeamColumn" # Define elements for i in range(numBay+1): # set some parameters iNode = i*3 + 1 jNode = i*3 + 2 for j in range(1, 3): # add the column element (secId == 2 if external, 1 if internal column) if (i == 0): ops.element(eleType, beamID, iNode, jNode, 1, 2) elif (i == numBay): ops.element(eleType, beamID, iNode, jNode, 1, 2) else: ops.element(eleType, beamID, iNode, jNode, 1, 1) # increment the parameters iNode += 1 jNode += 1 beamID += 1 # Define beam elements # ---------------------- # Geometric transformation ops.geomTransf("Linear", 2)
def get_inelastic_response(mass, k_spring, f_yield, motion, dt, xi=0.05, r_post=0.0): """ Run seismic analysis of a nonlinear SDOF :param mass: SDOF mass :param k_spring: spring stiffness :param f_yield: yield strength :param motion: list, acceleration values :param dt: float, time step of acceleration values :param xi: damping ratio :param r_post: post-yield stiffness :return: """ op.wipe() op.model('basic', '-ndm', 2, '-ndf', 3) # 2 dimensions, 3 dof per node # Establish nodes bot_node = 1 top_node = 2 op.node(bot_node, 0., 0.) op.node(top_node, 0., 0.) # Fix bottom node op.fix(top_node, opc.FREE, opc.FIXED, opc.FIXED) op.fix(bot_node, opc.FIXED, opc.FIXED, opc.FIXED) # Set out-of-plane DOFs to be slaved op.equalDOF(1, 2, *[2, 3]) # nodal mass (weight / g): op.mass(top_node, mass, 0., 0.) # Define material bilinear_mat_tag = 1 mat_type = "Steel01" mat_props = [f_yield, k_spring, r_post] op.uniaxialMaterial(mat_type, bilinear_mat_tag, *mat_props) # Assign zero length element beam_tag = 1 op.element('zeroLength', beam_tag, bot_node, top_node, "-mat", bilinear_mat_tag, "-dir", 1, '-doRayleigh', 1) # Define the dynamic analysis load_tag_dynamic = 1 pattern_tag_dynamic = 1 values = list(-1 * motion) # should be negative op.timeSeries('Path', load_tag_dynamic, '-dt', dt, '-values', *values) op.pattern('UniformExcitation', pattern_tag_dynamic, opc.X, '-accel', load_tag_dynamic) # set damping based on first eigen mode angular_freq = op.eigen('-fullGenLapack', 1)**0.5 alpha_m = 0.0 beta_k = 2 * xi / angular_freq beta_k_comm = 0.0 beta_k_init = 0.0 op.rayleigh(alpha_m, beta_k, beta_k_init, beta_k_comm) # Run the dynamic analysis op.wipeAnalysis() op.algorithm('Newton') op.system('SparseGeneral') op.numberer('RCM') op.constraints('Transformation') op.integrator('Newmark', 0.5, 0.25) op.analysis('Transient') tol = 1.0e-10 iterations = 10 op.test('EnergyIncr', tol, iterations, 0, 2) analysis_time = (len(values) - 1) * dt analysis_dt = 0.001 outputs = { "time": [], "rel_disp": [], "rel_accel": [], "rel_vel": [], "force": [] } while op.getTime() < analysis_time: curr_time = op.getTime() op.analyze(1, analysis_dt) outputs["time"].append(curr_time) outputs["rel_disp"].append(op.nodeDisp(top_node, 1)) outputs["rel_vel"].append(op.nodeVel(top_node, 1)) outputs["rel_accel"].append(op.nodeAccel(top_node, 1)) op.reactions() outputs["force"].append( -op.nodeReaction(bot_node, 1)) # Negative since diff node op.wipe() for item in outputs: outputs[item] = np.array(outputs[item]) return outputs
import sys 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())
#PDelta = "ON" # Geometric transformation for columns if (PDelta == "OFF"): ops.geomTransf("Linear", 1, 1.0, 0.0, 0.0) else: ops.geomTransf("PDelta", 1, 1.0, 0.0, 0.0) # Number of column integration points (sections) np = 4 ops.beamIntegration("Lobatto", colSec, colSec, np) # Create the nonlinear column elements eleType = "forceBeamColumn" # tag ndI ndJ transfTag integrationTag ops.element(eleType, 1, 1, 5, 1, colSec) ops.element(eleType, 2, 2, 6, 1, colSec) ops.element(eleType, 3, 3, 7, 1, colSec) ops.element(eleType, 4, 4, 8, 1, colSec) ops.element(eleType, 5, 5, 10, 1, colSec) ops.element(eleType, 6, 6, 11, 1, colSec) ops.element(eleType, 7, 7, 12, 1, colSec) ops.element(eleType, 8, 8, 13, 1, colSec) ops.element(eleType, 9, 10, 15, 1, colSec) ops.element(eleType, 10, 11, 16, 1, colSec) ops.element(eleType, 11, 12, 17, 1, colSec) ops.element(eleType, 12, 13, 18, 1, colSec) # Define beam elements
ops.node(14, 2., 3.) ops.node(15, 2., 4.) ops.node(16, 3., 0.) ops.node(17, 3., 1.) ops.node(18, 3., 2.) ops.node(19, 3., 3.) ops.node(20, 3., 4.) ops.node(21, 4., 0.) ops.node(22, 4., 1.) ops.node(23, 4., 2.) ops.node(24, 4., 3.) ops.node(25, 4., 4.) ops.nDMaterial('ElasticIsotropic', 1, 1000, 0.3) ops.element('quad', 1, 1, 6, 7, 2, 1, 'PlaneStress', 1) ops.element('quad', 2, 2, 7, 8, 3, 1, 'PlaneStress', 1) ops.element('quad', 3, 3, 8, 9, 4, 1, 'PlaneStress', 1) ops.element('quad', 4, 4, 9, 10, 5, 1, 'PlaneStress', 1) ops.element('quad', 5, 6, 11, 12, 7, 1, 'PlaneStress', 1) ops.element('quad', 6, 7, 12, 13, 8, 1, 'PlaneStress', 1) ops.element('quad', 7, 8, 13, 14, 9, 1, 'PlaneStress', 1) ops.element('quad', 8, 9, 14, 15, 10, 1, 'PlaneStress', 1) ops.element('quad', 9, 11, 16, 17, 12, 1, 'PlaneStress', 1) ops.element('quad', 10, 12, 17, 18, 13, 1, 'PlaneStress', 1) ops.element('quad', 11, 13, 18, 19, 14, 1, 'PlaneStress', 1) ops.element('quad', 12, 14, 19, 20, 15, 1, 'PlaneStress', 1) ops.element('quad', 13, 16, 21, 22, 17, 1, 'PlaneStress', 1) ops.element('quad', 14, 17, 22, 23, 18, 1, 'PlaneStress', 1) ops.element('quad', 15, 18, 23, 24, 19, 1, 'PlaneStress', 1) ops.element('quad', 16, 19, 24, 25, 20, 1, 'PlaneStress', 1)
tult = 50 #Ultimate capacity of the t-z material. (kN) tzz50 = 0.001 #Displacement at which 50% of tult is mobilized in monotonic loading. (mm) c = 0.0 #The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity). op.uniaxialMaterial('TzLiq1', matTag, soilType, tult, tzz50, c, '-timeSeries', 2) #---------------------------------------------------------- # zero-length interfac elements #---------------------------------------------------------- eleTag = 1 node1 = 5 node2 = 1 op.element('zeroLength', eleTag, node1, node2, '-mat', 1, '-dir', 2) eleTag = 2 node1 = 4 node2 = 2 op.element('zeroLength', eleTag, node1, node2, '-mat', 2, '-dir', 2) #---------------------------------------------------------- # create pile elements #---------------------------------------------------------- transfTag = 1 op.geomTransf('Linear', transfTag) #geometry transformation eleTag = 3 node1 = 1 node2 = 2 op.element('elasticBeamColumn', eleTag, node1, node2, A, E, Iz, transfTag)
soilType = 2 #soilType = 1 Backbone of t-z curve approximates Reese and O’Neill (1987). soilType = 2 Backbone of t-z curve approximates Mosher (1984) relation. tult = 1.0 #Ultimate capacity of the t-z material. z50 = 0.0001 #Displacement at which 50% of tult is mobilized in monotonic loading. c = 0.0 #The viscous damping term (dashpot) on the far-field (elastic) component of the displacement rate (velocity). op.uniaxialMaterial('TzLiq1', matTag, soilType, tult, z50, c, '-timeSeries', seriesTag) # zero-length element eleTag = 1 node1 = 1 node2 = 2 op.element('zeroLength', eleTag, node1, node2, '-mat', 1, '-dir', 1) eleTag = 2 node1 = 1 node2 = 2 op.element('zeroLength', eleTag, node1, node2, '-mat', 2, '-dir', 2) # update the materials op.updateMaterialStage('-material', 1, '-stage', 1) op.updateMaterialStage('-material', 2, '-stage', 1) # record element op.recorder('Element', '-file', 'TZ1_Liq.txt', '-time', '-ele', 2, 'force') # record nodes op.recorder('Node', '-file', 'Node_Disp_Liq.txt', '-time', '-node', 1, '-dof', 2, 'disp')
def BuildOpsModel(GRS): ops.wipe() ops.model('BasicBuilder', '-ndm', 3, '-ndf', 6) # material matID = 66 matID1 = 67 sY = 235. * un.MPa if GRS.MatNL == False: ops.uniaxialMaterial('Elastic', matID, GRS.Es) else: ops.uniaxialMaterial('Steel4', matID1, sY, GRS.Es, '-kin', 4e-3, 50., 0.05, 0.15, '-ult', 360.* un.MPa, 5., ) ops.uniaxialMaterial('MinMax', matID, matID1, '-min', -0.20, '-max', 0.20) #ops.uniaxialMaterial('Steel4', matID, sY, GRS.Es, '-kin', 1e-2, 50., 0.05, 0.15, '-ult', 360.* un.MPa, 10., ) #ops.uniaxialMaterial('Steel4', matID, sY, GRS.Es, '-kin', 1e-2, 50., 0.05, 0.15) #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 210. * 1e7, sY / GRS.Es) #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 210. * 1e6, sY / GRS.Es) #ops.uniaxialMaterial('ElasticBilin', matID, GRS.Es, 1., sY / GRS.Es) #Oldalnyomasos igy futott le # cross-section CHSid = 99 CHSSection(CHSid, matID, GRS.secD, GRS.secT, 8, 1, GRS.Gs*GRS.secIt) # nodes for i in range(GRS.nbNsAll): ops.node(int(100+i), GRS.nsAll.x[i], GRS.nsAll.y[i], GRS.nsAll.z[i]) # ...create zeroLength element nodes... # end supports if GRS.SupType==0: # all boundary points fixed for deformations for i in range(GRS.nbBns): ops.fix(100+GRS.bn[i], 1, 1, 1, 0, 0, 0) elif GRS.SupType == 1: # oldalnyomasos for i in range(len(GRS.bnX)): ops.fix(100+GRS.bnX[i], 1, 0, 1, 0, 0, 0) for i in range(len(GRS.bnY)): ops.fix(100+GRS.bnY[i], 0, 1, 1, 0, 0, 0) for i in range(len(GRS.bnC)): ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0) elif GRS.SupType == 2: # oldalnyomasmentes for i in range(len(GRS.bnX)): ops.fix(100+GRS.bnX[i], 0, 0, 1, 0, 0, 0) for i in range(len(GRS.bnY)): ops.fix(100+GRS.bnY[i], 0, 0, 1, 0, 0, 0) #for i in range(len(GRS.bnC)): # ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0) ops.fix(100 + GRS.bnC[0], 1, 1, 1, 0, 0, 0) ops.fix(100 + GRS.bnC[1], 0, 0, 1, 0, 0, 0) ops.fix(100 + GRS.bnC[2], 1, 0, 1, 0, 0, 0) ops.fix(100 + GRS.bnC[3], 0, 0, 1, 0, 0, 0) elif GRS.SupType == 3: # felmerev #NOT WORKING YET pass elif GRS.SupType == 4: # sarkok for i in range(len(GRS.bnC)): ops.fix(100+GRS.bnC[i], 1, 1, 1, 0, 0, 0) elif GRS.SupType == 5: # dome oldalnyomasos for i in range(GRS.nbBns): if i==0: ops.fix(100+GRS.bn[i], 1, 1, 1, 0, 0, 0) elif i==10: ops.fix(100+GRS.bn[i], 0, 1, 1, 0, 0, 0) else: ops.fix(100+GRS.bn[i], 0, 0, 1, 0, 0, 0) elif GRS.SupType == 6: # dome #NOT WORKING YET pass # transformations TRtag = 55 if GRS.GeomNL == 1: TRType = 'Corotational' ops.geomTransf('Corotational', TRtag, 0., 0., 1.) else: TRType = 'Linear' ops.geomTransf('Linear', TRtag, 0., 0., 1.) # integration points gauss = 5 beamIntTag=44 ops.beamIntegration('Lobatto', beamIntTag, CHSid, gauss) # create elements for i in range(GRS.nbElAll): sID = GRS.lsAll.sID[i] eID = GRS.lsAll.eID[i] dx = abs(GRS.nsAll.x[sID] - GRS.nsAll.x[eID]) dy = abs(GRS.nsAll.y[sID] - GRS.nsAll.y[eID]) dz = abs(GRS.nsAll.z[sID] - GRS.nsAll.z[eID]) if dx+dy+dz == 0: ops.equalDOF(eID, sID, 1,2,3,4,5,6) # Grasshopper geomType=4 Zero length elements - should not come here else: ops.element('forceBeamColumn', int(1000 + i), int(100+sID), int(100+eID), TRtag, beamIntTag)
# Geometric transformation ops.geomTransf("Linear", 1) beamID = 1 eleType = "forceBeamColumn" # Define elements for i in range(numBay + 1): # set some parameters iNode = i * 3 + 1 jNode = i * 3 + 2 for j in range(1, 3): # add the column element (secId == 2 if external, 1 if internal column) if (i == 0): ops.element(eleType, beamID, iNode, jNode, 1, 2) elif (i == numBay): ops.element(eleType, beamID, iNode, jNode, 1, 2) else: ops.element(eleType, beamID, iNode, jNode, 1, 1) # increment the parameters iNode += 1 jNode += 1 beamID += 1 # Define beam elements # ---------------------- # Geometric transformation ops.geomTransf("Linear", 2)
lmass = 200. ops.mass(2, lmass, lmass, lmass, 0.001, 0.001, 0.001) ops.mass(3, lmass, lmass, lmass, 0.001, 0.001, 0.001) ops.mass(4, lmass, lmass, lmass, 0.001, 0.001, 0.001) gTTagz = 1 gTTagx = 2 gTTagy = 3 coordTransf = 'Linear' ops.geomTransf(coordTransf, gTTagz, 0., -1., 0.) 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')
# create nodes ops.node(1, 0.0, 0.0, "-disp", 0.0, 0.0, "-vel", 0.0, 0.0, "-mass", 0.0, 0.0) ops.node(2, 144.0, 0.0) ops.node(3, 168.0, 0.0) ops.node(4, 72.0, 96.0) # set boundary condition ops.fix(1, 1, 1) ops.fix(2, 1, 1) 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")
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)
nI = (6 * j) - 5 nJ = nI + 2 nK = nI + 8 nL = nI + 6 nM = nI + 1 nN = nI + 5 nP = nI + 7 nQ = nI + 3 nR = nI + 4 lowerBound = 0.0 for i in range(1, numLayers + 1): if j * sElemY[i - 1] <= layerBound[ i - 1] and j * sElemY[i - 1] > lowerBound: # permeabilities are initially set at 1.0 m/s for gravity analysis, op.element('9_4_QuadUP', j, nI, nJ, nK, nL, nM, nN, nP, nQ, nR, \ thick[i-1], i, uBulk[i-1], 1.0, 1.0, 1.0, xWgt[i-1], yWgt[i-1]) lowerBound = layerBound[i - 1] print("Finished creating all soil elements...") #----------------------------------------------------------------------------------------- # 6. LYSMER DASHPOT #----------------------------------------------------------------------------------------- # define dashpot nodes dashF = nNodeT + 1 dashS = nNodeT + 2 op.node(dashF, 0.0, 0.0) op.node(dashS, 0.0, 0.0)
a.write(str(np)) a.close() if np < 2: 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)
#PDelta = "ON" # Geometric transformation for columns if (PDelta == "OFF"): ops.geomTransf("Linear", 1, 1.0, 0.0, 0.0) else: ops.geomTransf("PDelta", 1, 1.0, 0.0, 0.0) # Number of column integration points (sections) np = 4 ops.beamIntegration("Lobatto", colSec, colSec, np) # Create the nonlinear column elements eleType = "forceBeamColumn" # tag ndI ndJ transfTag integrationTag ops.element(eleType, 1, 1, 5, 1, colSec) ops.element(eleType, 2, 2, 6, 1, colSec) ops.element(eleType, 3, 3, 7, 1, colSec) ops.element(eleType, 4, 4, 8, 1, colSec) ops.element(eleType, 5, 5, 10, 1, colSec) ops.element(eleType, 6, 6, 11, 1, colSec) ops.element(eleType, 7, 7, 12, 1, colSec) ops.element(eleType, 8, 8, 13, 1, colSec) ops.element(eleType, 9, 10, 15, 1, colSec) ops.element(eleType, 10, 11, 16, 1, colSec) ops.element(eleType, 11, 12, 17, 1, colSec) ops.element(eleType, 12, 13, 18, 1, colSec) # Define beam elements
qzParam = get_qzParam (phi, diameter, sigVq, Gsoil) qult = qzParam [0] z50q = qzParam [1] #op.uniaxialMaterial('QzSimple1', 101, 2, qult, z50q) #, 0.0, 0.0 op.uniaxialMaterial('TzSimple1', 101, 2, qult, z50q, 0.0) print("Finished creating all p-y, t-z, and z-z spring material objects...") #---------------------------------------------------------- # create zero-length elements for springs #---------------------------------------------------------- # element at the pile tip (has q-z spring) op.element('zeroLength', 1001, 1, 101, '-mat', 1, 101, '-dir', 1, 3) # remaining elements for i in range(2, nNodeEmbed+1): op.element('zeroLength', 1000+i, i, 100+i, '-mat', i, 100+i, '-dir', 1, 3) print("Finished creating all zero-Length elements for springs...") #---------------------------------------------------------- # create pile nodes #---------------------------------------------------------- # pile nodes created with 3 dimensions, 6 degrees of freedom op.model('basic', '-ndm', 3, '-ndf', 6) # create pile nodes
ops.node(4, 72.0, 96.0) # set the boundary conditions - command: fix nodeID xRestrnt? yRestrnt? ops.fix(1, 1, 1) ops.fix(2, 1, 1) ops.fix(3, 1, 1) # Define materials for truss elements # ----------------------------------- # Create Elastic material prototype - command: uniaxialMaterial Elastic matID E ops.uniaxialMaterial("Elastic", 1, 3000.0) # 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()
L = 144.0 ops.node(1, 0, 0) ops.node(2, L, 0.0) ops.fix(1, 1, 1) ops.fix(2, 0, 1) E = 30000.0 A = 25.0 fy = 50.0 ops.uniaxialMaterial("Hardening", 1, E, fy, 0, 100.0) ops.element("truss", 1, 1, 2, A, 1) P = 25.0 tsTag = 1 ops.timeSeries("Linear", tsTag) patternTag = 1 ops.pattern("Plain", patternTag, tsTag) ops.load(2, P, 0) ops.analysis("Static") ops.randomVariable(62, 'lognormal', '-mean', E, '-stdv', 0.1 * E) ops.randomVariable(25, 'lognormal', '-mean', A, '-stdv', 0.1 * A)
ops.layer("straight", 3, 3, As, cover - y1, z1 - cover, cover - y1, cover - z1) # define beam integration np = 5 # number of integration points along length of element ops.beamIntegration("Lobatto", 1, 1, np) # Define column elements # ---------------------- # Geometry of column elements # tag ops.geomTransf("PDelta", 1) # Create the coulumns using Beam-column elements # tag ndI ndJ transfTag integrationTag eleType = "forceBeamColumn" ops.element(eleType, 1, 1, 3, 1, 1) ops.element(eleType, 2, 2, 4, 1, 1) # Define beam element # ----------------------------- # Geometry of column elements # tag ops.geomTransf("Linear", 2) # Create the beam element # 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
csecTag = 2 ops.section("Elastic", csecTag, E, Ac, Ic) transfTag = 1 ops.geomTransf("Linear", transfTag) N = 3 gbiTag = 1 ops.beamIntegration("Lobatto", gbiTag, gsecTag, N) cbiTag = 2 ops.beamIntegration("Lobatto", cbiTag, csecTag, N) leftColTag = 1 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.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) # define beam integration np = 5; # number of integration points along length of element ops.beamIntegration("Lobatto", 1, 1, np) # Define column elements # ---------------------- # Geometry of column elements # tag ops.geomTransf("PDelta", 1) # Create the coulumns using Beam-column elements # tag ndI ndJ transfTag integrationTag eleType = "forceBeamColumn" ops.element(eleType, 1, 1, 3, 1, 1) ops.element(eleType, 2, 2, 4, 1, 1) # Define beam element # ----------------------------- # Geometry of column elements # tag ops.geomTransf("Linear", 2) # Create the beam element # 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
import sys TEST_DIR = os.path.dirname(os.path.abspath(__file__)) + "/" INTERPRETER_PATH = TEST_DIR + "../SRC/interpreter/" sys.path.append(INTERPRETER_PATH) import opensees as opy opy.wipe() opy.model('basic', '-ndm', 2, '-ndf', 2) opy.node(1, 0.0, 0.0) opy.node(2, 1.0, 0.0) opy.node(3, 1.0, 1.0) opy.node(4, 0.0, 1.0) for i in range(4): opy.fix(1 + 1 * i, 1, 1) opy.nDMaterial('stressDensity', 1, 1.8, 0.7, 250.0, 0.6, 0.2, 0.592, 0.021, 291.0, 55.0, 98.0, 13.0, 4.0, 0.22, 0.0, 0.0055, 0.607, 98.1) opy.nDMaterial('InitStressNDMaterial', 2, 1, -100.0, 2) opy.element('SSPquad', 1, 1, 2, 3, 4, 2, 'PlaneStrain', 1.0, 0.0, 0.0) opy.constraints('Penalty', 1e+15, 1e+15) opy.algorithm('Linear', False, False, False) opy.numberer('RCM') opy.system('FullGeneral') opy.integrator('LoadControl', 0.1, 1) opy.analysis('Static') opy.timeSeries('Path', 1, '-values', 0, 0, 0, 0.1, '-time', 0.0, 1.0, 2.0, 1002.0, '-factor', 1.0) opy.pattern('Plain', 1, 1) opy.sp(3, 1, 1) opy.sp(4, 1, 1) opy.analyze(1) opy.setParameter('-val', 1, '-ele', 1, 'materialState') opy.analyze(1)